Commit 138b1cef679e535da81447374b609c9a954f7a8b
1 parent
a9b33ca64c
Exists in
master
and in
8 other branches
bug fix
用户查看 只能查看机构下的数据
Showing 6 changed files with 69 additions and 19 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/UsersQuery.java
- platform-biz-service/src/main/resources/mainOrm/Users.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RegionController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java
platform-biz-service/src/main/java/com/lyms/platform/permission/model/UsersQuery.java
View file @
138b1ce
| ... | ... | @@ -4,6 +4,7 @@ | 
| 4 | 4 | import com.lyms.platform.common.dao.BaseQuery; | 
| 5 | 5 | |
| 6 | 6 | import java.util.Date; | 
| 7 | +import java.util.List; | |
| 7 | 8 | |
| 8 | 9 | |
| 9 | 10 | public class UsersQuery extends BaseQuery { | 
| ... | ... | @@ -32,6 +33,17 @@ | 
| 32 | 33 | private Integer otherAccount; //第三方帐号, 1医院帐号 | 
| 33 | 34 | public Integer getOtherAccount() { | 
| 34 | 35 | return otherAccount; | 
| 36 | + } | |
| 37 | + | |
| 38 | + | |
| 39 | + public List<Integer> orgIds; //这些机构下的用户 | |
| 40 | + | |
| 41 | + public List<Integer> getOrgIds() { | |
| 42 | + return orgIds; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setOrgIds(List<Integer> orgIds) { | |
| 46 | + this.orgIds = orgIds; | |
| 35 | 47 | } | 
| 36 | 48 | |
| 37 | 49 | public void setOtherAccount(Integer otherAccount) { | 
platform-biz-service/src/main/resources/mainOrm/Users.xml
View file @
138b1ce
| ... | ... | @@ -211,8 +211,11 @@ | 
| 211 | 211 | <if test="ksId != null"> | 
| 212 | 212 | and u.ks_id = #{ksId,jdbcType=INTEGER} | 
| 213 | 213 | </if> | 
| 214 | - <if test="orgId != null"> | |
| 215 | - and u.org_id = #{orgId,jdbcType=INTEGER} | |
| 214 | + <if test="orgIds != null"> | |
| 215 | + and u.org_id in | |
| 216 | + <foreach collection="orgIds" index="index" item="item" open="(" separator="," close=")"> | |
| 217 | + #{item} | |
| 218 | + </foreach> | |
| 216 | 219 | </if> | 
| 217 | 220 | <if test="deptId != null"> | 
| 218 | 221 | and u.dept_id = #{deptId,jdbcType=INTEGER} | 
| ... | ... | @@ -245,8 +248,11 @@ | 
| 245 | 248 | <if test="ksId != null and ksId != ''"> | 
| 246 | 249 | and u.ks_id = #{ksId,jdbcType=INTEGER} | 
| 247 | 250 | </if> | 
| 248 | - <if test="orgId != null and orgId != ''"> | |
| 249 | - and u.org_id = #{orgId,jdbcType=INTEGER} | |
| 251 | + <if test="orgIds != null"> | |
| 252 | + and u.org_id in | |
| 253 | + <foreach collection="orgIds" index="index" item="item" open="(" separator="," close=")"> | |
| 254 | + #{item} | |
| 255 | + </foreach> | |
| 250 | 256 | </if> | 
| 251 | 257 | <if test="deptId != null and deptId != ''"> | 
| 252 | 258 | and u.dept_id = #{deptId,jdbcType=INTEGER} | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
View file @
138b1ce
| ... | ... | @@ -52,6 +52,7 @@ | 
| 52 | 52 | private AccessPermissionFacade accessPermissionFacade; | 
| 53 | 53 | |
| 54 | 54 | |
| 55 | + | |
| 55 | 56 | /** | 
| 56 | 57 | * 删除机构 | 
| 57 | 58 | */ | 
| ... | ... | @@ -221,7 +222,9 @@ | 
| 221 | 222 | @RequestMapping(value = "/organization1", method = RequestMethod.GET) | 
| 222 | 223 | @ResponseBody | 
| 223 | 224 | @TokenRequired | 
| 224 | - public FrontEndResult getOrganization(HttpServletRequest request) { | |
| 225 | + public FrontEndResult getOrganization(HttpServletRequest request, @RequestParam(value = "page", required = false) Integer page, | |
| 226 | + @RequestParam(value = "limit", required = false) Integer limit, | |
| 227 | + @RequestParam(value = "keyword", required = false) String keyword) { | |
| 225 | 228 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | 
| 226 | 229 | |
| 227 | 230 | List<Integer> areaId = autoMatchFacade.matchOrgId(loginState.getId()); | 
| 228 | 231 | |
| 229 | 232 | |
| ... | ... | @@ -232,23 +235,36 @@ | 
| 232 | 235 | OrganizationQuery organizationQuery = new OrganizationQuery(); | 
| 233 | 236 | organizationQuery.setNeed("true"); | 
| 234 | 237 | organizationQuery.setSort("province_id desc,city_id desc,area_id desc"); | 
| 238 | + organizationQuery.setPage(page); | |
| 239 | + organizationQuery.setLimit(limit); | |
| 235 | 240 | organizationQuery.setYn(YnEnums.YES.getId()); | 
| 236 | 241 | organizationQuery.setIdList(areaId); | 
| 237 | - List<Integer> list = new ArrayList<>(); | |
| 238 | - list.add(3); | |
| 239 | - list.add(4); | |
| 240 | - organizationQuery.setYn(YnEnums.YES.getId()); | |
| 242 | + organizationQuery.setKeyword(keyword); | |
| 243 | +// List<Integer> list = new ArrayList<>(); | |
| 244 | +// list.add(3); | |
| 245 | +// list.add(4); | |
| 246 | +// organizationQuery.setYn(YnEnums.YES.getId()); | |
| 241 | 247 | // organizationQuery.setTypeList(list); | 
| 242 | 248 | organizations = organizationService.queryOrganization(organizationQuery); | 
| 243 | 249 | pageInfo=organizationQuery.getPageInfo(); | 
| 244 | 250 | |
| 245 | 251 | } else { | 
| 246 | - UserOrganizationMapsQuery userOrganizationMapsQuery = new UserOrganizationMapsQuery(); | |
| 247 | - userOrganizationMapsQuery.setYn(YnEnums.YES.getId()); | |
| 248 | - userOrganizationMapsQuery.setUserId(loginState.getId()); | |
| 249 | - organizations = accessPermissionFacade.findAccessPerminssionByUserId(loginState.getId()); | |
| 250 | - userOrganizationMapsQuery.mysqlBuild(organizations.size()); | |
| 251 | - pageInfo=userOrganizationMapsQuery.getPageInfo(); | |
| 252 | +// UserOrganizationMapsQuery userOrganizationMapsQuery = new UserOrganizationMapsQuery(); | |
| 253 | +// userOrganizationMapsQuery.setYn(YnEnums.YES.getId()); | |
| 254 | +// userOrganizationMapsQuery.setUserId(loginState.getId()); | |
| 255 | +// organizations = accessPermissionFacade.findAccessPerminssionByUserId(loginState.getId()); | |
| 256 | +// userOrganizationMapsQuery.mysqlBuild(organizations.size()); | |
| 257 | +// pageInfo=userOrganizationMapsQuery.getPageInfo(); | |
| 258 | + | |
| 259 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
| 260 | + organizationQuery.setNeed("tree"); | |
| 261 | + organizationQuery.setSort("province_id desc,city_id desc,area_id desc"); | |
| 262 | + organizationQuery.setLimit(limit); | |
| 263 | + organizationQuery.setKeyword(keyword); | |
| 264 | + organizationQuery.setPage(page); | |
| 265 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
| 266 | + organizations = organizationService.queryOrganization(organizationQuery); | |
| 267 | + pageInfo = organizationQuery.getPageInfo(); | |
| 252 | 268 | } | 
| 253 | 269 | if (CollectionUtils.isNotEmpty(organizations)) { | 
| 254 | 270 | for (Organization organization : organizations) { | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RegionController.java
View file @
138b1ce
| ... | ... | @@ -87,7 +87,7 @@ | 
| 87 | 87 | } | 
| 88 | 88 | |
| 89 | 89 | |
| 90 | - if (user.getType().equals(0) && ("0".equals(parentId) || StringUtils.isBlank(parentId))) { | |
| 90 | + if (user.getType().equals(2) || user.getType().equals(0) && ("0".equals(parentId) || StringUtils.isBlank(parentId))) { | |
| 91 | 91 | parentId = SystemConfig.CHINA_BASIC_ID; | 
| 92 | 92 | query.setParentId(parentId); | 
| 93 | 93 | } | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
138b1ce
| ... | ... | @@ -12,6 +12,7 @@ | 
| 12 | 12 | import com.lyms.platform.operate.web.result.FrontEndResult; | 
| 13 | 13 | import com.lyms.platform.permission.model.*; | 
| 14 | 14 | import com.lyms.platform.permission.service.*; | 
| 15 | +import org.apache.commons.collections.CollectionUtils; | |
| 15 | 16 | import org.apache.commons.lang.StringUtils; | 
| 16 | 17 | import org.springframework.beans.factory.annotation.Autowired; | 
| 17 | 18 | import org.springframework.beans.factory.annotation.Value; | 
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | |
| 21 | 22 | |
| 22 | 23 | |
| ... | ... | @@ -120,22 +121,37 @@ | 
| 120 | 121 | @RequestParam(value = "deptId", required = false) Integer deptId) { | 
| 121 | 122 | LoginContext loginContext = (LoginContext) request.getAttribute("loginContext"); | 
| 122 | 123 | Users u = usersService.getUsers(loginContext.getId()); | 
| 124 | + | |
| 125 | + | |
| 126 | + List<Integer> ids = null; | |
| 123 | 127 | if(u.getType().equals(1)) { | 
| 124 | 128 | orgId = u.getOrgId(); | 
| 129 | + }else if(u.getType().equals(0)) { | |
| 130 | + List<Organization> organizations = accessPermissionFacade.findAccessPerminssionByUserId(u.getId()); | |
| 131 | + ids = new ArrayList<>(); | |
| 132 | + if(CollectionUtils.isNotEmpty(organizations)) { | |
| 133 | + for(Organization organization : organizations) { | |
| 134 | + ids.add(organization.getId()); | |
| 135 | + } | |
| 136 | + } | |
| 125 | 137 | } | 
| 126 | 138 | |
| 139 | + if(null != orgId) { | |
| 140 | + ids = new ArrayList<>(); | |
| 141 | + ids.add(orgId); | |
| 142 | + } | |
| 127 | 143 | |
| 144 | + UsersQuery usersQuery = new UsersQuery(); | |
| 128 | 145 | limit = limit == null ? 10 : limit; | 
| 129 | 146 | page = page == null ? 1 : page; | 
| 130 | 147 | |
| 131 | - UsersQuery usersQuery = new UsersQuery(); | |
| 132 | 148 | usersQuery.setNeed("true"); | 
| 133 | 149 | usersQuery.setSort("id desc"); | 
| 134 | 150 | usersQuery.setYn(YnEnums.YES.getId()); | 
| 135 | 151 | usersQuery.setDeptId(deptId); | 
| 136 | 152 | usersQuery.setKeyword(keyword); | 
| 137 | 153 | usersQuery.setType(1); | 
| 138 | - usersQuery.setOrgId(orgId); | |
| 154 | + usersQuery.setOrgIds(ids); | |
| 139 | 155 | usersQuery.setPage(page); | 
| 140 | 156 | usersQuery.setLimit(limit); | 
| 141 | 157 | usersQuery.setRoleId(rolesId); | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java
View file @
138b1ce
| ... | ... | @@ -69,7 +69,7 @@ | 
| 69 | 69 | data.add(users.getOrgId()); | 
| 70 | 70 | } | 
| 71 | 71 | } | 
| 72 | - } else if(list.get(0).getType() == 1){ | |
| 72 | + } else if(list.get(0).getType() == 0){ | |
| 73 | 73 | List<Organization> list2 =accessPermissionFacade.findAccessPerminssionByUserId(list.get(0).getId()); | 
| 74 | 74 | if(CollectionUtils.isNotEmpty(list2)){ | 
| 75 | 75 | for(Organization organization:list2){ |