feat(content): 添加父分类ID字段支持
- 在CmsContent实体类中新增parentCategoryId字段 - 在CmsContentDto数据传输对象中添加parentCategoryId属性 - 更新数据库映射文件中的查询语句以包含parent_category_id字段 - 添加针对parentCategoryId的条件查询逻辑 - 在插入和更新操作中支持parentCategoryId字段 - 为官方内容添加isOfficial过滤条件支持
This commit is contained in:
parent
fc0a29e944
commit
a401b05ad8
|
|
@ -129,6 +129,9 @@ public class CmsContent extends BaseEntity implements Serializable {
|
|||
@Schema(description ="副标题")
|
||||
private String subtitle;
|
||||
|
||||
@Schema(description ="父分类ID")
|
||||
private Long parentCategoryId;
|
||||
|
||||
// 用于接收前端发送的分类ID数组
|
||||
@JsonProperty("categoryIds")
|
||||
public void setCategoryIdsFromArray(List<Long> categoryIdList) {
|
||||
|
|
|
|||
|
|
@ -42,4 +42,6 @@ public class CmsContentDto extends BaseQueryDto {
|
|||
|
||||
private Integer deleteFlag;
|
||||
|
||||
private Long parentCategoryId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<result property="contentId" column="content_id" jdbcType="BIGINT"/>
|
||||
<result property="title" column="title" jdbcType="VARCHAR"/>
|
||||
<result property="subtitle" column="subtitle" jdbcType="VARCHAR"/>
|
||||
<result property="parentCategoryId" column="parent_category_id" jdbcType="BIGINT"/>
|
||||
<result property="contentType" column="content_type" jdbcType="INTEGER"/>
|
||||
<result property="categoryIds" column="category_ids" jdbcType="VARCHAR"/>
|
||||
<result property="summary" column="summary" jdbcType="VARCHAR"/>
|
||||
|
|
@ -42,7 +43,7 @@
|
|||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="CmsContentMap">
|
||||
select
|
||||
content_id, title, subtitle, content_type, category_ids, summary, content, cover_image, author_id, author_name,
|
||||
content_id, title, subtitle, parent_category_id, content_type, category_ids, summary, content, cover_image, author_id, author_name,
|
||||
reviewer_id, reviewer_name, audit_status, audit_comment, publish_status, publish_time,
|
||||
view_count, like_count, comment_count, sort, is_paid, price, required_points, support_points_pay, is_official, share_count, file_url, icon, background, create_time, update_time, create_by, update_by, delete_flag
|
||||
from cms_content
|
||||
|
|
@ -52,7 +53,7 @@
|
|||
<!--查询分页列表-->
|
||||
<select id="getPageList" resultMap="CmsContentMap">
|
||||
select
|
||||
content_id, title, subtitle, content_type, category_ids, summary, content, cover_image, author_id, author_name,
|
||||
content_id, title, subtitle, parent_category_id, content_type, category_ids, summary, content, cover_image, author_id, author_name,
|
||||
reviewer_id, reviewer_name, audit_status, audit_comment, publish_status, publish_time,
|
||||
view_count, like_count, comment_count, sort, is_paid, price, required_points, support_points_pay, is_official, share_count, file_url, icon, background, create_time, update_time, create_by, update_by, delete_flag
|
||||
from cms_content
|
||||
|
|
@ -97,6 +98,12 @@
|
|||
<if test="deleteFlag != null">
|
||||
and delete_flag = #{deleteFlag}
|
||||
</if>
|
||||
<if test="isOfficial != null">
|
||||
and is_official = #{isOfficial}
|
||||
</if>
|
||||
<if test="parentCategoryId != null">
|
||||
and parent_category_id = #{parentCategoryId}
|
||||
</if>
|
||||
</where>
|
||||
<if test="sortBy != null and sortBy != ''">
|
||||
order by ${sortBy} ${sortDesc ? 'desc' : 'asc'}
|
||||
|
|
@ -109,7 +116,7 @@
|
|||
<!--查询列表-->
|
||||
<select id="getList" resultMap="CmsContentMap">
|
||||
select
|
||||
content_id, title, subtitle, content_type, category_ids, summary, content, cover_image, author_id, author_name,
|
||||
content_id, title, subtitle, parent_category_id, content_type, category_ids, summary, content, cover_image, author_id, author_name,
|
||||
reviewer_id, reviewer_name, audit_status, audit_comment, publish_status, publish_time,
|
||||
view_count, like_count, comment_count, sort, is_paid, price, required_points, support_points_pay, is_official, share_count, file_url, icon, background, create_time, update_time, create_by, update_by, delete_flag
|
||||
from cms_content
|
||||
|
|
@ -148,16 +155,22 @@
|
|||
<if test="deleteFlag != null">
|
||||
and delete_flag = #{deleteFlag}
|
||||
</if>
|
||||
<if test="isOfficial != null">
|
||||
and is_official = #{isOfficial}
|
||||
</if>
|
||||
<if test="parentCategoryId != null">
|
||||
and parent_category_id = #{parentCategoryId}
|
||||
</if>
|
||||
</where>
|
||||
order by sort asc, create_time desc
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="contentId" useGeneratedKeys="true">
|
||||
insert into cms_content(title, subtitle, content_type, category_ids, summary, content, cover_image, author_id, author_name,
|
||||
insert into cms_content(title, subtitle, parent_category_id, content_type, category_ids, summary, content, cover_image, author_id, author_name,
|
||||
reviewer_id, reviewer_name, audit_status, audit_comment, publish_status, publish_time,
|
||||
view_count, like_count, comment_count, sort, is_paid, price, required_points, support_points_pay, is_official, share_count, file_url, icon, background, create_time, update_time, create_by, update_by, delete_flag)
|
||||
values (#{title}, #{subtitle}, #{contentType}, #{categoryIds}, #{summary}, #{content}, #{coverImage}, #{authorId}, #{authorName},
|
||||
values (#{title}, #{subtitle}, #{parentCategoryId}, #{contentType}, #{categoryIds}, #{summary}, #{content}, #{coverImage}, #{authorId}, #{authorName},
|
||||
#{reviewerId}, #{reviewerName}, #{auditStatus}, #{auditComment}, #{publishStatus}, #{publishTime},
|
||||
#{viewCount}, #{likeCount}, #{commentCount}, #{sort}, #{isPaid}, #{price}, #{requiredPoints}, #{supportPointsPay}, #{isOfficial}, #{shareCount}, #{fileUrl}, #{icon}, #{background}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{deleteFlag})
|
||||
</insert>
|
||||
|
|
@ -172,6 +185,9 @@
|
|||
<if test="subtitle != null">
|
||||
subtitle = #{subtitle},
|
||||
</if>
|
||||
<if test="parentCategoryId != null">
|
||||
parent_category_id = #{parentCategoryId},
|
||||
</if>
|
||||
<if test="contentType != null">
|
||||
content_type = #{contentType},
|
||||
</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue