mirror of
https://github.com/suyiiyii/SIMS.git
synced 2025-06-02 00:16:11 +08:00
refactor(user): 更改用户组字段并更新关联代码
用户实体的group字段已被重命名为userGroup,以提高清晰度。此外,与用户组相关的逻辑已从UserService和UserController中更新,以适应这一变化。用户权限集合的处理逻辑也被移除。
This commit is contained in:
parent
645789254d
commit
e9bbc1e274
@ -78,7 +78,7 @@ public class UserController {
|
||||
user.setPassword(request.getPassword());
|
||||
user.setEmail(request.getEmail());
|
||||
user.setGrade(request.getGrade());
|
||||
user.setGroup(request.getGroup());
|
||||
user.setUserGroup(request.getGroup());
|
||||
userService.register(user);
|
||||
|
||||
return Result.success(CommonResponse.factory("注册成功"));
|
||||
|
@ -1,14 +1,11 @@
|
||||
package top.suyiiyii.sims.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.tangzc.mpe.autotable.annotation.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Author tortoise
|
||||
* @Date 2024/8/9 14:02
|
||||
@ -29,9 +26,5 @@ public class User {
|
||||
private String password;
|
||||
private String email;
|
||||
private String grade;
|
||||
private String group;
|
||||
@TableField(exist = false)
|
||||
private String token;
|
||||
@TableField(exist = false)
|
||||
private Set<Permissions> permissions;
|
||||
private String userGroup;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package top.suyiiyii.sims.service;
|
||||
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -74,7 +73,6 @@ public class UserService {
|
||||
permissionsSet.add(permissions);
|
||||
}
|
||||
}
|
||||
dbUser.setPermissions(permissionsSet);
|
||||
|
||||
String token = JwtUtils.createToken(dbUser.getId().toString(), dbUser.getPassword());
|
||||
|
||||
@ -103,7 +101,7 @@ public class UserService {
|
||||
if (user.getEmail() == null || user.getEmail().equals("")) {
|
||||
throw new ServiceException("邮箱不能为空");
|
||||
}
|
||||
if (user.getGroup() == null || user.getGroup().equals("")) {
|
||||
if (user.getUserGroup() == null || user.getUserGroup().equals("")) {
|
||||
throw new ServiceException("组别不能为空");
|
||||
}
|
||||
|
||||
@ -125,7 +123,7 @@ public class UserService {
|
||||
UserDto.setUserId(user.getId());
|
||||
UserDto.setUsername(user.getUsername());
|
||||
UserDto.setGrade(user.getGrade());
|
||||
UserDto.setGroup(user.getGroup());
|
||||
UserDto.setGroup(user.getUserGroup());
|
||||
UserDto.setRoles(new ArrayList<>());
|
||||
Integer id = user.getId();
|
||||
List<UserRole> userRoles = roleMapper.selectRolesById(id);
|
||||
@ -147,7 +145,7 @@ public class UserService {
|
||||
UserDto.setUserId(user.getId());
|
||||
UserDto.setUsername(user.getUsername());
|
||||
UserDto.setGrade(user.getGrade());
|
||||
UserDto.setGroup(user.getGroup());
|
||||
UserDto.setGroup(user.getUserGroup());
|
||||
UserDto.setRoles(new ArrayList<>());
|
||||
List<UserRole> userRoles = roleMapper.selectRolesById(id);
|
||||
for (UserRole userRole : userRoles) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user