Commit 4a6ae2ae9569d3e9f9d471a7f75c11cfb9cfd341

Authored by rui.zhang
1 parent ddaac54d1a

platform permission

fix bug

Showing 4 changed files with 36 additions and 1 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CommunityConfigService.java View file @ 4a6ae2a
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import java.util.List;
4 4  
  5 +import org.aspectj.apache.bcel.generic.RET;
5 6 import org.springframework.beans.factory.annotation.Autowired;
6 7 import org.springframework.stereotype.Service;
7 8  
8 9  
... ... @@ -40,10 +41,24 @@
40 41 MongoCondition mongoCondition = MongoCondition.newInstance();
41 42 if(null != keyword) {
42 43 mongoCondition.orCondition(new MongoCondition[]{new MongoCondition("name", keyword, MongoOper.LIKE), new MongoCondition("parentId", keyword, MongoOper.LIKE)});
  44 + mongoCondition.andCondition(new MongoCondition("yn", YnEnums.YES.getId(), MongoOper.IS));
43 45 }
44 46  
45 47 return communityConfigDao.queryArea(mongoCondition.toMongoQuery());
46 48 }
47 49  
  50 +
  51 + //查询区域根据ID
  52 + public CommunityConfig queryAreaById(String id) {
  53 + if(null == id) return null;
  54 +
  55 + MongoCondition mongoCondition = MongoCondition.newInstance().and("id", id, MongoOper.IS).and("yn", YnEnums.YES.getId(), MongoOper.IS);
  56 +
  57 + List<CommunityConfig> communityConfigs = communityConfigDao.queryArea(mongoCondition.toMongoQuery());
  58 + if(null != communityConfigs && 1 == communityConfigs.size()) {
  59 + return communityConfigs.get(0);
  60 + }
  61 + return null;
  62 + }
48 63 }
platform-dal/src/main/java/com/lyms/platform/pojo/CommunityConfig.java View file @ 4a6ae2a
... ... @@ -11,6 +11,16 @@
11 11 private String parentId;
12 12 private Integer yn;
13 13  
  14 + private CommunityConfig parent;
  15 +
  16 + public CommunityConfig getParent() {
  17 + return parent;
  18 + }
  19 +
  20 + public void setParent(CommunityConfig parent) {
  21 + this.parent = parent;
  22 + }
  23 +
14 24 public CommunityConfig(String parentId, String tmp) {
15 25 this.parentId = parentId;
16 26 this.yn = YnEnums.YES.getId();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java View file @ 4a6ae2a
... ... @@ -74,10 +74,20 @@
74 74 @ResponseBody
75 75 public BaseListResponse queryArea(String keyword ) {
76 76 List<CommunityConfig> communityConfigList = communityConfigService.queryArea(keyword);
  77 +
  78 + for(CommunityConfig communityConfig : communityConfigList) {
  79 + if(null != communityConfig.getParentId()) {
  80 + communityConfig.setParent(communityConfigService.queryAreaById(communityConfig.getParentId()));
  81 + } else {
  82 + communityConfig.setParent(new CommunityConfig("0", "root"));
  83 + }
  84 + }
  85 +
77 86 return new BaseListResponse().setData(communityConfigList)
78 87 .setErrorcode(ErrorCodeConstants.SUCCESS)
79 88 .setErrormsg("查询成功!");
80 89 }
  90 +
81 91  
82 92 //
83 93 @RequestMapping(value = "communityConfigTest", method = RequestMethod.GET)
platform-operate-api/src/main/resources/database.properties View file @ 4a6ae2a
... ... @@ -2,7 +2,7 @@
2 2 #mongo.db.port=27017
3 3 #mongo.db.dbname=platform
4 4  
5   -mongo.db.host=localhost
  5 +mongo.db.host=192.168.5.223
6 6 mongo.db.port=27017
7 7 mongo.db.dbname=platform
8 8 mongo.db.username=root