提交修改

This commit is contained in:
quyixiao 2020-11-10 15:52:38 +08:00
parent f786cb20ec
commit 7282fe67c8
3 changed files with 19 additions and 5 deletions

View File

@ -60,4 +60,6 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
List<StaffMenu> selectAllMenus(@Param("userId") Long userId);
List<StaffRole> selectAllStaffRoleByDepartmentLevel(@Param("departmentLevels") List<String> departmentLevels);
StaffRole selectStaffRolesByStaffIdDepartmentLevelList(@Param("staffId") Long staffId, @Param("departmentLevels") List<String> departmentLevels);
}

View File

@ -37,10 +37,8 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.lang.reflect.Array;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -411,7 +409,14 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
return R.ok("更新成功");
}
} else if (roleModel.getStaffId() != null) { // 员工不为空
StaffRole data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevel(roleModel.getStaffId(), roleModel.getDepartmentLevel());
StaffRole data = null;
if(RoleEnums.CHILD_PM.getName().equals(roleModel.getDepartmentLevel()) //如果是主管理员或者是子管理员主管理员和子管理员不能同时存在
|| RoleEnums.MASTER_PM.getName().equals(roleModel.getDepartmentLevel())){
data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(),
Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName(),RoleEnums.MASTER_PM.getName()}));
} else {
data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevel(roleModel.getStaffId(), roleModel.getDepartmentLevel());
}
if (data != null) {
return R.error("该管理员己经存在");
}

View File

@ -176,6 +176,13 @@
</foreach>
</select>
<select id="selectStaffRolesByStaffIdDepartmentLevelList" resultType="com.lz.modules.flow.entity.StaffRole">
select * from lz_staff_role where is_delete = 0 and staff_id = #{staffId} and department_level in
<foreach collection="departmentLevels" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper>