feat(分类属性): 实现分类属性管理功能

新增分类属性相关实体、DTO、仓库、服务及控制器
扩展文章服务以支持按属性查询文章
重构文章实体将typeid改为attributeid
添加按标题查询文章功能
This commit is contained in:
qingfeng1121
2025-10-16 16:34:36 +08:00
parent 8cc4c1da1d
commit ffea3e85ae
15 changed files with 1513 additions and 2039 deletions

View File

@@ -22,8 +22,8 @@ public class Article {
private String content;
@NotNull(message = "类别id不能为空")
@Column(name = "typeid")
private Integer typeid;
@Column(name = "attributeid")
private Integer attributeid;
@Column(name = "img")
private String img;
@@ -42,6 +42,14 @@ public class Article {
// Getters and Setters
public Integer getAttributeid() {
return attributeid;
}
public void setAttributeid(Integer attributeid) {
this.attributeid = attributeid;
}
public Integer getArticleid() {
return articleid;
}
@@ -66,14 +74,6 @@ public class Article {
this.content = content;
}
public Integer getTypeid() {
return typeid;
}
public void setTypeid(Integer typeid) {
this.typeid = typeid;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}

View File

@@ -1,4 +1,42 @@
package com.qf.myafterprojecy.pojo;
public class category_attribute {
import javax.persistence.*;
@Entity
@Table(name = "category_attribute")
public class Category_attribute {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "attributeid")
private Integer attributeid;
@Column(name = "categoryid")
private Integer categoryid;
@Column(name = "attributename")
private String attributename;
public Integer getAttributeid() {
return attributeid;
}
public void setAttributeid(Integer attributeid) {
this.attributeid = attributeid;
}
public Integer getCategoryid() {
return categoryid;
}
public void setCategoryid(Integer categoryid) {
this.categoryid = categoryid;
}
public String getAttributename() {
return attributename;
}
public void setAttributename(String attributename) {
this.attributename = attributename;
}
}

View File

@@ -0,0 +1,30 @@
package com.qf.myafterprojecy.pojo.dto;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
public class CategoryAttributeDto {
@NotNull(message = "分类ID不能为空")
private Integer categoryid;
@NotBlank(message = "属性名称不能为空")
private String attributename;
// Getters and Setters
public Integer getCategoryid() {
return categoryid;
}
public void setCategoryid(Integer categoryid) {
this.categoryid = categoryid;
}
public String getAttributename() {
return attributename;
}
public void setAttributename(String attributename) {
this.attributename = attributename;
}
}