Commit cf8d22544fc3f6bedde45c3b318c9e2b891d00ce
1 parent
f0640d2743
Exists in
master
and in
8 other branches
增加权限判断
Showing 6 changed files with 39 additions and 7 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/UserRoleMapsMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/UserRoleMapsService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/OrganizationServiceImpl.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/UserRoleMapsServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/UserRoleMaps.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/UserRoleMapsMapper.java
View file @
cf8d225
platform-biz-service/src/main/java/com/lyms/platform/permission/service/UserRoleMapsService.java
View file @
cf8d225
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/OrganizationServiceImpl.java
View file @
cf8d225
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | public Organization getOrganization(Integer id) { |
38 | 38 | Organization organization = organizationMapper.getOrganization(id); |
39 | 39 | if(null != organization) { |
40 | - //设置机构类型 0 公司 1 医院 | |
40 | + //锟斤拷锟矫伙拷锟斤拷锟斤拷锟斤拷 0 锟斤拷司 1 医院 | |
41 | 41 | if( null != organization.getType() && |
42 | 42 | (organization.getType().equals(OrganizationTypeEnum.NY.getId()) || organization.getType().equals(OrganizationTypeEnum.FB.getId()) || |
43 | 43 | organization.getType().equals(OrganizationTypeEnum.TY.getId())|| organization.getType().equals(OrganizationTypeEnum.JMQY.getId()))) { |
... | ... | @@ -63,7 +63,6 @@ |
63 | 63 | if(CollectionUtils.isNotEmpty(organizations)) { |
64 | 64 | for(Organization organization : organizations) { |
65 | 65 | if(null != organization) { |
66 | - //设置机构类型 0 公司 1 医院 | |
67 | 66 | if( null != organization.getType() && |
68 | 67 | (organization.getType().equals(OrganizationTypeEnum.NY.getId()) || organization.getType().equals(OrganizationTypeEnum.FB.getId()) || |
69 | 68 | organization.getType().equals(OrganizationTypeEnum.TY.getId())|| organization.getType().equals(OrganizationTypeEnum.JMQY.getId()))) { |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/UserRoleMapsServiceImpl.java
View file @
cf8d225
platform-biz-service/src/main/resources/mainOrm/UserRoleMaps.xml
View file @
cf8d225
... | ... | @@ -100,7 +100,9 @@ |
100 | 100 | <include refid="UserRoleMapsCondition" /> |
101 | 101 | </select> |
102 | 102 | |
103 | - | |
103 | +<select id="queryUserRoleName" resultType="java.lang.String" parameterType="java.lang.Integer"> | |
104 | + select b.name from user_role_maps a ,roles b where a.yn=1 and a.user_id=#{id,jdbcType=INTEGER} and a.role_id=b.id and b.yn=1 | |
105 | +</select> | |
104 | 106 | |
105 | 107 | </mapper> |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
cf8d225
... | ... | @@ -61,8 +61,10 @@ |
61 | 61 | |
62 | 62 | private static final String LYMS = "龙源美生"; |
63 | 63 | |
64 | + private static final String ADMIN="管理员"; | |
64 | 65 | |
65 | 66 | |
67 | + | |
66 | 68 | /** |
67 | 69 | * 获取管理员列表 |
68 | 70 | */ |
... | ... | @@ -525,7 +527,15 @@ |
525 | 527 | return; |
526 | 528 | } |
527 | 529 | |
528 | - | |
530 | + //根据当前登录的用户判断是否 有管理员的权限 | |
531 | + List<String> list = userRoleMapsService.queryUserRoleName(loginState.getId()); | |
532 | + if(CollectionUtils.isEmpty(list) ||!list.contains(ADMIN)){ | |
533 | + Map<String, Object> map = new HashMap<>(); | |
534 | + map.put(ResultUtils.ERROR_CODE, ConstantInterface.PARAMETER_ERROR); | |
535 | + map.put(ResultUtils.ERROR_MSG, "你没有足够的权限."); | |
536 | + writeJson(response, JsonUtil.obj2JsonString(map)); | |
537 | + return; | |
538 | + } | |
529 | 539 | if (user != null) { |
530 | 540 | |
531 | 541 | //检查注册账户是否存在 |
... | ... | @@ -630,7 +640,15 @@ |
630 | 640 | ResultUtils.buildParameterErrorResultAndWrite(response, "deptId or ksId required"); |
631 | 641 | return; |
632 | 642 | } |
633 | - | |
643 | + //根据当前登录的用户判断是否 有管理员的权限 | |
644 | + List<String> list = userRoleMapsService.queryUserRoleName(loginState.getId()); | |
645 | + if(CollectionUtils.isEmpty(list) ||!list.contains(ADMIN)){ | |
646 | + Map<String, Object> map = new HashMap<>(); | |
647 | + map.put(ResultUtils.ERROR_CODE, ConstantInterface.PARAMETER_ERROR); | |
648 | + map.put(ResultUtils.ERROR_MSG, "你没有足够的权限."); | |
649 | + writeJson(response, JsonUtil.obj2JsonString(map)); | |
650 | + return; | |
651 | + } | |
634 | 652 | if (user != null) { |
635 | 653 | |
636 | 654 | //检查注册账户是否存在 |
... | ... | @@ -824,6 +842,15 @@ |
824 | 842 | if (user != null) { |
825 | 843 | |
826 | 844 | Users users = usersService.getUsers(id); |
845 | + //根据当前登录的用户判断是否 有管理员的权限 | |
846 | + List<String> list = userRoleMapsService.queryUserRoleName(loginState.getId()); | |
847 | + if(CollectionUtils.isEmpty(list) ||!list.contains(ADMIN)){ | |
848 | + Map<String, Object> map = new HashMap<>(); | |
849 | + map.put(ResultUtils.ERROR_CODE, ConstantInterface.PARAMETER_ERROR); | |
850 | + map.put(ResultUtils.ERROR_MSG, "你没有足够的权限."); | |
851 | + writeJson(response, JsonUtil.obj2JsonString(map)); | |
852 | + return; | |
853 | + } | |
827 | 854 | if(null == users) { |
828 | 855 | Map<String, Object> map = new HashMap<>(); |
829 | 856 | map.put(ResultUtils.ERROR_CODE, ConstantInterface.PARAMETER_ERROR); |