From 96e42dc05cbf8d9e10357a009df4c8df5af72a88 Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Tue, 20 Apr 2021 15:59:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=91=98=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/msdw/tms/dao/SystemSetttingDao.java | 2 ++ .../service/impl/SystemSettingServiceImpl.java | 18 ++++++++++++++++-- .../resources/mapper/tms/SystemSetting.xml | 6 +++++- 3 files changed, 23 insertions(+), 3 deletions(-) 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