feat : 部门重构完成
This commit is contained in:
@@ -66,6 +66,10 @@
|
||||
<version>${guava.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,67 @@
|
||||
package cn.fateverse.common.core.bo;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Data
|
||||
public abstract class BaseQueryBO {
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private DateIntervalBO createTimeInterval;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private DateIntervalBO updateTimeInterval;
|
||||
|
||||
/**
|
||||
* 创建用户名称
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 更新用户名称
|
||||
*/
|
||||
private String updateUserName;
|
||||
|
||||
/**
|
||||
* 获取创建时间间隔
|
||||
*
|
||||
* @return 基准日期间隔
|
||||
*/
|
||||
public DateIntervalBO getCreateTimeInterval() {
|
||||
return Optional.ofNullable(createTimeInterval).orElse(new DateIntervalBO());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取更新时间间隔
|
||||
*
|
||||
* @return 基准日期间隔
|
||||
*/
|
||||
public DateIntervalBO getUpdateTimeInterval() {
|
||||
return Optional.ofNullable(updateTimeInterval).orElse(new DateIntervalBO());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间 区间非空校验
|
||||
*
|
||||
* @return boolean true = 起止非空
|
||||
*/
|
||||
public boolean createTimeBetweenIsNotEmpty() {
|
||||
return Optional.ofNullable(createTimeInterval).map(item -> ObjectUtil.isAllNotEmpty(item.getStartTime(), item.getEndTime())).orElse(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时间 区间非空校验
|
||||
*
|
||||
* @return boolean true = 起止非空
|
||||
*/
|
||||
public boolean updateTimeBetweenIsNotEmpty() {
|
||||
return Optional.ofNullable(updateTimeInterval).map(item -> ObjectUtil.isAllNotEmpty(item.getStartTime(), item.getEndTime())).orElse(false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.fateverse.common.core.bo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 基准日期间隔
|
||||
*
|
||||
* @author ZhangQiang
|
||||
* @date 2024/09/26
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DateIntervalBO {
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package cn.fateverse.common.core.constant;
|
||||
|
||||
public interface BaseConstant {
|
||||
|
||||
Long ZERO = 0L;
|
||||
}
|
||||
@@ -5,24 +5,24 @@ package cn.fateverse.common.core.constant;
|
||||
* @author Clay
|
||||
* @date 2022/11/9
|
||||
*/
|
||||
public class CacheConstants {
|
||||
public interface CacheConstants {
|
||||
|
||||
/**
|
||||
* 验证码 redis key
|
||||
*/
|
||||
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
|
||||
String CAPTCHA_CODE_KEY = "captcha_codes:";
|
||||
/**
|
||||
* 路由缓存地址
|
||||
*/
|
||||
public static final String ROUTE_CACHE_KEY = "router:key:";
|
||||
String ROUTE_CACHE_KEY = "router:key:";
|
||||
/**
|
||||
* 登录用户 redis key
|
||||
*/
|
||||
public static final String LOGIN_TOKEN_KEY = "login_info:";
|
||||
String LOGIN_TOKEN_KEY = "login_info:";
|
||||
/**
|
||||
* 字典类型 redis key
|
||||
*/
|
||||
public static final String DICT_KEY = "dict:";
|
||||
String DICT_KEY = "dict:";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,34 +5,34 @@ package cn.fateverse.common.core.constant;
|
||||
*
|
||||
* @author Clay
|
||||
*/
|
||||
public class Constants {
|
||||
public interface Constants {
|
||||
/**
|
||||
* 令牌前缀
|
||||
*/
|
||||
public static final String TOKEN_PREFIX = "Bearer ";
|
||||
String TOKEN_PREFIX = "Bearer ";
|
||||
/**
|
||||
* http请求
|
||||
*/
|
||||
public static final String HTTP = "http://";
|
||||
String HTTP = "http://";
|
||||
|
||||
/**
|
||||
* https请求
|
||||
*/
|
||||
public static final String HTTPS = "https://";
|
||||
String HTTPS = "https://";
|
||||
|
||||
|
||||
/**
|
||||
* 令牌前缀
|
||||
*/
|
||||
public static final String LOGIN_USER_KEY = "login_user_key";
|
||||
String LOGIN_USER_KEY = "login_user_key";
|
||||
|
||||
/**
|
||||
* 验证码有效期(分钟)
|
||||
*/
|
||||
public static final long CAPTCHA_EXPIRATION = 2;
|
||||
long CAPTCHA_EXPIRATION = 2;
|
||||
|
||||
|
||||
public static final String UTF8 = "UTF-8";
|
||||
String UTF8 = "UTF-8";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,17 +4,17 @@ package cn.fateverse.common.core.constant;
|
||||
* @author Clay
|
||||
* @date 2023-05-25
|
||||
*/
|
||||
public class DateConstants {
|
||||
public interface DateConstants {
|
||||
|
||||
public static String YYYY = "yyyy";
|
||||
String YYYY = "yyyy";
|
||||
|
||||
public static String YYYY_MM = "yyyy-MM";
|
||||
String YYYY_MM = "yyyy-MM";
|
||||
|
||||
public static String YYYY_MM_DD = "yyyy-MM-dd";
|
||||
String YYYY_MM_DD = "yyyy-MM-dd";
|
||||
|
||||
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||
String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
|
||||
|
||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,44 +5,44 @@ package cn.fateverse.common.core.constant;
|
||||
*
|
||||
* @author Clay
|
||||
*/
|
||||
public class UserConstants {
|
||||
public interface UserConstants {
|
||||
|
||||
/**
|
||||
* 平台内系统用户的唯一标志
|
||||
*/
|
||||
public static final String SYS_USER = "SYS_USER";
|
||||
String SYS_USER = "SYS_USER";
|
||||
|
||||
/**
|
||||
* 匿名用户
|
||||
*/
|
||||
public static final String ANONYMOUS_USER = "anonymousUser";
|
||||
String ANONYMOUS_USER = "anonymousUser";
|
||||
|
||||
/**
|
||||
* 正常状态
|
||||
*/
|
||||
public static final String NORMAL = "0";
|
||||
String NORMAL = "0";
|
||||
|
||||
/**
|
||||
* 异常状态
|
||||
*/
|
||||
public static final String EXCEPTION = "1";
|
||||
String EXCEPTION = "1";
|
||||
|
||||
|
||||
/**
|
||||
* 部门停用状态
|
||||
*/
|
||||
public static final String DEPT_DISABLE = "1";
|
||||
String DEPT_DISABLE = "1";
|
||||
|
||||
|
||||
/**
|
||||
* Layout组件标识
|
||||
*/
|
||||
public final static String LAYOUT = "Layout";
|
||||
String LAYOUT = "Layout";
|
||||
|
||||
/**
|
||||
* 校验返回结果码
|
||||
*/
|
||||
public final static String UNIQUE = "0";
|
||||
String UNIQUE = "0";
|
||||
|
||||
public final static String NOT_UNIQUE = "1";
|
||||
String NOT_UNIQUE = "1";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.fateverse.common.core.convert;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 基本转换定义
|
||||
*
|
||||
* @author Clay
|
||||
* @date 2024/09/29
|
||||
*/
|
||||
public interface BaseConvertDefine<DTO, Entity, VO> {
|
||||
|
||||
/**
|
||||
* 实体到视图对象
|
||||
*
|
||||
* @param entity 实体
|
||||
* @return {@link VO}
|
||||
*/
|
||||
VO entityToVo(Entity entity);
|
||||
|
||||
/**
|
||||
* 业务对象到实体
|
||||
*
|
||||
* @param DTO 业务对象
|
||||
* @return {@link Entity}
|
||||
*/
|
||||
Entity dtoToEntity(DTO DTO);
|
||||
|
||||
/**
|
||||
* 从实体到视图对象
|
||||
*
|
||||
* @param list 列表
|
||||
* @return {@link List}<{@link VO}>
|
||||
*/
|
||||
default List<VO> entityToVOList(List<Entity> list) {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return list.stream().map(this::entityToVo).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务对象到实体列表
|
||||
*
|
||||
* @param list 列表
|
||||
* @return {@link List}<{@link Entity}>
|
||||
*/
|
||||
default List<Entity> dtoToEntityList(List<DTO> list) {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return list.stream().map(this::dtoToEntity).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,15 +4,17 @@ import cn.fateverse.common.core.annotaion.AutoTime;
|
||||
import cn.fateverse.common.core.annotaion.AutoUser;
|
||||
import cn.fateverse.common.core.enums.MethodEnum;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2022/10/30
|
||||
*/
|
||||
public class BaseEntity implements Serializable {
|
||||
@Data
|
||||
public abstract class BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
@@ -25,7 +27,7 @@ public class BaseEntity implements Serializable {
|
||||
*/
|
||||
@AutoTime(method = MethodEnum.INSERT)
|
||||
@JsonFormat(locale = "zh",timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
@@ -38,7 +40,7 @@ public class BaseEntity implements Serializable {
|
||||
*/
|
||||
@AutoTime(method = MethodEnum.UPDATE)
|
||||
@JsonFormat(locale = "zh",timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
private Date updateTime;
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
/**
|
||||
@@ -46,44 +48,4 @@ public class BaseEntity implements Serializable {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
public Object getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(Object createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Object getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(Object updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.fateverse.common.core.entity;
|
||||
|
||||
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* 部门表 sys_dept
|
||||
*
|
||||
* @author Clay
|
||||
* @date 2022/10/30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@EnableAutoField
|
||||
public class Dept extends BaseEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 父部门ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
private String ancestors;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@NotBlank(message = "部门名称不能为空!")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
@NotNull(message = "显示顺序不能为空!")
|
||||
private Integer orderNum;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@NotBlank(message = "负责人不能为空!")
|
||||
private String leader;
|
||||
|
||||
/**
|
||||
* 负责人id
|
||||
*/
|
||||
@NotNull(message = "负责人id不能为空!")
|
||||
private Long leaderId;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Pattern(message = "手机号格式错误!",regexp = "^1[0-9]{10}$")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
@Email(message = "邮箱格式错误!")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 部门状态:1正常,0停用
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package cn.fateverse.common.core.entity;
|
||||
|
||||
import cn.fateverse.admin.entity.User;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2022/10/27
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class LoginUser implements UserDetails {
|
||||
|
||||
/**
|
||||
* 用户唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
private Long loginTime;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Long expireTime;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
private User user;
|
||||
|
||||
/**
|
||||
* 登录ip
|
||||
*/
|
||||
private String ipddr;
|
||||
/**
|
||||
* 登录地点
|
||||
*/
|
||||
private String loginLocation;
|
||||
/**
|
||||
* 浏览器类型
|
||||
*/
|
||||
private String browser;
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
private String os;
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*/
|
||||
private Set<String> permissions;
|
||||
|
||||
|
||||
public LoginUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
List<String> roleList = new ArrayList<>();
|
||||
roleList.add("ROLE_ACTIVITI_USER");
|
||||
roleList.add("GROUP_activitiTeam");
|
||||
return roleList.stream().map(SimpleGrantedAuthority::new).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return this.user.getPassword();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return this.user.getUserName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 账户是否未过期,过期无法验证
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public boolean isAccountNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定用户是否解锁,锁定的用户无法进行身份验证
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public boolean isAccountNonLocked() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public boolean isCredentialsNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可用 ,禁用的用户不能身份验证
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package cn.fateverse.common.core.entity;
|
||||
|
||||
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Clay
|
||||
* @date 2022/10/30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@EnableAutoField
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Role extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色关键词
|
||||
*/
|
||||
private String roleKey;
|
||||
|
||||
/**
|
||||
* 角色排序
|
||||
*/
|
||||
private Integer roleSort;
|
||||
|
||||
/**
|
||||
* 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限)
|
||||
*/
|
||||
private String dataScope;
|
||||
|
||||
/**
|
||||
* 角色状态(1正常 0停用)
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 1代表删除)
|
||||
*/
|
||||
@JsonIgnore
|
||||
private String delFlag;
|
||||
|
||||
private Integer roleType = 0;
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isAdmin() {
|
||||
return isAdmin(this.roleId);
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public static boolean isAdmin(Long roleId) {
|
||||
return roleId != null && 1L == roleId;
|
||||
}
|
||||
|
||||
public Role(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.fateverse.common.core.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2022/10/27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class User extends UserBase {
|
||||
|
||||
|
||||
/**
|
||||
* 部门对象
|
||||
*/
|
||||
private Dept dept;
|
||||
|
||||
/**
|
||||
* 角色对象
|
||||
*/
|
||||
private List<Role> roles;
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isAdmin() {
|
||||
return isAdmin(super.getUserId());
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public static boolean isAdmin(Long userId) {
|
||||
return userId != null && 1L == userId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package cn.fateverse.common.core.entity;
|
||||
|
||||
import cn.fateverse.common.core.annotaion.EnableAutoField;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Clay
|
||||
* @date 2022/11/7
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@EnableAutoField
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserBase extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 盐加密
|
||||
*/
|
||||
@JsonIgnore
|
||||
private String salt;
|
||||
|
||||
/**
|
||||
* 帐号状态(1正常 0停用)
|
||||
*/
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
@JsonIgnore
|
||||
private String delFlag;
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 一个微信开放平台帐号下的应用,同一用户的 union
|
||||
*/
|
||||
private String unionId;
|
||||
/**
|
||||
* 用户唯一标识
|
||||
*/
|
||||
private String openId;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
private String loginIp;
|
||||
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
private Date loginDate;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.fateverse.common.core.utils;
|
||||
|
||||
import cn.fateverse.common.core.exception.CustomException;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
public class AssertUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 断定为 true. 非 true 时抛出异常.
|
||||
*
|
||||
* @param condition 条件
|
||||
* @param message 异常枚举
|
||||
* @param args 需要 format 的参数
|
||||
*/
|
||||
public static void isTrue(boolean condition, String message, Object... args) {
|
||||
if (!condition) {
|
||||
throw new CustomException(StrUtil.format(message, args));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 断定为 false. 非 false 时抛出异常.
|
||||
*
|
||||
* @param condition 条件
|
||||
* @param message 异常枚举
|
||||
* @param args arg游戏
|
||||
*/
|
||||
public static void isFalse(boolean condition, String message, Object... args) {
|
||||
if (condition) {
|
||||
throw new CustomException(StrUtil.format(message, args));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user