Initial commit

This commit is contained in:
南宁网宿科技
2023-06-03 23:56:49 +08:00
commit 912944faea
821 changed files with 74279 additions and 0 deletions
@@ -0,0 +1,141 @@
package com.gxwebsoft.cms.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.cms.service.ArticleCategoryService;
import com.gxwebsoft.cms.entity.ArticleCategory;
import com.gxwebsoft.cms.param.ArticleCategoryParam;
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 科技小王子
* @since 2022-11-22 17:49:15
*/
@Api(tags = "文章分类表管理")
@RestController
@RequestMapping("/api/cms/article-category")
public class ArticleCategoryController extends BaseController {
@Resource
private ArticleCategoryService articleCategoryService;
@PreAuthorize("hasAuthority('cms:articleCategory:list')")
@OperationLog
@ApiOperation("分页查询文章分类表")
@GetMapping("/page")
public ApiResult<PageResult<ArticleCategory>> page(ArticleCategoryParam param) {
PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>(param);
// page.setDefaultOrder("create_time desc");
page.setDefaultOrder("sort_number");
return success(articleCategoryService.page(page, page.getWrapper()));
// 使用关联查询
//return success(articleCategoryService.pageRel(param));
}
@PreAuthorize("hasAuthority('cms:articleCategory:list')")
@OperationLog
@ApiOperation("查询全部文章分类表")
@GetMapping()
public ApiResult<List<ArticleCategory>> list(ArticleCategoryParam param) {
PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>(param);
// page.setDefaultOrder("create_time desc");
page.setDefaultOrder("sort_number");
return success(articleCategoryService.list(page.getOrderWrapper()));
// 使用关联查询
//return success(articleCategoryService.listRel(param));
}
@PreAuthorize("hasAuthority('cms:articleCategory:list')")
@OperationLog
@ApiOperation("根据id查询文章分类表")
@GetMapping("/{id}")
public ApiResult<ArticleCategory> get(@PathVariable("id") Integer id) {
return success(articleCategoryService.getById(id));
// 使用关联查询
//return success(articleCategoryService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('cms:articleCategory:save')")
@OperationLog
@ApiOperation("添加文章分类表")
@PostMapping()
public ApiResult<?> save(@RequestBody ArticleCategory articleCategory) {
// 记录当前登录用户id、租户id
User loginUser = getLoginUser();
if (loginUser != null) {
articleCategory.setUserId(loginUser.getUserId());
}
if (articleCategoryService.save(articleCategory)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('cms:articleCategory:update')")
@OperationLog
@ApiOperation("修改文章分类表")
@PutMapping()
public ApiResult<?> update(@RequestBody ArticleCategory articleCategory) {
if (articleCategoryService.updateById(articleCategory)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('cms:articleCategory:remove')")
@OperationLog
@ApiOperation("删除文章分类表")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (articleCategoryService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('cms:articleCategory:save')")
@OperationLog
@ApiOperation("批量添加文章分类表")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<ArticleCategory> list) {
if (articleCategoryService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('cms:articleCategory:update')")
@OperationLog
@ApiOperation("批量修改文章分类表")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<ArticleCategory> batchParam) {
if (batchParam.update(articleCategoryService, "category_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('cms:articleCategory:remove')")
@OperationLog
@ApiOperation("批量删除文章分类表")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (articleCategoryService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -0,0 +1,140 @@
package com.gxwebsoft.cms.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.cms.service.ArticleService;
import com.gxwebsoft.cms.entity.Article;
import com.gxwebsoft.cms.param.ArticleParam;
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 WebSoft
* @since 2022-11-16 11:40:27
*/
@Api(tags = "文章记录表管理")
@RestController
@RequestMapping("/api/cms/article")
public class ArticleController extends BaseController {
@Resource
private ArticleService articleService;
@PreAuthorize("hasAuthority('cms:article:list')")
@OperationLog
@ApiOperation("分页查询文章记录表")
@GetMapping("/page")
public ApiResult<PageResult<Article>> page(ArticleParam param) {
// 使用关联查询
return success(articleService.pageRel(param));
}
@PreAuthorize("hasAuthority('cms:article:list')")
@OperationLog
@ApiOperation("查询全部文章记录表")
@GetMapping()
public ApiResult<List<Article>> list(ArticleParam param) {
PageParam<Article, ArticleParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
return success(articleService.list(page.getOrderWrapper()));
// 使用关联查询
//return success(articleService.listRel(param));
}
@PreAuthorize("hasAuthority('cms:article:list')")
@OperationLog
@ApiOperation("根据id查询文章记录表")
@GetMapping("/{id}")
public ApiResult<Article> get(@PathVariable("id") Integer id) {
// return success(articleService.getById(id));
// 使用关联查询
Article article = articleService.getByIdRel(id);
article.setArticleId(id);
article.setVirtualViews(article.getVirtualViews()+1);
articleService.saveOrUpdate(article);
return success(article);
}
@PreAuthorize("hasAuthority('cms:article:save')")
@OperationLog
@ApiOperation("添加文章记录表")
@PostMapping()
public ApiResult<?> save(@RequestBody Article article) {
// 记录当前登录用户id、租户id
User loginUser = getLoginUser();
if (loginUser != null) {
article.setUserId(loginUser.getUserId());
}
if (articleService.save(article)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('cms:article:update')")
@OperationLog
@ApiOperation("修改文章记录表")
@PutMapping()
public ApiResult<?> update(@RequestBody Article article) {
if (articleService.updateById(article)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('cms:article:remove')")
@OperationLog
@ApiOperation("删除文章记录表")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (articleService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('cms:article:save')")
@OperationLog
@ApiOperation("批量添加文章记录表")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Article> list) {
if (articleService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('cms:article:update')")
@OperationLog
@ApiOperation("批量修改文章记录表")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Article> batchParam) {
if (batchParam.update(articleService, "article_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('cms:article:remove')")
@OperationLog
@ApiOperation("批量删除文章记录表")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (articleService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -0,0 +1,139 @@
package com.gxwebsoft.cms.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.cms.service.DocsService;
import com.gxwebsoft.cms.entity.Docs;
import com.gxwebsoft.cms.param.DocsParam;
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 科技小王子
* @since 2022-11-16 11:40:27
*/
@Api(tags = "文档管理记录表管理")
@RestController
@RequestMapping("/api/cms/docs")
public class DocsController extends BaseController {
@Resource
private DocsService docsService;
@PreAuthorize("hasAuthority('cms:docs:list')")
@OperationLog
@ApiOperation("分页查询文档管理记录表")
@GetMapping("/page")
public ApiResult<PageResult<Docs>> page(DocsParam param) {
PageParam<Docs, DocsParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc,create_time asc");
return success(docsService.page(page, page.getWrapper()));
// 使用关联查询
// return success(docsService.pageRel(param));
}
@PreAuthorize("hasAuthority('cms:docs:list')")
@OperationLog
@ApiOperation("查询全部文档管理记录表")
@GetMapping()
public ApiResult<List<Docs>> list(DocsParam param) {
PageParam<Docs, DocsParam> page = new PageParam<>(param);
// page.setDefaultOrder("sort_number asc,create_time asc");
// return success(docsService.list(page.getOrderWrapper()));
// 使用关联查询
return success(docsService.listRel(param));
}
@PreAuthorize("hasAuthority('cms:docs:list')")
@OperationLog
@ApiOperation("根据id查询文档管理记录表")
@GetMapping("/{id}")
public ApiResult<Docs> get(@PathVariable("id") Integer id) {
return success(docsService.getById(id));
// 使用关联查询
//return success(docsService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('cms:docs:save')")
@OperationLog
@ApiOperation("添加文档管理记录表")
@PostMapping()
public ApiResult<?> save(@RequestBody Docs docs) {
// 记录当前登录用户id、租户id
User loginUser = getLoginUser();
if (loginUser != null) {
docs.setUserId(loginUser.getUserId());
}
if (docsService.save(docs)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('cms:docs:update')")
@OperationLog
@ApiOperation("修改文档管理记录表")
@PutMapping()
public ApiResult<?> update(@RequestBody Docs docs) {
if (docsService.updateById(docs)) {
return success("保存成功");
}
return fail("保存失败");
}
@PreAuthorize("hasAuthority('cms:docs:remove')")
@OperationLog
@ApiOperation("删除文档管理记录表")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (docsService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('cms:docs:save')")
@OperationLog
@ApiOperation("批量添加文档管理记录表")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Docs> list) {
if (docsService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('cms:docs:update')")
@OperationLog
@ApiOperation("批量修改文档管理记录表")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Docs> batchParam) {
if (batchParam.update(docsService, "docs_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('cms:docs:remove')")
@OperationLog
@ApiOperation("批量删除文档管理记录表")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (docsService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -0,0 +1,91 @@
package com.gxwebsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 文章记录表
*
* @author WebSoft
* @since 2022-11-16 11:40:27
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Article对象", description = "文章记录表")
@TableName("cms_article")
public class Article implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "文章ID")
@TableId(value = "article_id", type = IdType.AUTO)
private Integer articleId;
@ApiModelProperty(value = "文章标题")
private String title;
@ApiModelProperty(value = "列表显示方式(10小图展示 20大图展示)")
private Integer showType;
@ApiModelProperty(value = "文章分类ID")
private Integer categoryId;
@ApiModelProperty(value = "封面图")
private String image;
@ApiModelProperty(value = "来源")
private String source;
@ApiModelProperty(value = "文章内容")
private String content;
@ApiModelProperty(value = "虚拟阅读量(仅用作展示)")
private Integer virtualViews;
@ApiModelProperty(value = "实际阅读量")
private Integer actualViews;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "商户编号")
private String merchantCode;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "用户昵称")
@TableField(exist = false)
private String nickname;
@ApiModelProperty(value = "用户头像")
@TableField(exist = false)
private String userAvatar;
}
@@ -0,0 +1,70 @@
package com.gxwebsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 文章分类表
*
* @author 科技小王子
* @since 2022-11-22 17:49:15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "ArticleCategory对象", description = "文章分类表")
@TableName("cms_article_category")
public class ArticleCategory implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "文章分类ID")
@TableId(value = "category_id", type = IdType.AUTO)
private Integer categoryId;
@ApiModelProperty(value = "分类名称")
private String title;
@ApiModelProperty(value = "分类索引图")
private String image;
@ApiModelProperty(value = "上级分类ID")
private Integer parentId;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1禁用")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "商户编号")
private String merchantCode;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
}
@@ -0,0 +1,71 @@
package com.gxwebsoft.cms.entity;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 文档管理记录表
*
* @author WebSoft
* @since 2022-11-16 11:40:27
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Docs对象", description = "文档管理记录表")
@TableName("cms_docs")
public class Docs implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "文档ID")
@TableId(value = "docs_id", type = IdType.AUTO)
private Integer docsId;
@ApiModelProperty(value = "文档标题")
private String title;
@ApiModelProperty(value = "上级目录")
private Integer parentId;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "机构id")
private Integer organizationId;
@ApiModelProperty(value = "可见性(public,private,protected)")
private String visibility;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "文档内容")
private String content;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
}
@@ -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.ArticleCategory;
import com.gxwebsoft.cms.param.ArticleCategoryParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 文章分类表Mapper
*
* @author 科技小王子
* @since 2022-11-22 17:49:15
*/
public interface ArticleCategoryMapper extends BaseMapper<ArticleCategory> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<ArticleCategory>
*/
List<ArticleCategory> selectPageRel(@Param("page") IPage<ArticleCategory> page,
@Param("param") ArticleCategoryParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<ArticleCategory> selectListRel(@Param("param") ArticleCategoryParam 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.Article;
import com.gxwebsoft.cms.param.ArticleParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 文章分类表Mapper
*
* @author 科技小王子
* @since 2022-11-22 17:49:15
*/
public interface ArticleMapper extends BaseMapper<Article> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Article>
*/
List<Article> selectPageRel(@Param("page") IPage<Article> page,
@Param("param") ArticleParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Article> selectListRel(@Param("param") ArticleParam 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.Docs;
import com.gxwebsoft.cms.param.DocsParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 文档管理记录表Mapper
*
* @author WebSoft
* @since 2022-11-16 11:40:27
*/
public interface DocsMapper extends BaseMapper<Docs> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Docs>
*/
List<Docs> selectPageRel(@Param("page") IPage<Docs> page,
@Param("param") DocsParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Docs> selectListRel(@Param("param") DocsParam param);
}
@@ -0,0 +1,59 @@
<?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.ArticleCategoryMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM cms_article_category a
<where>
<if test="param.categoryId != null">
AND a.category_id = #{param.categoryId}
</if>
<if test="param.title != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%')
</if>
<if test="param.image != null">
AND a.image LIKE CONCAT('%', #{param.image}, '%')
</if>
<if test="param.parentId != null">
AND a.parent_id = #{param.parentId}
</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.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</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>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.ArticleCategory">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.ArticleCategory">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -0,0 +1,87 @@
<?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.ArticleMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*,
b.nickname,
b.user_id,
b.avatar userAvatar
FROM cms_article a
LEFT JOIN sys_user b ON a.user_id = b.user_id
<where>
<if test="param.articleId != null">
AND a.article_id = #{param.articleId}
</if>
<if test="param.title != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%')
</if>
<if test="param.showType != null">
AND a.show_type = #{param.showType}
</if>
<if test="param.categoryId != null">
AND a.category_id = #{param.categoryId}
</if>
<if test="param.image != null">
AND a.image LIKE CONCAT('%', #{param.image}, '%')
</if>
<if test="param.source != null">
AND a.source LIKE CONCAT('%', #{param.source}, '%')
</if>
<if test="param.content != null">
AND a.content LIKE CONCAT('%', #{param.content}, '%')
</if>
<if test="param.virtualViews != null">
AND a.virtual_views = #{param.virtualViews}
</if>
<if test="param.actualViews != null">
AND a.actual_views = #{param.actualViews}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.shopId != null">
AND a.shop_id = #{param.shopId}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</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.userId != null">
AND b.user_id = #{param.userId}
</if>
<if test="param.nickname != null">
AND b.nickname LIKE CONCAT('%', #{param.nickname}, '%')
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.Article">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.Article">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -0,0 +1,68 @@
<?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.DocsMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.docs_id, a.title, a.parent_id, a.user_id, a.sort_number, a.comments, a.status, a.merchant_code
FROM cms_docs a
<where>
<if test="param.docsId != null">
AND a.docs_id = #{param.docsId}
</if>
<if test="param.title != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%')
</if>
<if test="param.parentId != null">
AND a.parent_id = #{param.parentId}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.organizationId != null">
AND a.organization_id = #{param.organizationId}
</if>
<if test="param.shopId != null">
AND a.shop_id = #{param.shopId}
</if>
<if test="param.visibility != null">
AND a.visibility LIKE CONCAT('%', #{param.visibility}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.content != null">
AND a.content LIKE CONCAT('%', #{param.content}, '%')
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</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>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.Docs">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.Docs">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -0,0 +1,62 @@
package com.gxwebsoft.cms.param;
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 科技小王子
* @since 2022-11-22 17:49:15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ArticleCategoryParam对象", description = "文章分类表查询参数")
public class ArticleCategoryParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "文章分类ID")
@QueryField(type = QueryType.EQ)
private Integer categoryId;
@ApiModelProperty(value = "分类名称")
private String title;
@ApiModelProperty(value = "分类图片")
private String image;
@ApiModelProperty(value = "上级分类ID")
@QueryField(type = QueryType.EQ)
private Integer parentId;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "所属门店ID")
@QueryField(type = QueryType.EQ)
private Integer shopId;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@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,85 @@
package com.gxwebsoft.cms.param;
import com.baomidou.mybatisplus.annotation.TableField;
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 WebSoft
* @since 2022-11-16 11:40:27
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "ArticleParam对象", description = "文章记录表查询参数")
public class ArticleParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "文章ID")
@QueryField(type = QueryType.EQ)
private Integer articleId;
@ApiModelProperty(value = "文章标题")
private String title;
@ApiModelProperty(value = "列表显示方式(10小图展示 20大图展示)")
@QueryField(type = QueryType.EQ)
private Integer showType;
@ApiModelProperty(value = "文章分类ID")
@QueryField(type = QueryType.EQ)
private Integer categoryId;
@ApiModelProperty(value = "封面图")
private String image;
@ApiModelProperty(value = "来源")
private String source;
@ApiModelProperty(value = "文章内容")
private String content;
@ApiModelProperty(value = "虚拟阅读量(仅用作展示)")
@QueryField(type = QueryType.EQ)
private Integer virtualViews;
@ApiModelProperty(value = "实际阅读量")
@QueryField(type = QueryType.EQ)
private Integer actualViews;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "所属门店ID")
@QueryField(type = QueryType.EQ)
private Integer shopId;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
@ApiModelProperty("用户昵称")
@TableField(exist = false)
private String nickname;
}
@@ -0,0 +1,69 @@
package com.gxwebsoft.cms.param;
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 WebSoft
* @since 2022-11-16 11:40:27
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "DocsParam对象", description = "文档管理记录表查询参数")
public class DocsParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "文档ID")
@QueryField(type = QueryType.EQ)
private Integer docsId;
@ApiModelProperty(value = "文档标题")
private String title;
@ApiModelProperty(value = "上级目录")
@QueryField(type = QueryType.EQ)
private Integer parentId;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "机构id")
@QueryField(type = QueryType.EQ)
private Integer organizationId;
@ApiModelProperty(value = "所属门店ID")
@QueryField(type = QueryType.EQ)
private Integer shopId;
@ApiModelProperty(value = "可见性(public,private,protected)")
private String visibility;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "文档内容")
private String content;
@ApiModelProperty(value = "备注")
private String comments;
@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,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.ArticleCategory;
import com.gxwebsoft.cms.param.ArticleCategoryParam;
import java.util.List;
/**
* 文章分类表Service
*
* @author 科技小王子
* @since 2022-11-22 17:49:15
*/
public interface ArticleCategoryService extends IService<ArticleCategory> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<ArticleCategory>
*/
PageResult<ArticleCategory> pageRel(ArticleCategoryParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<ArticleCategory>
*/
List<ArticleCategory> listRel(ArticleCategoryParam param);
/**
* 根据id查询
*
* @param categoryId 文章分类ID
* @return ArticleCategory
*/
ArticleCategory getByIdRel(Integer categoryId);
}
@@ -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.Article;
import com.gxwebsoft.cms.param.ArticleParam;
import java.util.List;
/**
* 文章记录表Service
*
* @author WebSoft
* @since 2022-11-16 11:40:27
*/
public interface ArticleService extends IService<Article> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Article>
*/
PageResult<Article> pageRel(ArticleParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Article>
*/
List<Article> listRel(ArticleParam param);
/**
* 根据id查询
*
* @param articleId 文章ID
* @return Article
*/
Article getByIdRel(Integer articleId);
}
@@ -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.Docs;
import com.gxwebsoft.cms.param.DocsParam;
import java.util.List;
/**
* 文档管理记录表Service
*
* @author WebSoft
* @since 2022-11-16 11:40:27
*/
public interface DocsService extends IService<Docs> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Docs>
*/
PageResult<Docs> pageRel(DocsParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Docs>
*/
List<Docs> listRel(DocsParam param);
/**
* 根据id查询
*
* @param docsId 文档ID
* @return Docs
*/
Docs getByIdRel(Integer docsId);
}
@@ -0,0 +1,47 @@
package com.gxwebsoft.cms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.cms.mapper.ArticleCategoryMapper;
import com.gxwebsoft.cms.service.ArticleCategoryService;
import com.gxwebsoft.cms.entity.ArticleCategory;
import com.gxwebsoft.cms.param.ArticleCategoryParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 文章分类表Service实现
*
* @author 科技小王子
* @since 2022-11-22 17:49:15
*/
@Service
public class ArticleCategoryServiceImpl extends ServiceImpl<ArticleCategoryMapper, ArticleCategory> implements ArticleCategoryService {
@Override
public PageResult<ArticleCategory> pageRel(ArticleCategoryParam param) {
PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>(param);
//page.setDefaultOrder("create_time desc");
List<ArticleCategory> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<ArticleCategory> listRel(ArticleCategoryParam param) {
List<ArticleCategory> list = baseMapper.selectListRel(param);
// 排序
PageParam<ArticleCategory, ArticleCategoryParam> page = new PageParam<>();
//page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public ArticleCategory getByIdRel(Integer categoryId) {
ArticleCategoryParam param = new ArticleCategoryParam();
param.setCategoryId(categoryId);
return param.getOne(baseMapper.selectListRel(param));
}
}
@@ -0,0 +1,47 @@
package com.gxwebsoft.cms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.cms.mapper.ArticleMapper;
import com.gxwebsoft.cms.service.ArticleService;
import com.gxwebsoft.cms.entity.Article;
import com.gxwebsoft.cms.param.ArticleParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 文章记录表Service实现
*
* @author WebSoft
* @since 2022-11-16 11:40:27
*/
@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
@Override
public PageResult<Article> pageRel(ArticleParam param) {
PageParam<Article, ArticleParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<Article> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Article> listRel(ArticleParam param) {
List<Article> list = baseMapper.selectListRel(param);
// 排序
PageParam<Article, ArticleParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public Article getByIdRel(Integer articleId) {
ArticleParam param = new ArticleParam();
param.setArticleId(articleId);
return param.getOne(baseMapper.selectListRel(param));
}
}
@@ -0,0 +1,47 @@
package com.gxwebsoft.cms.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.cms.mapper.DocsMapper;
import com.gxwebsoft.cms.service.DocsService;
import com.gxwebsoft.cms.entity.Docs;
import com.gxwebsoft.cms.param.DocsParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 文档管理记录表Service实现
*
* @author 科技小王子
* @since 2022-11-16 11:40:27
*/
@Service
public class DocsServiceImpl extends ServiceImpl<DocsMapper, Docs> implements DocsService {
@Override
public PageResult<Docs> pageRel(DocsParam param) {
PageParam<Docs, DocsParam> page = new PageParam<>(param);
//page.setDefaultOrder("create_time desc");
List<Docs> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Docs> listRel(DocsParam param) {
List<Docs> list = baseMapper.selectListRel(param);
// 排序
PageParam<Docs, DocsParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc,create_time asc");
return page.sortRecords(list);
}
@Override
public Docs getByIdRel(Integer docsId) {
DocsParam param = new DocsParam();
param.setDocsId(docsId);
return param.getOne(baseMapper.selectListRel(param));
}
}