Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
c90fb460
Commit
c90fb460
authored
Sep 29, 2020
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台员工管理
parent
817681e1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
10 deletions
+33
-10
ChwUserController.java
...ub/wxiaoqi/security/admin/rest/chw/ChwUserController.java
+33
-10
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/chw/ChwUserController.java
View file @
c90fb460
...
...
@@ -146,40 +146,63 @@ public class ChwUserController extends CommonBaseController implements UserRestI
@RequestMapping
(
value
=
"/operate/{id}"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
public
ObjectRestResponse
<
User
>
update
(
@RequestBody
UserController
.
UserVO
vo
)
{
if
(!
edit
(
vo
,
BIZ_TYPE_OPERATE
)){
return
ObjectRestResponse
.
createFailedResult
(
ResCode
.
USER_IS_EXIST
.
getCode
(),
ResCode
.
USER_IS_EXIST
.
getDesc
());
}
return
new
ObjectRestResponse
<
User
>();
}
@RequestMapping
(
value
=
"/business/{id}"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
public
ObjectRestResponse
<
User
>
businessUpdate
(
@RequestBody
UserController
.
UserVO
vo
)
{
if
(!
edit
(
vo
,
BIZ_TYPE_BUSINESS
)){
return
ObjectRestResponse
.
createFailedResult
(
ResCode
.
USER_IS_EXIST
.
getCode
(),
ResCode
.
USER_IS_EXIST
.
getDesc
());
}
return
new
ObjectRestResponse
<
User
>();
}
private
boolean
edit
(
UserController
.
UserVO
vo
,
Integer
bizType
)
{
handleDataLimit
(
vo
);
String
username
=
vo
.
getUsername
();
if
(
StringUtils
.
isNotBlank
(
username
))
{
List
<
User
>
list
=
userBiz
.
getCountByUsername
(
username
);
if
(
list
.
size
()
>
1
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResCode
.
USER_IS_EXIST
.
getCode
(),
ResCode
.
USER_IS_EXIST
.
getDesc
())
;
return
false
;
}
if
(
list
.
size
()
==
1
)
{
User
user
=
list
.
get
(
0
);
if
(!
user
.
getId
().
equals
(
vo
.
getId
()))
{
return
ObjectRestResponse
.
createFailedResult
(
ResCode
.
USER_IS_EXIST
.
getCode
(),
ResCode
.
USER_IS_EXIST
.
getDesc
())
;
if
(!
user
.
getId
().
equals
(
vo
.
getId
())
&&
bizType
!=
user
.
getBizType
()
)
{
return
false
;
}
}
}
userBiz
.
updateSelectiveById
(
vo
);
//添加权限关系
groupBiz
.
modifyUserGroups
(
vo
.
getId
(),
vo
.
getMembers
());
return
new
ObjectRestResponse
<
User
>()
;
return
true
;
}
@RequestMapping
(
value
=
"/operate/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ResponseBody
public
ObjectRestResponse
<
User
>
remove
(
@PathVariable
int
id
)
{
userBiz
.
deleteById
(
id
);
return
new
ObjectRestResponse
<
User
>
();
del
(
id
,
BIZ_TYPE_OPERATE
);
return
new
ObjectRestResponse
();
}
@RequestMapping
(
value
=
"/business/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ResponseBody
public
ObjectRestResponse
businessRemove
(
@PathVariable
int
id
)
{
del
(
id
,
BIZ_TYPE_BUSINESS
);
return
new
ObjectRestResponse
();
}
private
void
del
(
int
id
,
Integer
bizType
)
{
User
user
=
userBiz
.
selectById
(
id
);
if
(
null
!=
user
&&
user
.
getBizType
()
==
bizType
)
{
del
(
new
User
(){{
setId
(
id
);
}});
return
new
ObjectRestResponse
<
User
>();
}
}
private
void
handleDataLimit
(
@RequestBody
UserController
.
UserVO
dto
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment