UserCard.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package com.zanxiang.mybatis.entity;
  2. import com.baomidou.mybatisplus.annotation.IdType;
  3. import com.baomidou.mybatisplus.annotation.TableId;
  4. import com.baomidou.mybatisplus.annotation.TableName;
  5. import lombok.*;
  6. import org.apache.logging.log4j.util.Strings;
  7. import java.time.LocalDateTime;
  8. /**
  9. * @author : lingfeng
  10. * @time : 2022-09-26
  11. * @description : 用户实名认证信息
  12. */
  13. @Data
  14. @NoArgsConstructor
  15. @AllArgsConstructor
  16. @ToString
  17. @Builder
  18. @TableName("t_user_card")
  19. public class UserCard {
  20. /**
  21. * 主键
  22. */
  23. @TableId(value = "id", type = IdType.AUTO)
  24. private Long id;
  25. /**
  26. * 用户id
  27. */
  28. private Long userId;
  29. /**
  30. * 用户名
  31. */
  32. private String username;
  33. /**
  34. * 昵称
  35. */
  36. private String nickname;
  37. /**
  38. * 注册时间
  39. */
  40. private LocalDateTime regTime;
  41. /**
  42. * 身份证号
  43. */
  44. private String cardId;
  45. /**
  46. * 真实姓名
  47. */
  48. private String cardName;
  49. /**
  50. * 生日
  51. */
  52. private String birthday;
  53. /**
  54. * 性别, 0 : 未知, 1 : 男, 2 : 女
  55. */
  56. private Integer sex;
  57. /**
  58. * 实名证件类型 1、身份证
  59. */
  60. private Integer cardType;
  61. /**
  62. * 创建时间
  63. */
  64. private LocalDateTime createTime;
  65. /**
  66. * 更新时间
  67. */
  68. private LocalDateTime updateTime;
  69. /**
  70. * 获取展示身份证号
  71. *
  72. * @return : 返回显示身份证号
  73. */
  74. public String getShowCardId() {
  75. if (Strings.isBlank(this.cardId)) {
  76. return null;
  77. }
  78. return this.cardId.substring(0, 3) + " *** " + this.cardId.substring(this.cardId.length() - 3);
  79. }
  80. /**
  81. * 获取展示身份证号
  82. *
  83. * @return : 返回显示身份证号
  84. */
  85. public String getShowCardName() {
  86. if (Strings.isBlank(this.cardName)) {
  87. return null;
  88. }
  89. //两个字得名字
  90. if (this.cardName.length() <= 2) {
  91. return this.cardName.substring(0, 1) + " * ";
  92. }
  93. //两个字以上得名字, 显示头尾
  94. return this.cardName.substring(0, 1) + " * " + this.cardName.substring(this.cardName.length() - 1);
  95. }
  96. }