UserInfo.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package com.uas.demo.model;
  2. import org.springframework.data.mongodb.core.index.CompoundIndex;
  3. import org.springframework.data.mongodb.core.index.Indexed;
  4. import org.springframework.data.mongodb.core.mapping.Document;
  5. import javax.persistence.Id;
  6. /**
  7. * 缓存用户或联系人信息
  8. */
  9. @Document(collection = "user_info")
  10. @CompoundIndex(name = "phone_user_id_unique", def = "{'phone': 1, 'userId': 1}", unique = true)
  11. public class UserInfo {
  12. /**
  13. * 主键
  14. */
  15. @Id
  16. private String id;
  17. /**
  18. * 手机号
  19. */
  20. @Indexed(unique = true)
  21. private String phone;
  22. /**
  23. * 用户User Id[IM]
  24. */
  25. @Indexed(unique = true)
  26. private String userId;
  27. /**
  28. * 资质
  29. */
  30. private String certification;
  31. /**
  32. * 用户名称
  33. */
  34. private String name;
  35. public UserInfo() {
  36. }
  37. public String getId() {
  38. return id;
  39. }
  40. public void setId(String id) {
  41. this.id = id;
  42. }
  43. public String getPhone() {
  44. return phone;
  45. }
  46. public void setPhone(String phone) {
  47. this.phone = phone;
  48. }
  49. public String getUserId() {
  50. return userId;
  51. }
  52. public void setUserId(String userId) {
  53. this.userId = userId;
  54. }
  55. public String getCertification() {
  56. return certification;
  57. }
  58. public void setCertification(String certification) {
  59. this.certification = certification;
  60. }
  61. public String getName() {
  62. return name;
  63. }
  64. public void setName(String name) {
  65. this.name = name;
  66. }
  67. @Override
  68. public String toString() {
  69. return "UserInfo{" +
  70. "id='" + id + '\'' +
  71. ", phone='" + phone + '\'' +
  72. ", userId='" + userId + '\'' +
  73. ", certification='" + certification + '\'' +
  74. ", name='" + name + '\'' +
  75. '}';
  76. }
  77. }