编辑员工

hehai
shijie 4 years ago
parent 0b2d226757
commit 96e42dc05c
  1. 2
      src/main/java/com/msdw/tms/dao/SystemSetttingDao.java
  2. 18
      src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java
  3. 6
      src/main/resources/mapper/tms/SystemSetting.xml

@ -61,4 +61,6 @@ public interface SystemSetttingDao {
List<Integer> queryUserIdsByGradeId(Integer staffGradeId); List<Integer> queryUserIdsByGradeId(Integer staffGradeId);
List<Integer> queryUserIdsByProfessionalId(Integer staffProfessionalArchitectureId); List<Integer> queryUserIdsByProfessionalId(Integer staffProfessionalArchitectureId);
List<Integer> queryStaffId(Integer userId);
} }

@ -140,7 +140,20 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
String roleIds = result.getRoleId(); String roleIds = result.getRoleId();
String[] splitOld = staffVo.getRoleId().split(","); String[] splitOld = staffVo.getRoleId().split(",");
String[] splitNew = roleIds.split(","); String[] splitNew = roleIds.split(",");
if (splitOld.length == splitNew.length && splitNew.length < 3) {
//根据userId删除数据,再新增
//List<Integer> 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++) { for (int i = 0; i < splitNew.length; i++) {
boolean a = systemSetttingDao.updateStaff(staff.get(i)); boolean a = systemSetttingDao.updateStaff(staff.get(i));
if (!a) { if (!a) {
@ -157,11 +170,12 @@ public class SystemSettingServiceImpl implements SystemSetttingService {
} }
} else if (splitNew.length < splitOld.length) { } else if (splitNew.length < splitOld.length) {
boolean a = systemSetttingDao.deleteStaffOnly(staffVo.getUserId());//删除roleId最大的数据 boolean a = systemSetttingDao.deleteStaffOnly(staffVo.getUserId());//删除roleId最大的数据
System.out.println("roleId=========="+staffVo.getRoleId());
staffVo.setStaffRoleId(Integer.parseInt(staffVo.getRoleId())); staffVo.setStaffRoleId(Integer.parseInt(staffVo.getRoleId()));
boolean b = systemSetttingDao.updateStaffOnly(staffVo);//修改仅剩的数据 boolean b = systemSetttingDao.updateStaffOnly(staffVo);//修改仅剩的数据
} else { } else {
return R.error(400, "不存在此账号"); return R.error(400, "不存在此账号");
} }*/
userInfoDao.setNUM(staffVo.getUserId());//重置账号、手机号码为00 userInfoDao.setNUM(staffVo.getUserId());//重置账号、手机号码为00
// systemSetttingDao.deleteStaffInfo(staffVo.getUserId());// // systemSetttingDao.deleteStaffInfo(staffVo.getUserId());//

@ -82,7 +82,7 @@
delete from staff where userId = #{userId} delete from staff where userId = #{userId}
</delete> </delete>
<delete id="deleteStaffOnly"> <delete id="deleteStaffOnly">
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 )
</delete> </delete>
<select id="queryStaff" resultType="com.msdw.tms.entity.vo.StaffVo"> <select id="queryStaff" resultType="com.msdw.tms.entity.vo.StaffVo">
SELECT SELECT
@ -202,4 +202,8 @@ WHERE
<select id="queryUserIdsByProfessionalId" resultType="java.lang.Integer"> <select id="queryUserIdsByProfessionalId" resultType="java.lang.Integer">
select userId from staff where staffProfessionalArchitectureId =#{staffProfessionalArchitectureId} and isdel = 0 select userId from staff where staffProfessionalArchitectureId =#{staffProfessionalArchitectureId} and isdel = 0
</select> </select>
<select id="queryStaffId" resultType="java.lang.Integer">
select staffId from staff where userId =#{userId} and isdel = 0
</select>
</mapper> </mapper>
Loading…
Cancel
Save