From bac11e73e92b4e486e06dc22e05f3f92fb838397 Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Tue, 10 Nov 2020 15:38:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/lz/config/ShiroConfig.java | 1 + .../app/controller/StaffRoleController.java | 16 ++++++++++++++-- .../com/lz/modules/app/resp/StaffRoleModel.java | 4 ---- .../flow/dao/StaffRoleEvaluationGroupMapper.java | 2 ++ .../com/lz/modules/flow/dao/StaffRoleMapper.java | 2 ++ .../service/StaffRoleEvaluationGroupService.java | 2 ++ .../modules/flow/service/StaffRoleService.java | 2 ++ .../StaffRoleEvaluationGroupServiceImpl.java | 8 +++++++- .../flow/service/impl/StaffRoleServiceImpl.java | 6 ++++++ .../flow/StaffRoleEvaluationGroupMapper.xml | 5 +++++ .../resources/mapper/flow/StaffRoleMapper.xml | 6 ++++++ 11 files changed, 47 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/lz/config/ShiroConfig.java b/src/main/java/com/lz/config/ShiroConfig.java index 1fe3d0c6..7ea36211 100644 --- a/src/main/java/com/lz/config/ShiroConfig.java +++ b/src/main/java/com/lz/config/ShiroConfig.java @@ -54,6 +54,7 @@ public class ShiroConfig { filterMap.put("/file/**", "anon"); filterMap.put("/user/lzstaffrole/role/**", "anon"); filterMap.put("/user/lzresultrecord/**", "anon"); + filterMap.put("/user/lzstaffrole/listByGroupId/**", "anon"); filterMap.put("/test/**", "anon"); filterMap.put("/druid/**", "anon"); filterMap.put("/app/**", "anon"); diff --git a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java index a368def7..17d6f218 100644 --- a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java +++ b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java @@ -8,6 +8,7 @@ import com.lz.common.utils.R; import com.lz.modules.app.entity.DepartmentsEntity; import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.entity.StaffEntity; +import com.lz.modules.app.enums.RoleEnums; import com.lz.modules.app.model.RoleModel; import com.lz.modules.app.resp.StaffRoleModel; import com.lz.modules.app.service.DepartmentsService; @@ -16,9 +17,11 @@ import com.lz.modules.app.service.StaffService; import com.lz.modules.flow.entity.RecordRole; import com.lz.modules.flow.entity.StaffRole; import com.lz.modules.flow.entity.StaffRoleDepartment; +import com.lz.modules.flow.entity.StaffRoleEvaluationGroup; import com.lz.modules.flow.req.StaffRoleRequest; import com.lz.modules.flow.service.RecordRoleService; import com.lz.modules.flow.service.StaffRoleDepartmentService; +import com.lz.modules.flow.service.StaffRoleEvaluationGroupService; import com.lz.modules.flow.service.StaffRoleService; import com.lz.modules.sys.entity.SysMenuEntity; import com.lz.modules.sys.entity.SysRoleEntity; @@ -63,6 +66,8 @@ public class StaffRoleController { @Autowired private DepartmentsStaffRelateService departmentsStaffRelateService; +@Autowired + private StaffRoleEvaluationGroupService staffRoleEvaluationGroupService; /** * 列表 @@ -80,7 +85,7 @@ public class StaffRoleController { // http://localhost:8080/lz_management/user/lzstaffrole/listByGroupId?groupId=3 @ApiImplicitParam(name = "groupId",value = "组id",defaultValue = "1",required = true, dataType = "Long",paramType = "query") public R listByGroupId( Long groupId ) { - List staffRoleList = staffRoleService.selectByGroupId(groupId); + List staffRoleList = staffRoleService.selectAllStaffRoleByDepartmentLevel(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName(),RoleEnums.CHILD_PM.getName()})); List staffRoles = new ArrayList<>(); for(StaffRole staffRole:staffRoleList){ StaffRoleModel staffRoleModel = new StaffRoleModel(); @@ -93,6 +98,14 @@ public class StaffRoleController { staffRoleModel.setStaffName(staffRoleModel.getStaffName() + " "+departmentsEntity.getDepartmentName()); } } + StaffRoleEvaluationGroup staffRoleEvaluationGroup = staffRoleEvaluationGroupService.selectEvaluationGroupIdsByRoleIdGroupId(staffRole.getId(),groupId); + staffRoleModel.setIsSelect(0); + if(staffRoleEvaluationGroup !=null){ + staffRoleModel.setIsSelect(1); + } + if(staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())){ + staffRoleModel.setIsSelect(1); + } staffRoles.add(staffRoleModel); } return R.ok().put("data", staffRoles); @@ -185,7 +198,6 @@ public class StaffRoleController { } } } - if (req.getId() == null || req.getId() <= 0) { staffRoleService.insertStaffRole(staffRole); } else { diff --git a/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java b/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java index 9e060205..9b16b41e 100644 --- a/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java +++ b/src/main/java/com/lz/modules/app/resp/StaffRoleModel.java @@ -21,10 +21,6 @@ public class StaffRoleModel { @ApiModelProperty(value = "组id", name = "evaluationGroupId") private Long evaluationGroupId; - - - - //是否是必选 @ApiModelProperty(value = "是否是必选,0不是必选,1必选", name = "isSelect") private Integer isSelect; diff --git a/src/main/java/com/lz/modules/flow/dao/StaffRoleEvaluationGroupMapper.java b/src/main/java/com/lz/modules/flow/dao/StaffRoleEvaluationGroupMapper.java index f9c7dc00..66a1a3a4 100644 --- a/src/main/java/com/lz/modules/flow/dao/StaffRoleEvaluationGroupMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/StaffRoleEvaluationGroupMapper.java @@ -39,4 +39,6 @@ public interface StaffRoleEvaluationGroupMapper extends BaseMapper { List selectAllByStaffId(@Param("staffId") Long staffId); List selectAllMenus(@Param("userId") Long userId); + + List selectAllStaffRoleByDepartmentLevel(@Param("departmentLevels") List departmentLevels); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/StaffRoleEvaluationGroupService.java b/src/main/java/com/lz/modules/flow/service/StaffRoleEvaluationGroupService.java index 14c86c65..6f4ba810 100644 --- a/src/main/java/com/lz/modules/flow/service/StaffRoleEvaluationGroupService.java +++ b/src/main/java/com/lz/modules/flow/service/StaffRoleEvaluationGroupService.java @@ -38,4 +38,6 @@ public interface StaffRoleEvaluationGroupService extends IService selectStaffRoleEvaluationGroupBy(Long id); void deleteStaffRoleEvaluationGroupByRoleId(Long roleId); + + StaffRoleEvaluationGroup selectEvaluationGroupIdsByRoleIdGroupId(Long roleId, Long groupId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/StaffRoleService.java b/src/main/java/com/lz/modules/flow/service/StaffRoleService.java index 1f7f8467..60f3f864 100644 --- a/src/main/java/com/lz/modules/flow/service/StaffRoleService.java +++ b/src/main/java/com/lz/modules/flow/service/StaffRoleService.java @@ -65,4 +65,6 @@ public interface StaffRoleService extends IService { List selectAllByStaffId(Long userId); Map getRoleByUserId(Long userId); + + List selectAllStaffRoleByDepartmentLevel(List asList); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleEvaluationGroupServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleEvaluationGroupServiceImpl.java index e9f7d0d0..9a93f962 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleEvaluationGroupServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleEvaluationGroupServiceImpl.java @@ -71,7 +71,13 @@ public class StaffRoleEvaluationGroupServiceImpl extends ServiceImpl selectEvaluationGroupIdsByRoleId(Long roleId) { return staffRoleEvaluationGroupMapper.selectEvaluationGroupIdsByRoleId(roleId); } diff --git a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java index 4b4ba480..ffe69a08 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java @@ -503,6 +503,12 @@ public class StaffRoleServiceImpl extends ServiceImpl selectAllStaffRoleByDepartmentLevel(List asList) { + + return staffRoleMapper.selectAllStaffRoleByDepartmentLevel(asList); + } + public void insertPM(StaffRole staffRole, Long parentId, StaffEntity staffEntity) { staffRole.setEvaluationGroupId(EvaluationGroupEnums.ALL.getType());//全部考评组 staffRole.setDepartmentId(DepartmentPMEnums.ALL.getType());//所有部门 diff --git a/src/main/resources/mapper/flow/StaffRoleEvaluationGroupMapper.xml b/src/main/resources/mapper/flow/StaffRoleEvaluationGroupMapper.xml index f7b1c1c8..59dde81b 100644 --- a/src/main/resources/mapper/flow/StaffRoleEvaluationGroupMapper.xml +++ b/src/main/resources/mapper/flow/StaffRoleEvaluationGroupMapper.xml @@ -97,5 +97,10 @@ select evaluation_group_id from lz_staff_role_evaluation_group where is_delete = 0 and role_id = #{roleId} and is_select = 1 + + diff --git a/src/main/resources/mapper/flow/StaffRoleMapper.xml b/src/main/resources/mapper/flow/StaffRoleMapper.xml index 48e8d35e..8f44cb4f 100644 --- a/src/main/resources/mapper/flow/StaffRoleMapper.xml +++ b/src/main/resources/mapper/flow/StaffRoleMapper.xml @@ -169,6 +169,12 @@ select menu_id from lz_staff_role_menu where role_id in ( select id from lz_staff_role where staff_id = #{userId} and is_delete=0) and is_delete = 0 ) and is_delete = 0 +