Browse Source

/student/cadreDept 校验干部部门编号唯一性
/student/basestudentcadre 修改字段

phoenix 1 year ago
parent
commit
b88ce56cf3

+ 2 - 5
src/main/java/com/xjrsoft/module/student/controller/BaseStudentCadreController.java

@@ -26,10 +26,7 @@ import com.xjrsoft.module.organization.entity.Department;
 import com.xjrsoft.module.student.dto.AddBaseStudentCadreDto;
 import com.xjrsoft.module.student.dto.BaseStudentCadrePageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentCadreDto;
-import com.xjrsoft.module.student.entity.BaseStudent;
-import com.xjrsoft.module.student.entity.BaseStudentCadre;
-import com.xjrsoft.module.student.entity.BaseStudentPost;
-import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
+import com.xjrsoft.module.student.entity.*;
 import com.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper;
 import com.xjrsoft.module.student.service.IBaseStudentCadreService;
 import com.xjrsoft.module.student.vo.BaseStudentCadrePageVo;
@@ -156,7 +153,7 @@ public class BaseStudentCadreController {
         // 没传ClassID 不用查部门
         if(ObjectUtil.isAllEmpty(dto.getClassId())||dto.getClassId()==0) {
             wrapper.selectAs(Department::getName, BaseStudentCadrePageVo::getOrgName)
-                    .leftJoin(Department.class, Department::getId, BaseStudentCadre::getOrgId);
+                    .leftJoin(CadreDept.class, CadreDept::getId, BaseStudentCadre::getCadreDeptId);
         }
 
         IPage<BaseStudentCadrePageVo> page = baseStudentCadreService.selectJoinListPage(ConventPage.getPage(dto), BaseStudentCadrePageVo.class,

+ 2 - 1
src/main/java/com/xjrsoft/module/student/controller/BaseStudentPostController.java

@@ -93,7 +93,8 @@ public class BaseStudentPostController {
                 .selectAs(DictionaryDetail::getName, BaseStudentPostPageVo::getLevelCn)
                 .select(BaseStudentPost.class,x -> VoToColumnUtil.fieldsToColumns(BaseStudentPostPageVo.class).contains(x.getProperty()))
                 .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, BaseStudentPost::getLevel)
-                        .select(BaseStudentPost::getId)
+                .select(BaseStudentPost::getId)
+                .eq(ObjectUtil.isNotNull(dto.getLevel()), BaseStudentPost::getLevel, dto.getLevel())
         );
         PageOutput<BaseStudentPostPageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentPostPageVo.class);
         return RT.ok(pageOutput);

+ 17 - 1
src/main/java/com/xjrsoft/module/student/controller/CadreDeptController.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.xjrsoft.common.annotation.XjrLog;
 import com.xjrsoft.common.constant.GlobalConstant;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
@@ -97,6 +98,14 @@ public class CadreDeptController {
     @ApiOperation(value = "新增干部部门")
     @SaCheckPermission("cadredept:add")
     public RT<Boolean> add(@Valid @RequestBody AddCadreDeptDto dto){
+        //校验code唯一性
+        if(ObjectUtil.isNotNull(dto.getCode())){
+            CadreDept cadreDept = cadreDeptService.getOne(Wrappers.<CadreDept>lambdaQuery()
+                    .eq(CadreDept::getCode,dto.getCode()));
+            if(ObjectUtil.isNotNull(cadreDept)){
+                throw new MyException("干部部门编号不唯一");
+            }
+        }
         CadreDept cadreDept = BeanUtil.toBean(dto, CadreDept.class);
         boolean isSuccess = cadreDeptService.save(cadreDept);
     return RT.ok(isSuccess);
@@ -106,7 +115,14 @@ public class CadreDeptController {
     @ApiOperation(value = "修改干部部门")
     @SaCheckPermission("cadredept:edit")
     public RT<Boolean> update(@Valid @RequestBody UpdateCadreDeptDto dto){
-
+        //校验code唯一性
+        if(ObjectUtil.isNotNull(dto.getCode())){
+            CadreDept cadreDept = cadreDeptService.getOne(Wrappers.<CadreDept>lambdaQuery()
+                    .eq(CadreDept::getCode,dto.getCode()));
+            if(ObjectUtil.isNotNull(cadreDept) && cadreDept.getId() != (dto.getId())){
+                throw new MyException("干部部门编号不唯一");
+            }
+        }
         CadreDept cadreDept = BeanUtil.toBean(dto, CadreDept.class);
         return RT.ok(cadreDeptService.updateById(cadreDept));
 

+ 3 - 3
src/main/java/com/xjrsoft/module/student/dto/AddBaseStudentCadreDto.java

@@ -45,10 +45,10 @@ public class AddBaseStudentCadreDto implements Serializable {
     @ApiModelProperty("职务id")
     private Long postId;
     /**
-    * 学生任职机构
+    * 干部部门编号
     */
-    @ApiModelProperty("学生任职机构")
-    private Long orgId;
+    @ApiModelProperty("干部部门编号")
+    private Long cadreDeptId;
     /**
     * 任职开始时间
     */

+ 5 - 5
src/main/java/com/xjrsoft/module/student/dto/BaseStudentCadrePageDto.java

@@ -51,13 +51,13 @@ public class BaseStudentCadrePageDto extends PageInput {
     private String level;
 
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学生任职机构名称")
-    @ApiModelProperty("学生任职机构名称")
-    private String orgName;
+    @ExcelProperty("干部部门编号")
+    @ApiModelProperty("干部部门编号")
+    private String cadreDeptIdCN;
 
     @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("学生任职机构")
-    private Long orgId;
+    @ApiModelProperty("干部部门编号")
+    private Long cadreDeptId;
 
     @ContentStyle(dataFormat = 49)
     @ApiModelProperty("班级id")

+ 5 - 2
src/main/java/com/xjrsoft/module/student/dto/BaseStudentPostPageDto.java

@@ -21,6 +21,9 @@ import java.util.Date;
 @Data
 @EqualsAndHashCode(callSuper = false)
 public class BaseStudentPostPageDto extends PageInput {
-
-
+    /**
+     * 职务级别
+     */
+    @ApiModelProperty("职务级别")
+    private String level;
 }

+ 3 - 3
src/main/java/com/xjrsoft/module/student/dto/UpdateBaseStudentCadreDto.java

@@ -37,10 +37,10 @@ public class UpdateBaseStudentCadreDto {
     @ApiModelProperty("职务id")
     private Long postId;
     /**
-     * 学生任职机构
+     * 干部部门编号
      */
-    @ApiModelProperty("学生任职机构")
-    private Long orgId;
+    @ApiModelProperty("干部部门编号")
+    private Long cadreDeptId;
     /**
      * 任职开始时间
      */

+ 8 - 3
src/main/java/com/xjrsoft/module/student/entity/BaseStudentCadre.java

@@ -96,10 +96,10 @@ public class BaseStudentCadre implements Serializable {
     @ApiModelProperty("职务id")
     private Long postId;
     /**
-    * 学生任职机构
+    * 干部部门编号
     */
-    @ApiModelProperty("学生任职机构")
-    private Long orgId;
+    @ApiModelProperty("干部部门编号")
+    private Long cadreDeptId;
     /**
     * 任职开始时间
     */
@@ -115,6 +115,11 @@ public class BaseStudentCadre implements Serializable {
     */
     @ApiModelProperty("状态(1:在职 0:离职)")
     private Integer status;
+    /**
+     * 人员类型(1:教师 2:学生)
+     */
+    @ApiModelProperty("人员类型(1:教师 2:学生)")
+    private Integer personnelType;
     /**
     * 离职生效日期
     */

+ 4 - 4
src/main/java/com/xjrsoft/module/student/vo/BaseStudentCadrePageVo.java

@@ -103,12 +103,12 @@ public class BaseStudentCadrePageVo {
     @ApiModelProperty("职务id")
     private Long postId;
     /**
-    * 学生任职机构
+    * 干部部门编号
     */
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学生任职机构")
-    @ApiModelProperty("学生任职机构")
-    private Long orgId;
+    @ExcelProperty("干部部门编号")
+    @ApiModelProperty("干部部门编号")
+    private Long cadreDeptId;
     /**
     * 任职开始时间
     */

+ 3 - 3
src/main/java/com/xjrsoft/module/student/vo/BaseStudentCadreVo.java

@@ -44,10 +44,10 @@ public class BaseStudentCadreVo {
     @ApiModelProperty("职务id")
     private Long postId;
     /**
-    * 学生任职机构
+    * 干部部门编号
     */
-    @ApiModelProperty("学生任职机构")
-    private Long orgId;
+    @ApiModelProperty("干部部门编号")
+    private Long cadreDeptId;
     /**
     * 任职开始时间
     */