Pārlūkot izejas kodu

"/student/basestudentcadre/page" 数据库有字段变更

phoenix 1 gadu atpakaļ
vecāks
revīzija
617d4edf35

+ 1 - 36
src/main/java/com/xjrsoft/module/student/controller/BaseStudentCadreController.java

@@ -122,43 +122,8 @@ public class BaseStudentCadreController {
     @ApiOperation(value="学生干部管理列表(分页)")
     @SaCheckPermission("basestudentcadre:detail")
     public RT<PageOutput<BaseStudentCadrePageVo>> page(@Valid BaseStudentCadrePageDto dto){
-        // 如果未传班级id和职务id,
-        if(!StrUtil.equals(dto.getLevel(), StudentCadreLevelEnum.CLASS.getCode()) && ObjectUtil.isEmpty(dto.getPostId())){
-            PageOutput<BaseStudentCadrePageVo> result = ConventPage.getPageOutputNull(BaseStudentCadrePageVo.class);
-            return RT.ok(result);
-        }
-        MPJLambdaWrapper<BaseStudentCadre> wrapper = new MPJLambdaWrapper<>();
-        wrapper.like(StrUtil.isNotBlank(dto.getUserName()), XjrUser::getName, dto.getUserName())
-                .eq(ObjectUtil.isNotEmpty(dto.getClassId()), BaseStudentCadre::getClassId, dto.getClassId())
-                .eq(ObjectUtil.isNotEmpty(dto.getPostId()), BaseStudentCadre::getPostId, dto.getPostId())
-                .eq(ObjectUtil.isNotEmpty(dto.getLevel()), BaseStudentPost::getLevel, dto.getLevel())
-                .eq(ObjectUtil.isNotEmpty(dto.getPost()), BaseStudentPost::getPost, dto.getPost())
-                .eq(StrUtil.equals(dto.getLevel(), StudentCadreLevelEnum.CLASS.getCode()), BaseClass::getTeacherId, StpUtil.getLoginIdAsLong())
-                .orderByDesc(BaseStudentCadre::getId)
-                .selectAs(BaseStudent::getStudentId, BaseStudentCadrePageVo::getStudentId)
-                .selectAs(XjrUser::getName, BaseStudentCadrePageVo::getUserName)
-                //.selectAs(Department::getName, BaseStudentCadrePageVo::getOrgName)
-                .selectAs(BaseClass::getName, BaseStudentCadrePageVo::getClassName)
-                .selectAs(BaseStudentPost::getPost, BaseStudentCadrePageVo::getPost)
-                .selectAs(BaseStudentPost::getLevel, BaseStudentCadrePageVo::getLevel)
-                .select(BaseStudentCadre::getId)
-                .select(BaseStudentCadre.class,x -> VoToColumnUtil.fieldsToColumns(BaseStudentCadrePageVo.class).contains(x.getProperty()))
-                .innerJoin(XjrUser.class, XjrUser::getId, BaseStudentCadre::getUserId)
-                .innerJoin(BaseStudent.class, BaseStudent::getUserId, BaseStudentCadre::getUserId)
-                .leftJoin(BaseStudentPost.class, BaseStudentPost::getId, BaseStudentCadre::getPostId)
-                .leftJoin(BaseClass.class, BaseClass::getId, BaseStudentCadre::getClassId)
-                //.leftJoin( Department.class, Department::getId, BaseStudentCadre::getOrgId)
-                .leftJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, BaseStudentCadre::getUserId);
-
-        // 没传ClassID 不用查部门
-        if(ObjectUtil.isAllEmpty(dto.getClassId())||dto.getClassId()==0) {
-            wrapper.selectAs(Department::getName, BaseStudentCadrePageVo::getCadreDeptIdCN)
-                    .leftJoin(CadreDept.class, CadreDept::getId, BaseStudentCadre::getCadreDeptId);
-        }
 
-        IPage<BaseStudentCadrePageVo> page = baseStudentCadreService.selectJoinListPage(ConventPage.getPage(dto), BaseStudentCadrePageVo.class,
-                wrapper
-        );
+        IPage<BaseStudentCadrePageVo> page = baseStudentCadreService.getListPage(dto);
 
         PageOutput<BaseStudentCadrePageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentCadrePageVo.class);
         return RT.ok(pageOutput);

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

@@ -31,6 +31,10 @@ public class BaseStudentCadrePageDto extends PageInput {
     @ApiModelProperty("学生姓名")
     private String userName;
 
+    @ContentStyle(dataFormat = 49)
+    @ApiModelProperty("班级id")
+    private Long classId;
+
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("班级名称")
     @ApiModelProperty("班级名称")
@@ -46,35 +50,18 @@ public class BaseStudentCadrePageDto extends PageInput {
     private String postId;
 
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("级别")
-    @ApiModelProperty("级别")
+    @ApiModelProperty("职务等级")
     private String level;
 
     @ContentStyle(dataFormat = 49)
-    @ExcelProperty("干部部门编号")
-    @ApiModelProperty("干部部门编号")
+    @ExcelProperty("干部部门名称")
+    @ApiModelProperty("干部部门名称")
     private String cadreDeptIdCN;
 
     @ContentStyle(dataFormat = 49)
     @ApiModelProperty("干部部门编号")
     private Long cadreDeptId;
 
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("班级id")
-    private Long classId;
-
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("年级id")
-    private String gradeId;
-
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("专业id")
-    private String majorSetId;
-
-    @ContentStyle(dataFormat = 49)
-    @ApiModelProperty("状态(1:在职 0:离职)")
-    private Integer status;
-
     @ApiModelProperty("任职开始时间-开始")
     private LocalDateTime startTimeStart;
 

+ 6 - 0
src/main/java/com/xjrsoft/module/student/dto/UpdateCadreDeptDto.java

@@ -29,4 +29,10 @@ public class UpdateCadreDeptDto extends AddCadreDeptDto {
     */
     @ApiModelProperty("主键编号")
     private Long id;
+
+    /**
+     * 部门指导教师用户编号
+     */
+    @ApiModelProperty("部门指导教师用户编号")
+    private Long instructorUserId;
 }

+ 5 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentCadreMapper.java

@@ -1,8 +1,12 @@
 package com.xjrsoft.module.student.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.student.dto.BaseStudentCadrePageDto;
 import com.xjrsoft.module.student.entity.BaseStudentCadre;
+import com.xjrsoft.module.student.vo.BaseStudentCadrePageVo;
+import com.xjrsoft.module.teacher.dto.AttendancePersonnelPageDto;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -14,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface BaseStudentCadreMapper extends MPJBaseMapper<BaseStudentCadre> {
 
+    IPage<BaseStudentCadrePageVo> getListPage(IPage<BaseStudentCadrePageDto> page, BaseStudentCadrePageDto dto);
 }

+ 5 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseStudentCadreService.java

@@ -1,10 +1,13 @@
 package com.xjrsoft.module.student.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.dto.BaseStudentCadrePageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentCadreDto;
 import com.xjrsoft.module.student.entity.BaseStudentCadre;
 import com.xjrsoft.module.student.entity.BaseStudentUser;
+import com.xjrsoft.module.student.vo.BaseStudentCadrePageVo;
 import lombok.Data;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -19,6 +22,8 @@ import java.util.List;
 
 public interface IBaseStudentCadreService extends MPJBaseService<BaseStudentCadre> {
 
+    IPage<BaseStudentCadrePageVo> getListPage(BaseStudentCadrePageDto dto);
+
     /**
      * 批量新增
      *

+ 10 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentCadreServiceImpl.java

@@ -3,14 +3,19 @@ package com.xjrsoft.module.student.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.xjrsoft.common.model.result.RT;
+import com.xjrsoft.common.page.ConventPage;
+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.mapper.BaseStudentCadreMapper;
 import com.xjrsoft.module.student.service.IBaseStudentCadreService;
+import com.xjrsoft.module.student.vo.BaseStudentCadrePageVo;
+import com.xjrsoft.module.teacher.vo.AttendancePersonnelPageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -33,6 +38,11 @@ public class BaseStudentCadreServiceImpl extends MPJBaseServiceImpl<BaseStudentC
 
     private final BaseStudentCadreMapper baseStudentCadreMapper;
 
+    @Override
+    public IPage<BaseStudentCadrePageVo> getListPage(BaseStudentCadrePageDto dto) {
+        return baseStudentCadreMapper.getListPage(ConventPage.getPage(dto),dto);
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean addAll(List<BaseStudentCadre> baseStudentCadreList) {

+ 2 - 0
src/main/java/com/xjrsoft/module/student/service/impl/CadreDeptServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.github.yulichang.query.MPJQueryWrapper;
 import com.github.yulichang.wrapper.MPJAbstractWrapper;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.utils.TreeUtil;
@@ -42,6 +43,7 @@ public class CadreDeptServiceImpl extends MPJBaseServiceImpl<CadreDeptMapper, Ca
 
     @Override
     public List<CadreDeptTreeVo> getCadreDeptTree(CadreDeptTreeDto dto) {
+
         List<CadreDeptTreeVo> list = cadreDeptMapper.getCadreDeptTree(dto);
 
         List<CadreDeptTreeVo> treeVoList = TreeUtil.build(list);

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

@@ -26,61 +26,13 @@ import java.util.Date;
 public class BaseStudentCadrePageVo {
 
     /**
-    * 主键编号
-    */
+     * 主键编号
+     */
     @ContentStyle(dataFormat = 49)
     @ExcelProperty("主键编号")
     @ApiModelProperty("主键编号")
     private String id;
-    /**
-    * 创建人
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("创建人")
-    @ApiModelProperty("创建人")
-    private Long createUserId;
-    /**
-    * 创建时间
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("创建时间")
-    @ApiModelProperty("创建时间")
-    private Date createDate;
-    /**
-    * 修改人
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("修改人")
-    @ApiModelProperty("修改人")
-    private Long modifyUserId;
-    /**
-    * 修改时间
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("修改时间")
-    @ApiModelProperty("修改时间")
-    private Date modifyDate;
-    /**
-    * 删除标记
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("删除标记")
-    @ApiModelProperty("删除标记")
-    private Integer deleteMark;
-    /**
-    * 有效标志
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("有效标志")
-    @ApiModelProperty("有效标志")
-    private Integer enabledMark;
-    /**
-    * 序号
-    */
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("序号")
-    @ApiModelProperty("序号")
-    private Integer sortCode;
+
     /**
     * 学生id
     */
@@ -88,6 +40,16 @@ public class BaseStudentCadrePageVo {
     @ExcelProperty("学生id")
     @ApiModelProperty("学生id")
     private Long userId;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学生姓名")
+    @ApiModelProperty("学生姓名")
+    private String userName;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("学号")
+    @ApiModelProperty("学号")
+    private String studentId;
     /**
     * 班级id
     */
@@ -95,6 +57,11 @@ public class BaseStudentCadrePageVo {
     @ExcelProperty("班级id")
     @ApiModelProperty("班级id")
     private Long classId;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("班级名称")
+    @ApiModelProperty("班级名称")
+    private String className;
     /**
     * 职务id
     */
@@ -102,6 +69,17 @@ public class BaseStudentCadrePageVo {
     @ExcelProperty("职务id")
     @ApiModelProperty("职务id")
     private Long postId;
+
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("职务")
+    @ApiModelProperty("职务")
+    private String post;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("职务级别")
+    @ApiModelProperty("职务级别")
+    private String level;
     /**
     * 干部部门编号
     */
@@ -109,6 +87,12 @@ public class BaseStudentCadrePageVo {
     @ExcelProperty("干部部门编号")
     @ApiModelProperty("干部部门编号")
     private Long cadreDeptId;
+
+    @ContentStyle(dataFormat = 49)
+    @ExcelProperty("干部部门编号")
+    @ApiModelProperty("干部部门编号")
+    private String cadreDeptIdCN;
+
     /**
     * 任职开始时间
     */
@@ -148,48 +132,4 @@ public class BaseStudentCadrePageVo {
     @ApiModelProperty("离职原因")
     private String leaveReason;
 
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学号")
-    @ApiModelProperty("学号")
-    private String studentId;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学生姓名")
-    @ApiModelProperty("学生姓名")
-    private String userName;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("班级名称")
-    @ApiModelProperty("班级名称")
-    private String className;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("职务")
-    @ApiModelProperty("职务")
-    private String post;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("级别")
-    @ApiModelProperty("级别")
-    private String level;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("学生任职机构名称")
-    @ApiModelProperty("学生任职机构名称")
-    private String cadreDeptIdCN;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("手机号")
-    @ApiModelProperty("手机号")
-    private String mobile;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("专业")
-    @ApiModelProperty("专业")
-    private String majorSetName;
-
-    @ContentStyle(dataFormat = 49)
-    @ExcelProperty("年级")
-    @ApiModelProperty("年级")
-    private String gradeName;
 }

+ 52 - 0
src/main/resources/mapper/student/BaseStudentCadreMapper.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xjrsoft.module.student.mapper.BaseStudentCadreMapper">
+    <select id="getListPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentCadrePageDto"
+            resultType="com.xjrsoft.module.student.vo.BaseStudentCadrePageVo">
+        SELECT
+            t.*,
+            t1.name as userName,
+            t2.student_id as studentId,
+            t3.name as className,
+            t4.post as post,
+            t4.level as level,
+            t5.name as cadreDeptIdCN
+        FROM base_student_cadre t
+                 LEFT JOIN xjr_user t1 ON (t1.id = t.user_id)
+                 LEFT JOIN base_student t2 ON (t2.user_id = t.user_id)
+                 LEFT JOIN base_class t3 ON (t3.id = t.class_id)
+                 LEFT JOIN base_student_post t4 ON (t4.id = t.post_id)
+                 LEFT JOIN cadre_dept t5 ON (t5.id = t.cadre_dept_id)
+        WHERE t.delete_mark = 0
+        <if test="dto.userName != null and dto.userName != ''">
+            and t1.name like concat('%',#{dto.userName},'%')
+        </if>
+        <if test="dto.studentId != null and dto.studentId > 0">
+            and t2.student_id = #{dto.studentId}
+        </if>
+        <if test="dto.classId != null and dto.classId > 0">
+            and t.class_id = #{dto.classId}
+        </if>
+        <if test="dto.className != null and dto.className != ''">
+            and t3.name like concat('%',#{dto.className},'%')
+        </if>
+        <if test="dto.postId != null and dto.postId > 0">
+            and t.post_id = #{dto.postId}
+        </if>
+        <if test="dto.post != null and dto.post != ''">
+            and t4.post like concat('%',#{dto.post},'%')
+        </if>
+        <if test="dto.level != null and dto.level != ''">
+            and t4.level = #{dto.level}
+        </if>
+        <if test="dto.cadreDeptId != null and dto.cadreDeptId > 0">
+            and t.cadre_dept_id = #{dto.cadreDeptId}
+        </if>
+        <if test="dto.cadreDeptIdCN != null and dto.cadreDeptIdCN != ''">
+            and t5.name like concat('%',#{dto.cadreDeptIdCN},'%')
+        </if>
+        order by t.id
+    </select>
+</mapper>