Quellcode durchsuchen

分班批量修改调整

dzx vor 1 Jahr
Ursprung
Commit
b73577c978

+ 14 - 2
src/main/java/com/xjrsoft/module/banding/controller/BandingTaskClassController.java

@@ -5,6 +5,7 @@ import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.utils.VoToColumnUtil;
@@ -27,6 +28,7 @@ import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassStudentListVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassSureListVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassVo;
+import com.xjrsoft.module.room.entity.RoomBed;
 import com.xjrsoft.module.student.dto.BaseNewStudentPageDto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -138,6 +140,8 @@ public class BandingTaskClassController {
     public RT<Boolean> update(@Valid @RequestBody List<UpdateBandingClassDto> dtoList){
         List<BandingTaskClass> insList = new ArrayList<>();
         List<BandingTaskClass> updList = new ArrayList<>();
+
+        List<BandingTaskClass> updNullList = new ArrayList<>();
         List<String> errorList = new ArrayList<>();
         for (UpdateBandingClassDto dto : dtoList) {
             if(dto.getSortCode() != null){
@@ -155,16 +159,24 @@ public class BandingTaskClassController {
             BandingTaskClass bandingTask = BeanUtil.toBean(dto, BandingTaskClass.class);
             if(bandingTask.getId() != null){
                 bandingTask.setModifyDate(new Date());
-                updList.add(bandingTask);
+                if(bandingTask.getSortCode() == null){
+                    updNullList.add(bandingTask);
+                }else{
+                    updList.add(bandingTask);
+                }
             }else{
                 bandingTask.setCreateDate(new Date());
                 insList.add(bandingTask);
             }
-
         }
         if(!errorList.isEmpty()){
             return RT.error(errorList.toString().replace("[", "").replace("]", "") + ",分班排序重复");
         }
+
+        if(!updNullList.isEmpty()){
+            bandingTaskClassService.updateNull(updNullList);
+        }
+
         boolean saveBatch = bandingTaskClassService.saveBatch(insList);
         boolean isSuccess = bandingTaskClassService.updateBatchById(updList);
         return RT.ok(isSuccess);

+ 2 - 3
src/main/java/com/xjrsoft/module/banding/service/IBandingTaskClassService.java

@@ -7,9 +7,6 @@ import com.xjrsoft.module.banding.entity.BandingTaskClass;
 import com.xjrsoft.module.banding.vo.BandingTaskClassPageVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassStudentListVo;
 import com.xjrsoft.module.banding.vo.BandingTaskClassSureListVo;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 import java.util.Map;
@@ -56,4 +53,6 @@ public interface IBandingTaskClassService extends MPJBaseService<BandingTaskClas
     List<BandingTaskClassSureListVo> getClassSure(BandingTaskClassStudentPageDto dto);
 
     Boolean importData(Long bandingTaskId, List<Map<Integer, Object>> excelDataList);
+
+    Boolean updateNull(List<BandingTaskClass> updNullList);
 }

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

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.banding.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.DeleteMark;
@@ -24,6 +25,7 @@ import com.xjrsoft.module.base.service.IBaseClassroomService;
 import com.xjrsoft.module.base.service.IBaseMajorSetService;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.service.IUserService;
+import com.xjrsoft.module.room.entity.RoomBed;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.system.entity.DictionaryItem;
 import com.xjrsoft.module.system.mapper.DictionarydetailMapper;
@@ -184,4 +186,17 @@ public class BandingTaskClassServiceImpl extends MPJBaseServiceImpl<BandingTaskC
         Boolean result = this.saveBatch(classList);
         return result;
     }
+
+    @Override
+    public Boolean updateNull(List<BandingTaskClass> updNullList) {
+        for (BandingTaskClass taskClass : updNullList) {
+            UpdateWrapper<BandingTaskClass> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.eq("id", taskClass.getId());
+            updateWrapper.setSql("sort_code = null");
+            updateWrapper.setSql("is_check_in = 0");
+            this.baseMapper.update(taskClass, updateWrapper);
+        }
+
+        return true;
+    }
 }

+ 1 - 19
src/main/resources/sqlScript/20240718_sql.sql

@@ -321,25 +321,7 @@ CREATE TABLE `activity_enroll` (
 
 ALTER TABLE  `patrol_offline_courses`   
   ADD COLUMN `patrol_user_id` BIGINT NULL   COMMENT '巡课人(xjr_user)' AFTER `status`;
-  
-  
--- --------------------------------------------------------------------------------------------
--- 微信消息模板
--- --------------------------------------------------------------------------------------------
-DROP TABLE IF EXISTS wechat_message_template;   
-CREATE TABLE `wechat_message_template` (
-  `id` BIGINT NOT NULL,
-  `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
-  `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
-  `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
-  `modify_date` DATETIME DEFAULT NULL COMMENT '修改日期',
-  `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
-  `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
-  `name` BIGINT DEFAULT NULL COMMENT '活动(activity_info)',
-  user_id DATETIME DEFAULT NULL COMMENT '参与人(xjr_user)',
-  STATUS INT DEFAULT 0 COMMENT '状态(0:待确认 1:未参与 2:已参与)',
-  PRIMARY KEY (`id`)
-) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动登记表';
+
 
 
 -- ---------------------------------------------------------------------------------------------