dzx 4 miesięcy temu
rodzic
commit
d7ab3c597b

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

@@ -18,6 +18,7 @@ import com.xjrsoft.module.banding.dto.SureBandingTaskDto;
 import com.xjrsoft.module.banding.dto.UpdateBandingClassDto;
 import com.xjrsoft.module.banding.entity.BandingTask;
 import com.xjrsoft.module.banding.entity.BandingTaskClass;
+import com.xjrsoft.module.banding.entity.BandingTaskClassStudent;
 import com.xjrsoft.module.banding.service.IBandingTaskClassService;
 import com.xjrsoft.module.banding.service.IBandingTaskClassStudentService;
 import com.xjrsoft.module.banding.vo.BandingTaskClassExcelVo;
@@ -141,6 +142,13 @@ public class BandingTaskClassController {
     @ApiOperation(value = "删除新生分班")
     @SaCheckPermission("bandingTaskClass:delete")
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
+        if(!ids.isEmpty()){
+            classStudentService.remove(
+                    new QueryWrapper<BandingTaskClassStudent>().lambda()
+                            .in(BandingTaskClassStudent::getBandingTaskClassId, ids)
+            );
+        }
+
         return RT.ok(bandingTaskClassService.delete(ids));
 
     }

+ 8 - 0
src/main/java/com/xjrsoft/module/banding/controller/BandingTaskController.java

@@ -98,6 +98,14 @@ public class BandingTaskController {
     @ApiOperation(value = "新增新生分班任务")
     @SaCheckPermission("bandingtask:add")
     public RT<Boolean> add(@Valid @RequestBody AddBandingTaskDto dto){
+        List<BandingTask> list = bandingTaskService.list(
+                new QueryWrapper<BandingTask>().lambda()
+                        .eq(BandingTask::getGradeId, dto.getGradeId())
+                        .eq(BandingTask::getEnrollType, dto.getEnrollType())
+        );
+        if (!list.isEmpty()) {
+            return RT.error("已存在一个任务,无法添加");
+        }
         BandingTask bandingTask = BeanUtil.toBean(dto, BandingTask.class);
         boolean isSuccess = bandingTaskService.add(bandingTask);
         return RT.ok(isSuccess);

+ 6 - 0
src/main/java/com/xjrsoft/module/banding/dto/BandingTaskClassStudentPageDto.java

@@ -39,4 +39,10 @@ public class BandingTaskClassStudentPageDto extends PageInput {
 
     @ApiModelProperty("班级状态")
     private String status;
+
+    @ApiModelProperty("招生类型")
+    private String enrollType;
+
+    @ApiModelProperty("年级id")
+    private Long gradeId;
 }

+ 4 - 0
src/main/java/com/xjrsoft/module/banding/service/impl/BandingTaskClassServiceImpl.java

@@ -8,6 +8,7 @@ import com.xjrsoft.common.enums.YesOrNoEnum;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.banding.dto.BandingTaskClassPageDto;
 import com.xjrsoft.module.banding.dto.BandingTaskClassStudentPageDto;
+import com.xjrsoft.module.banding.entity.BandingTask;
 import com.xjrsoft.module.banding.entity.BandingTaskClass;
 import com.xjrsoft.module.banding.entity.BandingTaskClassStudent;
 import com.xjrsoft.module.banding.mapper.BandingTaskClassMapper;
@@ -99,6 +100,9 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
 
     @Override
     public List<BandingTaskClassStudentListVo> classStudent(BandingTaskClassStudentPageDto dto) {
+        BandingTask bandingTask = bandingTaskMapper.selectById(dto.getBandingTaskId());
+        dto.setGradeId(bandingTask.getGradeId());
+        dto.setEnrollType(bandingTask.getEnrollType());
         return this.baseMapper.getClassStudent(dto);
     }
 

+ 5 - 3
src/main/resources/mapper/banding/BandingTaskClassMapper.xml

@@ -59,14 +59,16 @@
         t5.name AS first_ambition, t6.name AS second_ambition,t7.name AS stduy_status_cn,t1.height,t1.weight,t1.score,t3.name AS class_name,
         t8.name AS teacher_name FROM base_new_student t1
         INNER JOIN banding_task_class_student t2 ON t1.id = t2.new_student_id
-        INNER JOIN banding_task_class t3 ON t2.banding_task_class_id = t3.id
+        LEFT JOIN banding_task_class t3 ON t2.banding_task_class_id = t3.id
+        AND t3.delete_mark = 0 AND t3.banding_task_id = #{dto.bandingTaskId}
         LEFT JOIN xjr_dictionary_detail t4 ON t1.gender = t4.code
         LEFT JOIN base_major_set t5 ON t1.first_ambition_id = t5.id
         LEFT JOIN base_major_set t6 ON t1.second_ambition_id = t6.id
         LEFT JOIN xjr_dictionary_detail t7 ON t1.stduy_status = t7.code
         LEFT JOIN xjr_user t8 ON t3.teacher_id = t8.id
-        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0 AND t3.delete_mark = 0
-        AND t3.banding_task_id = #{dto.bandingTaskId}
+        INNER JOIN enrollment_plan t9 ON t1.enrollment_plan_id = t9.id
+        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
+        and t9.grade_id = #{dto.gradeId} and t9.enroll_type = #{dto.enrollType}
         <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
             AND t1.credential_number like concat('%', #{dto.credentialNumber}, '%')
         </if>