Browse Source

学生专业年级班级树

dzx 4 tháng trước cách đây
mục cha
commit
981ff7ee73

+ 5 - 12
src/main/java/com/xjrsoft/module/student/controller/StudentManagerController.java

@@ -202,22 +202,12 @@ public class StudentManagerController {
         return R.ok(userVo);
     }
 
-    @GetMapping(value = "/majro-grade-class-tree")
+    @GetMapping(value = "/major-grade-class-tree")
     @ApiOperation(value = "学生部门专业年级班级树")
     @SaCheckPermission("studentmanager:detail")
     public RT<List<BaseDepMajorGradeClassStudenTreeVo>> tree2() {
         List<BaseDepMajorGradeClassStudenTreeVo> voList = new ArrayList<>();
         MPJLambdaWrapper<BaseClass> baseClassMPJLambdaWrapper = new MPJLambdaWrapper<>();
-//        MPJLambdaWrapper<BaseMajorSet> majorSetWrapper = new MPJLambdaWrapper<>();
-//        majorSetWrapper
-//                .select(BaseClass::getId)
-//                .select("t.major_id")
-//                .select("t3.name as className")
-//                .select("t3.id as classId")
-//                .select("t3.grade_id")
-//                .leftJoin("base_class_major_set t2 on t2.major_set_id = t.id")
-//                .leftJoin("base_class t3 on t3.id = t2.class_id")
-//                .eq(BaseMajorSet::getDeleteMark, DeleteMark.NODELETE.getCode());
         baseClassMPJLambdaWrapper
                 .selectAs(BaseClass::getId, BaseClassMajorSetVo::getClassId)
                 .selectAs(BaseMajorSet::getMajorId, BaseClassMajorSetVo::getMajorId)
@@ -243,6 +233,7 @@ public class StudentManagerController {
         departmentList.forEach((node) -> {
             voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
                 setId(node.getId().toString());
+                setTreeType(1);
                 setName(node.getName());
                 setParentId("0");
             }});
@@ -251,12 +242,14 @@ public class StudentManagerController {
             voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
                 setId(node.getId().toString());
                 setName(node.getName());
+                setTreeType(2);
                 setParentId(node.getDepartmentId().toString());
             }});
             gradeList.forEach((DDD)->{
                 voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
                     setId(node.getId().toString()+"_"+DDD.getId().toString());
                     setName(DDD.getName());
+                    setTreeType(3);
                     setParentId(node.getId().toString());
                 }});
             });
@@ -265,9 +258,9 @@ public class StudentManagerController {
             voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
                 setId(node.getClassId().toString());
                 setName(node.getClassName());
+                setTreeType(4);
                 setParentId(node.getMajorId().toString()+"_"+node.getGradeId());
             }});
-
         });
 
         List<BaseDepMajorGradeClassStudenTreeVo> treeVoList = TreeUtil.build(voList);

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

@@ -38,7 +38,10 @@ public class BaseStudentUserPageDto extends PageInput {
     /**
      * 班级id
      */
-    @ApiModelProperty("班级id")
-    private Long classId;
+    @ApiModelProperty("树id")
+    private Long treeId;
+
+    @ApiModelProperty("树类型(1:部门  2:专业  3:年级  4:班级)")
+    private Integer treeType;
 
 }

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

@@ -26,4 +26,7 @@ public  class BaseDepMajorGradeClassStudenTreeVo implements ITreeNode<BaseDepMaj
     @ApiModelProperty("children")
     private List<BaseDepMajorGradeClassStudenTreeVo> children;
 
+    @ApiModelProperty("树类型(1:部门  2:专业  3:年级  4:班级)")
+    private Integer treeType;
+
 }

+ 14 - 2
src/main/resources/mapper/student/BaseStudentMapper.xml

@@ -76,9 +76,21 @@
         <if test="dto.email != null and dto.email != ''">
             and t1.email like concat('%', #{dto.email},'%')
         </if>
-        <if test="dto.classId != null">
-            and t4.id = #{dto.classId}
+        <if test="dto.treeType != null and dto.treeId != null">
+            <if test="dto.treeType == 1">
+                and t4.org_id = #{dto.treeId}
+            </if>
+            <if test="dto.treeType == 2">
+                and t3.major_set_id = #{dto.treeId}
+            </if>
+            <if test="dto.treeType == 3">
+                and t4.grade_id = #{dto.treeId}
+            </if>
+            <if test="dto.treeType == 4">
+                and t4.id = #{dto.treeId}
+            </if>
         </if>
+
         <if test="dto.order == null">
             order by t1.id
         </if>