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
1c2850f3
Commit
1c2850f3
authored
Jul 31, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/base-modify' into base-modify
parents
7bbb7553
4abb6c63
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
35 deletions
+40
-35
UserBiz.java
...n/java/com/github/wxiaoqi/security/admin/biz/UserBiz.java
+1
-0
UserController.java
...om/github/wxiaoqi/security/admin/rest/UserController.java
+39
-35
No files found.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/UserBiz.java
View file @
1c2850f3
...
...
@@ -48,6 +48,7 @@ public class UserBiz extends BaseBiz<UserMapper,User> {
@Override
@CacheClear
(
pre
=
"user{1.username}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateSelectiveById
(
User
entity
)
{
User
user1
=
super
.
selectById
(
entity
.
getId
());
if
(
user1
!=
null
&&
StringUtils
.
isNotBlank
(
entity
.
getPassword
())&&!
user1
.
getPassword
().
equals
(
entity
.
getPassword
())){
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/UserController.java
View file @
1c2850f3
...
...
@@ -22,13 +22,12 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
com.github.wxiaoqi.security.common.context.BaseContextHandler
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
github
.
wxiaoqi
.
security
.
auth
.
common
.
constatns
.
CommonConstants
.
DATA_ALL_TRUE
;
import
static
com
.
github
.
wxiaoqi
.
security
.
auth
.
common
.
constatns
.
CommonConstants
.
DATA_ALL_FALSE
;
/**
* ${DESCRIPTION}
*
...
...
@@ -66,16 +65,17 @@ public class UserController extends CommonBaseController {
@Data
public
static
class
UserVO
extends
User
{
List
<
Integer
>
dataLimit
;
// List<Integer> dataLimit;
Integer
dataLimit
;
List
<
Integer
>
members
;
}
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
@IgnoreClientToken
public
ObjectRestResponse
<
User
>
add
(
@RequestBody
UserVO
vo
){
public
ObjectRestResponse
<
User
>
add
(
@RequestBody
UserVO
vo
)
{
handleDataLimit
(
vo
);
String
username
=
vo
.
getUsername
();
if
(
StringUtils
.
isNotBlank
(
username
))
{
String
username
=
vo
.
getUsername
();
if
(
StringUtils
.
isNotBlank
(
username
))
{
List
<
User
>
list
=
userBiz
.
getCountByUsername
(
username
);
if
(
list
.
size
()
>
0
)
{
throw
new
RuntimeException
(
"用户名不能重复"
);
...
...
@@ -88,15 +88,18 @@ public class UserController extends CommonBaseController {
}
private
void
handleDataLimit
(
@RequestBody
UserVO
dto
)
{
if
(
null
!=
dto
.
getDataLimit
())
{
if
(
dto
.
getDataLimit
().
contains
(
CURRENT_COMPANY
)&&
dto
.
getCompanyId
()!=
null
)
{
if
(
null
!=
dto
.
getDataLimit
())
{
dto
.
setDataCompany
(
""
);
dto
.
setDataAll
(
DATA_ALL_FALSE
);
dto
.
setDataZone
(
""
);
if
(
dto
.
getDataLimit
()>=
CURRENT_COMPANY
&&
dto
.
getCompanyId
()
!=
null
)
{
dto
.
setDataCompany
(
dto
.
getCompanyId
().
toString
());
}
if
(
dto
.
getDataLimit
().
contains
(
CURRENT_ZONE
)&&
dto
.
getZoneId
()!=
null
)
{
}
if
(
dto
.
getDataLimit
()>=
CURRENT_ZONE
&&
dto
.
getZoneId
()
!=
null
)
{
dto
.
setDataZone
(
dto
.
getZoneId
().
toString
());
}
if
(
dto
.
getDataLimit
().
contains
(
DATA_ALL
)
)
{
if
(
dto
.
getDataLimit
()>=
DATA_ALL
)
{
dto
.
setDataAll
(
DATA_ALL_TRUE
);
}
}
...
...
@@ -140,34 +143,34 @@ public class UserController extends CommonBaseController {
}
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ObjectRestResponse
<
User
>
get
(
@PathVariable
int
id
){
public
ObjectRestResponse
<
User
>
get
(
@PathVariable
int
id
)
{
ObjectRestResponse
<
User
>
entityObjectRestResponse
=
new
ObjectRestResponse
<>();
User
o
=
userBiz
.
selectById
(
id
);
entityObjectRestResponse
.
data
(
o
);
return
entityObjectRestResponse
;
}
@RequestMapping
(
value
=
"/{id}/group"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}/group"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ObjectRestResponse
<
GroupUsers
>
getGroup
(
@PathVariable
int
id
){
public
ObjectRestResponse
<
GroupUsers
>
getGroup
(
@PathVariable
int
id
)
{
return
new
ObjectRestResponse
<
GroupUsers
>().
rel
(
true
).
data
(
groupBiz
.
getUserGroups
(
id
));
}
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
public
ObjectRestResponse
<
User
>
update
(
@RequestBody
UserVO
vo
){
public
ObjectRestResponse
<
User
>
update
(
@RequestBody
UserVO
vo
)
{
handleDataLimit
(
vo
);
String
username
=
vo
.
getUsername
();
if
(
StringUtils
.
isNotBlank
(
username
))
{
List
<
User
>
list
=
userBiz
.
getCountByUsername
(
username
);
if
(
list
.
size
()>
1
)
{
String
username
=
vo
.
getUsername
();
if
(
StringUtils
.
isNotBlank
(
username
))
{
List
<
User
>
list
=
userBiz
.
getCountByUsername
(
username
);
if
(
list
.
size
()
>
1
)
{
throw
new
RuntimeException
(
"用户名不能重复"
);
}
if
(
list
.
size
()==
1
)
{
User
user
=
list
.
get
(
0
);
if
(!
user
.
getId
().
equals
(
vo
.
getId
()))
{
if
(
list
.
size
()
==
1
)
{
User
user
=
list
.
get
(
0
);
if
(!
user
.
getId
().
equals
(
vo
.
getId
()))
{
throw
new
RuntimeException
(
"用户名不能重复"
);
}
}
...
...
@@ -177,16 +180,17 @@ public class UserController extends CommonBaseController {
groupBiz
.
modifyUserGroups
(
vo
.
getId
(),
vo
.
getMembers
());
return
new
ObjectRestResponse
<
User
>();
}
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ResponseBody
public
ObjectRestResponse
<
User
>
remove
(
@PathVariable
int
id
){
public
ObjectRestResponse
<
User
>
remove
(
@PathVariable
int
id
)
{
userBiz
.
deleteById
(
id
);
return
new
ObjectRestResponse
<
User
>();
}
@RequestMapping
(
value
=
"/all"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/all"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
List
<
User
>
all
(){
public
List
<
User
>
all
()
{
return
userBiz
.
selectListAll
();
}
}
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