Commit 1e2aa2815c10cd8d27ff79c9f042ea87aecfa497
1 parent
e1a5bb8bed
Exists in
master
and in
1 other branch
platform permission
机构修改时 名称重复验证
Showing 2 changed files with 19 additions and 1 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
View file @
1e2aa28
... | ... | @@ -124,9 +124,20 @@ |
124 | 124 | //判断ID是否存在 |
125 | 125 | Organization organization = organizationService.getOrganization(id); |
126 | 126 | if (null == organization) { |
127 | - ResultUtils.buildParameterErrorResultAndWrite(response, "id不存在!"); | |
127 | + ResultUtils.buildParameterErrorResultAndWrite(response, "机构不存在!"); | |
128 | 128 | return; |
129 | 129 | } |
130 | + | |
131 | + if(!organization.getName().equals(name)) { | |
132 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
133 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
134 | + organizationQuery.setName(name); | |
135 | + if (0 < organizationService.queryOrganizationCount(organizationQuery)) { | |
136 | + ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.NAME_EXIST, "机构名称已存在!"); | |
137 | + return; | |
138 | + } | |
139 | + } | |
140 | + | |
130 | 141 | |
131 | 142 | organization.setName(name); |
132 | 143 | organization.setType(type); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
1e2aa28
... | ... | @@ -111,12 +111,19 @@ |
111 | 111 | @TokenRequired |
112 | 112 | @ResponseBody |
113 | 113 | public FrontEndResult getPermissions(HttpServletResponse response, |
114 | + HttpServletRequest request, | |
114 | 115 | @RequestParam(value = "keyword", required = false) String keyword, |
115 | 116 | @RequestParam(value = "rolesId", required = false) Integer rolesId, |
116 | 117 | @RequestParam(value = "page", required = false) Integer page, |
117 | 118 | @RequestParam(value = "limit", required = false) Integer limit, |
118 | 119 | @RequestParam(value = "orgId", required = false) Integer orgId, |
119 | 120 | @RequestParam(value = "deptId", required = false) Integer deptId) { |
121 | + LoginContext loginContext = (LoginContext) request.getAttribute("loginContext"); | |
122 | + Users u = usersService.getUsers(loginContext.getId()); | |
123 | + if(u.getType().equals(1)) { | |
124 | + orgId = u.getOrgId(); | |
125 | + } | |
126 | + | |
120 | 127 | |
121 | 128 | limit = limit == null ? 10 : limit; |
122 | 129 | page = page == null ? 1 : page; |