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

This commit is contained in:
SjS 2025-04-29 11:47:41 +08:00
parent c637407334
commit f02ba8bb3e
3 changed files with 20 additions and 2 deletions

View File

@ -4,9 +4,12 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.TreeEntity;
import com.ruoyi.common.core.interfaces.LogBizParam;
import com.ruoyi.common.core.validate.ValidGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 文章分类对象 bst_article_category
*
@ -22,12 +25,19 @@ public class ArticleCategory extends TreeEntity implements LogBizParam
@Excel(name = "分类名称")
@ApiModelProperty("分类名称")
@NotBlank(message = "分类名称不能为空", groups = {ValidGroup.Create.class})
private String categoryName;
@Excel(name = "状态0-禁用 1-启用")
@ApiModelProperty("状态0-禁用 1-启用")
@NotBlank(message = "状态不能为空", groups = {ValidGroup.Create.class})
private String categoryStatus;
@Excel(name = "类型1-其他 2-商户帮助中心")
@ApiModelProperty("类型1-其他 2-商户帮助中心")
@NotBlank(message = "文章类型不能为空", groups = {ValidGroup.Create.class})
private String type;
@Excel(name = "父分类ID")
@ApiModelProperty("父分类ID")
private Long parentId;

View File

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="categoryStatus" column="category_status" />
<result property="sort" column="sort" />
<result property="createTime" column="create_time" />
<result property="type" column="type" />
</resultMap>
<sql id="selectArticleCategoryVo">
@ -20,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bac.parent_id,
bac.category_status,
bac.sort,
bac.type,
bac.create_time
from bst_article_category bac
</sql>
@ -30,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.parentId != null "> and bac.parent_id = #{query.parentId}</if>
<if test="query.categoryStatus != null "> and bac.category_status = #{query.categoryStatus}</if>
<if test="query.sort != null "> and bac.sort = #{query.sort}</if>
<if test="query.type != null "> and bac.type = #{query.type}</if>
${query.params.dataScope}
</sql>
@ -68,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="categoryStatus != null">category_status,</if>
<if test="sort != null">sort,</if>
<if test="createTime != null">create_time,</if>
<if test="type != null">type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="categoryName != null and categoryName != ''">#{categoryName},</if>
@ -75,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="categoryStatus != null">#{categoryStatus},</if>
<if test="sort != null">#{sort},</if>
<if test="createTime != null">#{createTime},</if>
<if test="type != null">#{type},</if>
</trim>
</insert>
@ -188,6 +193,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="categoryStatus != null">category_status = #{data.categoryStatus},</if>
<if test="sort != null">sort = #{data.sort},</if>
<if test="createTime != null">create_time = #{data.createTime},</if>
<if test="type != null">type = #{data.type},</if>
</sql>
<delete id="deleteArticleCategoryById" parameterType="Long">

View File

@ -4,8 +4,10 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.validate.ValidGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -80,7 +82,7 @@ public class ArticleCategoryController extends BaseController
@PreAuthorize("@ss.hasPermi('bst:articleCategory:add')")
@Log(title = "新增文章分类", businessType = BusinessType.INSERT, bizIdName = "arg0", bizType = LogBizType.ARTICLE_CATEGORY)
@PostMapping
public AjaxResult add(@RequestBody ArticleCategory articleCategory )
public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) ArticleCategory articleCategory )
{
return toAjax(articleCategoryService.insertArticleCategory(articleCategory));
}
@ -93,7 +95,7 @@ public class ArticleCategoryController extends BaseController
@PreAuthorize("@ss.hasPermi('bst:articleCategory:edit')")
@Log(title = "修改文章分类", businessType = BusinessType.UPDATE, bizIdName = "arg0", bizType = LogBizType.ARTICLE_CATEGORY)
@PutMapping
public AjaxResult edit(@RequestBody ArticleCategory articleCategory)
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) ArticleCategory articleCategory)
{
return toAjax(articleCategoryService.updateArticleCategory(articleCategory));
}