From 5b8bf7b57f8106d8306af36a4b8e1d1f8dc11b9e Mon Sep 17 00:00:00 2001 From: lxd <1004405501@qq.com> Date: Tue, 30 Jul 2024 15:00:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=91=E5=AE=A4=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E5=A2=9E=E5=8A=A0=E7=A7=91=E5=AE=A4=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E5=92=8C=E6=9C=BA=E6=9E=84=E5=AD=97=E5=85=B8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/apiconfig/ApiconfigController.java | 15 +- .../department/DepartmentController.java | 135 ++++++++++++++++++ .../department/vo/DepartmentPageReqVO.java | 24 ++++ .../admin/department/vo/DepartmentRespVO.java | 60 ++++++++ .../department/vo/DepartmentSaveReqVO.java | 46 ++++++ .../admin/org/OrgUnitController.java | 8 ++ .../vo/profile/UserProfileUpdateReqVO.java | 2 +- .../admin/user/vo/user/UserPageReqVO.java | 2 + .../admin/user/vo/user/UserRespVO.java | 2 +- .../admin/user/vo/user/UserSaveReqVO.java | 6 + .../admin/user/vo/user/UserSimpleRespVO.java | 2 +- .../dataobject/department/DepartmentDO.java | 80 +++++++++++ .../dal/dataobject/user/AdminUserDO.java | 6 +- .../mysql/department/DepartmentMapper.java | 33 +++++ .../dal/mysql/examitems/examitemsMapper.java | 4 +- .../system/dal/mysql/org/OrgUnitMapper.java | 6 + .../service/department/DepartmentService.java | 57 ++++++++ .../department/DepartmentServiceImpl.java | 81 +++++++++++ .../system/service/org/OrgUnitService.java | 4 + .../service/org/OrgUnitServiceImpl.java | 7 + .../mapper/department/DepartmentMapper.xml | 15 ++ .../resources/mapper/org/OrgUnitMapper.xml | 3 + .../src/main/resources/application-local.yaml | 1 + 23 files changed, 592 insertions(+), 7 deletions(-) create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/DepartmentController.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentPageReqVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentRespVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentSaveReqVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/department/DepartmentDO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/department/DepartmentMapper.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/department/DepartmentService.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/department/DepartmentServiceImpl.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/department/DepartmentMapper.xml diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/ApiconfigController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/ApiconfigController.java index b4798a4f5..586463ac7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/ApiconfigController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/apiconfig/ApiconfigController.java @@ -72,7 +72,20 @@ public class ApiconfigController { } else { - bol=false; + ApiconfigDO apiconfig = apiconfigService.getApiconfig(updateReqVO.getId()); + if(apiconfig!=null) + { + if(apiconfig.getApiCode().equals(updateReqVO.getApiCode())) + { + apiconfigService.updateApiconfig(updateReqVO); + bol=true; + } + else + { + bol=false; + } + } + } return success(bol); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/DepartmentController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/DepartmentController.java new file mode 100644 index 000000000..bd39272c7 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/DepartmentController.java @@ -0,0 +1,135 @@ +package cn.iocoder.yudao.module.system.controller.admin.department; + +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import com.mzt.logapi.starter.annotation.LogRecord; +import com.thoughtworks.xstream.core.SecurityUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; + +import cn.iocoder.yudao.module.system.controller.admin.department.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.department.DepartmentDO; +import cn.iocoder.yudao.module.system.service.department.DepartmentService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "管理后台 - 科室管理") +@RestController +@RequestMapping("/system/department") +@Validated +public class DepartmentController { + + @Resource + private DepartmentService departmentService; + @Resource + private AdminUserService userService; + @PostMapping("/create") + @Operation(summary = "创建科室管理") + @PreAuthorize("@ss.hasPermission('system:department:create')") + @LogRecord(type = "科室管理", subType = "创建", bizNo ="000" , success = "创建名称为{{#createReqVO.getDepartmentName}}的科室") + public CommonResult createDepartment(@Valid @RequestBody DepartmentSaveReqVO createReqVO) { + UUID guid = UUID.randomUUID(); + //当前时间 + LocalDateTime dateTime= LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + createReqVO.setId(guid.toString()); + createReqVO.setCreateDate(dateTime); + return success(departmentService.createDepartment(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新科室管理") + @PreAuthorize("@ss.hasPermission('system:department:update')") + @LogRecord(type = "科室管理", subType = "更新", bizNo ="000" , success = "更新名称为{{#updateReqVO.getDepartmentName}}的科室") + public CommonResult updateDepartment(@Valid @RequestBody DepartmentSaveReqVO updateReqVO) { + departmentService.updateDepartment(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除科室管理") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:department:delete')") + @LogRecord(type = "科室管理", subType = "删除", bizNo ="000" , success = "删除ID为{{#id}}的科室") + public CommonResult deleteDepartment(@RequestParam("id") String id) { + + //当前时间 + LocalDateTime dateTime= LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + //获取当前登陆用户 + AdminUserDO user = userService.getUser(getLoginUserId()); + DepartmentSaveReqVO updateReqVO=new DepartmentSaveReqVO(); + updateReqVO.setId(id); + updateReqVO.setDeletePerson(user.getUsername()); + updateReqVO.setDeleteDate(dateTime); + updateReqVO.setIsDelete("1"); + departmentService.updateDepartment(updateReqVO); + // departmentService.deleteDepartment(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得科室管理") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:department:query')") + public CommonResult getDepartment(@RequestParam("id") String id) { + DepartmentDO department = departmentService.getDepartment(id); + return success(BeanUtils.toBean(department, DepartmentRespVO.class)); + } + + @GetMapping("/getlist") + @Operation(summary = "获得科室管理列表 用于字典") + @PreAuthorize("@ss.hasPermission('system:department:query')") + public CommonResult> getDepartmentListr() { + List department = departmentService.getgetDepartmentList(); + + return success(BeanUtils.toBean(department, DepartmentRespVO.class)); + } + + + @GetMapping("/page") + @Operation(summary = "获得科室管理分页") + @PreAuthorize("@ss.hasPermission('system:department:query')") + public CommonResult> getDepartmentPage(@Valid DepartmentPageReqVO pageReqVO) { + PageResult pageResult = departmentService.getDepartmentPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, DepartmentRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出科室管理 Excel") + @PreAuthorize("@ss.hasPermission('system:department:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportDepartmentExcel(@Valid DepartmentPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = departmentService.getDepartmentPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "科室管理.xls", "数据", DepartmentRespVO.class, + BeanUtils.toBean(list, DepartmentRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentPageReqVO.java new file mode 100644 index 000000000..ebcd7f57c --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentPageReqVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.system.controller.admin.department.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 科室管理分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DepartmentPageReqVO extends PageParam { + + @Schema(description = "科室名称", example = "张三") + private String departmentName; + + @Schema(description = "机构ID", example = "15227") + private String orgId; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentRespVO.java new file mode 100644 index 000000000..3e0399e24 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentRespVO.java @@ -0,0 +1,60 @@ +package cn.iocoder.yudao.module.system.controller.admin.department.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 科室管理 Response VO") +@Data +@ExcelIgnoreUnannotated +public class DepartmentRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28070") + @ExcelProperty("主键") + private String id; + + @Schema(description = "科室名称", example = "张三") + @ExcelProperty("科室名称") + private String departmentName; + + @Schema(description = "创建人") + @ExcelProperty("创建人") + private String createPerson; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createDate; + + @Schema(description = "科室备注", example = "你说的对") + @ExcelProperty("科室备注") + private String departmentRemark; + + @Schema(description = "删除操作人") + @ExcelProperty("删除操作人") + private String deletePerson; + + @Schema(description = "删除时间") + @ExcelProperty("删除时间") + private LocalDateTime deleteDate; + + @Schema(description = "科室具体位置") + @ExcelProperty("科室具体位置") + private String departmentAddress; + + @Schema(description = "机构ID", example = "15227") + @ExcelProperty("机构ID") + private String orgId; + + @Schema(description = "科室代号:科室短号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("科室代号:科室短号") + private String departmentCode; + + @Schema(description = "删除标记:1为删除", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("删除标记:1为删除") + private String isDelete; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentSaveReqVO.java new file mode 100644 index 000000000..8ed670031 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/department/vo/DepartmentSaveReqVO.java @@ -0,0 +1,46 @@ +package cn.iocoder.yudao.module.system.controller.admin.department.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 科室管理新增/修改 Request VO") +@Data +public class DepartmentSaveReqVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28070") + private String id; + + @Schema(description = "科室名称", example = "张三") + private String departmentName; + + @Schema(description = "创建人") + private String createPerson; + + @Schema(description = "创建时间") + private LocalDateTime createDate; + + @Schema(description = "科室备注", example = "你说的对") + private String departmentRemark; + + @Schema(description = "删除操作人") + private String deletePerson; + + @Schema(description = "删除时间") + private LocalDateTime deleteDate; + + @Schema(description = "科室具体位置") + private String departmentAddress; + + @Schema(description = "机构ID", example = "15227") + private String orgId; + + @Schema(description = "科室代号:科室短号", requiredMode = Schema.RequiredMode.REQUIRED) + private String departmentCode; + + @Schema(description = "删除标记:1为删除", requiredMode = Schema.RequiredMode.REQUIRED) + private String isDelete; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/org/OrgUnitController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/org/OrgUnitController.java index ef1a5dfbf..542ee1914 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/org/OrgUnitController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/org/OrgUnitController.java @@ -99,6 +99,14 @@ public class OrgUnitController { return success(BeanUtils.toBean(aDo, OrgUnitRespVO.class)); } + @GetMapping("/getlist") + @Operation(summary = "获得机构管理字典") + @PreAuthorize("@ss.hasPermission('org::query')") + public CommonResult> getlist() { + List aDo = Service.getOrgUnitList(); + return success(BeanUtils.toBean(aDo, OrgUnitRespVO.class)); + } + @GetMapping("/page") @Operation(summary = "获得机构管理分页") @PreAuthorize("@ss.hasPermission('org::query')") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileUpdateReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileUpdateReqVO.java index f1e54ac90..b666597d0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileUpdateReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/profile/UserProfileUpdateReqVO.java @@ -27,5 +27,5 @@ public class UserProfileUpdateReqVO { @Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1") private Integer sex; - + private String orgId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java index 525cb11c4..b58712b13 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; +import javax.validation.constraints.NotBlank; import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -35,4 +36,5 @@ public class UserPageReqVO extends PageParam { @Schema(description = "部门编号,同时筛选子部门", example = "1024") private Long deptId; + private String orgId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserRespVO.java index 2837318f9..0fc53c410 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserRespVO.java @@ -71,5 +71,5 @@ public class UserRespVO{ @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") private LocalDateTime createTime; - + private String orgId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java index 192e0539f..491f42987 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSaveReqVO.java @@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.validation.Mobile; import cn.iocoder.yudao.module.system.framework.operatelog.core.DeptParseFunction; import cn.iocoder.yudao.module.system.framework.operatelog.core.PostParseFunction; import cn.iocoder.yudao.module.system.framework.operatelog.core.SexParseFunction; +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonIgnore; import com.mzt.logapi.starter.annotation.DiffLogField; import io.swagger.v3.oas.annotations.media.Schema; @@ -64,6 +65,11 @@ public class UserSaveReqVO { @DiffLogField(name = "用户头像") private String avatar; + /** + * 机构ID + */ + @NotBlank(message = "机构不能为空") + private String orgId; // ========== 仅【创建】时,需要传递的字段 ========== @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSimpleRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSimpleRespVO.java index 6dac2869d..888d0e142 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSimpleRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserSimpleRespVO.java @@ -21,5 +21,5 @@ public class UserSimpleRespVO { private Long deptId; @Schema(description = "部门名称", example = "IT 部") private String deptName; - + private String orgId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/department/DepartmentDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/department/DepartmentDO.java new file mode 100644 index 000000000..ec77f9eff --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/department/DepartmentDO.java @@ -0,0 +1,80 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.department; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 科室管理 DO + * + * @author 李晓东 + */ +@TableName("tb_department") +@KeySequence("tb_department_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DepartmentDO { + + /** + * 主键 + */ + @TableId(type = IdType.INPUT) + private String id; + /** + * 科室名称 + */ + @TableField("departmentName") + private String departmentName; + /** + * 创建人 + */ + @TableField("createPerson") + private String createPerson; + /** + * 创建时间 + */ + @TableField("createDate") + private LocalDateTime createDate; + /** + * 科室备注 + */ + @TableField("departmentRemark") + private String departmentRemark; + /** + * 删除操作人 + */ + @TableField("deletePerson") + private String deletePerson; + /** + * 删除时间 + */ + @TableField("deleteDate") + private LocalDateTime deleteDate; + /** + * 科室具体位置 + */ + @TableField("departmentAddress") + private String departmentAddress; + /** + * 机构ID + */ + @TableField("orgId") + private String orgId; + /** + * 科室代号:科室短号 + */ + @TableField("departmentCode") + private String departmentCode; + /** + * 删除标记:1为删除 + */ + @TableField("isDelete") + private String isDelete; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java index 84f54a344..eee3a1207 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/AdminUserDO.java @@ -92,5 +92,9 @@ public class AdminUserDO extends TenantBaseDO { * 最后登录时间 */ private LocalDateTime loginDate; - + /** + * 机构ID + */ + @TableField("orgId") + private String orgId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/department/DepartmentMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/department/DepartmentMapper.java new file mode 100644 index 000000000..b7129b149 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/department/DepartmentMapper.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.system.dal.mysql.department; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.dal.dataobject.department.DepartmentDO; +import cn.iocoder.yudao.module.system.dal.dataobject.examitems.examitemsDO; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.admin.department.vo.*; + +/** + * 科室管理 Mapper + * + * @author 李晓东 + */ +@InterceptorIgnore(tenantLine = "true") +@Mapper +public interface DepartmentMapper extends BaseMapperX { + + default PageResult selectPage(DepartmentPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(DepartmentDO::getDepartmentName, reqVO.getDepartmentName()) + .eqIfPresent(DepartmentDO::getOrgId, reqVO.getOrgId()) + .eq(DepartmentDO::getIsDelete, '0') + .orderByDesc(DepartmentDO::getId)); + } + + + List getDepartmentList(); +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/examitems/examitemsMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/examitems/examitemsMapper.java index ba2cd389c..1ab7474dc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/examitems/examitemsMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/examitems/examitemsMapper.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.examitems; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO; import cn.iocoder.yudao.module.system.dal.dataobject.examitems.examitemsDO; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import org.apache.ibatis.annotations.Mapper; @@ -23,8 +24,7 @@ public interface examitemsMapper extends BaseMapperX { .likeIfPresent(examitemsDO::getExamItemName, reqVO.getExamItemName()) .likeIfPresent(examitemsDO::getExamItemCode, reqVO.getExamItemCode()) .likeIfPresent(examitemsDO::getExamPartCode, reqVO.getExamPartCode()) - .or(wrapper -> wrapper.eq(examitemsDO::getIsdelete, 0)) - .or(wrapper -> wrapper.isNull(examitemsDO::getIsdelete)) + .eq(examitemsDO::getIsdelete, '0') .orderByDesc(examitemsDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/org/OrgUnitMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/org/OrgUnitMapper.java index d4c272c82..2a4979ab4 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/org/OrgUnitMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/org/OrgUnitMapper.java @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.system.dal.dataobject.apiconfig.ApiconfigDO; +import cn.iocoder.yudao.module.system.dal.dataobject.department.DepartmentDO; import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO; import cn.iocoder.yudao.module.system.dal.dataobject.org.OrgUnitDO; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; @@ -11,6 +12,8 @@ import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.system.controller.admin.org.vo.*; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 机构管理 Mapper * @@ -38,4 +41,7 @@ public interface OrgUnitMapper extends BaseMapperX { } //查询当前ID 是否存在 int getOrgUnitIDExist(@Param("orgID") String orgID); + + + List getOrgUnitdictList(); } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/department/DepartmentService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/department/DepartmentService.java new file mode 100644 index 000000000..1e74efe26 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/department/DepartmentService.java @@ -0,0 +1,57 @@ +package cn.iocoder.yudao.module.system.service.department; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.department.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.department.DepartmentDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 科室管理 Service 接口 + * + * @author 李晓东 + */ +public interface DepartmentService { + + /** + * 创建科室管理 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + String createDepartment(@Valid DepartmentSaveReqVO createReqVO); + + /** + * 更新科室管理 + * + * @param updateReqVO 更新信息 + */ + void updateDepartment(@Valid DepartmentSaveReqVO updateReqVO); + + /** + * 删除科室管理 + * + * @param id 编号 + */ + void deleteDepartment(String id); + + /** + * 获得科室管理 + * + * @param id 编号 + * @return 科室管理 + */ + DepartmentDO getDepartment(String id); + + /** + * 获得科室管理分页 + * + * @param pageReqVO 分页查询 + * @return 科室管理分页 + */ + PageResult getDepartmentPage(DepartmentPageReqVO pageReqVO); + + List getgetDepartmentList(); +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/department/DepartmentServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/department/DepartmentServiceImpl.java new file mode 100644 index 000000000..06568d4b9 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/department/DepartmentServiceImpl.java @@ -0,0 +1,81 @@ +package cn.iocoder.yudao.module.system.service.department; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.system.controller.admin.department.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.department.DepartmentDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.system.dal.mysql.department.DepartmentMapper; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; + +/** + * 科室管理 Service 实现类 + * + * @author 李晓东 + */ +@Service +@Validated +public class DepartmentServiceImpl implements DepartmentService { + + @Resource + private DepartmentMapper departmentMapper; + + @Override + public String createDepartment(DepartmentSaveReqVO createReqVO) { + // 插入 + DepartmentDO department = BeanUtils.toBean(createReqVO, DepartmentDO.class); + departmentMapper.insert(department); + // 返回 + return department.getId(); + } + + @Override + public void updateDepartment(DepartmentSaveReqVO updateReqVO) { + // 校验存在 + validateDepartmentExists(updateReqVO.getId()); + // 更新 + DepartmentDO updateObj = BeanUtils.toBean(updateReqVO, DepartmentDO.class); + departmentMapper.updateById(updateObj); + } + + @Override + public void deleteDepartment(String id) { + // 校验存在 + validateDepartmentExists(id); + // 删除 + departmentMapper.deleteById(id); + } + + private void validateDepartmentExists(String id) { + if (departmentMapper.selectById(id) == null) { + throw exception(new ErrorCode(1,"ID为空")); + } + } + + @Override + public DepartmentDO getDepartment(String id) { + return departmentMapper.selectById(id); + } + + @Override + public PageResult getDepartmentPage(DepartmentPageReqVO pageReqVO) { + return departmentMapper.selectPage(pageReqVO); + } + + @Override + public List getgetDepartmentList() { + return departmentMapper.getDepartmentList(); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/org/OrgUnitService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/org/OrgUnitService.java index 6555f190f..a58af3de1 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/org/OrgUnitService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/org/OrgUnitService.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.apache.ibatis.annotations.Param; import javax.validation.Valid; +import java.util.List; /** * 机构管理 Service 接口 @@ -53,4 +54,7 @@ public interface OrgUnitService { PageResult getPage(OrgUnitPageReqVO pageReqVO); boolean getOrgUnitIDISExist(String orgID); + + // 获取机构字典 + List getOrgUnitList(); } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/org/OrgUnitServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/org/OrgUnitServiceImpl.java index a68a74eae..bd64ba351 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/org/OrgUnitServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/org/OrgUnitServiceImpl.java @@ -14,6 +14,8 @@ import cn.iocoder.yudao.module.system.dal.mysql.org.OrgUnitMapper; import javax.annotation.Resource; +import java.util.List; + import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; /** @@ -78,4 +80,9 @@ public class OrgUnitServiceImpl implements OrgUnitService { return bol; } + @Override + public List getOrgUnitList() { + return Mapper.getOrgUnitdictList(); + } + } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/department/DepartmentMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/department/DepartmentMapper.xml new file mode 100644 index 000000000..fdb73d664 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/department/DepartmentMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/org/OrgUnitMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/org/OrgUnitMapper.xml index d16701626..78932918a 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/org/OrgUnitMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/org/OrgUnitMapper.xml @@ -12,4 +12,7 @@ + \ No newline at end of file diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 0ad1c752e..e77f046c3 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -172,6 +172,7 @@ logging: cn.iocoder.yudao.module.crm.dal.mysql: debug cn.iocoder.yudao.module.erp.dal.mysql: debug cn.iocoder.yudao.module.ultrasoniccom.dal: debug + cn.iocoder.yudao.module.tblist.dal: debug org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示 debug: false