文章分类新增可选商户帮助中心

This commit is contained in:
SjS 2025-04-29 14:02:16 +08:00
parent 0944cb3cfa
commit af02a0ae0b
4 changed files with 36 additions and 9 deletions

View File

@ -0,0 +1,13 @@
package com.ruoyi.bst.articleCategory.domain.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ArticleCategoryType {
OTHERS("1", "其他"),
STOREHELP("2", "商户帮助中心");
private final String code;
private final String name;
}

View File

@ -172,7 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<update id="updateArticleCategory" parameterType="ArticleCategory"> <update id="updateArticleCategory" parameterType="ArticleCategory">
update bst_article_category update bst_article_category bac
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/> <include refid="updateColumns"/>
</trim> </trim>
@ -183,17 +183,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateArticleCategorySortAndStatusOnly" parameterType="ArticleCategory"> <update id="updateArticleCategorySortAndStatusOnly" parameterType="ArticleCategory">
update bst_article_category set update bst_article_category set
<if test="categoryStatus != null">category_status = #{categoryStatus},</if> <if test="categoryStatus != null">category_status = #{categoryStatus},</if>
<if test="sort != null">sort = #{sort}</if> <if test="sort != null">sort = #{sort},</if>
<if test="type != null">type = #{type}</if>
where id = #{id} where id = #{id}
</update> </update>
<sql id="updateColumns"> <sql id="updateColumns">
<if test="categoryName != null and categoryName != ''">category_name = #{data.categoryName},</if> <if test="categoryName != null and categoryName != ''">bac.category_name = #{data.categoryName},</if>
<if test="parentId != null">parent_id = #{data.parentId},</if> <if test="parentId != null">bac.parent_id = #{data.parentId},</if>
<if test="categoryStatus != null">category_status = #{data.categoryStatus},</if> <if test="categoryStatus != null">bac.category_status = #{data.categoryStatus},</if>
<if test="sort != null">sort = #{data.sort},</if> <if test="sort != null">bac.sort = #{data.sort},</if>
<if test="createTime != null">create_time = #{data.createTime},</if> <if test="createTime != null">bac.create_time = #{data.createTime},</if>
<if test="type != null">type = #{data.type},</if> <if test="type != null">bac.type = #{data.type},</if>
</sql> </sql>
<delete id="deleteArticleCategoryById" parameterType="Long"> <delete id="deleteArticleCategoryById" parameterType="Long">

View File

@ -113,7 +113,7 @@ public class ArticleCategoryServiceImpl implements ArticleCategoryService
public int updateArticleCategory(ArticleCategory articleCategory) public int updateArticleCategory(ArticleCategory articleCategory)
{ {
ArticleCategoryVO vo = articleCategoryMapper.selectArticleCategoryById(articleCategory.getId()); ArticleCategoryVO vo = articleCategoryMapper.selectArticleCategoryById(articleCategory.getId());
//检查是否仅修改排序或状态字段 //检查是否需要分类校验
if (vo != null && vo.getParentId().equals(articleCategory.getParentId())&&vo.getCategoryName().equals(articleCategory.getCategoryName())) { if (vo != null && vo.getParentId().equals(articleCategory.getParentId())&&vo.getCategoryName().equals(articleCategory.getCategoryName())) {
// 新增状态变更方向判断 // 新增状态变更方向判断
boolean isEnabling = vo.getCategoryStatus().equals(ArticleCategoryStatus.DISABLED.getCode()) boolean isEnabling = vo.getCategoryStatus().equals(ArticleCategoryStatus.DISABLED.getCode())

View File

@ -6,6 +6,7 @@ import com.ruoyi.bst.article.service.ArticleService;
import com.ruoyi.bst.articleCategory.domain.ArticleCategoryQuery; import com.ruoyi.bst.articleCategory.domain.ArticleCategoryQuery;
import com.ruoyi.bst.articleCategory.domain.ArticleCategoryVO; import com.ruoyi.bst.articleCategory.domain.ArticleCategoryVO;
import com.ruoyi.bst.articleCategory.domain.enums.ArticleCategoryStatus; import com.ruoyi.bst.articleCategory.domain.enums.ArticleCategoryStatus;
import com.ruoyi.bst.articleCategory.domain.enums.ArticleCategoryType;
import com.ruoyi.bst.articleCategory.service.ArticleCategoryService; import com.ruoyi.bst.articleCategory.service.ArticleCategoryService;
import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
@ -14,6 +15,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -48,6 +50,17 @@ public class AppAtricleCategoryController extends BaseController {
return getDataTable(articleCategoryService.selectArticleCategoryList(articleCategoryQuery)); return getDataTable(articleCategoryService.selectArticleCategoryList(articleCategoryQuery));
} }
@ApiOperation("查询分类为商户帮助中心的分类信息")
@GetMapping("/storeHelp/list")
@Anonymous
public TableDataInfo getStoreHelpArticle(ArticleCategoryQuery articleCategoryQuery) {
startPage();
//查询分类的文章
articleCategoryQuery.setCategoryStatus(ArticleCategoryStatus.ENABLED.getCode());
articleCategoryQuery.setType(ArticleCategoryType.STOREHELP.getCode());
return getDataTable(articleCategoryService.selectArticleCategoryList(articleCategoryQuery));
}
@ApiOperation("查询分类下的文章") @ApiOperation("查询分类下的文章")
@GetMapping("/article") @GetMapping("/article")
@Anonymous @Anonymous