phoenix 1 year ago
parent
commit
33e2599709

+ 19 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentPunishmentInfoMapper.java

@@ -1,8 +1,15 @@
 package com.xjrsoft.module.student.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionMobilePageDto;
+import com.xjrsoft.module.student.dto.BaseStudentAssessmentInspectionPageDto;
+import com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoMobilePageDto;
+import com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoPageDto;
 import com.xjrsoft.module.student.entity.BaseStudentPunishmentInfo;
+import com.xjrsoft.module.student.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -13,5 +20,17 @@ import org.apache.ibatis.annotations.Mapper;
 */
 @Mapper
 public interface BaseStudentPunishmentInfoMapper extends MPJBaseMapper<BaseStudentPunishmentInfo> {
+    /**
+     * 分页查询
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<BaseStudentPunishmentInfoPageVo> getPage(IPage<BaseStudentPunishmentInfoPageDto> page, BaseStudentPunishmentInfoPageDto dto);
 
+    /**
+     * 数据详情
+     * @return
+     */
+    BaseStudentPunishmentInfoDetailVo getInfo(Long id);
 }

+ 13 - 36
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentPunishmentInfoServiceImpl.java

@@ -49,33 +49,24 @@ public class BaseStudentPunishmentInfoServiceImpl extends MPJBaseServiceImpl<Bas
 
     IBasePunishStudentRelationService basePunishStudentRelationService;
 
+    /**
+     * 学生处分信息管理列表(分页)
+     * @param dto 处分管理信息前端请求实体对象
+     * @return
+     */
     @Override
     public IPage<BaseStudentPunishmentInfoPageVo> selectJoinListPagePc(BaseStudentPunishmentInfoPageDto dto) {
-        MPJLambdaWrapper<BaseStudentPunishmentInfo> wrapper = MPJWrappers.<BaseStudentPunishmentInfo>lambdaJoin()
-                .select(BaseStudentPunishmentInfo::getId)
-                .selectAs(BaseSemester::getName, BaseStudentPunishmentInfoPageVo::getBaseSemesterName)
-                .selectAs(BasePunishmentType::getPunishmentType, BaseStudentPunishmentInfoPageVo::getPunishmentType)
-                .selectAs(BaseClass::getName, BaseStudentPunishmentInfoPageVo::getClassName)
-                .select(BaseStudentPunishmentInfo::getStartTime)
-                .select(BaseStudentPunishmentInfo::getEndTime)
-                .select(BaseStudentPunishmentInfo::getIsPublicity)
-                .select(BaseStudentPunishmentInfo::getPushMessageObject)
-                .select(BaseStudentPunishmentInfo::getReason)
-                .innerJoin(BaseSemester.class, BaseSemester::getId, BaseStudentPunishmentInfo::getBaseSemesterId)
-                .innerJoin(BasePunishmentType.class, BasePunishmentType::getId, BaseStudentPunishmentInfo::getPunishmentTypeId)
-                .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentPunishmentInfo::getClassId)
-                .eq(ObjectUtil.isNotNull(dto.getSemesterId()) && dto.getSemesterId() > 0, BaseStudentPunishmentInfo::getBaseSemesterId, dto.getSemesterId())
-                .eq(ObjectUtil.isNotNull(dto.getPunishmentTypeId()) && dto.getPunishmentTypeId() > 0, BaseStudentPunishmentInfo::getPunishmentTypeId, dto.getPunishmentTypeId())
-                .eq(StrUtil.isNotBlank(dto.getStartTime()), BaseStudentPunishmentInfo::getStartTime, dto.getStartTime())
-                .eq(StrUtil.isNotBlank(dto.getEndTime()), BaseStudentPunishmentInfo::getEndTime, dto.getEndTime())
-                .eq(BaseStudentPunishmentInfo::getDeleteMark, 0)
-                .orderByDesc(BaseStudentPunishmentInfo::getId);
 
-        IPage<BaseStudentPunishmentInfoPageVo> pageList = this.selectJoinListPage(ConventPage.getPage(dto), BaseStudentPunishmentInfoPageVo.class, wrapper);
+        IPage<BaseStudentPunishmentInfoPageVo> pageList = baseStudentPunishmentInfoBaseStudentPunishmentInfoMapper.getPage(ConventPage.getPage(dto),dto);
 
         return pageList;
     }
 
+    /**
+     * 学生处分信息管理列表(分页)(移动端)
+     * @param dto 处分管理信息前端请求实体对象(移动端)
+     * @return
+     */
     @Override
     public IPage<BaseStudentPunishmentInfoMobilePageVo> selectJoinListPageMobile(BaseStudentPunishmentInfoMobilePageDto dto) {
 
@@ -112,24 +103,10 @@ public class BaseStudentPunishmentInfoServiceImpl extends MPJBaseServiceImpl<Bas
      */
     @Override
     public BaseStudentPunishmentInfoDetailVo getDetailById(Long id) {
-        MPJLambdaWrapper<BaseStudentPunishmentInfo> wrapper = MPJWrappers.<BaseStudentPunishmentInfo>lambdaJoin()
-                .select(BaseStudentPunishmentInfo::getId)
-                .selectAs(BaseSemester::getName, BaseStudentPunishmentInfoPageVo::getBaseSemesterName)
-                .selectAs(BasePunishmentType::getPunishmentType, BaseStudentPunishmentInfoPageVo::getPunishmentType)
-                .selectAs(BaseClass::getName, BaseStudentPunishmentInfoPageVo::getClassName)
-                .select(BaseStudentPunishmentInfo::getStartTime)
-                .select(BaseStudentPunishmentInfo::getEndTime)
-                .select(BaseStudentPunishmentInfo::getIsPublicity)
-                .select(BaseStudentPunishmentInfo::getPushMessageObject)
-                .select(BaseStudentPunishmentInfo::getReason)
-                .innerJoin(BaseSemester.class, BaseSemester::getId, BaseStudentPunishmentInfo::getBaseSemesterId)
-                .innerJoin(BasePunishmentType.class, BasePunishmentType::getId, BaseStudentPunishmentInfo::getPunishmentTypeId)
-                .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentPunishmentInfo::getClassId)
-                .eq(BaseStudentPunishmentInfo::getId, id)
-                .eq(BaseStudentPunishmentInfo::getDeleteMark, 0);
 
-        BaseStudentPunishmentInfoDetailVo baseStudentPunishmentInfoDetailVo = this.selectJoinOne(BaseStudentPunishmentInfoDetailVo.class, wrapper);
+        BaseStudentPunishmentInfoDetailVo baseStudentPunishmentInfoDetailVo =  baseStudentPunishmentInfoBaseStudentPunishmentInfoMapper.getInfo(id);
 
+        //添加学生列表集合
         QueryWrapper<BasePunishmentStudentRelation> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("punishment_info_id", id);
         List<BasePunishmentStudentRelation> studentList = basePunishStudentRelationService.list(queryWrapper);

+ 51 - 0
src/main/resources/mapper/student/BaseStudentPunishmentInfoMapper.xml

@@ -3,6 +3,57 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xjrsoft.module.student.mapper.BaseStudentPunishmentInfoMapper">
+    <select id="getPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentPunishmentInfoPageDto"
+            resultType="com.xjrsoft.module.student.vo.BaseStudentPunishmentInfoPageVo">
+        SELECT t.id,
+        t1.name AS baseSemesterName,
+        t2.punishment_type AS punishmentType,
+        t3.name AS className,
+        t.start_time,
+        t.end_time,
+        t.is_publicity,
+        t.push_message_object,
+        t.reason
+        FROM base_student_punishment_info t
+        INNER JOIN base_semester t1 ON (t1.id = t.base_semester_id)
+        INNER JOIN base_punishment_type t2 ON (t2.id = t.punishment_type_id)
+        INNER JOIN base_class t3 ON (t3.id = t.class_id)
 
+        WHERE t.delete_mark = 0
+        <if test="dto.semesterId != null and dto.semesterId > 0">
+            and t.base_semester_id = #{dto.semesterId}
+        </if>
+        <if test="dto.punishmentTypeId != null and dto.punishmentTypeId > 0">
+            and t.punishment_type_id = #{dto.punishmentTypeId}
+        </if>
+        <if test="dto.startTime != null and dto.startTime != ''">
+            and t.start_time = #{dto.startTime}
+        </if>
+        <if test="dto.endTime != null and dto.endTime != ''">
+            and t.end_time = #{dto.endTime}
+        </if>
+        ORDER BY t.id DESC;
+    </select>
+
+    <select id="getInfo"
+            resultType="com.xjrsoft.module.student.vo.BaseStudentPunishmentInfoDetailVo">
+        SELECT
+        t.id,
+        t1.name AS baseSemesterName,
+        t2.punishment_type AS punishmentType,
+        t3.name AS className,
+        t.start_time,
+        t.end_time,
+        t.is_publicity,
+        t.push_message_object,
+        t.reason
+        FROM base_student_punishment_info t
+        INNER JOIN base_semester t1 ON (t1.id = t.base_semester_id)
+        INNER JOIN base_punishment_type t2 ON (t2.id = t.punishment_type_id)
+        INNER JOIN base_class t3 ON (t3.id = t.class_id)
+
+        WHERE t.id = #{id}
+        AND t.delete_mark=0
+    </select>
 
 </mapper>