Browse Source

学生信息批量修改,只修改固定的几个字段

dzx 1 year ago
parent
commit
7ba9c679df

+ 6 - 0
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentSchoolRollMapper.java

@@ -3,10 +3,13 @@ package com.xjrsoft.module.student.mapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
+import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
 import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
+import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Update;
 
 /**
  * @title: mapper
@@ -21,5 +24,8 @@ public interface BaseStudentSchoolRollMapper extends MPJBaseMapper<BaseStudentSc
 
     BaseStudentInfoDetailVo getInfoById(Long id);
 
+    @Update("UPDATE base_student_school_roll SET roll_modality = #{dto.rollModality},archives_status = #{dto.archivesStatus},stduy_status = #{dto.stduyStatus} where user_id = #{id}")
+    Boolean updateInfoById(UpdateBaseStudentInfoDto dto, Long id);
+
 }
 

+ 1 - 9
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentSchoolRollServiceImpl.java

@@ -1,9 +1,7 @@
 package com.xjrsoft.module.student.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
-import com.xjrsoft.module.room.entity.RoomBed;
 import com.xjrsoft.module.room.mapper.RoomBedMapper;
 import com.xjrsoft.module.room.vo.RoomBedInfoVo;
 import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
@@ -36,13 +34,7 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
     @Override
     public Boolean updateInfo(UpdateBaseStudentInfoDto dto) {
         for (Long id : dto.getUserIds()) {
-            BaseStudentSchoolRoll roll = baseStudentSchoolRollMapper.selectById(id);
-            UpdateWrapper<BaseStudentSchoolRoll> updateWrapper = new UpdateWrapper<>();
-            updateWrapper.eq("user_id", id);
-            updateWrapper.set("archives_status", dto.getArchivesStatus());
-            updateWrapper.set("roll_modality", dto.getRollModality());
-            updateWrapper.set("stduy_status", dto.getStduyStatus());
-            baseStudentSchoolRollMapper.update(roll, updateWrapper);
+            baseStudentSchoolRollMapper.updateInfoById(dto, id);
         }
         return true;
     }