Skip to content

Commit

Permalink
refactor:统一BaseEntity 位主建ID
Browse files Browse the repository at this point in the history
  • Loading branch information
myxzjie committed Sep 22, 2022
1 parent d75360c commit 46a647e
Show file tree
Hide file tree
Showing 24 changed files with 82 additions and 80 deletions.
6 changes: 3 additions & 3 deletions cms-boot-web/src/main/java/com/xzjie/cms/ad/dto/AdDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public class AdDto extends BasePageDto {
private String image;
@ApiModelProperty("URL连接")
private String adLink;
@ApiModelProperty("广告CODE")
@QueryCondition
private String adCode;
// @ApiModelProperty("广告CODE")
// @QueryCondition
// private String adCode;
@ApiModelProperty("开始时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
private Date startTime;
Expand Down
3 changes: 0 additions & 3 deletions cms-boot-web/src/main/java/com/xzjie/cms/ad/model/Ad.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
@Table(name = "cms_ad")
@ApiModel("广告数据")
public class Ad extends BaseEntity<Ad> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ApiModelProperty("广告位ID")
private Long positionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
@Table(name = "cms_ad_position")
@ApiModel("广告位")
public class AdPosition extends BaseEntity<AdPosition> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

@ApiModelProperty("用户ID")
private Long userId;
Expand Down
8 changes: 4 additions & 4 deletions cms-boot-web/src/main/java/com/xzjie/cms/model/Article.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@ApiModel("内容对象")
public class Article extends BaseEntity<Article> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("ID")
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// @ApiModelProperty("ID")
// private Long id;
@ApiModelProperty("类型ID")
private Long categoryId;
@ApiModelProperty("标题")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
@Table(name = "cms_article_hot")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class ArticleHot extends BaseEntity<ArticleHot> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

private Long articleId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
@Table(name = "cms_article_recommend")
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class ArticleRecommendStat extends BaseEntity<ArticleRecommendStat> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

private Long articleId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseEntity<T extends Object> implements Serializable {

@Id
@ApiModelProperty("ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ApiModelProperty("排序")
@Transient
private Sorting sorting;
Expand Down
6 changes: 3 additions & 3 deletions cms-boot-web/src/main/java/com/xzjie/cms/model/Category.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
@SQLDelete(sql = "update cms_category set state = 0 where id = ?")
@JsonIgnoreProperties({"hibernateLazyInitializer","handler"})
public class Category extends BaseEntity<Category> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

@Column(name = "p_id")
private Long pid;
Expand Down
6 changes: 3 additions & 3 deletions cms-boot-web/src/main/java/com/xzjie/cms/model/KeyData.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
@Table(name = "sys_key_data")
@NoArgsConstructor
public class KeyData extends BaseEntity<KeyData> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

@Column(name = "`key`")
private String key;
Expand Down
6 changes: 3 additions & 3 deletions cms-boot-web/src/main/java/com/xzjie/cms/model/Label.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
@Where(clause = "state = 1")
@SQLDelete(sql = "update cms_label set state = 0 where id = ?")
public class Label extends BaseEntity<Label> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
@Entity
@Table(name = "cms_navigation")
public class Navigation extends BaseEntity<Navigation> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
@Column(name = "p_id")
private Long pid;
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
@Table(name = "sys_permission")
public class Permission extends BaseEntity<Permission>{

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
private Long roleId;
private Long menuId;
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
@Table(name = "sys_pictures_group")
@SQLDelete(sql = "update sys_pictures_group set state = 0 where id = ?")
public class PicturesGroup extends BaseEntity<PicturesGroup> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

private String name;

Expand Down
6 changes: 3 additions & 3 deletions cms-boot-web/src/main/java/com/xzjie/cms/model/Topic.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
@SQLDelete(sql = "update cms_topic set state = 0 where id = ?")
public class Topic extends BaseEntity<Topic>{

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

private String topic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
@Entity(name = "sys_verify_code")
@ApiModel("验证信息对象")
public class VerifyCode extends BaseEntity<VerifyCode> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("ID")
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// @ApiModelProperty("ID")
// private Long id;

@Column(name = "scenes", columnDefinition = "varchar")
@ApiModelProperty("业务类型")
Expand Down
6 changes: 3 additions & 3 deletions cms-boot-web/src/main/java/com/xzjie/cms/model/VisitLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
@Entity
@Table(name = "sys_visit_log")
public class VisitLog extends BaseEntity<VisitLog> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
private String ip;
private String type;
@JsonFormat(shape = JsonFormat.Shape.STRING ,pattern="yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
@SQLDelete(sql = "update wx_account_fans set state = 0 where id = ?")
public class WxAccountFans extends BaseEntity<WxAccountFans> {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

private String openId;

Expand Down
6 changes: 3 additions & 3 deletions cms-boot-web/src/main/java/com/xzjie/cms/model/WxArticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class WxArticle extends BaseEntity<WxArticle> {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

/**
* 标题
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public class WxArticleTemplate extends BaseEntity<WxArticleTemplate> {
/**
* 主键 主键ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

/**
* 模板名称
Expand Down
4 changes: 2 additions & 2 deletions cms-boot-web/src/main/java/com/xzjie/cms/model/WxTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
@Entity
@Table(name = "wx_tags")
public class WxTags extends BaseEntity<WxTags> {
@Id
private Long id;
// @Id
// private Long id;

private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
@ApiModel("管理用户对象")
public class Account extends BaseEntity<Account> {

@Id
@Column(name = "id")
@ApiModelProperty("ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @Id
// @Column(name = "id")
// @ApiModelProperty("ID")
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;

@Column
@ApiModelProperty("用户名")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
@Table(name = "sys_social")
public class Social extends BaseEntity<Social> {

@ApiModelProperty("ID")
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// @ApiModelProperty("ID")
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
@ApiModelProperty("用户ID")
private Long userId;
@ApiModelProperty("第三方唯一id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
@ApiModel("菜单对象")
public class Menu extends BaseEntity<Menu> {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("ID")
private Long id;
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// @ApiModelProperty("ID")
// private Long id;

/**
* 上级菜单ID
Expand Down Expand Up @@ -94,11 +94,11 @@ public boolean equals(Object o) {
return false;
}
Menu menu = (Menu) o;
return Objects.equals(id, menu.id);
return Objects.equals(this.getId(), menu.getId());
}

@Override
public int hashCode() {
return Objects.hash(id);
return Objects.hash(this.getId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
@SQLDelete(sql = "update sys_role set state = 0 where id = ?")
@NoArgsConstructor
@ApiModel("角色对象")
public class Role extends BaseEntity<Role> implements Serializable {
public class Role extends BaseEntity<Role> {

public Role(Long id, String roleCode, String roleName, Integer roleLevel) {
this.id = id;
this.setId(id);
this.roleCode = roleCode;
this.roleName = roleName;
this.roleLevel = roleLevel;
}

@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("ID")
private Long id;
// @Id
// @Column(name = "id")
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// @ApiModelProperty("ID")
// private Long id;
@ApiModelProperty("角色code")
private String roleCode;
@ApiModelProperty("角色名称")
Expand Down

0 comments on commit 46a647e

Please sign in to comment.