From 7f395f4ae67b01d5df726db75b5a8acf6869b1a9 Mon Sep 17 00:00:00 2001 From: zhangzhiqiang Date: Wed, 30 Nov 2022 09:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=EF=BC=8C=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E5=8E=BBjpa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/modules/common/base/BaseEntity.java | 12 +++-- .../modules/common/utils/SecurityUtils.java | 2 +- .../modules/common/utils/dto/CurrentUser.java | 3 +- .../rest/AuthorizationController.java | 4 +- .../org/nl/modules/system/domain/Dept.java | 30 +---------- .../org/nl/modules/system/domain/Param.java | 18 ------- .../org/nl/modules/system/domain/User.java | 52 ++++--------------- .../modules/system/rest/DeptController.java | 2 +- .../modules/system/rest/UserController.java | 24 ++++----- .../modules/system/service/DataService.java | 3 +- .../modules/system/service/dto/UserDto.java | 2 +- .../system/service/dto/UserQueryCriteria.java | 8 +-- .../system/service/impl/DataServiceImpl.java | 9 ++-- .../system/service/impl/DeptServiceImpl.java | 22 ++++---- .../system/service/impl/MenuServiceImpl.java | 2 +- .../system/service/impl/ParamServiceImpl.java | 4 +- .../system/service/impl/RoleServiceImpl.java | 2 +- 17 files changed, 65 insertions(+), 134 deletions(-) diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/base/BaseEntity.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/base/BaseEntity.java index 582cb1a..98803eb 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/base/BaseEntity.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/base/BaseEntity.java @@ -44,22 +44,26 @@ public class BaseEntity implements Serializable { @CreatedBy @Column(name = "create_by", updatable = false) @ApiModelProperty(value = "创建人", hidden = true) - private String createBy; + private String create_name; + + private Long create_id; @LastModifiedBy @Column(name = "update_by") @ApiModelProperty(value = "更新人", hidden = true) - private String updatedBy; + private String update_optname; + + private Long update_optid; @CreationTimestamp @Column(name = "create_time", updatable = false) @ApiModelProperty(value = "创建时间", hidden = true) - private Timestamp createTime; + private Timestamp create_time; @UpdateTimestamp @Column(name = "update_time") @ApiModelProperty(value = "更新时间", hidden = true) - private Timestamp updateTime; + private Timestamp update_time; /* 分组校验 */ public @interface Create {} diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/utils/SecurityUtils.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/utils/SecurityUtils.java index 9bc4ea2..3601c80 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/utils/SecurityUtils.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/utils/SecurityUtils.java @@ -50,7 +50,7 @@ public class SecurityUtils { * @return 系统用户名称 */ public static String getCurrentNickName() { - return getCurrentUser().getNickName(); + return getCurrentUser().getPreson_name(); } /** diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/utils/dto/CurrentUser.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/utils/dto/CurrentUser.java index bbf7bdf..f490abc 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/utils/dto/CurrentUser.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/common/utils/dto/CurrentUser.java @@ -3,6 +3,7 @@ package org.nl.modules.common.utils.dto; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; +import org.nl.modules.system.domain.User; import org.nl.modules.system.service.dto.UserDto; import java.io.Serializable; @@ -22,7 +23,7 @@ public class CurrentUser implements Serializable { //账号 private String username; //姓名 - private String nickName; + private String preson_name; //用户详细信息 private UserDto user; diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/security/rest/AuthorizationController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/security/rest/AuthorizationController.java index f2c3199..b70bcd0 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/security/rest/AuthorizationController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/security/rest/AuthorizationController.java @@ -22,6 +22,7 @@ import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Lists; import com.wf.captcha.base.Captcha; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -48,6 +49,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -110,7 +112,7 @@ public class AuthorizationController { CurrentUser user = new CurrentUser(); user.setId(userInfo.getLong("user_id")); user.setUsername(userInfo.getString("username")); - user.setNickName(userInfo.getString("person_name")); + user.setPermissions(Lists.newArrayList(userInfo.getString("person_name"))); user.setUser(this.getById(userInfo.getLong("user_id"))); user.setPermissions(permissionList); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/Dept.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/Dept.java index 9a68cb5..3869333 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/Dept.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/Dept.java @@ -32,23 +32,12 @@ import java.util.Set; * @author Zheng Jie * @date 2019-03-25 */ -@Entity @Getter @Setter -@Table(name="sys_dept") public class Dept extends BaseEntity implements Serializable { - @Id - @Column(name = "dept_id") - @NotNull(groups = Update.class) - @ApiModelProperty(value = "ID", hidden = true) - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; + private Long dept_id; - @JsonIgnore - @ManyToMany(mappedBy = "depts") - @ApiModelProperty(value = "角色") - private Set roles; @ApiModelProperty(value = "排序") private Integer deptSort; @@ -67,21 +56,4 @@ public class Dept extends BaseEntity implements Serializable { @ApiModelProperty(value = "子节点数目", hidden = true) private Integer subCount = 0; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Dept dept = (Dept) o; - return Objects.equals(id, dept.id) && - Objects.equals(name, dept.name); - } - - @Override - public int hashCode() { - return Objects.hash(id, name); - } } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/Param.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/Param.java index 39d79b8..b40e2fa 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/Param.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/Param.java @@ -57,24 +57,6 @@ public class Param extends BaseEntity implements Serializable { @ApiModelProperty(value = "is_delete") private String is_delete; - @Column(name = "create_by",nullable = false,updatable = false,insertable = false) - @NotBlank - @ApiModelProperty(value = "create_by") - private String create_by; - - @Column(name = "create_time",nullable = false,updatable = false,insertable = false) - @NotBlank - @ApiModelProperty(value = "create_time") - private String create_time; - - @Column(name = "update_by",updatable = false,insertable = false) - @ApiModelProperty(value = "update_by") - private String update_by; - - @Column(name = "update_time",updatable = false,insertable = false) - @ApiModelProperty(value = "update_time") - private String update_time; - public void copy(Param source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/User.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/User.java index b7d8d07..6d7fb45 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/User.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/domain/User.java @@ -34,40 +34,23 @@ import java.util.Set; * @author Zheng Jie * @date 2018-11-22 */ -@Entity @Getter @Setter -@Table(name="sys_user") public class User extends BaseEntity implements Serializable { - @Id - @Column(name = "user_id") - @NotNull(groups = Update.class) - @GeneratedValue(strategy = GenerationType.IDENTITY) - @ApiModelProperty(value = "ID", hidden = true) - private Long id; - @ManyToMany - @ApiModelProperty(value = "用户角色") - @JoinTable(name = "sys_users_roles", - joinColumns = {@JoinColumn(name = "user_id",referencedColumnName = "user_id")}, - inverseJoinColumns = {@JoinColumn(name = "role_id",referencedColumnName = "role_id")}) - private Set roles; + private Long user_id; + + private String roles; + + private String depts; + - @OneToOne - @JoinColumn(name = "dept_id") - @ApiModelProperty(value = "用户部门") - @NotFound(action= NotFoundAction.IGNORE) - private Dept dept; - @NotBlank - @Column(unique = true) - @ApiModelProperty(value = "用户名称") private String username; - @NotBlank - @ApiModelProperty(value = "用户昵称") - private String nickName; + + private String person_name; @ApiModelProperty(value = "邮箱") private String email; @@ -89,7 +72,7 @@ public class User extends BaseEntity implements Serializable { @NotNull @ApiModelProperty(value = "是否启用") - private Boolean enabled; + private Boolean is_used; @ApiModelProperty(value = "是否为admin账号", hidden = true) private Boolean isAdmin = false; @@ -98,21 +81,4 @@ public class User extends BaseEntity implements Serializable { @ApiModelProperty(value = "最后修改密码的时间", hidden = true) private Date pwdResetTime; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(id, user.id) && - Objects.equals(username, user.username); - } - - @Override - public int hashCode() { - return Objects.hash(id, username); - } } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/DeptController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/DeptController.java index b9d9cac..f6ce520 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/DeptController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/DeptController.java @@ -74,7 +74,7 @@ public class DeptController { @PostMapping @SaCheckPermission("dept:add") public ResponseEntity create(@Validated @RequestBody Dept resources){ - if (resources.getId() != null) { + if (resources.getDept_id() != null) { throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); } deptService.create(resources); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/UserController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/UserController.java index 672e2ef..ada7d82 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/UserController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/rest/UserController.java @@ -134,7 +134,7 @@ public class UserController { @ApiOperation("修改用户:个人中心") @PutMapping(value = "center") public ResponseEntity center(@Validated(User.Update.class) @RequestBody User resources){ - if(!resources.getId().equals(StpUtil.getLoginIdAsLong())){ + if(!resources.getUser_id().equals(StpUtil.getLoginIdAsLong())){ throw new BadRequestException("不能修改他人资料"); } userService.updateCenter(resources); @@ -153,10 +153,10 @@ public class UserController { throw new BadRequestException("角色权限不足,不能删除:" + userService.findById(id).getUsername()); } // 删除缓存信息 - UserDto userDto = userService.findById(id); - redisUtils.del("data::user:" + userDto.getId()); - redisUtils.del("menu::user:" + userDto.getId()); - redisUtils.del("role::auth:" + userDto.getId()); + User userDto = userService.findById(id); + redisUtils.del("data::user:" + userDto.getUser_id()); + redisUtils.del("menu::user:" + userDto.getUser_id()); + redisUtils.del("role::auth:" + userDto.getUser_id()); redisUtils.del("user::username:" + userDto.getUsername()); } userService.delete(ids); @@ -169,7 +169,7 @@ public class UserController { // 解密,得到字符密码 String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getOldPass()); String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getNewPass()); - UserDto user = userService.findByName(SecurityUtils.getCurrentUsername()); + User user = userService.findByName(SecurityUtils.getCurrentUsername()); if (!SaSecureUtil.md5BySalt(user.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(oldPass, "salt"))) { throw new BadRequestException("修改失败,旧密码错误"); } @@ -191,7 +191,7 @@ public class UserController { @PostMapping(value = "/updateEmail/{code}") public ResponseEntity updateEmail(@PathVariable String code,@RequestBody User user) throws Exception { String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,user.getPassword()); - UserDto userDto = userService.findByName(SecurityUtils.getCurrentUsername()); + User userDto = userService.findByName(SecurityUtils.getCurrentUsername()); if(!SaSecureUtil.md5BySalt(user.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(password, "salt"))){ throw new BadRequestException("密码错误"); } @@ -204,10 +204,10 @@ public class UserController { * @param resources / */ private void checkLevel(User resources) { - Integer currentLevel = Collections.min(roleService.findByUsersId(StpUtil.getLoginIdAsLong()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList())); - Integer optLevel = roleService.findByRoles(resources.getRoles()); - if (currentLevel > optLevel) { - throw new BadRequestException("角色权限不足"); - } +// Integer currentLevel = Collections.min(roleService.findByUsersId(StpUtil.getLoginIdAsLong()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList())); +// Integer optLevel = roleService.findByRoles(resources.getRoles()); +// if (currentLevel > optLevel) { +// throw new BadRequestException("角色权限不足"); +// } } } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/DataService.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/DataService.java index e3ab727..568b642 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/DataService.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/DataService.java @@ -15,6 +15,7 @@ */ package org.nl.modules.system.service; +import org.nl.modules.system.domain.User; import org.nl.modules.system.service.dto.UserDto; import java.util.List; @@ -31,5 +32,5 @@ public interface DataService { * @param user / * @return / */ - List getDeptIds(UserDto user); + List getDeptIds(User user); } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserDto.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserDto.java index c348c98..7079dab 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserDto.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserDto.java @@ -36,7 +36,7 @@ public class UserDto extends BaseDTO implements Serializable { @JsonSerialize(using = ToStringSerializer.class) private Long id; - private Set roles; +// private Set roles; private String username; diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserQueryCriteria.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserQueryCriteria.java index 70d81bc..738c57c 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserQueryCriteria.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/dto/UserQueryCriteria.java @@ -20,6 +20,7 @@ import org.nl.modules.common.annotation.Query; import java.io.Serializable; import java.sql.Timestamp; +import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -41,10 +42,11 @@ public class UserQueryCriteria implements Serializable { private String blurry; @Query - private Boolean enabled; + private Boolean is_used; private Long deptId; - @Query(type = Query.Type.BETWEEN) - private List createTime; + private Date startTime; + + private Date endTime; } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DataServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DataServiceImpl.java index e5be390..d5a91fd 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DataServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DataServiceImpl.java @@ -19,6 +19,7 @@ import cn.hutool.core.util.ObjectUtil; import lombok.RequiredArgsConstructor; import org.nl.modules.common.utils.enums.DataScopeEnum; import org.nl.modules.system.domain.Dept; +import org.nl.modules.system.domain.User; import org.nl.modules.system.service.DataService; import org.nl.modules.system.service.DeptService; import org.nl.modules.system.service.RoleService; @@ -51,11 +52,11 @@ public class DataServiceImpl implements DataService { */ @Override @Cacheable(key = "'user:' + #p0.id") - public List getDeptIds(UserDto user) { + public List getDeptIds(User user) { // 用于存储部门id Set deptIds = new HashSet<>(); // 查询用户角色 - List roleSet = roleService.findByUsersId(user.getId()); + List roleSet = roleService.findByUsersId(user.getUser_id()); // 获取对应的部门ID for (RoleSmallDto role : roleSet) { DataScopeEnum dataScopeEnum = DataScopeEnum.find(role.getDataScope()); @@ -84,8 +85,8 @@ public class DataServiceImpl implements DataService { public Set getCustomize(Set deptIds, RoleSmallDto role){ Set depts = deptService.findByRoleId(role.getId()); for (Dept dept : depts) { - deptIds.add(dept.getId()); - List deptChildren = deptService.findByPid(dept.getId()); + deptIds.add(dept.getDept_id()); + List deptChildren = deptService.findByPid(dept.getPid()); if (deptChildren != null && deptChildren.size() != 0) { deptIds.addAll(deptService.getDeptChildren(deptChildren)); } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DeptServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DeptServiceImpl.java index 553f9e5..ca94ce9 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DeptServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/DeptServiceImpl.java @@ -103,7 +103,7 @@ public class DeptServiceImpl implements DeptService { @Cacheable(key = "'id:' + #p0") public DeptDto findById(Long id) { Dept dept = deptRepository.findById(id).orElseGet(Dept::new); - ValidationUtil.isNull(dept.getId(), "Dept", "id", id); + ValidationUtil.isNull(dept.getDept_id(), "Dept", "id", id); return deptMapper.toDto(dept); } @@ -131,20 +131,20 @@ public class DeptServiceImpl implements DeptService { @Transactional(rollbackFor = Exception.class) public void update(Dept resources) { // 旧的部门 - Long oldPid = findById(resources.getId()).getPid(); + Long oldPid = findById(resources.getDept_id()).getPid(); Long newPid = resources.getPid(); - if (resources.getPid() != null && resources.getId().equals(resources.getPid())) { + if (resources.getPid() != null && resources.getDept_id().equals(resources.getPid())) { throw new BadRequestException("上级不能为自己"); } - Dept dept = deptRepository.findById(resources.getId()).orElseGet(Dept::new); - ValidationUtil.isNull(dept.getId(), "Dept", "id", resources.getId()); - resources.setId(dept.getId()); + Dept dept = deptRepository.findById(resources.getDept_id()).orElseGet(Dept::new); + ValidationUtil.isNull(dept.getDept_id(), "Dept", "id", resources.getDept_id()); + resources.setDept_id(dept.getDept_id()); deptRepository.save(resources); // 更新父节点中子节点数目 updateSubCnt(oldPid); updateSubCnt(newPid); // 清理缓存 - delCaches(resources.getId()); + delCaches(resources.getDept_id()); } @Override @@ -162,7 +162,7 @@ public class DeptServiceImpl implements DeptService { public Set getDeleteDepts(List menuList, Set deptDtos) { for (Dept dept : menuList) { deptDtos.add(deptMapper.toDto(dept)); - List depts = deptRepository.findByPid(dept.getId()); + List depts = deptRepository.findByPid(dept.getDept_id()); if (depts != null && depts.size() != 0) { getDeleteDepts(depts, deptDtos); } @@ -260,7 +260,7 @@ public class DeptServiceImpl implements DeptService { public void delCaches(Long id) { List users = userRepository.findByRoleDeptId(id); // 删除数据权限 - redisUtils.delByKeys(CacheKey.DATA_USER, users.stream().map(User::getId).collect(Collectors.toSet())); + redisUtils.delByKeys(CacheKey.DATA_USER, users.stream().map(User::getUser_id).collect(Collectors.toSet())); redisUtils.del(CacheKey.DEPT_ID + id); } @@ -269,11 +269,11 @@ public class DeptServiceImpl implements DeptService { List list = new ArrayList<>(); deptList.forEach(dept -> { if (dept != null && dept.getEnabled()) { - List depts = deptRepository.findByPid(dept.getId()); + List depts = deptRepository.findByPid(dept.getDept_id()); if (deptList.size() != 0) { list.addAll(getDeptChildren(depts)); } - list.add(dept.getId()); + list.add(dept.getDept_id()); } } ); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java index d0dfc37..caf907b 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/MenuServiceImpl.java @@ -353,7 +353,7 @@ public class MenuServiceImpl implements MenuService { public void delCaches(Long id) { List users = userRepository.findByMenuId(id); redisUtils.del("menu::id:" + id); - redisUtils.delByKeys("menu::user:", users.stream().map(User::getId).collect(Collectors.toSet())); + redisUtils.delByKeys("menu::user:", users.stream().map(User::getUser_id).collect(Collectors.toSet())); // 清除 Role 缓存 List roles = roleService.findInMenuId(new ArrayList() {{ add(id); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java index 78ec333..c0e892c 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java @@ -82,8 +82,8 @@ public class ParamServiceImpl implements ParamService { dto.setId(IdUtil.simpleUUID()); dto.setCreate_id(currentId); dto.setUpdate_optid(currentId); - dto.setCreate_name(currentUsername.getNickName()); - dto.setUpdate_optname(currentUsername.getNickName()); + dto.setCreate_name(currentUsername.getPreson_name()); + dto.setUpdate_optname(currentUsername.getPreson_name()); dto.setUpdate_time(now); dto.setCreate_time(now); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/RoleServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/RoleServiceImpl.java index f3488cb..f7961c1 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/RoleServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/modules/system/service/impl/RoleServiceImpl.java @@ -226,7 +226,7 @@ public class RoleServiceImpl implements RoleService { users = CollectionUtil.isEmpty(users) ? userRepository.findByRoleId(id) : users; if (CollectionUtil.isNotEmpty(users)) { // users.forEach(item -> userCacheClean.cleanUserCache(item.getUsername())); - Set userIds = users.stream().map(User::getId).collect(Collectors.toSet()); + Set userIds = users.stream().map(User::getUser_id).collect(Collectors.toSet()); redisUtils.delByKeys(CacheKey.DATA_USER, userIds); redisUtils.delByKeys(CacheKey.MENU_USER, userIds); redisUtils.delByKeys(CacheKey.ROLE_AUTH, userIds);