第一次提交
This commit is contained in:
@@ -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,170 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.entity.ArticleComment;
|
||||
import com.gxwebsoft.cms.param.ArticleCommentParam;
|
||||
import com.gxwebsoft.cms.param.ArticleParam;
|
||||
import com.gxwebsoft.cms.service.ArticleCommentService;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.love.socketio.cache.ClientCache;
|
||||
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 2023-07-07 14:14:35
|
||||
*/
|
||||
@Api(tags = "文章评论表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/article-comment")
|
||||
public class ArticleCommentController extends BaseController {
|
||||
@Resource
|
||||
private ArticleCommentService articleCommentService;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
|
||||
@Resource
|
||||
private ClientCache clientCache;
|
||||
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("获取未读评论数")
|
||||
@GetMapping("/unread")
|
||||
public ApiResult<Integer> page() {
|
||||
User loginUser = getLoginUser();
|
||||
return success(articleCommentService.getUserUnReadCount(loginUser.getUserId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("分页查询文章评论表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ArticleComment>> page(ArticleCommentParam param) {
|
||||
User loginUser = getLoginUser();
|
||||
// 使用关联查询
|
||||
if(loginUser != null){
|
||||
param.setLoginUserId(getLoginUserId());
|
||||
}
|
||||
// 使用关联查询
|
||||
return success(articleCommentService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部文章评论表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ArticleComment>> list(ArticleCommentParam param) {
|
||||
// 使用关联查询
|
||||
return success(articleCommentService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询文章评论表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<PageResult<Article>> get(@PathVariable("id") Integer id) {
|
||||
final ArticleComment comment = articleCommentService.getByIdRel(id);
|
||||
// 查询文章
|
||||
ArticleParam param = new ArticleParam();
|
||||
param.setArticleId(comment.getArticleId());
|
||||
comment.setStatus(1);
|
||||
articleCommentService.updateById(comment);
|
||||
final PageResult<Article> result = articleService.pageRel(param);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("添加文章评论表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ArticleComment articleComment) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
articleComment.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (articleCommentService.save(articleComment)) {
|
||||
// 累加文章评论数量
|
||||
final Article article = articleService.getById(articleComment.getArticleId());
|
||||
article.setCommentNumbers(articleComment.getCountComment() + 1);
|
||||
articleService.updateById(article);
|
||||
// 获取未读评论数
|
||||
int count = articleCommentService.getUserUnReadCount(articleComment.getToUserId());
|
||||
if(!articleComment.getUserId().equals(articleComment.getToUserId())){
|
||||
clientCache.sendUserEvent(articleComment.getToUserId() + "", "pyq", count);
|
||||
}
|
||||
return success("发表成功",article);
|
||||
}
|
||||
return fail("发表失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改文章评论表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ArticleComment articleComment) {
|
||||
if (articleCommentService.updateById(articleComment)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除文章评论表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (articleCommentService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量添加文章评论表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ArticleComment> list) {
|
||||
if (articleCommentService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改文章评论表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ArticleComment> batchParam) {
|
||||
if (batchParam.update(articleCommentService, "comment_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除文章评论表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (articleCommentService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.param.ArticleParam;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
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) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
param.setLoginUserId(loginUser.getUserId());
|
||||
// 按用户所在城市查询
|
||||
if (param.getScene() != null && param.getScene().equals("intraCity")) {
|
||||
param.setCity(loginUser.getCity());
|
||||
}
|
||||
}
|
||||
return success(articleService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:article:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部文章记录表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Article>> list(ArticleParam param) {
|
||||
// 使用关联查询
|
||||
return success(articleService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:article:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询文章记录表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Article> get(@PathVariable("id") Integer 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.getUserId() == 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,162 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.entity.ArticleLike;
|
||||
import com.gxwebsoft.cms.param.ArticleLikeParam;
|
||||
import com.gxwebsoft.cms.service.ArticleLikeService;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
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 2023-07-07 13:00:03
|
||||
*/
|
||||
@Api(tags = "点赞文章管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/article-like")
|
||||
public class ArticleLikeController extends BaseController {
|
||||
@Resource
|
||||
private ArticleLikeService articleLikeService;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("分页查询点赞文章")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ArticleLike>> page(ArticleLikeParam param) {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
param.setUserId(loginUser.getUserId());
|
||||
}
|
||||
return success(articleLikeService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部点赞文章")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ArticleLike>> list(ArticleLikeParam param) {
|
||||
// 使用关联查询
|
||||
return success(articleLikeService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询点赞文章")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ArticleLike> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(articleLikeService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加点赞文章")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ArticleLike articleLike) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return fail("请先登录",null);
|
||||
}
|
||||
// 获取文章
|
||||
Article article = articleService.getById(articleLike.getArticleId());
|
||||
// 我是否已点赞
|
||||
ArticleLike one = articleLikeService.getOne(new LambdaQueryWrapper<ArticleLike>()
|
||||
.eq(ArticleLike::getArticleId, articleLike.getArticleId())
|
||||
.eq(ArticleLike::getUserId, loginUser.getUserId()));
|
||||
|
||||
articleLike.setUserId(loginUser.getUserId());
|
||||
|
||||
if (!articleLike.getLiked() && one == null) {
|
||||
// 点赞行为
|
||||
articleLikeService.save(articleLike);
|
||||
// 更新点赞数量
|
||||
article.setLikes(article.getLikes() + 1);
|
||||
article.setLiked(true);
|
||||
articleService.updateById(article);
|
||||
return success("点赞成功",article);
|
||||
}else if(articleLike.getLiked() && one != null) {
|
||||
// 取消点赞
|
||||
articleLikeService.removeById(one.getId());
|
||||
// 更新点赞数量
|
||||
article.setLikes(article.getLikes() - 1);
|
||||
article.setLiked(false);
|
||||
articleService.updateById(article);
|
||||
return success("已取消点赞",article);
|
||||
}else {
|
||||
article.setLiked(!articleLike.getLiked());
|
||||
return success("操作失败",article);
|
||||
}
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改点赞文章")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ArticleLike articleLike) {
|
||||
if (articleLikeService.updateById(articleLike)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除点赞文章")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (articleLikeService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量添加点赞文章")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ArticleLike> list) {
|
||||
if (articleLikeService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改点赞文章")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ArticleLike> batchParam) {
|
||||
if (batchParam.update(articleLikeService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除点赞文章")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (articleLikeService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
139
src/main/java/com/gxwebsoft/cms/controller/DocsController.java
Normal file
139
src/main/java/com/gxwebsoft/cms/controller/DocsController.java
Normal file
@@ -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("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
151
src/main/java/com/gxwebsoft/cms/entity/Article.java
Normal file
151
src/main/java/com/gxwebsoft/cms/entity/Article.java
Normal file
@@ -0,0 +1,151 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文章记录表
|
||||
*
|
||||
* @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 = "话题")
|
||||
private String topic;
|
||||
|
||||
@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 = "发布来源客户端")
|
||||
private String platform;
|
||||
|
||||
@ApiModelProperty(value = "文章附件")
|
||||
private String files;
|
||||
|
||||
@ApiModelProperty(value = "视频文件地址")
|
||||
private String video;
|
||||
|
||||
@ApiModelProperty(value = "上传文件类型")
|
||||
private String accept;
|
||||
|
||||
@ApiModelProperty(value = "经度")
|
||||
private String longitude;
|
||||
|
||||
@ApiModelProperty(value = "纬度")
|
||||
private String latitude;
|
||||
|
||||
@ApiModelProperty(value = "所在省份")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "所在城市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "所在辖区")
|
||||
private String region;
|
||||
|
||||
@ApiModelProperty("文章发布地点")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty("获赞数")
|
||||
private Integer likes;
|
||||
|
||||
@ApiModelProperty("评论数")
|
||||
private Integer commentNumbers;
|
||||
|
||||
@ApiModelProperty("提醒谁看")
|
||||
private String toUsers;
|
||||
|
||||
@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;
|
||||
|
||||
@ApiModelProperty(value = "所在城市")
|
||||
@TableField(exist = false)
|
||||
private String userCity;
|
||||
|
||||
@ApiModelProperty(value = "是否关注")
|
||||
@TableField(exist = false)
|
||||
private Boolean follow;
|
||||
|
||||
@ApiModelProperty(value = "是否点赞")
|
||||
@TableField(exist = false)
|
||||
private Boolean liked;
|
||||
|
||||
@ApiModelProperty(value = "年龄")
|
||||
@TableField(exist = false)
|
||||
private String age;
|
||||
|
||||
@ApiModelProperty(value = "年龄")
|
||||
@TableField(exist = false)
|
||||
private String position;
|
||||
|
||||
}
|
||||
69
src/main/java/com/gxwebsoft/cms/entity/ArticleCategory.java
Normal file
69
src/main/java/com/gxwebsoft/cms/entity/ArticleCategory.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文章分类表
|
||||
*
|
||||
* @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;
|
||||
|
||||
}
|
||||
151
src/main/java/com/gxwebsoft/cms/entity/ArticleComment.java
Normal file
151
src/main/java/com/gxwebsoft/cms/entity/ArticleComment.java
Normal file
@@ -0,0 +1,151 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章评论表
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-07 14:14:35
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "ArticleComment对象", description = "文章评论表")
|
||||
@TableName("cms_article_comment")
|
||||
public class ArticleComment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "评价ID")
|
||||
@TableId(value = "comment_id", type = IdType.AUTO)
|
||||
private Integer commentId;
|
||||
|
||||
@ApiModelProperty(value = "评分 (10好评 20中评 30差评)")
|
||||
private Integer score;
|
||||
|
||||
@ApiModelProperty(value = "评价内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "是否为图片评价")
|
||||
private Integer isPicture;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "回复的评论ID")
|
||||
private Integer replyCommentId;
|
||||
|
||||
@ApiModelProperty(value = "回复者ID")
|
||||
private Integer replyUserId;
|
||||
|
||||
@ApiModelProperty(value = "被评论者ID")
|
||||
private Integer toUserId;
|
||||
|
||||
@ApiModelProperty(value = "文章ID")
|
||||
private Integer articleId;
|
||||
|
||||
@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 avatar;
|
||||
|
||||
@ApiModelProperty(value = "评论条数")
|
||||
@TableField(exist = false)
|
||||
private Integer countComment;
|
||||
|
||||
@ApiModelProperty(value = "评论者粉丝数")
|
||||
@TableField(exist = false)
|
||||
private Integer fans;
|
||||
|
||||
@ApiModelProperty(value = "是否已点赞")
|
||||
@TableField(exist = false)
|
||||
private Integer liked;
|
||||
|
||||
@ApiModelProperty(value = "评论者获赞数")
|
||||
@TableField(exist = false)
|
||||
private Boolean likes;
|
||||
|
||||
@ApiModelProperty(value = "评论者所在省份")
|
||||
@TableField(exist = false)
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "评论者所在城市")
|
||||
@TableField(exist = false)
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "被评论者昵称")
|
||||
@TableField(exist = false)
|
||||
private String toUserNickname;
|
||||
|
||||
@ApiModelProperty(value = "被评论者头像")
|
||||
@TableField(exist = false)
|
||||
private String toUserAvatar;
|
||||
|
||||
@ApiModelProperty(value = "被评论者粉丝数")
|
||||
@TableField(exist = false)
|
||||
private Integer toUserFans;
|
||||
|
||||
@ApiModelProperty(value = "被评论者所在省份")
|
||||
@TableField(exist = false)
|
||||
private String toUserProvince;
|
||||
|
||||
@ApiModelProperty(value = "被评论者所在城市")
|
||||
@TableField(exist = false)
|
||||
private String toUserCity;
|
||||
|
||||
@ApiModelProperty(value = "被评论者获赞数")
|
||||
@TableField(exist = false)
|
||||
private Integer toUserLikes;
|
||||
|
||||
@ApiModelProperty(value = "回复者昵称")
|
||||
@TableField(exist = false)
|
||||
private String replyNickname;
|
||||
|
||||
@ApiModelProperty(value = "回复者头像")
|
||||
@TableField(exist = false)
|
||||
private String replyAvatar;
|
||||
|
||||
@ApiModelProperty(value = "回复者粉丝数")
|
||||
@TableField(exist = false)
|
||||
private Integer replyFans;
|
||||
|
||||
@ApiModelProperty(value = "子评论列表")
|
||||
@TableField(exist = false)
|
||||
private List<ArticleComment> children;
|
||||
|
||||
}
|
||||
52
src/main/java/com/gxwebsoft/cms/entity/ArticleLike.java
Normal file
52
src/main/java/com/gxwebsoft/cms/entity/ArticleLike.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 点赞文章
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-07 13:00:03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "ArticleLike对象", description = "点赞文章")
|
||||
@TableName("cms_article_like")
|
||||
public class ArticleLike implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "文章ID")
|
||||
private Integer articleId;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "是否已点赞")
|
||||
@TableField(exist = false)
|
||||
private Boolean liked;
|
||||
|
||||
@ApiModelProperty(value = "文章点赞数量")
|
||||
@TableField(exist = false)
|
||||
private Integer likes;
|
||||
|
||||
}
|
||||
72
src/main/java/com/gxwebsoft/cms/entity/Docs.java
Normal file
72
src/main/java/com/gxwebsoft/cms/entity/Docs.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文档管理记录表
|
||||
*
|
||||
* @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.ArticleComment;
|
||||
import com.gxwebsoft.cms.param.ArticleCommentParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章评论表Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-07 14:14:35
|
||||
*/
|
||||
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.ArticleLike;
|
||||
import com.gxwebsoft.cms.param.ArticleLikeParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 点赞文章Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-07 13:00:03
|
||||
*/
|
||||
public interface ArticleLikeMapper extends BaseMapper<ArticleLike> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<ArticleLike>
|
||||
*/
|
||||
List<ArticleLike> selectPageRel(@Param("page") IPage<ArticleLike> page,
|
||||
@Param("param") ArticleLikeParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<ArticleLike> selectListRel(@Param("param") ArticleLikeParam param);
|
||||
|
||||
}
|
||||
37
src/main/java/com/gxwebsoft/cms/mapper/ArticleMapper.java
Normal file
37
src/main/java/com/gxwebsoft/cms/mapper/ArticleMapper.java
Normal file
@@ -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);
|
||||
|
||||
}
|
||||
37
src/main/java/com/gxwebsoft/cms/mapper/DocsMapper.java
Normal file
37
src/main/java/com/gxwebsoft/cms/mapper/DocsMapper.java
Normal file
@@ -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 >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{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,78 @@
|
||||
<?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.*,
|
||||
b.nickname as toUserNickname, b.avatar as toUserAvatar,b.fans as toUserFans,b.province as toUserProvince,b.city as toUserCity,b.likes as toUserLikes,
|
||||
c.nickname,c.avatar,c.fans,c.province,c.city,c.likes,
|
||||
d.nickname as replyNickname,d.avatar as replyAvatar,d.fans as replyFans
|
||||
FROM cms_article_comment a
|
||||
LEFT JOIN sys_user b ON a.to_user_id = b.user_id
|
||||
LEFT JOIN sys_user c ON a.user_id = c.user_id
|
||||
LEFT JOIN sys_user d ON a.reply_user_id = d.user_id
|
||||
<where>
|
||||
<if test="param.commentId != null">
|
||||
AND a.comment_id = #{param.commentId}
|
||||
</if>
|
||||
<if test="param.score != null">
|
||||
AND a.score = #{param.score}
|
||||
</if>
|
||||
<if test="param.content != null">
|
||||
AND a.content LIKE CONCAT('%', #{param.content}, '%')
|
||||
</if>
|
||||
<if test="param.isPicture != null">
|
||||
AND a.is_picture = #{param.isPicture}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.toUserId != null">
|
||||
AND a.to_user_id = #{param.toUserId}
|
||||
</if>
|
||||
<if test="param.articleId != null">
|
||||
AND a.article_id = #{param.articleId}
|
||||
</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.merchantCode != null">
|
||||
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<!-- 查询未读评论 -->
|
||||
<if test="param.sceneType == 'UN_READ_COMMENT'">
|
||||
AND (a.to_user_id = #{param.loginUserId})
|
||||
</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>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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.ArticleLikeMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM cms_article_like 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.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.ArticleLike">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.ArticleLike">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
109
src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleMapper.xml
Normal file
109
src/main/java/com/gxwebsoft/cms/mapper/xml/ArticleMapper.xml
Normal file
@@ -0,0 +1,109 @@
|
||||
<?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,b.city as userCity,
|
||||
b.age,
|
||||
c.position
|
||||
FROM cms_article a
|
||||
LEFT JOIN sys_user b ON a.user_id = b.user_id
|
||||
LEFT JOIN love_user_profile c ON a.user_id = c.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.topic != null">
|
||||
AND a.topic = #{param.topic}
|
||||
</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.showFollow != null">
|
||||
AND b.deleted = 0
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{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>
|
||||
<if test="param.gender != null">
|
||||
AND b.sex = #{param.gender}
|
||||
</if>
|
||||
<if test="param.city != null">
|
||||
AND b.city = #{param.city}
|
||||
</if>
|
||||
<if test="param.userIds != null">
|
||||
AND b.user_id IN
|
||||
<foreach collection="param.userIds" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- <if test="param.sceneType == 'LOVE_INDEX'">-->
|
||||
<!-- ORDER BY rand()-->
|
||||
<!-- </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>
|
||||
68
src/main/java/com/gxwebsoft/cms/mapper/xml/DocsMapper.xml
Normal file
68
src/main/java/com/gxwebsoft/cms/mapper/xml/DocsMapper.xml
Normal file
@@ -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 >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{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,79 @@
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 文章评论表查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-07 14:14:35
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "ArticleCommentParam对象", description = "文章评论表查询参数")
|
||||
public class ArticleCommentParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "评价ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer commentId;
|
||||
|
||||
@ApiModelProperty(value = "评分 (10好评 20中评 30差评)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer score;
|
||||
|
||||
@ApiModelProperty(value = "评价内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "是否为图片评价")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer isPicture;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "被评价者ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer toUserId;
|
||||
|
||||
@ApiModelProperty(value = "回复者ID")
|
||||
@TableField(exist = false)
|
||||
private Integer replyUserId;
|
||||
|
||||
@ApiModelProperty(value = "文章ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer articleId;
|
||||
|
||||
@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(value = "商户编码")
|
||||
private String merchantCode;
|
||||
|
||||
@ApiModelProperty(value = "当前登录用户ID")
|
||||
@TableField(exist = false)
|
||||
private Integer loginUserId;
|
||||
|
||||
}
|
||||
41
src/main/java/com/gxwebsoft/cms/param/ArticleLikeParam.java
Normal file
41
src/main/java/com/gxwebsoft/cms/param/ArticleLikeParam.java
Normal file
@@ -0,0 +1,41 @@
|
||||
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 2023-07-07 13:00:03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "ArticleLikeParam对象", description = "点赞文章查询参数")
|
||||
public class ArticleLikeParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "文章ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer articleId;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "客户端")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String platform;
|
||||
|
||||
}
|
||||
114
src/main/java/com/gxwebsoft/cms/param/ArticleParam.java
Normal file
114
src/main/java/com/gxwebsoft/cms/param/ArticleParam.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 文章记录表查询参数
|
||||
*
|
||||
* @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;
|
||||
|
||||
@ApiModelProperty("查询关注状态")
|
||||
private Boolean showFollow;
|
||||
|
||||
@ApiModelProperty(value = "当前登录用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer loginUserId;
|
||||
|
||||
@ApiModelProperty(value = "按性别筛选")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer gender;
|
||||
|
||||
@ApiModelProperty(value = "场景")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String scene;
|
||||
|
||||
@ApiModelProperty(value = "按用户所在城市查询")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "话题")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private String topic;
|
||||
|
||||
@ApiModelProperty(value = "用户id集合")
|
||||
@TableField(exist = false)
|
||||
private Set<Integer> userIds;
|
||||
|
||||
}
|
||||
69
src/main/java/com/gxwebsoft/cms/param/DocsParam.java
Normal file
69
src/main/java/com/gxwebsoft/cms/param/DocsParam.java
Normal file
@@ -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,44 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.cms.entity.ArticleComment;
|
||||
import com.gxwebsoft.cms.param.ArticleCommentParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文章评论表Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-07 14:14:35
|
||||
*/
|
||||
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 commentId 评价ID
|
||||
* @return ArticleComment
|
||||
*/
|
||||
ArticleComment getByIdRel(Integer commentId);
|
||||
|
||||
int getUserUnReadCount(Integer userId);
|
||||
|
||||
}
|
||||
@@ -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.ArticleLike;
|
||||
import com.gxwebsoft.cms.param.ArticleLikeParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 点赞文章Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-07 13:00:03
|
||||
*/
|
||||
public interface ArticleLikeService extends IService<ArticleLike> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<ArticleLike>
|
||||
*/
|
||||
PageResult<ArticleLike> pageRel(ArticleLikeParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<ArticleLike>
|
||||
*/
|
||||
List<ArticleLike> listRel(ArticleLikeParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id 主键ID
|
||||
* @return ArticleLike
|
||||
*/
|
||||
ArticleLike getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
42
src/main/java/com/gxwebsoft/cms/service/ArticleService.java
Normal file
42
src/main/java/com/gxwebsoft/cms/service/ArticleService.java
Normal file
@@ -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);
|
||||
|
||||
}
|
||||
42
src/main/java/com/gxwebsoft/cms/service/DocsService.java
Normal file
42
src/main/java/com/gxwebsoft/cms/service/DocsService.java
Normal file
@@ -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,100 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.entity.ArticleComment;
|
||||
import com.gxwebsoft.cms.entity.ArticleLike;
|
||||
import com.gxwebsoft.cms.mapper.ArticleCommentMapper;
|
||||
import com.gxwebsoft.cms.param.ArticleCommentParam;
|
||||
import com.gxwebsoft.cms.service.ArticleCommentService;
|
||||
import com.gxwebsoft.cms.service.ArticleLikeService;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 文章评论表Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-07 14:14:35
|
||||
*/
|
||||
@Service
|
||||
public class ArticleCommentServiceImpl extends ServiceImpl<ArticleCommentMapper, ArticleComment> implements ArticleCommentService {
|
||||
|
||||
@Resource
|
||||
private ArticleLikeService articleLikeService;
|
||||
|
||||
@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);
|
||||
|
||||
// 获取带点赞状态和评论的文章列表
|
||||
if (param.getSceneType() != null && param.getSceneType().equals("UN_READ_COMMENT")) {
|
||||
// 更新为已读
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
Set<Integer> commentIds = list.stream().map(ArticleComment::getCommentId).collect(Collectors.toSet());
|
||||
LambdaUpdateWrapper<ArticleComment> updateWrapper = new LambdaUpdateWrapper<ArticleComment>()
|
||||
.in(ArticleComment::getCommentId, commentIds)
|
||||
.set(ArticleComment::getStatus, 1);
|
||||
baseMapper.update(null, updateWrapper);
|
||||
}
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
// 我点赞的人
|
||||
final List<ArticleLike> myLikes = articleLikeService.list(new LambdaQueryWrapper<ArticleLike>().eq(ArticleLike::getUserId, param.getLoginUserId()));
|
||||
list.forEach(d -> {
|
||||
final boolean isLike = myLikes.stream().anyMatch(f -> f.getUserId().equals(param.getLoginUserId()));
|
||||
d.setLikes(isLike);
|
||||
});
|
||||
// List转为树形结构
|
||||
final List<ArticleComment> articleComments = CommonUtil.toTreeData(list, 0, ArticleComment::getReplyCommentId, ArticleComment::getCommentId, ArticleComment::setChildren);
|
||||
return new PageResult<>(articleComments, 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");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArticleComment getByIdRel(Integer commentId) {
|
||||
ArticleCommentParam param = new ArticleCommentParam();
|
||||
param.setCommentId(commentId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUserUnReadCount(Integer userId) {
|
||||
// List<Article> list = articleService.list(new LambdaQueryWrapper<Article>().eq(Article::getUserId, userId).select(Article::getArticleId));
|
||||
// Set<Integer> articleIds = list.stream().map(Article::getArticleId).collect(Collectors.toSet());
|
||||
int count = baseMapper.selectCount(
|
||||
new LambdaQueryWrapper<>(ArticleComment.class)
|
||||
// .in(ArticleComment::getArticleId, articleIds)
|
||||
.eq(ArticleComment::getStatus, 0)
|
||||
.eq(ArticleComment::getToUserId, userId)
|
||||
);
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.ArticleLikeMapper;
|
||||
import com.gxwebsoft.cms.service.ArticleLikeService;
|
||||
import com.gxwebsoft.cms.entity.ArticleLike;
|
||||
import com.gxwebsoft.cms.param.ArticleLikeParam;
|
||||
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 2023-07-07 13:00:03
|
||||
*/
|
||||
@Service
|
||||
public class ArticleLikeServiceImpl extends ServiceImpl<ArticleLikeMapper, ArticleLike> implements ArticleLikeService {
|
||||
|
||||
@Override
|
||||
public PageResult<ArticleLike> pageRel(ArticleLikeParam param) {
|
||||
PageParam<ArticleLike, ArticleLikeParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<ArticleLike> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleLike> listRel(ArticleLikeParam param) {
|
||||
List<ArticleLike> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<ArticleLike, ArticleLikeParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArticleLike getByIdRel(Integer id) {
|
||||
ArticleLikeParam param = new ArticleLikeParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
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.entity.Article;
|
||||
import com.gxwebsoft.cms.entity.ArticleLike;
|
||||
import com.gxwebsoft.cms.mapper.ArticleMapper;
|
||||
import com.gxwebsoft.cms.param.ArticleParam;
|
||||
import com.gxwebsoft.cms.service.ArticleLikeService;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.shop.entity.UserFollow;
|
||||
import com.gxwebsoft.shop.service.UserFollowService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 文章记录表Service实现
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2022-11-16 11:40:27
|
||||
*/
|
||||
@Service
|
||||
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
|
||||
@Resource
|
||||
private UserFollowService userFollowService;
|
||||
@Resource
|
||||
private ArticleLikeService articleLikeService;
|
||||
|
||||
@Override
|
||||
public PageResult<Article> pageRel(ArticleParam param) {
|
||||
PageParam<Article, ArticleParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
// 搜素条件
|
||||
if (param.getScene() != null) {
|
||||
// 最新
|
||||
if (param.getScene().equals("new")) {
|
||||
param.setCity(null);
|
||||
param.setUserIds(null);
|
||||
}
|
||||
// 同城intraCity
|
||||
if (param.getScene().equals("intraCity")) {
|
||||
param.setCity(param.getCity());
|
||||
}
|
||||
// 关注focus
|
||||
if (param.getScene().equals("focus")) {
|
||||
final List<UserFollow> myFocus = userFollowService.list(new LambdaQueryWrapper<UserFollow>().eq(UserFollow::getUserId, param.getLoginUserId()));
|
||||
if (!CollectionUtils.isEmpty(myFocus)) {
|
||||
final Set<Integer> collect = myFocus.stream().map(UserFollow::getShopId).collect(Collectors.toSet());
|
||||
param.setUserIds(collect);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据列表
|
||||
List<Article> list = baseMapper.selectPageRel(page, param);
|
||||
// 我关注的人
|
||||
final List<UserFollow> myFollows = userFollowService.list(new LambdaQueryWrapper<UserFollow>().eq(UserFollow::getUserId, param.getLoginUserId()));
|
||||
// 我点赞的文章
|
||||
final List<ArticleLike> myLikes = articleLikeService.list(new LambdaQueryWrapper<ArticleLike>().eq(ArticleLike::getUserId, param.getLoginUserId()));
|
||||
// 是否显示关注状态
|
||||
if(param.getShowFollow() != null){
|
||||
list.forEach(d -> {
|
||||
// 是否关注
|
||||
final boolean isFollows = myFollows.stream().filter(f -> f.getShopId().equals(d.getUserId())).findFirst().isPresent();
|
||||
final boolean isLike = myLikes.stream().filter(f -> f.getArticleId().equals(d.getArticleId())).findFirst().isPresent();
|
||||
d.setFollow(isFollows);
|
||||
d.setLiked(isLike);
|
||||
});
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user