Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0
This commit is contained in:
commit
a6170d0e1b
@ -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);
|
||||
}
|
||||
@ -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;
|
||||
|
||||
/**
|
||||
@ -410,8 +408,15 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
|
||||
return R.ok("更新成功");
|
||||
}
|
||||
} else if (roleModel.getStaffId() != null) { // 员工不为空
|
||||
StaffRole data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevel(roleModel.getStaffId(), roleModel.getDepartmentLevel());
|
||||
} else if (roleModel.getStaffId() != null) { // 员工不为空,表示是新增数据
|
||||
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("该管理员己经存在");
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user