集中角色表,重新写登录接口

This commit is contained in:
dongjie 2024-06-09 00:26:54 +08:00
parent 4e93cfb624
commit 4809c57412
38 changed files with 104 additions and 871 deletions

View File

@ -1,6 +1,11 @@
package com.zoo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.common.R;
import com.zoo.entity.Account;
import com.zoo.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
/**
@ -11,8 +16,53 @@ import org.springframework.stereotype.Controller;
* @author DJ
* @since 2024-05-17
*/
@Controller
@RestController
@RequestMapping("/zoo/account")
public class AccountController {
@Autowired
IAccountService iAccountService;
@GetMapping("/info")
public R info(Integer id) {
if (id!=null){
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",id);
return R.success(iAccountService.getOne(queryWrapper));
}
return R.success(iAccountService.list());
}
@PostMapping("/save")
public R save(@RequestBody Account account){
boolean save = iAccountService.save(account);
if (save){
return R.success("添加成功");
}
return R.error("添加失败");
}
@PostMapping("/update")
public R update(@RequestBody Account account){
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",account.getId());
boolean b = iAccountService.update(account,queryWrapper);
if (b){
return R.success("修改成功");
}
return R.error("修改失败");
}
@GetMapping("/delete")
public R delete(Integer id){
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",id);
boolean b = iAccountService.remove(queryWrapper);
if (b){
return R.success("删除成功");
}
return R.error("删除失败");
}
}

View File

@ -1,99 +0,0 @@
package com.zoo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.common.R;
import com.zoo.dto.AdminDto;
import com.zoo.entity.*;
import com.zoo.service.IAccountService;
import com.zoo.service.IAdminService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
* <p>
* 前端控制器
* </p>
*
* @author DJ
* @since 2024-05-17
*/
@RestController
@RequestMapping("/zoo/admin")
public class AdminController {
@Autowired
IAdminService iAdminService;
@Autowired
IAccountService iAccountService;
@GetMapping("/info")
public R info(Integer id){
QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
QueryWrapper<Account> queryWrapper1 = new QueryWrapper<>();
if (id!=null){
queryWrapper.eq("roleid",id);
Admin admin = iAdminService.getOne(queryWrapper);
queryWrapper1.eq("roleid",id);
queryWrapper1.eq("permissions",0);
Account one = iAccountService.getOne(queryWrapper1);
AdminDto adminDto = new AdminDto();
BeanUtils.copyProperties(admin,adminDto);
adminDto.setPassword(one.getPassword());
adminDto.setUsername(one.getUsername());
adminDto.setPermissions(0);
return R.success(adminDto);
}
List<Admin> list = iAdminService.list();
List<AdminDto> adminDtoList = list.stream().map((item)->{
AdminDto adminDto = new AdminDto();
BeanUtils.copyProperties(item,adminDto);
QueryWrapper<Account> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("roleid",item.getRoleid());
queryWrapper2.eq("permissions",0);
Account one = iAccountService.getOne(queryWrapper2);
adminDto.setPassword(one.getPassword());
adminDto.setUsername(one.getUsername());
adminDto.setPermissions(0);
return adminDto;
}).collect(Collectors.toList());
return R.success(adminDtoList);
}
@PostMapping("/add")
public R add(Admin admin){
boolean save = iAdminService.save(admin);
if (save){
return R.success("添加成功");
}
return R.error("添加失败");
}
@PostMapping("/update")
public R update(Admin admin){
QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("roleid",admin.getRoleid());
boolean b = iAdminService.update(admin,queryWrapper);
if (b){
return R.success("修改成功");
}
return R.error("修改失败");
}
@GetMapping("/delete")
public R delete(Integer roleid){
QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("roleid",roleid);
boolean b = iAdminService.remove(queryWrapper);
if (b){
return R.success("删除成功");
}
return R.error("删除失败");
}
}

View File

@ -2,15 +2,12 @@ package com.zoo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.common.R;
import com.zoo.entity.Admin;
import com.zoo.entity.Animal;
import com.zoo.service.IAnimalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import java.util.List;
import java.util.Map;
/**
* <p>
@ -37,7 +34,7 @@ public class AnimalController {
return R.success(list);
}
@PostMapping("/add")
public R add(Animal animal){
public R add(@RequestBody Animal animal){
boolean save = iAnimalService.save(animal);
if (save){
return R.success("添加成功");
@ -46,7 +43,7 @@ public class AnimalController {
}
@PostMapping("/update")
public R update(Animal animal){
public R update(@RequestBody Animal animal){
QueryWrapper<Animal> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("a_id",animal.getaId());
boolean b = iAnimalService.update(animal,queryWrapper);

View File

@ -5,15 +5,9 @@ package com.zoo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.common.R;
import com.zoo.entity.Archive;
import com.zoo.entity.Breedingplan;
import com.zoo.entity.Veterinary;
import com.zoo.service.IArchiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -26,7 +20,7 @@ import java.util.List;
* @since 2024-06-07
*/
@RestController
@RequestMapping("/com/zoo/archive")
@RequestMapping("/zoo/archive")
public class ArchiveController {
@Autowired
IArchiveService iArchiveService;
@ -40,7 +34,7 @@ public class ArchiveController {
return R.success(one);
}
if (animallId!=null){
queryWrapper.eq("animallId",animallId);
queryWrapper.eq("animall_id",animallId);
List<Archive> list = iArchiveService.list(queryWrapper);
return R.success(list);
}
@ -48,7 +42,7 @@ public class ArchiveController {
return R.success(iArchiveService.list());
}
@PostMapping("/add")
public R add(Archive archive){
public R add(@RequestBody Archive archive){
boolean save = iArchiveService.save(archive);
if (save){
return R.success("添加成功");
@ -57,7 +51,7 @@ public class ArchiveController {
}
@PostMapping("/update")
public R update(Archive archive){
public R update(@RequestBody Archive archive){
QueryWrapper<Archive> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",archive.getId());
boolean update = iArchiveService.update(archive,queryWrapper);

View File

@ -2,17 +2,10 @@ package com.zoo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.common.R;
import com.zoo.entity.Animal;
import com.zoo.entity.Breedingplan;
import com.zoo.entity.Keeper;
import com.zoo.service.IAnimalService;
import com.zoo.service.IBreedingplanService;
import com.zoo.service.IKeeperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -33,7 +26,7 @@ public class BreedingplanController {
return R.success(list);
}
@PostMapping("/add")
public R add(Breedingplan breedingplan){
public R add(@RequestBody Breedingplan breedingplan){
boolean save = iBreedingplanService.save(breedingplan);
if (save){
return R.success("添加成功");
@ -42,7 +35,7 @@ public class BreedingplanController {
}
@PostMapping("/update")
public R update(Breedingplan breedingplan){
public R update(@RequestBody Breedingplan breedingplan){
QueryWrapper<Breedingplan> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",breedingplan.getId());
boolean b = iBreedingplanService.update(breedingplan,queryWrapper);

View File

@ -6,11 +6,8 @@ import com.zoo.common.R;
import com.zoo.entity.Health;
import com.zoo.service.IHealthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -23,7 +20,7 @@ import java.util.List;
* @since 2024-06-07
*/
@RestController
@RequestMapping("/com/zoo/health")
@RequestMapping("/zoo/health")
public class HealthController {
@Autowired
IHealthService iHealthService;
@ -44,7 +41,7 @@ public class HealthController {
return R.success(iHealthService.list());
}
@PostMapping("/add")
public R add(Health health){
public R add(@RequestBody Health health){
boolean save = iHealthService.save(health);
if (save){
return R.success("添加成功");
@ -53,7 +50,7 @@ public class HealthController {
}
@PostMapping("/update")
public R update(Health health){
public R update(@RequestBody Health health){
boolean update = iHealthService.save(health);
if (update){
return R.success("修改成功");

View File

@ -1,98 +0,0 @@
package com.zoo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.common.R;
import com.zoo.dto.AdminDto;
import com.zoo.dto.KeeperDto;
import com.zoo.entity.*;
import com.zoo.service.IAccountService;
import com.zoo.service.IKeeperService;
import com.zoo.service.IVeterinaryService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 前端控制器
* </p>
*
* @author DJ
* @since 2024-05-17
*/
@RestController
@RequestMapping("/zoo/keeper")
public class KeeperController {
@Autowired
IKeeperService iKeeperService;
@Autowired
IAccountService iAccountService;
@GetMapping("info")
public R info(Integer roleid){
QueryWrapper<Keeper> queryWrapper = new QueryWrapper<>();
QueryWrapper<Account> queryWrapper1 = new QueryWrapper<>();
if (roleid!=null){
queryWrapper.eq("roleid",roleid);
Keeper keeper = iKeeperService.getOne(queryWrapper);
queryWrapper1.eq("roleid",roleid);
queryWrapper1.eq("permissions",1);
Account one = iAccountService.getOne(queryWrapper1);
KeeperDto keeperDto = new KeeperDto();
BeanUtils.copyProperties(keeper,keeperDto);
keeperDto.setPassword(one.getPassword());
keeperDto.setUsername(one.getUsername());
keeperDto.setPermissions(1);
return R.success(keeperDto);
}
List<Keeper> list = iKeeperService.list();
List<KeeperDto> keeperDtoList = list.stream().map((item)->{
KeeperDto keeperDto = new KeeperDto();
BeanUtils.copyProperties(item,keeperDto);
QueryWrapper<Account> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("roleid",item.getRoleid());
queryWrapper2.eq("permissions",1);
Account one = iAccountService.getOne(queryWrapper2);
keeperDto.setPassword(one.getPassword());
keeperDto.setUsername(one.getUsername());
keeperDto.setPermissions(1);
return keeperDto;
}).collect(Collectors.toList());
return R.success(keeperDtoList);
}
@PostMapping("/add")
public R add(Keeper keeper){
boolean save = iKeeperService.save(keeper);
if (save){
return R.success("添加成功");
}
return R.error("添加失败");
}
@PostMapping("/update")
public R update(Keeper keeper){
QueryWrapper<Keeper> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("roleid",keeper.getRoleid());
boolean b = iKeeperService.update(keeper,queryWrapper);
if (b){
return R.success("修改成功");
}
return R.error("修改失败");
}
@GetMapping("/delete")
public R delete(Integer roleid){
QueryWrapper<Keeper> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("roleid",roleid);
boolean b = iKeeperService.remove(queryWrapper);
if (b){
return R.success("删除成功");
}
return R.error("删除失败");
}
}

View File

@ -1,19 +1,10 @@
package com.zoo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.common.R;
import com.zoo.dto.AdminDto;
import com.zoo.dto.KeeperDto;
import com.zoo.dto.VeterinaryDto;
import com.zoo.entity.Account;
import com.zoo.entity.Admin;
import com.zoo.entity.Keeper;
import com.zoo.entity.Veterinary;
import com.zoo.service.IAccountService;
import com.zoo.service.IAdminService;
import com.zoo.service.IKeeperService;
import com.zoo.service.IVeterinaryService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -24,15 +15,8 @@ import org.springframework.web.bind.annotation.RestController;
public class LoginController {
@Autowired
IAccountService iAccountService;
@Autowired
IAdminService iAdminService;
@Autowired
IKeeperService iKeeperService;
@Autowired
IVeterinaryService iVeterinaryService;
@PostMapping("/login")
public R login(String username,String password){
public R login(String username, String password) {
QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("username",username);
queryWrapper.eq("password",password);
@ -40,24 +24,35 @@ public class LoginController {
if (one == null){
return R.error("账号密码错误");
}
if (one.getPermissions()==0){
Admin admin = iAdminService.selectById(one.getRoleid());
AdminDto adminDto = new AdminDto();
BeanUtils.copyProperties(admin,adminDto);
adminDto.setPermissions(0);
return R.success(adminDto);
}else if (one.getPermissions()==1){
Keeper keeper = iKeeperService.selectById(one.getRoleid());
KeeperDto keeperDto = new KeeperDto();
BeanUtils.copyProperties(keeper,keeperDto);
keeperDto.setPermissions(1);
return R.success(keeperDto);
}else {
Veterinary veterinary = iVeterinaryService.selectById(one.getRoleid());
VeterinaryDto veterinaryDto = new VeterinaryDto();
BeanUtils.copyProperties(veterinary,veterinaryDto);
veterinaryDto.setPermissions(2);
return R.success(veterinaryDto);
}
return R.success(one);
}
// @PostMapping("/login")
// public R login(String username,String password){
// QueryWrapper<Account> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("username",username);
// queryWrapper.eq("password",password);
// Account one = iAccountService.getOne(queryWrapper);
// if (one == null){
// return R.error("账号密码错误");
// }
// if (one.getPermissions()==0){
// Admin admin = iAdminService.selectById(one.getRoleid());
// AdminDto adminDto = new AdminDto();
// BeanUtils.copyProperties(admin,adminDto);
// adminDto.setPermissions(0);
// return R.success(adminDto);
// }else if (one.getPermissions()==1){
// Keeper keeper = iKeeperService.selectById(one.getRoleid());
// KeeperDto keeperDto = new KeeperDto();
// BeanUtils.copyProperties(keeper,keeperDto);
// keeperDto.setPermissions(1);
// return R.success(keeperDto);
// }else {
// Veterinary veterinary = iVeterinaryService.selectById(one.getRoleid());
// VeterinaryDto veterinaryDto = new VeterinaryDto();
// BeanUtils.copyProperties(veterinary,veterinaryDto);
// veterinaryDto.setPermissions(2);
// return R.success(veterinaryDto);
// }
// }
}

View File

@ -1,99 +0,0 @@
package com.zoo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.common.R;
import com.zoo.dto.KeeperDto;
import com.zoo.dto.VeterinaryDto;
import com.zoo.entity.Account;
import com.zoo.entity.Keeper;
import com.zoo.entity.Veterinary;
import com.zoo.service.IAccountService;
import com.zoo.service.IVeterinaryService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 前端控制器
* </p>
*
* @author DJ
* @since 2024-05-17
*/
@RestController
@RequestMapping("/zoo/veterinary")
public class VeterinaryController {
@Autowired
IVeterinaryService iVeterinaryService;
@Autowired
IAccountService iAccountService;
@GetMapping("info")
public R info(Integer roleid){
QueryWrapper<Veterinary> queryWrapper = new QueryWrapper<>();
QueryWrapper<Account> queryWrapper1 = new QueryWrapper<>();
if (roleid!=null){
queryWrapper.eq("roleid",roleid);
Veterinary keeper = iVeterinaryService.getOne(queryWrapper);
queryWrapper1.eq("roleid",roleid);
queryWrapper1.eq("permissions",2);
Account one = iAccountService.getOne(queryWrapper1);
VeterinaryDto veterinaryDto = new VeterinaryDto();
BeanUtils.copyProperties(keeper,veterinaryDto);
veterinaryDto.setPassword(one.getPassword());
veterinaryDto.setUsername(one.getUsername());
veterinaryDto.setPermissions(2);
return R.success(veterinaryDto);
}
List<Veterinary> list = iVeterinaryService.list();
List<Veterinary> veterinaryList = list.stream().map((item)->{
VeterinaryDto veterinaryDto = new VeterinaryDto();
BeanUtils.copyProperties(item,veterinaryDto);
QueryWrapper<Account> queryWrapper2 = new QueryWrapper<>();
queryWrapper2.eq("roleid",item.getRoleid());
queryWrapper2.eq("permissions",2);
Account one = iAccountService.getOne(queryWrapper2);
veterinaryDto.setPassword(one.getPassword());
veterinaryDto.setUsername(one.getUsername());
veterinaryDto.setPermissions(2);
return veterinaryDto;
}).collect(Collectors.toList());
return R.success(veterinaryList);
}
@PostMapping("/add")
public R add(Veterinary veterinary){
boolean save = iVeterinaryService.save(veterinary);
if (save){
return R.success("添加成功");
}
return R.error("添加失败");
}
@PostMapping("/update")
public R update(Veterinary veterinary){
QueryWrapper<Veterinary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("roleid",veterinary.getRoleid());
boolean b = iVeterinaryService.update(veterinary,queryWrapper);
if (b){
return R.success("修改成功");
}
return R.error("修改失败");
}
@GetMapping("/delete")
public R delete(Integer roleid){
QueryWrapper<Veterinary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("roleid",roleid);
boolean b = iVeterinaryService.remove(queryWrapper);
if (b){
return R.success("删除成功");
}
return R.error("删除失败");
}
}

View File

@ -1,41 +0,0 @@
package com.zoo.dto;
import com.zoo.entity.Admin;
public class AdminDto extends Admin {
private Integer permissions;
/**
* 角色账号
*/
private String username;
/**
* 角色密码
*/
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getPermissions() {
return permissions;
}
public void setPermissions(Integer permissions) {
this.permissions = permissions;
}
}

View File

@ -1,40 +0,0 @@
package com.zoo.dto;
import com.zoo.entity.Keeper;
public class KeeperDto extends Keeper {
private Integer permissions;
/**
* 角色账号
*/
private String username;
/**
* 角色密码
*/
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getPermissions() {
return permissions;
}
public void setPermissions(Integer permissions) {
this.permissions = permissions;
}
}

View File

@ -1,40 +0,0 @@
package com.zoo.dto;
import com.zoo.entity.Veterinary;
public class VeterinaryDto extends Veterinary {
private Integer permissions;
/**
* 角色账号
*/
private String username;
/**
* 角色密码
*/
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getPermissions() {
return permissions;
}
public void setPermissions(Integer permissions) {
this.permissions = permissions;
}
}

View File

@ -19,11 +19,6 @@ public class Account implements Serializable {
*/
private Integer id;
/**
* 角色id
*/
private Integer roleid;
/**
* 角色账号
*/
@ -35,7 +30,7 @@ public class Account implements Serializable {
private String password;
/**
* 权限
* 权限 0管理员1饲养员2兽医
*/
private Integer permissions;
@ -46,13 +41,6 @@ public class Account implements Serializable {
public void setId(Integer id) {
this.id = id;
}
public Integer getRoleid() {
return roleid;
}
public void setRoleid(Integer roleid) {
this.roleid = roleid;
}
public String getUsername() {
return username;
}
@ -78,11 +66,10 @@ public class Account implements Serializable {
@Override
public String toString() {
return "Account{" +
"id=" + id +
", roleid=" + roleid +
", username=" + username +
", password=" + password +
", permissions=" + permissions +
"}";
"id=" + id +
", username=" + username +
", password=" + password +
", permissions=" + permissions +
"}";
}
}

View File

@ -1,49 +0,0 @@
package com.zoo.entity;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author DJ
* @since 2024-05-17
*/
public class Admin implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 角色id
*/
private Integer roleid;
/**
* 管理员名称
*/
private String name;
public Integer getRoleid() {
return roleid;
}
public void setRoleid(Integer roleid) {
this.roleid = roleid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Admin{" +
"roleid=" + roleid +
", name=" + name +
"}";
}
}

View File

@ -1,75 +0,0 @@
package com.zoo.entity;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author DJ
* @since 2024-05-17
*/
public class Keeper implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 角色id
*/
private Integer roleid;
/**
* 性别
*/
private String sex;
/**
* 饲养员名称
*/
private String name;
/**
* 手机号码
*/
private String phone;
public Integer getRoleid() {
return roleid;
}
public void setRoleid(Integer roleid) {
this.roleid = roleid;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Override
public String toString() {
return "Keeper{" +
"roleid=" + roleid +
", sex=" + sex +
", name=" + name +
", phone=" + phone +
"}";
}
}

View File

@ -1,62 +0,0 @@
package com.zoo.entity;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author DJ
* @since 2024-05-17
*/
public class Veterinary implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 兽医角色id
*/
private Integer roleid;
/**
* 名称
*/
private String name;
/**
* 治疗记录
*/
private String record;
public Integer getRoleid() {
return roleid;
}
public void setRoleid(Integer roleid) {
this.roleid = roleid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRecord() {
return record;
}
public void setRecord(String record) {
this.record = record;
}
@Override
public String toString() {
return "Veterinary{" +
"roleid=" + roleid +
", name=" + name +
", record=" + record +
"}";
}
}

View File

@ -1,16 +0,0 @@
package com.zoo.mapper;
import com.zoo.entity.Admin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author DJ
* @since 2024-05-17
*/
public interface AdminMapper extends BaseMapper<Admin> {
}

View File

@ -1,16 +0,0 @@
package com.zoo.mapper;
import com.zoo.entity.Keeper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author DJ
* @since 2024-05-17
*/
public interface KeeperMapper extends BaseMapper<Keeper> {
}

View File

@ -1,16 +0,0 @@
package com.zoo.mapper;
import com.zoo.entity.Veterinary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author DJ
* @since 2024-05-17
*/
public interface VeterinaryMapper extends BaseMapper<Veterinary> {
}

View File

@ -1,16 +0,0 @@
package com.zoo.service;
import com.zoo.entity.Admin;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author DJ
* @since 2024-05-17
*/
public interface IAdminService extends IService<Admin> {
Admin selectById(int roleId);
}

View File

@ -1,16 +0,0 @@
package com.zoo.service;
import com.zoo.entity.Keeper;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author DJ
* @since 2024-05-17
*/
public interface IKeeperService extends IService<Keeper> {
Keeper selectById(int roleId);
}

View File

@ -1,16 +0,0 @@
package com.zoo.service;
import com.zoo.entity.Veterinary;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author DJ
* @since 2024-05-17
*/
public interface IVeterinaryService extends IService<Veterinary> {
Veterinary selectById(int roleId);
}

View File

@ -1,27 +0,0 @@
package com.zoo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.entity.Admin;
import com.zoo.mapper.AdminMapper;
import com.zoo.service.IAdminService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author DJ
* @since 2024-05-17
*/
@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements IAdminService {
@Override
public Admin selectById(int roleId) {
QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("roleId",roleId);
return this.getOne(queryWrapper);
}
}

View File

@ -1,27 +0,0 @@
package com.zoo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.entity.Keeper;
import com.zoo.mapper.KeeperMapper;
import com.zoo.service.IKeeperService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author DJ
* @since 2024-05-17
*/
@Service
public class KeeperServiceImpl extends ServiceImpl<KeeperMapper, Keeper> implements IKeeperService {
@Override
public Keeper selectById(int roleId) {
QueryWrapper<Keeper> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("roleId",roleId);
return this.getOne(queryWrapper);
}
}

View File

@ -1,27 +0,0 @@
package com.zoo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zoo.entity.Veterinary;
import com.zoo.mapper.VeterinaryMapper;
import com.zoo.service.IVeterinaryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author DJ
* @since 2024-05-17
*/
@Service
public class VeterinaryServiceImpl extends ServiceImpl<VeterinaryMapper, Veterinary> implements IVeterinaryService {
@Override
public Veterinary selectById(int roleId) {
QueryWrapper<Veterinary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("roleId",roleId);
return this.getOne(queryWrapper);
}
}