diff --git a/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java b/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java index 970b732..4f74d61 100644 --- a/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java +++ b/src/main/java/com/msdw/tms/dao/SystemSetttingDao.java @@ -61,4 +61,6 @@ public interface SystemSetttingDao { List queryUserIdsByGradeId(Integer staffGradeId); List queryUserIdsByProfessionalId(Integer staffProfessionalArchitectureId); + + List queryStaffId(Integer userId); } diff --git a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java index 6a85643..0dff1d7 100644 --- a/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java @@ -140,7 +140,20 @@ public class SystemSettingServiceImpl implements SystemSetttingService { String roleIds = result.getRoleId(); String[] splitOld = staffVo.getRoleId().split(","); String[] splitNew = roleIds.split(","); - if (splitOld.length == splitNew.length && splitNew.length < 3) { + + //根据userId删除数据,再新增 + //List staffIdList = systemSetttingDao.queryStaffId(staffVo.getUserId()); + boolean b = systemSetttingDao.deleteStaffInfo(staffVo.getUserId()); + + for (StaffEntity entity: staff) { + entity.setPlatformId(1); + entity.setUserId(staffVo.getUserId()); + entity.setSchoolId(staffVo.getSchoolId()); + systemSetttingDao.addStaffN(entity); + } + + +/* if (splitOld.length == splitNew.length && splitNew.length < 3) { for (int i = 0; i < splitNew.length; i++) { boolean a = systemSetttingDao.updateStaff(staff.get(i)); if (!a) { @@ -157,11 +170,12 @@ public class SystemSettingServiceImpl implements SystemSetttingService { } } else if (splitNew.length < splitOld.length) { boolean a = systemSetttingDao.deleteStaffOnly(staffVo.getUserId());//删除roleId最大的数据 + System.out.println("roleId=========="+staffVo.getRoleId()); staffVo.setStaffRoleId(Integer.parseInt(staffVo.getRoleId())); boolean b = systemSetttingDao.updateStaffOnly(staffVo);//修改仅剩的数据 } else { return R.error(400, "不存在此账号"); - } + }*/ userInfoDao.setNUM(staffVo.getUserId());//重置账号、手机号码为00 // systemSetttingDao.deleteStaffInfo(staffVo.getUserId());// diff --git a/src/main/resources/mapper/tms/SystemSetting.xml b/src/main/resources/mapper/tms/SystemSetting.xml index ab1fc96..04940f3 100644 --- a/src/main/resources/mapper/tms/SystemSetting.xml +++ b/src/main/resources/mapper/tms/SystemSetting.xml @@ -82,7 +82,7 @@ delete from staff where userId = #{userId} - delete from staff where userId = #{userId} and roleId = (select max(roleId) from staff where userId = #{userId}) + DELETE FROM staff WHERE userId = #{userId} and roleId IN ( SELECT a.tid FROM ( SELECT max( roleId ) AS tid FROM staff ) a ) select userId from staff where staffProfessionalArchitectureId =#{staffProfessionalArchitectureId} and isdel = 0 + + \ No newline at end of file