Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
backend-java
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
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
other-project
backend-java
Commits
01a7f2ce
Commit
01a7f2ce
authored
Feb 05, 2020
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改用户修改保存BUG
parent
2be39ea2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
SysUserController.java
...java/com/qkdata/biz/sys/controller/SysUserController.java
+1
-1
SysUserService.java
src/main/java/com/qkdata/biz/sys/service/SysUserService.java
+19
-0
SysUserMapper.xml
src/main/resources/mappers/SysUserMapper.xml
+1
-1
No files found.
src/main/java/com/qkdata/biz/sys/controller/SysUserController.java
View file @
01a7f2ce
...
@@ -61,7 +61,7 @@ public class SysUserController {
...
@@ -61,7 +61,7 @@ public class SysUserController {
@RequiresPermissions
(
"sys:user:update"
)
@RequiresPermissions
(
"sys:user:update"
)
@ResponseStatus
(
HttpStatus
.
NO_CONTENT
)
@ResponseStatus
(
HttpStatus
.
NO_CONTENT
)
public
void
update
(
@RequestBody
@Validated
(
UpdateGroup
.
class
)
SysUserModel
sysUserModel
){
public
void
update
(
@RequestBody
@Validated
(
UpdateGroup
.
class
)
SysUserModel
sysUserModel
){
sysUserService
.
updateUser
(
sysUserModel
);
}
}
/**
/**
...
...
src/main/java/com/qkdata/biz/sys/service/SysUserService.java
View file @
01a7f2ce
...
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
tk.mybatis.mapper.common.Mapper
;
import
tk.mybatis.mapper.common.Mapper
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.util.Sqls
;
import
tk.mybatis.mapper.util.Sqls
;
...
@@ -88,4 +89,22 @@ public class SysUserService extends BaseServiceImpl<SysUserPO,Long> {
...
@@ -88,4 +89,22 @@ public class SysUserService extends BaseServiceImpl<SysUserPO,Long> {
sysUserMapper
.
deleteByIds
(
ids
);
sysUserMapper
.
deleteByIds
(
ids
);
sysUserRoleService
.
deleteByUserIds
(
ids
);
sysUserRoleService
.
deleteByUserIds
(
ids
);
}
}
@Transactional
public
void
updateUser
(
SysUserModel
sysUserModel
)
{
SysUserPO
po
=
getById
(
sysUserModel
.
getId
());
if
(
po
==
null
){
throw
new
BusinessException
(
"请求错误,用户不存在"
);
}
po
.
setUsername
(
sysUserModel
.
getUsername
());
if
(!
StringUtils
.
isEmpty
(
sysUserModel
.
getPassword
())){
po
.
setPassword
(
new
Sha256Hash
(
sysUserModel
.
getPassword
(),
po
.
getSalt
()).
toHex
());
}
po
.
setEmail
(
sysUserModel
.
getEmail
());
po
.
setMobile
(
sysUserModel
.
getMobile
());
po
.
setStatus
(
sysUserModel
.
getStatus
());
updateById
(
po
);
sysUserRoleService
.
saveOrUpdate
(
po
.
getId
(),
sysUserModel
.
getRoleIdList
());
}
}
}
src/main/resources/mappers/SysUserMapper.xml
View file @
01a7f2ce
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
where ur.user_id = #{userId}
where ur.user_id = #{userId}
</select>
</select>
<select
id=
"selectByCondition"
resultType=
"com.qkdata.biz.sys.model.SysUserDTO"
parameterType=
"com.qkdata.biz.sys.model.QueryUserModel"
>
<select
id=
"selectByCondition"
resultType=
"com.qkdata.biz.sys.model.SysUserDTO"
parameterType=
"com.qkdata.biz.sys.model.QueryUserModel"
>
select id,username,email,mobile
select id,username,email,mobile
,status
from sys_user
from sys_user
where 1=1
where 1=1
<if
test=
"username != null and username != ''"
>
<if
test=
"username != null and username != ''"
>
...
...
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