Browse Source

学生专业年级班级树

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

+ 83 - 0
src/main/java/com/xjrsoft/module/student/controller/StudentManagerController.java

@@ -23,19 +23,27 @@ import com.xjrsoft.common.utils.TreeUtil;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseClass;
 import com.xjrsoft.module.base.entity.BaseGrade;
+import com.xjrsoft.module.base.entity.BaseMajorSet;
 import com.xjrsoft.module.base.service.IBaseClassService;
 import com.xjrsoft.module.base.service.IBaseGradeService;
 import com.xjrsoft.module.concat.service.IXjrUserService;
 import com.xjrsoft.module.hikvision.util.DataUtil;
+import com.xjrsoft.module.organization.entity.Department;
 import com.xjrsoft.module.organization.entity.UserDeptRelation;
+import com.xjrsoft.module.organization.service.IDepartmentService;
 import com.xjrsoft.module.organization.service.IUserDeptRelationService;
 import com.xjrsoft.module.room.service.IRoomBedService;
 import com.xjrsoft.module.student.dto.AddBaseStudentUserDto;
 import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentUserDto;
+import com.xjrsoft.module.student.entity.BaseClassMajorSet;
+import com.xjrsoft.module.student.entity.BaseMajor;
 import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentUser;
+import com.xjrsoft.module.student.service.IBaseMajorService;
 import com.xjrsoft.module.student.service.IStudentManagerService;
+import com.xjrsoft.module.student.vo.BaseClassMajorSetVo;
+import com.xjrsoft.module.student.vo.BaseDepMajorGradeClassStudenTreeVo;
 import com.xjrsoft.module.student.vo.BaseStudentSchoolRollVo;
 import com.xjrsoft.module.student.vo.BaseStudentTreeVo;
 import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
@@ -81,6 +89,8 @@ public class StudentManagerController {
 
     private final IStudentManagerService studentManagerService;
     private final IBaseGradeService baseGradeService;
+    private final IDepartmentService baseDeparmentService;
+    private final IBaseMajorService baseMajorService;
     private final IBaseClassService baseClassService;
     private final IXjrUserService xjrUserService;
     private final IRoomBedService roomBedService;
@@ -192,6 +202,79 @@ public class StudentManagerController {
         return R.ok(userVo);
     }
 
+    @GetMapping(value = "/majro-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)
+                .selectAs(BaseClass::getName, BaseClassMajorSetVo::getClassName)
+                .selectAs(BaseClass::getGradeId, BaseClassMajorSetVo::getGradeId)
+                .leftJoin(BaseClassMajorSet.class, BaseClassMajorSet::getClassId, BaseClass::getId)
+                .leftJoin(BaseMajorSet.class, BaseMajorSet::getId, BaseClassMajorSet::getMajorSetId)
+        ;
+
+        List<BaseClassMajorSetVo> majorSetList = baseClassService.selectJoinList(BaseClassMajorSetVo.class, baseClassMPJLambdaWrapper);
+
+
+        List<BaseGrade> gradeList = baseGradeService.list(
+                new QueryWrapper<BaseGrade>().lambda().eq(BaseGrade::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        List<BaseMajor> majorList = baseMajorService.list(
+                new QueryWrapper<BaseMajor>().lambda().eq(BaseMajor::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        List<Department> departmentList =baseDeparmentService.list(
+                new QueryWrapper<Department>().lambda().eq(Department::getDeleteMark, DeleteMark.NODELETE.getCode())
+                        .eq(Department::getParentId,"1684107782861680008")
+        );
+        departmentList.forEach((node) -> {
+            voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
+                setId(node.getId().toString());
+                setName(node.getName());
+                setParentId("0");
+            }});
+        });
+        majorList.forEach((node)->{
+            voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
+                setId(node.getId().toString());
+                setName(node.getName());
+                setParentId(node.getDepartmentId().toString());
+            }});
+            gradeList.forEach((DDD)->{
+                voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
+                    setId(node.getId().toString()+"_"+DDD.getId().toString());
+                    setName(DDD.getName());
+                    setParentId(node.getId().toString());
+                }});
+            });
+        });
+        majorSetList.forEach((node)->{
+            voList.add(new BaseDepMajorGradeClassStudenTreeVo(){{
+                setId(node.getClassId().toString());
+                setName(node.getClassName());
+                setParentId(node.getMajorId().toString()+"_"+node.getGradeId());
+            }});
+
+        });
+
+        List<BaseDepMajorGradeClassStudenTreeVo> treeVoList = TreeUtil.build(voList);
+
+        return RT.ok(treeVoList);
+    }
+
 
     @PostMapping
     @ApiOperation(value = "新增学生")

+ 151 - 0
src/main/java/com/xjrsoft/module/student/entity/BaseMajor.java

@@ -0,0 +1,151 @@
+package com.xjrsoft.module.student.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+* @title: 专业表
+* @Author wyf
+* @Date: 2024-07-01
+* @Version 1.0
+*/
+@Data
+@TableName("base_major")
+@ApiModel(value = "base_major", description = "专业表")
+public class BaseMajor implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+    * 主键
+    */
+    @ApiModelProperty("主键")
+    @TableId
+    private Long id;
+    /**
+    * 创建人
+    */
+    @ApiModelProperty("创建人")
+    @TableField(fill = FieldFill.INSERT)
+    private Long createUserId;
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty("创建时间")
+    @TableField(fill = FieldFill.INSERT)
+    private Date createDate;
+    /**
+    * 修改人
+    */
+    @ApiModelProperty("修改人")
+    @TableField(fill = FieldFill.UPDATE)
+    private Long modifyUserId;
+    /**
+    * 修改时间
+    */
+    @ApiModelProperty("修改时间")
+    @TableField(fill = FieldFill.UPDATE)
+    private Date modifyDate;
+    /**
+    * 删除标记
+    */
+    @ApiModelProperty("删除标记")
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer deleteMark;
+    /**
+    * 有效标志
+    */
+    @ApiModelProperty("有效标志")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer enabledMark;
+    /**
+    * 专业名称
+    */
+    @ApiModelProperty("专业名称")
+    private String name;
+    /**
+    * 专业代码
+    */
+    @ApiModelProperty("专业代码")
+    private String code;
+    /**
+    * 修业年限(0.5的整数倍)
+    */
+    @ApiModelProperty("修业年限(0.5的整数倍)")
+    private BigDecimal studyYear;
+    /**
+    * 重点专业(xjr_dictionary_item[key_major])
+    */
+    @ApiModelProperty("重点专业(xjr_dictionary_item[key_major])")
+    private String keyMajor;
+    /**
+    * 特色专业(xjr_dictionary_item[feature_major])
+    */
+    @ApiModelProperty("特色专业(xjr_dictionary_item[feature_major])")
+    private String featureMajor;
+    /**
+    * 批准设置日期
+    */
+    @ApiModelProperty("批准设置日期")
+    private Date approveSetDate;
+    /**
+    * 首次招生日期(年月)
+    */
+    @ApiModelProperty("首次招生日期(年月)")
+    private Date firstRecruitStudentDate;
+    /**
+    * 专业状态(1:正常、2:停招、3:撤销)
+    */
+    @ApiModelProperty("专业状态(1:正常、2:停招、3:撤销)")
+    private Integer status;
+    /**
+    * 专业带头人
+    */
+    @ApiModelProperty("专业带头人")
+    private String leaderName;
+    /**
+    * 专业负责人
+    */
+    @ApiModelProperty("专业负责人")
+    private String directorName;
+    /**
+    * 任职日期开始
+    */
+    @ApiModelProperty("任职日期开始")
+    private Date officeStartDate;
+    /**
+    * 任职日期结束
+    */
+    @ApiModelProperty("任职日期结束")
+    private Date officeEndDate;
+    /**
+    * 是否全日制
+    */
+    @ApiModelProperty("是否全日制")
+    private Integer isFullTime;
+    /**
+    * 办学层次(base_major_gradation)
+    */
+    @ApiModelProperty("办学层次(base_major_gradation)")
+    private Long majorGradationId;
+    /**
+    * 专业分类(base_major_categor)
+    */
+    @ApiModelProperty("专业分类(base_major_categor)")
+    private Long majorCategorId;
+    /**
+    * 所属机构(xjr_department)
+    */
+    @ApiModelProperty("所属机构(xjr_department)")
+    private Long departmentId;
+
+
+}

+ 16 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseMajorMapper.java

@@ -0,0 +1,16 @@
+package com.xjrsoft.module.student.mapper;
+
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.student.entity.BaseMajor;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 专业表
+* @Author wyf
+* @Date: 2024-07-01
+* @Version 1.0
+*/
+@Mapper
+public interface BaseMajorMapper extends MPJBaseMapper<BaseMajor> {
+
+}

+ 14 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseMajorService.java

@@ -0,0 +1,14 @@
+package com.xjrsoft.module.student.service;
+
+import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.entity.BaseMajor;
+
+/**
+* @title: 专业表
+* @Author wyf
+* @Date: 2024-07-01
+* @Version 1.0
+*/
+
+public interface IBaseMajorService extends MPJBaseService<BaseMajor> {
+}

+ 19 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseMajorServiceImpl.java

@@ -0,0 +1,19 @@
+package com.xjrsoft.module.student.service.impl;
+
+import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.student.entity.BaseMajor;
+import com.xjrsoft.module.student.mapper.BaseMajorMapper;
+import com.xjrsoft.module.student.service.IBaseMajorService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+* @title: 专业表
+* @Author wyf
+* @Date: 2024-07-01
+* @Version 1.0
+*/
+@Service
+@AllArgsConstructor
+public class BaseMajorServiceImpl extends MPJBaseServiceImpl<BaseMajorMapper, BaseMajor> implements IBaseMajorService {
+}

+ 15 - 2
src/main/java/com/xjrsoft/module/student/vo/BaseClassMajorSetVo.java

@@ -5,8 +5,8 @@ import lombok.Data;
 
 /**
 * @title: 班级专业方向表表单出参
-* @Author szs
-* @Date: 2023-12-28
+* @Author wyf
+* @Date: 2024-07-09
 * @Version 1.0
 */
 @Data
@@ -22,11 +22,24 @@ public class BaseClassMajorSetVo {
     */
     @ApiModelProperty("班级(base_class_major_set)")
     private Long classId;
+    /**
+     * 班级(base_class_major_set)
+     */
+    @ApiModelProperty("班级(base_class_major_set)")
+    private String className;
     /**
     * 专业方向(base_major_set)
     */
     @ApiModelProperty("专业方向(base_major_set)")
     private Long majorSetId;
+
+    @ApiModelProperty("所属年级(base_grade)")
+    private Long gradeId;
+    /**
+     * 专业(base_major)
+     */
+    @ApiModelProperty("专业(base_major)")
+    private Long majorId;
     /**
     * 计划人数
     */

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

@@ -0,0 +1,29 @@
+package com.xjrsoft.module.student.vo;
+
+import com.xjrsoft.common.model.tree.ITreeNode;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public  class BaseDepMajorGradeClassStudenTreeVo implements ITreeNode<BaseDepMajorGradeClassStudenTreeVo,String>, Serializable {
+
+
+    @ApiModelProperty("id")
+    private String id;
+
+
+    @ApiModelProperty("name")
+    private String name;
+
+
+    @ApiModelProperty("disabled")
+    private String parentId;
+
+
+    @ApiModelProperty("children")
+    private List<BaseDepMajorGradeClassStudenTreeVo> children;
+
+}