dzx преди 1 година
родител
ревизия
b7c5617235

+ 34 - 0
src/main/java/com/xjrsoft/module/banding/controller/BandingTaskClassController.java

@@ -9,6 +9,7 @@ import com.xjrsoft.module.banding.dto.AddBandingTaskClassDto;
 import com.xjrsoft.module.banding.dto.BandingTaskClassPageDto;
 import com.xjrsoft.module.banding.dto.BandingTaskClassStudentPageDto;
 import com.xjrsoft.module.banding.dto.ChangeClassDto;
+import com.xjrsoft.module.banding.dto.StudentDto;
 import com.xjrsoft.module.banding.dto.UpdateBandingClassDto;
 import com.xjrsoft.module.banding.entity.BandingTaskClass;
 import com.xjrsoft.module.banding.service.IBandingTaskClassService;
@@ -16,6 +17,7 @@ import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
 import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassVo;
 import com.xjrsoft.module.banding.vo.BandingTaskPageVo;
+import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -155,4 +157,36 @@ public class BandingTaskClassController {
         boolean isSuccess = classStudentService.changeClass(dto);
         return RT.ok(isSuccess);
     }
+
+    @PostMapping("/remove-student")
+    @ApiOperation(value = "移出学生")
+    @SaCheckPermission("bandingTaskClass:remove-student")
+    public RT<Boolean> removeStudent(@Valid @RequestBody ChangeClassDto dto){
+        boolean isSuccess = classStudentService.removeStudent(dto);
+        return RT.ok(isSuccess);
+    }
+
+    @PostMapping("/insert-student")
+    @ApiOperation(value = "移入学生")
+    @SaCheckPermission("bandingTaskClass:insert-student")
+    public RT<Boolean> insertStudent(@Valid @RequestBody ChangeClassDto dto){
+        boolean isSuccess = classStudentService.insertStudent(dto);
+        return RT.ok(isSuccess);
+    }
+
+    @GetMapping("/satisfy-student")
+    @ApiOperation(value = "满足学生")
+    @SaCheckPermission("bandingTaskClass:satisfy-student")
+    public RT<List<BaseNewStudentPageDto>> satisfyStudent(@Valid StudentDto dto){
+        List<BaseNewStudentPageDto> list = classStudentService.satisfyStudent(dto.getBandingTaskClassId());
+        return RT.ok(list);
+    }
+
+    @GetMapping("/surplus-student")
+    @ApiOperation(value = "剩余学生")
+    @SaCheckPermission("bandingTaskClass:surplus-student")
+    public RT<List<BaseNewStudentPageDto>> surplusStudent(@Valid StudentDto dto){
+        List<BaseNewStudentPageDto> list = classStudentService.surplusStudent(dto.getBandingTaskClassId());
+        return RT.ok(list);
+    }
 }

+ 25 - 0
src/main/java/com/xjrsoft/module/banding/dto/StudentDto.java

@@ -0,0 +1,25 @@
+package com.xjrsoft.module.banding.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+* @title: 调整班级
+* @Author dzx
+* @Date: 2024-07-01
+* @Version 1.0
+*/
+@Data
+public class StudentDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+
+    @ApiModelProperty("班级id")
+    private Long bandingTaskClassId;
+
+}

+ 9 - 0
src/main/java/com/xjrsoft/module/banding/mapper/BandingTaskClassStudentMapper.java

@@ -1,8 +1,13 @@
 package com.xjrsoft.module.banding.mapper;
 
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.banding.entity.BandingTaskClass;
 import com.xjrsoft.module.banding.entity.BandingTaskClassStudent;
+import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
 * @title: 新生分班任务班级配置
@@ -12,4 +17,8 @@ import org.apache.ibatis.annotations.Mapper;
 */
 @Mapper
 public interface BandingTaskClassStudentMapper extends MPJBaseMapper<BandingTaskClassStudent> {
+
+    List<BaseNewStudentPageDto> satisfyStudent(@Param("bandingTaskClassId") Long bandingTaskClassId);
+
+    List<BaseNewStudentPageDto> surplusStudent(@Param("taskClass") BandingTaskClass taskClass);
 }

+ 11 - 0
src/main/java/com/xjrsoft/module/banding/service/IBandingTaskClassStudentService.java

@@ -3,6 +3,7 @@ package com.xjrsoft.module.banding.service;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.banding.dto.ChangeClassDto;
 import com.xjrsoft.module.banding.entity.BandingTaskClassStudent;
+import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 
 import java.util.List;
 
@@ -40,4 +41,14 @@ public interface IBandingTaskClassStudentService extends MPJBaseService<BandingT
 
 
     Boolean changeClass(ChangeClassDto dto);
+
+    Boolean removeStudent(ChangeClassDto dto);
+
+
+    List<BaseNewStudentPageDto> satisfyStudent(Long bandingTaskClassId);
+
+    List<BaseNewStudentPageDto> surplusStudent(Long bandingTaskClassId);
+
+
+    Boolean insertStudent(ChangeClassDto dto);
 }

+ 45 - 1
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassStudentServiceImpl.java

@@ -4,9 +4,12 @@ import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.xjrsoft.module.banding.dto.ChangeClassDto;
+import com.xjrsoft.module.banding.entity.BandingTaskClass;
 import com.xjrsoft.module.banding.entity.BandingTaskClassStudent;
+import com.xjrsoft.module.banding.mapper.BandingTaskClassMapper;
 import com.xjrsoft.module.banding.mapper.BandingTaskClassStudentMapper;
 import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
+import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -24,7 +27,7 @@ import java.util.List;
 @Service
 @AllArgsConstructor
 public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<BandingTaskClassStudentMapper, BandingTaskClassStudent> implements IBandingTaskClassStudentService {
-
+    private final BandingTaskClassMapper taskClassMapper;
     @Override
     public Boolean add(BandingTaskClassStudent bandingTaskClass) {
         bandingTaskClass.setCreateDate(new Date());
@@ -70,4 +73,45 @@ public class BandingTaskClassStudentServiceImpl extends MPJBaseServiceImpl<Bandi
         return true;
     }
 
+    @Override
+    public Boolean removeStudent(ChangeClassDto dto) {
+        this.baseMapper.delete(
+                new QueryWrapper<BandingTaskClassStudent>().lambda()
+                        .in(BandingTaskClassStudent::getNewStudentId, dto.getNewStudentIds())
+                        .eq(BandingTaskClassStudent::getBandingTaskClassId, dto.getBandingTaskClassId())
+        );
+        return true;
+    }
+
+    @Override
+    public List<BaseNewStudentPageDto> satisfyStudent(Long bandingTaskClassId) {
+        return this.baseMapper.satisfyStudent(bandingTaskClassId);
+    }
+
+    @Override
+    public List<BaseNewStudentPageDto> surplusStudent(Long bandingTaskClassId) {
+        BandingTaskClass taskClass = taskClassMapper.selectById(bandingTaskClassId);
+        return this.baseMapper.surplusStudent(taskClass);
+    }
+
+    @Override
+    public Boolean insertStudent(ChangeClassDto dto) {
+        List<BandingTaskClassStudent> dataList = new ArrayList<>();
+        Date createDate = new Date();
+        for (Long newStudentId : dto.getNewStudentIds()) {
+            dataList.add(
+                    new BandingTaskClassStudent(){{
+                        setNewStudentId(newStudentId);
+                        setCreateDate(createDate);
+                        setStatus(0);
+                        setBandingTaskClassId(dto.getBandingTaskClassId());
+                    }}
+            );
+        }
+        if(!dataList.isEmpty()){
+           this.saveBatch(dataList);
+        }
+        return true;
+    }
+
 }

+ 30 - 0
src/main/resources/mapper/banding/BandingTaskClassStudentMapper.xml

@@ -0,0 +1,30 @@
+<?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.banding.mapper.BandingTaskClassStudentMapper">
+    <select id="satisfyStudent" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
+        SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
+        t1.score,t1.graduate_class,t1.source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t1.first_ambition,
+        t1.second_ambition,t1.is_adjust,t1.status FROM base_new_student t1
+        INNER JOIN banding_task_class_student t5 ON t1.id = t5.new_student_id
+        LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
+        LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
+        LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
+        WHERE t1.delete_mark = 0 AND t5.delete_mark = 0 AND t5.banding_task_class_id = #{bandingTaskClassId}
+    </select>
+
+    <select id="surplusStudent" parameterType="com.xjrsoft.module.banding.entity.BandingTaskClass" resultType="com.xjrsoft.module.student.vo.BaseNewStudentPageVo">
+        SELECT t1.id,t1.graduate_school,t1.name,t1.gender,t2.name AS gender_cn,t1.credential_number,t1.height,t1.weight,
+        t1.score,t1.graduate_class,t1.source,t1.stduy_status,t3.name AS stduy_status_cn,t1.mobile,t1.first_ambition,
+        t1.second_ambition,t1.is_adjust,t1.status FROM base_new_student t1
+        LEFT JOIN xjr_dictionary_detail t2 ON t1.gender = t2.code AND t2.item_id = 2023000000000000004
+        LEFT JOIN xjr_dictionary_detail t3 ON t1.stduy_status = t3.code AND t3.item_id = 2023000000000000030
+        LEFT JOIN enrollment_plan t4 ON t1.enrollment_plan_id = t4.id
+        WHERE t1.delete_mark = 0
+        AND (t1.first_ambition_id = #{taskClass.majorSetId} or t1.second_ambition_id = #{taskClass.majorSetId})
+            and t1.id not in (select new_student_id from banding_task_class_student
+            where delete_mark = 0 and banding_task_class_id = #{taskClass.id}
+        )
+    </select>
+</mapper>