BasicEntity.java 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package com.logistics.entity;
  2. import javax.persistence.*;
  3. /**
  4. * Created by Mklaus on 15/7/24.
  5. */
  6. @MappedSuperclass
  7. public class BasicEntity implements java.io.Serializable {
  8. @Id
  9. @Column(name = "ID")
  10. @GeneratedValue(strategy = GenerationType.IDENTITY)
  11. public int id;
  12. @Column(name = "IsDeleted")
  13. public boolean isDeleted;
  14. /**
  15. * The number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
  16. */
  17. @Column(name = "created_time")
  18. public long created_time;
  19. /**
  20. * The number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
  21. */
  22. @Column(name = "modify_time")
  23. public long modify_time;
  24. public int getId() {
  25. return id;
  26. }
  27. public void setId(int id) {
  28. this.id = id;
  29. }
  30. public boolean isDeleted() {
  31. return isDeleted;
  32. }
  33. public void setIsDeleted(boolean isDeleted) {
  34. this.isDeleted = isDeleted;
  35. }
  36. public long getCreated_time() {
  37. return created_time;
  38. }
  39. public void setCreated_time(long created_time) {
  40. this.created_time = created_time;
  41. }
  42. public long getModify_time() {
  43. return modify_time;
  44. }
  45. public void setModify_time(long modify_time) {
  46. this.modify_time = modify_time;
  47. }
  48. @Override
  49. public int hashCode() {
  50. int hash = 17;
  51. Integer ID = this.id;
  52. hash = hash * 31 + ID.hashCode();
  53. return (hash);
  54. }
  55. /**
  56. * 该方法仅仅进行了最基本的辨别,如果需要精确地确定比较的对象是否相等,需要在子类中重写这个方法!
  57. */
  58. @Override
  59. public boolean equals(Object o) {
  60. if (this == o)
  61. return true;
  62. if (o == null || !this.getClass().equals(o.getClass()))
  63. return false;
  64. return this.id != ((BasicEntity) o).getId();
  65. }
  66. }