This commit is contained in:
2026-07-20 11:48:06 +08:00
parent 7119dc76a9
commit f379291e4f
409 changed files with 150227 additions and 8557 deletions
@@ -0,0 +1,121 @@
package com.gxwebsoft.cms.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.cms.service.ArticleCollectService;
import com.gxwebsoft.cms.entity.ArticleCollect;
import com.gxwebsoft.cms.param.ArticleCollectParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 控制器
*
* @author LX
* @since 2025-11-23 14:05:18
*/
@Api(tags = "管理")
@RestController
@RequestMapping("/api/cms/article-collect")
public class ArticleCollectController extends BaseController {
@Resource
private ArticleCollectService articleCollectService;
@ApiOperation("分页查询")
@GetMapping("/page")
public ApiResult<PageResult<ArticleCollect>> page(ArticleCollectParam param) {
// 使用关联查询
return success(articleCollectService.pageRel(param));
}
@ApiOperation("查询全部")
@GetMapping()
public ApiResult<List<ArticleCollect>> list(ArticleCollectParam param) {
// 使用关联查询
param.setUserId(getLoginUserId());
return success(articleCollectService.listRel(param));
}
@ApiOperation("根据id查询")
@GetMapping("/{id}")
public ApiResult<ArticleCollect> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(articleCollectService.getByIdRel(id));
}
@ApiOperation("添加")
@PostMapping()
public ApiResult<?> save(@RequestBody ArticleCollect articleCollect) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
articleCollect.setUserId(loginUser.getUserId());
}
ArticleCollect check = articleCollectService.check(getLoginUserId(), articleCollect.getArticleId());
if (check == null) {
if (articleCollectService.save(articleCollect)) {
return success("添加成功");
}
}else {
articleCollectService.removeById(check.getId());
return success("取消成功");
}
return fail("添加失败");
}
@ApiOperation("修改")
@PutMapping()
public ApiResult<?> update(@RequestBody ArticleCollect articleCollect) {
if (articleCollectService.updateById(articleCollect)) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("删除")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (articleCollectService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@ApiOperation("批量添加")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<ArticleCollect> list) {
if (articleCollectService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("批量修改")
@PutMapping("/batch")
public ApiResult<?> updateBatch(@RequestBody BatchParam<ArticleCollect> batchParam) {
if (batchParam.update(articleCollectService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("批量删除")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (articleCollectService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -0,0 +1,115 @@
package com.gxwebsoft.cms.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.cms.service.ArticleCommentService;
import com.gxwebsoft.cms.entity.ArticleComment;
import com.gxwebsoft.cms.param.ArticleCommentParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 控制器
*
* @author LX
* @since 2025-12-02 16:56:51
*/
@Api(tags = "管理")
@RestController
@RequestMapping("/api/cms/article-comment")
public class ArticleCommentController extends BaseController {
@Resource
private ArticleCommentService articleCommentService;
@ApiOperation("分页查询")
@GetMapping("/page")
public ApiResult<PageResult<ArticleComment>> page(ArticleCommentParam param) {
// 使用关联查询
return success(articleCommentService.pageRel(param));
}
@ApiOperation("查询全部")
@GetMapping()
public ApiResult<List<ArticleComment>> list(ArticleCommentParam param) {
// 使用关联查询
return success(articleCommentService.listRel(param));
}
@PreAuthorize("hasAuthority('cms:articleComment:list')")
@ApiOperation("根据id查询")
@GetMapping("/{id}")
public ApiResult<ArticleComment> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(articleCommentService.getByIdRel(id));
}
@ApiOperation("添加")
@PostMapping()
public ApiResult<?> save(@RequestBody ArticleComment articleComment) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
articleComment.setUserId(loginUser.getUserId());
}
if (articleCommentService.save(articleComment)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("修改")
@PutMapping()
public ApiResult<?> update(@RequestBody ArticleComment articleComment) {
if (articleCommentService.updateById(articleComment)) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("删除")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (articleCommentService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@ApiOperation("批量添加")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<ArticleComment> list) {
if (articleCommentService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("批量修改")
@PutMapping("/batch")
public ApiResult<?> updateBatch(@RequestBody BatchParam<ArticleComment> batchParam) {
if (batchParam.update(articleCommentService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("批量删除")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (articleCommentService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -2,7 +2,9 @@ package com.gxwebsoft.cms.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gxwebsoft.cms.entity.ArticleCategory;
import com.gxwebsoft.cms.entity.ArticleCollect;
import com.gxwebsoft.cms.service.ArticleCategoryService;
import com.gxwebsoft.cms.service.ArticleCollectService;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.cms.service.ArticleService;
import com.gxwebsoft.cms.entity.Article;
@@ -35,6 +37,8 @@ public class ArticleController extends BaseController {
@Resource
private ArticleService articleService;
@Resource
private ArticleCollectService articleCollectService;
@Resource
private ArticleCategoryService articleCategoryService;
@ApiOperation("根据id查询文章记录表")
@@ -45,7 +49,6 @@ public class ArticleController extends BaseController {
}
@PreAuthorize("hasAuthority('cms:article:list')")
@OperationLog
@ApiOperation("分页查询文章记录表")
@GetMapping("/page")
@@ -74,11 +77,13 @@ public class ArticleController extends BaseController {
if (!categoryIds.isEmpty()) {
queryWrapper.in(Article::getCategoryId, categoryIds);
}
if (param.getTitle() != null) {
queryWrapper.like(Article::getTitle, param.getTitle());
}
List<Article> articleList = articleService.list(queryWrapper);
return success(articleList);
}
@PreAuthorize("hasAuthority('cms:article:list')")
@OperationLog
@ApiOperation("根据id查询文章记录表")
@GetMapping("/{id}")
@@ -89,6 +94,13 @@ public class ArticleController extends BaseController {
article.setArticleId(id);
article.setVirtualViews(article.getVirtualViews() + 1);
articleService.saveOrUpdate(article);
ArticleCategory category = articleCategoryService.getByIdRel(article.getCategoryId());
if (category != null) article.setCategory(category.getTitle());
article.setHasCollect(false);
if (getLoginUser() != null) {
ArticleCollect articleCollect = articleCollectService.check(getLoginUserId(), id);
article.setHasCollect(articleCollect != null);
}
return success(article);
}
@@ -0,0 +1,143 @@
package com.gxwebsoft.cms.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.cms.service.ManuscriptService;
import com.gxwebsoft.cms.entity.Manuscript;
import com.gxwebsoft.cms.param.ManuscriptParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.gxmu.entity.ReviewFlow;
import com.gxwebsoft.gxmu.entity.ReviewFlowConfig;
import com.gxwebsoft.gxmu.entity.ReviewList;
import com.gxwebsoft.gxmu.service.ReviewFlowConfigService;
import com.gxwebsoft.gxmu.service.ReviewFlowService;
import com.gxwebsoft.gxmu.service.ReviewListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 稿件控制器
*
* @author LX
* @since 2026-03-18 12:54:31
*/
@Api(tags = "稿件管理")
@RestController
@RequestMapping("/api/cms/manuscript")
public class ManuscriptController extends BaseController {
@Resource
private ManuscriptService manuscriptService;
@Resource
private ReviewFlowConfigService reviewFlowConfigService;
@Resource
private ReviewFlowService reviewFlowService;
@Resource
private ReviewListService reviewListService;
@ApiOperation("分页查询稿件")
@GetMapping("/page")
public ApiResult<PageResult<Manuscript>> page(ManuscriptParam param) {
// 使用关联查询
return success(manuscriptService.pageRel(param));
}
@ApiOperation("查询全部稿件")
@GetMapping()
public ApiResult<List<Manuscript>> list(ManuscriptParam param) {
// 使用关联查询
return success(manuscriptService.listRel(param));
}
@ApiOperation("根据id查询稿件")
@GetMapping("/{id}")
public ApiResult<Manuscript> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(manuscriptService.getByIdRel(id));
}
@ApiOperation("添加稿件")
@PostMapping()
public ApiResult<?> save(@RequestBody Manuscript manuscript) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
manuscript.setUserId(loginUser.getUserId());
}
if (manuscriptService.save(manuscript)) {
// 查找该模块的审核流
ReviewFlowConfig reviewFlowConfig = reviewFlowConfigService.getByModule("cms_manuscript");
if (reviewFlowConfig != null) {
ReviewFlow reviewFlow = reviewFlowService.getById(reviewFlowConfig.getFlowId());
if (reviewFlow != null) {
List<ReviewFlow> reviewFlowList = reviewFlowService.listByTitle(reviewFlow.getTitle());
if (reviewFlowList != null && !reviewFlowList.isEmpty()) {
ReviewFlow firstOne = reviewFlowList.get(0);
ReviewList reviewList = new ReviewList();
reviewList.setPk(manuscript.getId());
reviewList.setModule("cms_manuscript");
reviewList.setUserId(firstOne.getReviewUserId());
reviewList.setSortNumber(0);
reviewListService.save(reviewList);
}
}
}
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("修改稿件")
@PutMapping()
public ApiResult<?> update(@RequestBody Manuscript manuscript) {
if (manuscriptService.updateById(manuscript)) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("删除稿件")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (manuscriptService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@ApiOperation("批量添加稿件")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Manuscript> list) {
if (manuscriptService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("批量修改稿件")
@PutMapping("/batch")
public ApiResult<?> updateBatch(@RequestBody BatchParam<Manuscript> batchParam) {
if (batchParam.update(manuscriptService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("批量删除稿件")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (manuscriptService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -37,6 +37,9 @@ public class Article implements Serializable {
@ApiModelProperty(value = "文章分类ID")
private Integer categoryId;
@TableField(exist = false)
private String category;
@ApiModelProperty(value = "封面图")
private String image;
@@ -88,4 +91,6 @@ public class Article implements Serializable {
@TableField(exist = false)
private String userAvatar;
@TableField(exist = false)
private Boolean hasCollect;
}
@@ -0,0 +1,50 @@
package com.gxwebsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author LX
* @since 2025-11-23 14:05:18
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "ArticleCollect对象", description = "")
@TableName("cms_article_collect")
public class ArticleCollect implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Integer articleId;
private Integer userId;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "修改时间")
private LocalDateTime updateTime;
@TableField(exist = false)
private Article article;
}
@@ -0,0 +1,52 @@
package com.gxwebsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author LX
* @since 2025-12-02 16:56:51
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "ArticleComment对象", description = "")
@TableName("cms_article_comment")
public class ArticleComment implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private Integer articleId;
private Integer userId;
private String content;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "修改时间")
private LocalDateTime updateTime;
@TableField(exist = false)
private Article article;
}
@@ -0,0 +1,62 @@
package com.gxwebsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.List;
import com.gxwebsoft.gxmu.entity.ReviewList;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 稿件
*
* @author LX
* @since 2026-03-18 12:54:31
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Manuscript对象", description = "稿件")
@TableName("cms_manuscript")
public class Manuscript implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String title;
private String content;
private String cover;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "修改时间")
private LocalDateTime updateTime;
private Integer userId;
private Integer sortNumber;
@ApiModelProperty(value = "审核状态")
private Integer status;
@ApiModelProperty(value = "审核状态描述")
private String statusText;
@TableField(exist = false)
private List<ReviewList> reviewList;
}
@@ -0,0 +1,37 @@
package com.gxwebsoft.cms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.cms.entity.ArticleCollect;
import com.gxwebsoft.cms.param.ArticleCollectParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*
* @author LX
* @since 2025-11-23 14:05:18
*/
public interface ArticleCollectMapper extends BaseMapper<ArticleCollect> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<ArticleCollect>
*/
List<ArticleCollect> selectPageRel(@Param("page") IPage<ArticleCollect> page,
@Param("param") ArticleCollectParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<ArticleCollect> selectListRel(@Param("param") ArticleCollectParam param);
}
@@ -0,0 +1,37 @@
package com.gxwebsoft.cms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.cms.entity.ArticleComment;
import com.gxwebsoft.cms.param.ArticleCommentParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*
* @author LX
* @since 2025-12-02 16:56:51
*/
public interface ArticleCommentMapper extends BaseMapper<ArticleComment> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<ArticleComment>
*/
List<ArticleComment> selectPageRel(@Param("page") IPage<ArticleComment> page,
@Param("param") ArticleCommentParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<ArticleComment> selectListRel(@Param("param") ArticleCommentParam param);
}
@@ -0,0 +1,37 @@
package com.gxwebsoft.cms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.cms.entity.Manuscript;
import com.gxwebsoft.cms.param.ManuscriptParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 稿件Mapper
*
* @author LX
* @since 2026-03-18 12:54:31
*/
public interface ManuscriptMapper extends BaseMapper<Manuscript> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Manuscript>
*/
List<Manuscript> selectPageRel(@Param("page") IPage<Manuscript> page,
@Param("param") ManuscriptParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Manuscript> selectListRel(@Param("param") ManuscriptParam param);
}
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gxwebsoft.cms.mapper.ArticleCollectMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM cms_article_collect a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.articleId != null">
AND a.article_id = #{param.articleId}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.ArticleCollect">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.ArticleCollect">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gxwebsoft.cms.mapper.ArticleCommentMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM cms_article_comment a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.articleId != null">
AND a.article_id = #{param.articleId}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.content != null">
AND a.content LIKE CONCAT('%', #{param.content}, '%')
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.ArticleComment">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.ArticleComment">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -72,7 +72,7 @@
AND b.nickname LIKE CONCAT('%', #{param.nickname}, '%')
</if>
</where>
ORDER BY a.create_time DESC
ORDER BY a.sort_number ASC, a.create_time DESC
</sql>
<!-- 分页查询 -->
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gxwebsoft.cms.mapper.ManuscriptMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM cms_manuscript a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.title != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%')
</if>
<if test="param.content != null">
AND a.content LIKE CONCAT('%', #{param.content}, '%')
</if>
<if test="param.cover != null">
AND a.cover LIKE CONCAT('%', #{param.cover}, '%')
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.Manuscript">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.Manuscript">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -0,0 +1,43 @@
package com.gxwebsoft.cms.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 查询参数
*
* @author LX
* @since 2025-11-23 14:05:18
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ArticleCollectParam对象", description = "查询参数")
public class ArticleCollectParam extends BaseParam {
private static final long serialVersionUID = 1L;
@QueryField(type = QueryType.EQ)
private Integer id;
@QueryField(type = QueryType.EQ)
private Integer articleId;
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
}
@@ -0,0 +1,45 @@
package com.gxwebsoft.cms.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 查询参数
*
* @author LX
* @since 2025-12-02 16:56:51
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ArticleCommentParam对象", description = "查询参数")
public class ArticleCommentParam extends BaseParam {
private static final long serialVersionUID = 1L;
@QueryField(type = QueryType.EQ)
private Integer id;
@QueryField(type = QueryType.EQ)
private Integer articleId;
@QueryField(type = QueryType.EQ)
private Integer userId;
private String content;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
}
@@ -0,0 +1,49 @@
package com.gxwebsoft.cms.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 稿件查询参数
*
* @author LX
* @since 2026-03-18 12:54:31
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ManuscriptParam对象", description = "稿件查询参数")
public class ManuscriptParam extends BaseParam {
private static final long serialVersionUID = 1L;
@QueryField(type = QueryType.EQ)
private Integer id;
private String title;
private String content;
private String cover;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
@QueryField(type = QueryType.EQ)
private Integer userId;
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "待审核")
@QueryField(type = QueryType.EQ)
private Boolean status;
}
@@ -0,0 +1,43 @@
package com.gxwebsoft.cms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.cms.entity.ArticleCollect;
import com.gxwebsoft.cms.param.ArticleCollectParam;
import java.util.List;
/**
* Service
*
* @author LX
* @since 2025-11-23 14:05:18
*/
public interface ArticleCollectService extends IService<ArticleCollect> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<ArticleCollect>
*/
PageResult<ArticleCollect> pageRel(ArticleCollectParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<ArticleCollect>
*/
List<ArticleCollect> listRel(ArticleCollectParam param);
/**
* 根据id查询
*
* @param id
* @return ArticleCollect
*/
ArticleCollect getByIdRel(Integer id);
ArticleCollect check(Integer userId, Integer id);
}
@@ -0,0 +1,42 @@
package com.gxwebsoft.cms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.cms.entity.ArticleComment;
import com.gxwebsoft.cms.param.ArticleCommentParam;
import java.util.List;
/**
* Service
*
* @author LX
* @since 2025-12-02 16:56:51
*/
public interface ArticleCommentService extends IService<ArticleComment> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<ArticleComment>
*/
PageResult<ArticleComment> pageRel(ArticleCommentParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<ArticleComment>
*/
List<ArticleComment> listRel(ArticleCommentParam param);
/**
* 根据id查询
*
* @param id
* @return ArticleComment
*/
ArticleComment getByIdRel(Integer id);
}
@@ -0,0 +1,42 @@
package com.gxwebsoft.cms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.cms.entity.Manuscript;
import com.gxwebsoft.cms.param.ManuscriptParam;
import java.util.List;
/**
* 稿件Service
*
* @author LX
* @since 2026-03-18 12:54:31
*/
public interface ManuscriptService extends IService<Manuscript> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Manuscript>
*/
PageResult<Manuscript> pageRel(ManuscriptParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Manuscript>
*/
List<Manuscript> listRel(ManuscriptParam param);
/**
* 根据id查询
*
* @param id
* @return Manuscript
*/
Manuscript getByIdRel(Integer id);
}
@@ -0,0 +1,65 @@
package com.gxwebsoft.cms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.cms.mapper.ArticleCollectMapper;
import com.gxwebsoft.cms.service.ArticleCollectService;
import com.gxwebsoft.cms.entity.ArticleCollect;
import com.gxwebsoft.cms.param.ArticleCollectParam;
import com.gxwebsoft.cms.service.ArticleService;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Service实现
*
* @author LX
* @since 2025-11-23 14:05:18
*/
@Service
public class ArticleCollectServiceImpl extends ServiceImpl<ArticleCollectMapper, ArticleCollect> implements ArticleCollectService {
@Resource
private ArticleService articleService;
@Override
public PageResult<ArticleCollect> pageRel(ArticleCollectParam param) {
PageParam<ArticleCollect, ArticleCollectParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<ArticleCollect> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<ArticleCollect> listRel(ArticleCollectParam param) {
List<ArticleCollect> list = baseMapper.selectListRel(param);
// 排序
PageParam<ArticleCollect, ArticleCollectParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
for (ArticleCollect item : list) {
item.setArticle(articleService.getByIdRel(item.getArticleId()));
}
return page.sortRecords(list);
}
@Override
public ArticleCollect getByIdRel(Integer id) {
ArticleCollectParam param = new ArticleCollectParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
@Override
public ArticleCollect check(Integer userId, Integer id) {
return getOne(
new LambdaQueryWrapper<ArticleCollect>()
.eq(ArticleCollect::getUserId, userId)
.eq(ArticleCollect::getArticleId, id)
.last("limit 1")
);
}
}
@@ -0,0 +1,53 @@
package com.gxwebsoft.cms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.cms.mapper.ArticleCommentMapper;
import com.gxwebsoft.cms.service.ArticleCommentService;
import com.gxwebsoft.cms.entity.ArticleComment;
import com.gxwebsoft.cms.param.ArticleCommentParam;
import com.gxwebsoft.cms.service.ArticleService;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Service实现
*
* @author LX
* @since 2025-12-02 16:56:51
*/
@Service
public class ArticleCommentServiceImpl extends ServiceImpl<ArticleCommentMapper, ArticleComment> implements ArticleCommentService {
@Resource
private ArticleService articleService;
@Override
public PageResult<ArticleComment> pageRel(ArticleCommentParam param) {
PageParam<ArticleComment, ArticleCommentParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
List<ArticleComment> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<ArticleComment> listRel(ArticleCommentParam param) {
List<ArticleComment> list = baseMapper.selectListRel(param);
// 排序
PageParam<ArticleComment, ArticleCommentParam> page = new PageParam<>();
page.setDefaultOrder("create_time desc");
for (ArticleComment item : list) {
item.setArticle(articleService.getById(item.getArticleId()));
}
return page.sortRecords(list);
}
@Override
public ArticleComment getByIdRel(Integer id) {
ArticleCommentParam param = new ArticleCommentParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
}
@@ -23,7 +23,7 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
@Override
public PageResult<Article> pageRel(ArticleParam param) {
PageParam<Article, ArticleParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
// page.setDefaultOrder("sort_number asc, create_time desc");
List<Article> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@@ -33,7 +33,7 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
List<Article> list = baseMapper.selectListRel(param);
// 排序
PageParam<Article, ArticleParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
// page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@@ -0,0 +1,62 @@
package com.gxwebsoft.cms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.cms.mapper.ManuscriptMapper;
import com.gxwebsoft.cms.service.ManuscriptService;
import com.gxwebsoft.cms.entity.Manuscript;
import com.gxwebsoft.cms.param.ManuscriptParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.service.UserService;
import com.gxwebsoft.gxmu.entity.ReviewList;
import com.gxwebsoft.gxmu.service.ReviewListService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 稿件Service实现
*
* @author LX
* @since 2026-03-18 12:54:31
*/
@Service
public class ManuscriptServiceImpl extends ServiceImpl<ManuscriptMapper, Manuscript> implements ManuscriptService {
@Resource
private ReviewListService reviewListService;
@Resource
private UserService userService;
@Override
public PageResult<Manuscript> pageRel(ManuscriptParam param) {
PageParam<Manuscript, ManuscriptParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<Manuscript> list = baseMapper.selectPageRel(page, param);
for (Manuscript manuscript : list) {
List<ReviewList> reviewLists = reviewListService.listByModuleNPK("cms_manuscript", manuscript.getId());
for (ReviewList reviewList : reviewLists) {
if (reviewList.getUserId() != null) reviewList.setUser(userService.getById(reviewList.getUserId()));
}
manuscript.setReviewList(reviewLists);
}
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Manuscript> listRel(ManuscriptParam param) {
List<Manuscript> list = baseMapper.selectListRel(param);
// 排序
PageParam<Manuscript, ManuscriptParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public Manuscript getByIdRel(Integer id) {
ManuscriptParam param = new ManuscriptParam();
param.setId(id);
return param.getOne(baseMapper.selectListRel(param));
}
}