package com.zanxiang.mybatis.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; import org.apache.logging.log4j.util.Strings; import java.time.LocalDateTime; /** * @author : lingfeng * @time : 2022-09-26 * @description : 用户实名认证信息 */ @Data @NoArgsConstructor @AllArgsConstructor @ToString @Builder @TableName("t_user_card") public class UserCard { /** * 主键 */ @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 用户id */ private Long userId; /** * 用户名 */ private String username; /** * 昵称 */ private String nickname; /** * 注册时间 */ private LocalDateTime regTime; /** * 身份证号 */ private String cardId; /** * 真实姓名 */ private String cardName; /** * 生日 */ private String birthday; /** * 性别, 0 : 未知, 1 : 男, 2 : 女 */ private Integer sex; /** * 实名证件类型 1、身份证 */ private Integer cardType; /** * 创建时间 */ private LocalDateTime createTime; /** * 更新时间 */ private LocalDateTime updateTime; /** * 获取展示身份证号 * * @return : 返回显示身份证号 */ public String getShowCardId() { if (Strings.isBlank(this.cardId)) { return null; } return this.cardId.substring(0, 3) + " *** " + this.cardId.substring(this.cardId.length() - 3); } /** * 获取展示身份证号 * * @return : 返回显示身份证号 */ public String getShowCardName() { if (Strings.isBlank(this.cardName)) { return null; } //两个字得名字 if (this.cardName.length() <= 2) { return this.cardName.substring(0, 1) + " * "; } //两个字以上得名字, 显示头尾 return this.cardName.substring(0, 1) + " * " + this.cardName.substring(this.cardName.length() - 1); } }