Commit cc2921e1afdf95a0bc73b27d8e0a1502756ca099
1 parent
ca5582049c
Exists in
master
and in
8 other branches
platform permission
add return pageinfo
Showing 5 changed files with 96 additions and 18 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/Organization.java
- platform-common/src/main/java/com/lyms/platform/common/enums/OrganizationLevelEnum.java
- platform-common/src/main/java/com/lyms/platform/common/enums/OrganizationTypeEnum.java
- platform-common/src/main/java/com/lyms/platform/common/result/IdTextModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Organization.java
View file @
cc2921e
1 | 1 | package com.lyms.platform.permission.model; |
2 | 2 | |
3 | +import com.lyms.platform.common.result.IdTextModel; | |
4 | + | |
3 | 5 | import java.util.Date; |
4 | 6 | |
5 | 7 | public class Organization { |
6 | 8 | |
7 | 9 | |
8 | 10 | |
9 | 11 | |
10 | 12 | |
11 | 13 | |
... | ... | @@ -20,28 +22,57 @@ |
20 | 22 | private Date created; |
21 | 23 | private String shortCode; |
22 | 24 | |
23 | - private String levelStr; | |
24 | - private String typeStr; | |
25 | + private IdTextModel levelObj; | |
26 | + private IdTextModel typeObj; | |
27 | + private Regions province; | |
28 | + private Regions city; | |
29 | + private Regions area; | |
25 | 30 | |
26 | - public String getShortCode() { | |
27 | - return shortCode; | |
31 | + public Regions getProvince() { | |
32 | + return province; | |
28 | 33 | } |
29 | 34 | |
30 | - public String getLevelStr() { | |
31 | - return levelStr; | |
35 | + public void setProvince(Regions province) { | |
36 | + this.province = province; | |
32 | 37 | } |
33 | 38 | |
34 | - public void setLevelStr(String levelStr) { | |
35 | - this.levelStr = levelStr; | |
39 | + public Regions getCity() { | |
40 | + return city; | |
36 | 41 | } |
37 | 42 | |
38 | - public String getTypeStr() { | |
39 | - return typeStr; | |
43 | + public void setCity(Regions city) { | |
44 | + this.city = city; | |
40 | 45 | } |
41 | 46 | |
42 | - public void setTypeStr(String typeStr) { | |
43 | - this.typeStr = typeStr; | |
47 | + public Regions getArea() { | |
48 | + return area; | |
44 | 49 | } |
50 | + | |
51 | + public void setArea(Regions area) { | |
52 | + this.area = area; | |
53 | + } | |
54 | + | |
55 | + public IdTextModel getLevelObj() { | |
56 | + return levelObj; | |
57 | + } | |
58 | + | |
59 | + public void setLevelObj(IdTextModel levelObj) { | |
60 | + this.levelObj = levelObj; | |
61 | + } | |
62 | + | |
63 | + public IdTextModel getTypeObj() { | |
64 | + return typeObj; | |
65 | + } | |
66 | + | |
67 | + public void setTypeObj(IdTextModel typeObj) { | |
68 | + this.typeObj = typeObj; | |
69 | + } | |
70 | + | |
71 | + public String getShortCode() { | |
72 | + return shortCode; | |
73 | + } | |
74 | + | |
75 | + | |
45 | 76 | |
46 | 77 | public void setShortCode(String shortCode) { |
47 | 78 | this.shortCode = shortCode; |
platform-common/src/main/java/com/lyms/platform/common/enums/OrganizationLevelEnum.java
View file @
cc2921e
1 | 1 | package com.lyms.platform.common.enums; |
2 | 2 | |
3 | +import com.lyms.platform.common.result.IdTextModel; | |
4 | + | |
3 | 5 | import java.util.HashMap; |
4 | 6 | |
5 | 7 | /** |
6 | 8 | |
... | ... | @@ -36,10 +38,10 @@ |
36 | 38 | this.text = text; |
37 | 39 | } |
38 | 40 | |
39 | - public static String getById(int id) { | |
41 | + public static IdTextModel getById(int id) { | |
40 | 42 | for (OrganizationLevelEnum e : OrganizationLevelEnum.values()) { |
41 | 43 | if(e.getId().equals(id)) { |
42 | - return e.getText(); | |
44 | + return new IdTextModel(e.getId().toString(), e.getText()); | |
43 | 45 | } |
44 | 46 | } |
45 | 47 | return null; |
platform-common/src/main/java/com/lyms/platform/common/enums/OrganizationTypeEnum.java
View file @
cc2921e
1 | 1 | package com.lyms.platform.common.enums; |
2 | 2 | |
3 | +import com.lyms.platform.common.result.IdTextModel; | |
4 | + | |
3 | 5 | /** |
4 | 6 | * ๆบๆ็ฑปๅ |
5 | 7 | * Created by Zhang.Rui on 2016/4/7. |
6 | 8 | |
... | ... | @@ -35,10 +37,10 @@ |
35 | 37 | this.text = text; |
36 | 38 | } |
37 | 39 | |
38 | - public static String getById(int id) { | |
40 | + public static IdTextModel getById(int id) { | |
39 | 41 | for (OrganizationTypeEnum e : OrganizationTypeEnum.values()) { |
40 | 42 | if(e.getId().equals(id)) { |
41 | - return e.getText(); | |
43 | + return new IdTextModel(e.getId().toString(), e.getText()); | |
42 | 44 | } |
43 | 45 | } |
44 | 46 | return null; |
platform-common/src/main/java/com/lyms/platform/common/result/IdTextModel.java
View file @
cc2921e
1 | +package com.lyms.platform.common.result; | |
2 | + | |
3 | +/** | |
4 | + * Created by Zhang.Rui on 2016/4/29. | |
5 | + */ | |
6 | +public class IdTextModel { | |
7 | + private String id; | |
8 | + private String text; | |
9 | + | |
10 | + public String getId() { | |
11 | + return id; | |
12 | + } | |
13 | + | |
14 | + public void setId(String id) { | |
15 | + this.id = id; | |
16 | + } | |
17 | + | |
18 | + public String getText() { | |
19 | + return text; | |
20 | + } | |
21 | + | |
22 | + public void setText(String text) { | |
23 | + this.text = text; | |
24 | + } | |
25 | + | |
26 | + public IdTextModel(String id, String text) { | |
27 | + this.id = id; | |
28 | + this.text = text; | |
29 | + } | |
30 | + | |
31 | + public IdTextModel() { | |
32 | + | |
33 | + } | |
34 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
View file @
cc2921e
... | ... | @@ -221,8 +221,17 @@ |
221 | 221 | List<Organization> organizations = organizationService.queryOrganization(organizationQuery); |
222 | 222 | |
223 | 223 | for(Organization organization : organizations) { |
224 | - organization.setTypeStr(OrganizationLevelEnum.getById(organization.getLevel())); | |
225 | - organization.setLevelStr(OrganizationTypeEnum.getById(organization.getType())); | |
224 | + organization.setTypeObj(OrganizationLevelEnum.getById(organization.getLevel())); | |
225 | + organization.setLevelObj(OrganizationTypeEnum.getById(organization.getType())); | |
226 | + if(null != organization.getProvinceId()) { | |
227 | + organization.setProvince(regionsService.getRegions(organization.getProvinceId())); | |
228 | + } | |
229 | + if(null != organization.getCityId()) { | |
230 | + organization.setCity(regionsService.getRegions(organization.getCityId())); | |
231 | + } | |
232 | + if(null != organization.getAreaId()) { | |
233 | + organization.setArea(regionsService.getRegions(organization.getAreaId())); | |
234 | + } | |
226 | 235 | } |
227 | 236 | |
228 | 237 | FrontEndResult frontEndResult = new FrontEndResult(); |