科室ID改成Integer
This commit is contained in:
parent
1ec2b6e5af
commit
88ee4b4279
@ -55,7 +55,7 @@ public class InspectDepartmentController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除科室")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteDepartment(@RequestParam("id") String id) {
|
||||
public CommonResult<Boolean> deleteDepartment(@RequestParam("id") Integer id) {
|
||||
departmentService.deleteDepartment(id);
|
||||
return success(true);
|
||||
}
|
||||
@ -63,7 +63,7 @@ public class InspectDepartmentController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得科室")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<InspectDepartmentRespVO> getDepartment(@RequestParam("id") String id) {
|
||||
public CommonResult<InspectDepartmentRespVO> getDepartment(@RequestParam("id") Integer id) {
|
||||
InspectDepartmentDO department = departmentService.getDepartment(id);
|
||||
return success(BeanUtils.toBean(department, InspectDepartmentRespVO.class));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public class InspectDepartmentRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "19890")
|
||||
@ExcelProperty("主键")
|
||||
private String id;
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "科室名称", example = "王五")
|
||||
@ExcelProperty("科室名称")
|
||||
|
@ -13,7 +13,7 @@ import java.time.LocalDateTime;
|
||||
public class InspectDepartmentSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "19890")
|
||||
private String id;
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "科室名称", example = "王五")
|
||||
private String departmentName;
|
||||
|
@ -25,7 +25,7 @@ public class InspectDepartmentDO {
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String id;
|
||||
private Integer id;
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ public interface InspectDepartmentService {
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDepartment(String id);
|
||||
void deleteDepartment(Integer id);
|
||||
|
||||
/**
|
||||
* 获得科室
|
||||
@ -43,7 +43,7 @@ public interface InspectDepartmentService {
|
||||
* @param id 编号
|
||||
* @return 科室
|
||||
*/
|
||||
InspectDepartmentDO getDepartment(String id);
|
||||
InspectDepartmentDO getDepartment(Integer id);
|
||||
|
||||
/**
|
||||
* 获得科室分页
|
||||
|
@ -37,7 +37,7 @@ public class InspectDepartmentServiceImpl implements InspectDepartmentService {
|
||||
InspectDepartmentDO department = BeanUtils.toBean(createReqVO, InspectDepartmentDO.class);
|
||||
departmentMapper.insert(department);
|
||||
// 返回
|
||||
return department.getId();
|
||||
return String.valueOf(department.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,21 +50,21 @@ public class InspectDepartmentServiceImpl implements InspectDepartmentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDepartment(String id) {
|
||||
public void deleteDepartment(Integer id) {
|
||||
// 校验存在
|
||||
validateDepartmentExists(id);
|
||||
// 删除
|
||||
departmentMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateDepartmentExists(String id) {
|
||||
private void validateDepartmentExists(Integer id) {
|
||||
if (departmentMapper.selectById(id) == null) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InspectDepartmentDO getDepartment(String id) {
|
||||
public InspectDepartmentDO getDepartment(Integer id) {
|
||||
return departmentMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user