Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 90b23a3c
authored
Oct 08, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:用户禁用,新增,修改,删除优化
1 parent
35f0d99d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
project-interface/src/main/java/com/dituhui/pea/user/IUser.java
project-user/src/main/java/com/dituhui/pea/user/controller/UserController.java
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
project-interface/src/main/java/com/dituhui/pea/user/IUser.java
View file @
90b23a3
...
...
@@ -122,7 +122,7 @@ public interface IUser {
* @return
*/
@RequestMapping
(
value
=
"/pea-user/delete"
,
method
=
RequestMethod
.
POST
)
Result
<
Boolean
>
deleteUser
(
@Request
Param
(
"id"
)
String
userId
);
Result
<
Boolean
>
deleteUser
(
@Request
Body
UserInfoSearch
search
);
/**
* 注册用户
...
...
@@ -159,7 +159,7 @@ public interface IUser {
* @param search 查询条件
* @return
*/
@RequestMapping
(
value
=
"/pea-user/ban"
,
method
=
RequestMethod
.
GE
T
)
Result
<
Boolean
>
ban
(
UserInfoSearch
search
);
@RequestMapping
(
value
=
"/pea-user/ban"
,
method
=
RequestMethod
.
POS
T
)
Result
<
Boolean
>
ban
(
@RequestBody
UserInfoSearch
search
);
}
project-user/src/main/java/com/dituhui/pea/user/controller/UserController.java
View file @
90b23a3
...
...
@@ -109,7 +109,8 @@ public class UserController implements IUser {
}
@Override
public
Result
<
Boolean
>
deleteUser
(
String
userId
)
{
public
Result
<
Boolean
>
deleteUser
(
UserInfoSearch
search
)
{
String
userId
=
search
.
getId
();
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
StatusCodeEnum
.
COMMON_PARAM_EMPTY
,
null
);
}
...
...
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
View file @
90b23a3
...
...
@@ -17,12 +17,11 @@ import com.dituhui.pea.user.dao.*;
import
com.dituhui.pea.user.entity.*
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.hibernate.query.internal.NativeQueryImpl
;
import
org.hibernate.transform.Transformers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -296,6 +295,7 @@ public class UserService {
userEntity
.
setPassword
(
SecureUtil
.
md5
(
userInfo
.
getPassword
()));
// 保存用户信息
userEntity
=
userDao
.
save
(
userEntity
);
userInfo
.
setId
(
userEntity
.
getId
());
savaUserRoleAndOrgInfo
(
userInfo
);
UserInfo
info
=
BeanUtil
.
copyProperties
(
userEntity
,
UserInfo
.
class
);
info
.
setPassword
(
null
);
...
...
@@ -469,11 +469,17 @@ public class UserService {
userRoleDao
.
save
(
userRoleEntity
);
}
}
if
(
MapUtils
.
isNotEmpty
(
userRoleMap
))
{
for
(
String
roleId
:
userRoleMap
.
keySet
())
{
UserRoleEntity
userRoleEntity
=
userRoleMap
.
get
(
roleId
);
userRoleDao
.
deleteById
(
userRoleEntity
.
getId
());
}
}
}
//处理用户机构关联信息
if
(
CollectionUtils
.
isNotEmpty
(
userInfo
.
getOrgIds
())
&&
null
!=
userInfo
.
getOrgIds
())
{
for
(
Integer
orgId
:
userInfo
.
getOrgIds
())
{
userOrgDao
.
deleteByUserId
(
userInfo
.
getId
());
for
(
Integer
orgId
:
userInfo
.
getOrgIds
())
{
UserOrgEntity
userOrgEntity
=
new
UserOrgEntity
();
userOrgEntity
.
setUserId
(
userInfo
.
getId
());
userOrgEntity
.
setOrgId
(
orgId
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment