Commit 7ee7a147b1835e47bf383ff505a493f1ef766f92

Authored by fangcheng
1 parent dffb4c74a9
Exists in master

角色、机构组添加选择组件

Showing 8 changed files with 96 additions and 45 deletions

parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganGroupService.java View file @ 7ee7a14
1 1 package com.lyms.base.common.service.organ;
2 2  
3 3 import java.io.Serializable;
  4 +import java.util.List;
4 5  
5 6 import com.lyms.base.common.entity.organ.OrganGroup;
6 7 import com.lyms.exception.SystemException;
... ... @@ -58,6 +59,16 @@
58 59 * <li>修改时间:
59 60 */
60 61 public boolean updateGroup(OrganGroup organGrooup) throws SystemException;
  62 +
  63 + /**
  64 + * <li>@Description:获取所有医院组
  65 + * <li>@return
  66 + * <li>创建人:方承
  67 + * <li>创建时间:2017年5月25日
  68 + * <li>修改人:
  69 + * <li>修改时间:
  70 + */
  71 + public List<OrganGroup> getAllEnableGroup();
61 72  
62 73 }
parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganizationsService.java View file @ 7ee7a14
... ... @@ -95,6 +95,17 @@
95 95 * <li>修改时间:
96 96 */
97 97 public List<Organizations> selectListByName(String name);
  98 +
  99 +
  100 + /**
  101 + * <li>@Description:获取所有可用的机构
  102 + * <li>@return
  103 + * <li>创建人:方承
  104 + * <li>创建时间:2017年5月25日
  105 + * <li>修改人:
  106 + * <li>修改时间:
  107 + */
  108 + public List<Organizations> getAllEnableOrg();
98 109  
99 110 }
parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganGroupServiceImpl.java View file @ 7ee7a14
... ... @@ -15,6 +15,7 @@
15 15 import com.lyms.base.common.entity.organ.OrganGroup;
16 16 import com.lyms.base.common.entity.organ.OrganGroupMaps;
17 17 import com.lyms.base.common.enums.SyncParamEnum;
  18 +import com.lyms.base.common.enums.ValidityEnum;
18 19 import com.lyms.base.common.service.organ.OrganGroupService;
19 20 import com.lyms.base.common.utils.SyncComponent;
20 21 import com.lyms.exception.SystemException;
21 22  
22 23  
23 24  
24 25  
25 26  
26 27  
... ... @@ -31,29 +32,29 @@
31 32 */
32 33 @Service
33 34 public class OrganGroupServiceImpl extends ServiceImpl<OrganGroupMapper, OrganGroup> implements OrganGroupService {
34   -
  35 +
35 36 @Autowired
36 37 private OrganGroupMapsMapper organGroupMapsMapper;
37   -
  38 +
38 39 @Autowired
39   - private SyncComponent syncComponent;
  40 + private SyncComponent syncComponent;
40 41  
41 42 @Transactional
42   - public Integer deleteLogicById(Serializable id) {
  43 + public Integer deleteLogicById(Serializable id) {
43 44 organGroupMapsMapper.delete(new EntityWrapper<OrganGroupMaps>().where("GROUP_ID={0}", id));
44   - return baseMapper.deleteLogicById(id);
45   - }
  45 + return baseMapper.deleteLogicById(id);
  46 + }
46 47  
47   - @Override
48   - @Transactional
49   - public boolean create(OrganGroup organGroup) throws SystemException {
50   - if (organGroup == null)
51   - return false;
52   - organGroup.setId(StrUtils.uuid());
53   - if(StrUtils.isNotEmpty(organGroup.getOrgIds())){
  48 + @Override
  49 + @Transactional
  50 + public boolean create(OrganGroup organGroup) throws SystemException {
  51 + if (organGroup == null)
  52 + return false;
  53 + organGroup.setId(StrUtils.uuid());
  54 + if (StrUtils.isNotEmpty(organGroup.getOrgIds())) {
54 55 String[] ids = organGroup.getOrgIds().split(",");
55 56 List<OrganGroupMaps> mapsList = InstanceUtils.newArrayList();
56   - for(String id : ids){
  57 + for (String id : ids) {
57 58 OrganGroupMaps maps = new OrganGroupMaps();
58 59 maps.setId(StrUtils.uuid());
59 60 maps.setGroupId(organGroup.getId());
60 61  
61 62  
62 63  
63 64  
64 65  
65 66  
66 67  
67 68  
... ... @@ -63,37 +64,37 @@
63 64 }
64 65 organGroup.setOrgnumber(mapsList.size());
65 66 }
66   - Integer tag = baseMapper.insert(organGroup);
67   - if(tag >= 1){
  67 + Integer tag = baseMapper.insert(organGroup);
  68 + if (tag >= 1) {
68 69 syncComponent.addPushSyncOperation(SyncParamEnum.ORG_GROUP_INSERT, organGroup);
69 70 }
70   - return tag != null && tag > 0;
  71 + return tag != null && tag > 0;
71 72  
72   - }
  73 + }
73 74  
74   - @Override
75   - @Transactional
76   - public boolean deleteGroupById(String groupId) throws SystemException {
77   - if (StringUtils.isBlank(groupId))
78   - return false;
79   - Integer tag = baseMapper.deleteById(groupId);
80   - if(tag >= 1){
  75 + @Override
  76 + @Transactional
  77 + public boolean deleteGroupById(String groupId) throws SystemException {
  78 + if (StringUtils.isBlank(groupId))
  79 + return false;
  80 + Integer tag = baseMapper.deleteById(groupId);
  81 + if (tag >= 1) {
81 82 syncComponent.addPushSyncOperation(SyncParamEnum.ORG_GROUP_DELETE, groupId);
82 83 }
83   - return tag != null && tag > 0;
  84 + return tag != null && tag > 0;
84 85  
85   - }
  86 + }
86 87  
87   - @Override
88   - @Transactional
89   - public boolean updateGroup(OrganGroup organGroup) throws SystemException {
90   - if (organGroup == null)
  88 + @Override
  89 + @Transactional
  90 + public boolean updateGroup(OrganGroup organGroup) throws SystemException {
  91 + if (organGroup == null)
91 92 return false;
92 93 organGroupMapsMapper.delete(new EntityWrapper<OrganGroupMaps>().where("GROUP_ID={0}", organGroup.getId()));
93   - if(StrUtils.isNotEmpty(organGroup.getOrgIds())){
  94 + if (StrUtils.isNotEmpty(organGroup.getOrgIds())) {
94 95 String[] ids = organGroup.getOrgIds().split(",");
95 96 List<OrganGroupMaps> mapsList = InstanceUtils.newArrayList();
96   - for(String id : ids){
  97 + for (String id : ids) {
97 98 OrganGroupMaps maps = new OrganGroupMaps();
98 99 maps.setId(StrUtils.uuid());
99 100 maps.setGroupId(organGroup.getId());
100 101  
... ... @@ -104,11 +105,18 @@
104 105 organGroup.setOrgnumber(mapsList.size());
105 106 }
106 107 Integer tag = baseMapper.updateById(organGroup);
107   - if(tag >= 1){
  108 + if (tag >= 1) {
108 109 syncComponent.addPushSyncOperation(SyncParamEnum.ORG_GROUP_UPDATE, organGroup);
109 110 }
110 111 return tag != null && tag > 0;
111 112  
112   - }
  113 + }
  114 +
  115 + @Override
  116 + public List<OrganGroup> getAllEnableGroup() {
  117 + EntityWrapper<OrganGroup> ew = new EntityWrapper<OrganGroup>();
  118 + ew.where("ifdel=" + ValidityEnum.VALIDITY.getValidity());
  119 + return selectList(ew);
  120 + }
113 121 }
parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganizationsServiceImpl.java View file @ 7ee7a14
... ... @@ -97,5 +97,10 @@
97 97 return this.selectList(ew);
98 98 }
99 99  
  100 + @Override
  101 + public List<Organizations> getAllEnableOrg() {
  102 + return selectList(new EntityWrapper<Organizations>().where("ifdel=0").and("status!=2"));
  103 + }
  104 +
100 105 }
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysRolesController.java View file @ 7ee7a14
... ... @@ -13,9 +13,13 @@
13 13  
14 14 import com.baomidou.mybatisplus.mapper.EntityWrapper;
15 15 import com.baomidou.mybatisplus.plugins.Page;
  16 +import com.lyms.base.common.entity.organ.OrganGroup;
  17 +import com.lyms.base.common.entity.organ.Organizations;
16 18 import com.lyms.base.common.entity.role.Permissions;
17 19 import com.lyms.base.common.entity.role.RolePermissionMaps;
18 20 import com.lyms.base.common.entity.role.Roles;
  21 +import com.lyms.base.common.service.organ.OrganGroupService;
  22 +import com.lyms.base.common.service.organ.OrganizationsService;
19 23 import com.lyms.base.common.service.role.PermissionsService;
20 24 import com.lyms.base.common.service.role.RolePermissionMapsService;
21 25 import com.lyms.base.common.service.role.RolesService;
22 26  
... ... @@ -44,9 +48,17 @@
44 48  
45 49 @Autowired
46 50 private RolePermissionMapsService sysRolePermissionMapsService;
  51 + @Autowired
  52 + private OrganizationsService sysOrganizationsService;
  53 + @Autowired
  54 + private OrganGroupService sysOrganGroupService;
47 55  
48 56 @RequestMapping("/toList")
49   - public String list() {
  57 + public String list(Model model) {
  58 + List<Organizations> orgs = sysOrganizationsService.getAllEnableOrg();
  59 + List<OrganGroup> groups =sysOrganGroupService.getAllEnableGroup();
  60 + model.addAttribute("orgs", orgs);
  61 + model.addAttribute("groups", groups);
50 62 return "/role/role_list";
51 63 }
52 64  
... ... @@ -103,6 +115,10 @@
103 115 }
104 116 model.addAttribute("rolePermissions", permissionSB.toString().replaceFirst(",", ""));
105 117 }
  118 + List<Organizations> orgs = sysOrganizationsService.getAllEnableOrg();
  119 + List<OrganGroup> groups =sysOrganGroupService.getAllEnableGroup();
  120 + model.addAttribute("orgs", orgs);
  121 + model.addAttribute("groups", groups);
106 122 // 所有权限数据
107 123 List<Permissions> perList = sysPermissionsService.selectList(null);
108 124 model.addAttribute("perString", toJson(perList));
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java View file @ 7ee7a14
... ... @@ -87,7 +87,7 @@
87 87 */
88 88 @RequestMapping(value = "/toList", method = { RequestMethod.GET })
89 89 public String toList(Model model) {
90   - List<Organizations> orgs = sysOrganizationsService.selectList(new EntityWrapper<Organizations>().where("ifdel=0").and("status!=2"));
  90 + List<Organizations> orgs = sysOrganizationsService.getAllEnableOrg();
91 91 model.addAttribute("orgs", orgs);
92 92 return "/user/user_list";
93 93 }
... ... @@ -152,7 +152,7 @@
152 152 }
153 153 // 所有角色数据
154 154 List<Roles> roleList = sysRolesService.selectList(new EntityWrapper<Roles>().where("ifDel=0"));
155   - List<Organizations> orgs = sysOrganizationsService.selectList(new EntityWrapper<Organizations>().where("ifdel=0").and("status!=2"));
  155 + List<Organizations> orgs = sysOrganizationsService.getAllEnableOrg();
156 156  
157 157 model.addAttribute("roleString", toJson(roleList));
158 158 model.addAttribute("orgs", orgs);
parent/center.manager/src/main/webapp/WEB-INF/views/role/role_edit.html View file @ 7ee7a14
... ... @@ -143,13 +143,13 @@
143 143 <div class="form-group">
144 144 <label class="col-sm-3 control-label">医院id:</label>
145 145 <div class="col-sm-8">
146   - <input type="text" placeholder="医院id" value="$!role.orgId" aria-required="true" required="true" class="form-control" minlength="2" name="orgId" id="orgId">
  146 + #selector("orgId" "orgId" $orgs $!role.orgId)
147 147 </div>
148 148 </div>
149 149 <div class="form-group">
150 150 <label class="col-sm-3 control-label">医院组:</label>
151 151 <div class="col-sm-8">
152   - <input type="text" placeholder="医院组id" value="$!role.grouporgId" aria-required="true" required="true" class="form-control" minlength="2" name="grouporgId" id="grouporgId">
  152 + #selector("grouporgId" "grouporgId" $groups $!role.grouporgId)
153 153 </div>
154 154 </div>
155 155 <div class="form-group">
parent/center.manager/src/main/webapp/WEB-INF/views/role/role_list.html View file @ 7ee7a14
... ... @@ -7,20 +7,20 @@
7 7 <input type="text" placeholder="角色名" id="searchName" class="form-control">
8 8 </div>
9 9 <div class="form-group">
10   - <input type="text" placeholder="医院id" id="searchOrgId" class="form-control">
  10 + 医院:
  11 + #selector("searchOrgId" "searchOrgId" $orgs )
11 12 </div>
12 13 <div class="form-group">
13   - <input type="text" placeholder="医院组id" id="searchGrouporgId" class="form-control">
  14 + 医院组:
  15 + #selector("searchGrouporgId" "searchGrouporgId" $groups )
14 16 </div>
15 17 <div class="form-group">
  18 + 角色类型:
16 19 <select class="form-control m-b" name="type" id="searchType" style="margin-bottom: 0;">
17 20 <option value="">所有</option>
18 21 <option value="1">用户角色</option>
19 22 <option value="0">管理员角色</option>
20 23 </select>
21   - </div>
22   - <div class="form-group">
23   - <input type="text" placeholder="编号" id="searchId" class="form-control">
24 24 </div>
25 25 </form>
26 26 </div>