名医文章
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.common.entity.TaihuTalentArticleComment;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TaihuTalentArticleCommentDao extends MPJBaseMapper<TaihuTalentArticleComment> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.common.entity.TaihuTalentArticle;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TaihuTalentArticleDao extends MPJBaseMapper<TaihuTalentArticle> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.common.entity.TaihuTalentArticleLike;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TaihuTalentArticleLikeDao extends MPJBaseMapper<TaihuTalentArticleLike> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.peanut.modules.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("taihu_talent_article")
|
||||||
|
public class TaihuTalentArticle implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
private Integer userId;
|
||||||
|
//标题
|
||||||
|
private String title;
|
||||||
|
//内容
|
||||||
|
private String content;
|
||||||
|
//图片
|
||||||
|
private String img;
|
||||||
|
//阅读数
|
||||||
|
private Integer readCount;
|
||||||
|
//转发数
|
||||||
|
private Integer forwardCount;
|
||||||
|
private Date createTime;
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
//评论数
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer commentCount;
|
||||||
|
//点赞数
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer likeCount;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer likeFlag;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private TaihuTalent taihuTalent;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.peanut.modules.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("taihu_talent_article_comment")
|
||||||
|
public class TaihuTalentArticleComment implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
private Integer pid;
|
||||||
|
//文章id
|
||||||
|
private Integer articleId;
|
||||||
|
//用户id
|
||||||
|
private Integer userId;
|
||||||
|
//内容
|
||||||
|
private String content;
|
||||||
|
//阅读状态
|
||||||
|
private Integer readFlag;
|
||||||
|
private Date createTime;
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<TaihuTalentArticleComment> children;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.peanut.modules.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("taihu_talent_article_like")
|
||||||
|
public class TaihuTalentArticleLike implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
private Integer articleId;
|
||||||
|
private Integer userId;
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.peanut.modules.common.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.modules.common.entity.TaihuTalentArticleComment;
|
||||||
|
|
||||||
|
public interface TaihuTalentArticleCommentService extends IService<TaihuTalentArticleComment> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.peanut.modules.common.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.modules.common.entity.TaihuTalentArticleLike;
|
||||||
|
|
||||||
|
public interface TaihuTalentArticleLikeService extends IService<TaihuTalentArticleLike> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.peanut.modules.common.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.modules.common.entity.TaihuTalentArticle;
|
||||||
|
|
||||||
|
public interface TaihuTalentArticleService extends IService<TaihuTalentArticle> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.peanut.modules.common.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.modules.common.dao.TaihuTalentArticleCommentDao;
|
||||||
|
import com.peanut.modules.common.entity.TaihuTalentArticleComment;
|
||||||
|
import com.peanut.modules.common.service.TaihuTalentArticleCommentService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("commonTaihuTalentArticleCommentService")
|
||||||
|
public class TaihuTalentArticleCommentServiceImpl extends ServiceImpl<TaihuTalentArticleCommentDao, TaihuTalentArticleComment> implements TaihuTalentArticleCommentService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.peanut.modules.common.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.modules.common.dao.TaihuTalentArticleLikeDao;
|
||||||
|
import com.peanut.modules.common.entity.TaihuTalentArticleLike;
|
||||||
|
import com.peanut.modules.common.service.TaihuTalentArticleLikeService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("commonTaihuTalentArticleLikeService")
|
||||||
|
public class TaihuTalentArticleLikeServiceImpl extends ServiceImpl<TaihuTalentArticleLikeDao, TaihuTalentArticleLike> implements TaihuTalentArticleLikeService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.peanut.modules.common.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.modules.common.dao.TaihuTalentArticleDao;
|
||||||
|
import com.peanut.modules.common.entity.TaihuTalentArticle;
|
||||||
|
import com.peanut.modules.common.service.TaihuTalentArticleService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("commonTaihuTalentArticleService")
|
||||||
|
public class TaihuTalentArticleServiceImpl extends ServiceImpl<TaihuTalentArticleDao, TaihuTalentArticle> implements TaihuTalentArticleService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.peanut.modules.master.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
|
import com.peanut.modules.common.entity.*;
|
||||||
|
import com.peanut.modules.common.service.TaihuTalentArticleCommentService;
|
||||||
|
import com.peanut.modules.common.service.TaihuTalentArticleService;
|
||||||
|
import com.peanut.modules.common.service.TaihuTalentService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController("masterTaihuTalentArticle")
|
||||||
|
@RequestMapping("master/taihuTalentArticle")
|
||||||
|
public class TaihuTalentArticleController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TaihuTalentArticleService taihuTalentArticleService;
|
||||||
|
@Autowired
|
||||||
|
private TaihuTalentService taihuTalentService;
|
||||||
|
@Autowired
|
||||||
|
private TaihuTalentArticleCommentService taihuTalentArticleCommentService;
|
||||||
|
|
||||||
|
//太湖英才文章列表
|
||||||
|
@RequestMapping("/getArticleList")
|
||||||
|
public R getArticleList(@RequestBody Map<String,Object> params){
|
||||||
|
MPJLambdaWrapper<TaihuTalentArticle> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.leftJoin(TaihuTalent.class,TaihuTalent::getUserId,TaihuTalentArticle::getUserId);
|
||||||
|
wrapper.selectAll(TaihuTalentArticle.class);
|
||||||
|
wrapper.like(TaihuTalentArticle::getTitle,params.get("title"));
|
||||||
|
wrapper.like(TaihuTalent::getName,params.get("name"));
|
||||||
|
wrapper.orderByDesc(TaihuTalentArticle::getCreateTime);
|
||||||
|
Page<TaihuTalentArticle> page = taihuTalentArticleService.page(new Page<>(Long.parseLong(params.get("current").toString()),
|
||||||
|
Long.parseLong(params.get("limit").toString())), wrapper);
|
||||||
|
for (TaihuTalentArticle article : page.getRecords()) {
|
||||||
|
article.setTaihuTalent(taihuTalentService.getOne(new LambdaQueryWrapper<TaihuTalent>()
|
||||||
|
.eq(TaihuTalent::getUserId, article.getUserId())));
|
||||||
|
article.setCommentCount((int) taihuTalentArticleCommentService.count(new LambdaQueryWrapper<TaihuTalentArticleComment>()
|
||||||
|
.eq(TaihuTalentArticleComment::getArticleId,article.getId())));
|
||||||
|
}
|
||||||
|
return R.ok().put("page",page);
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增文章
|
||||||
|
@RequestMapping("/addArticle")
|
||||||
|
public R addArticle(@RequestBody TaihuTalentArticle taihuTalentArticle){
|
||||||
|
taihuTalentArticleService.save(taihuTalentArticle);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除文章
|
||||||
|
@RequestMapping("/delArticle")
|
||||||
|
public R delArticle(@RequestBody TaihuTalentArticle taihuTalentArticle){
|
||||||
|
taihuTalentArticleService.removeById(taihuTalentArticle);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
//评论列表
|
||||||
|
@RequestMapping("/getCommentList")
|
||||||
|
public R getCommentList(@RequestBody Map<String,Object> params){
|
||||||
|
MPJLambdaWrapper<TaihuTalentArticleComment> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.leftJoin(MyUserEntity.class,MyUserEntity::getId,TaihuTalentArticleComment::getUserId);
|
||||||
|
wrapper.selectAll(TaihuTalentArticleComment.class);
|
||||||
|
wrapper.like(TaihuTalentArticleComment::getContent,params.get("conten"));
|
||||||
|
if (StringUtils.isNotEmpty(params.get("userInfo").toString())) {
|
||||||
|
wrapper.and(t->t.like(MyUserEntity::getName,params.get("userInfo")).or().like(MyUserEntity::getNickname,params.get("userInfo"))
|
||||||
|
.or().like(MyUserEntity::getTel,params.get("userInfo")).or().like(MyUserEntity::getEmail,params.get("userInfo")));
|
||||||
|
}
|
||||||
|
wrapper.orderByDesc(TaihuTalentArticle::getCreateTime);
|
||||||
|
Page<TaihuTalentArticleComment> page = taihuTalentArticleCommentService.page(new Page<>(Long.parseLong(params.get("current").toString()),
|
||||||
|
Long.parseLong(params.get("limit").toString())), wrapper);
|
||||||
|
return R.ok().put("page",page);
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除评论
|
||||||
|
@RequestMapping("/delComment")
|
||||||
|
public R delComment(@RequestBody TaihuTalentArticleComment comment){
|
||||||
|
taihuTalentArticleCommentService.removeById(comment);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package com.peanut.modules.taihumed.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
|
import com.peanut.modules.common.entity.*;
|
||||||
|
import com.peanut.modules.common.service.*;
|
||||||
|
import com.peanut.modules.sys.entity.SysSensitiveWords;
|
||||||
|
import com.peanut.modules.sys.service.SysSensitiveWordsService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController("commonTaihuTalentArticle")
|
||||||
|
@RequestMapping("common/taihuTalentArticle")
|
||||||
|
public class TaihuTalentArticleController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TaihuTalentArticleService taihuTalentArticleService;
|
||||||
|
@Autowired
|
||||||
|
private TaihuTalentService taihuTalentService;
|
||||||
|
@Autowired
|
||||||
|
private TaihuTalentArticleCommentService taihuTalentArticleCommentService;
|
||||||
|
@Autowired
|
||||||
|
private TaihuTalentArticleLikeService taihuTalentArticleLikeService;
|
||||||
|
@Autowired
|
||||||
|
private SysSensitiveWordsService sysSensitiveWordsService;
|
||||||
|
|
||||||
|
//太湖英才文章列表
|
||||||
|
@RequestMapping("/getArticleList")
|
||||||
|
public R getArticleList(@RequestBody Map<String,Object> params){
|
||||||
|
LambdaQueryWrapper<TaihuTalentArticle> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.orderByDesc(TaihuTalentArticle::getCreateTime);
|
||||||
|
Page<TaihuTalentArticle> page = taihuTalentArticleService.page(new Page<>(Long.parseLong(params.get("current").toString()),
|
||||||
|
Long.parseLong(params.get("limit").toString())), wrapper);
|
||||||
|
for (TaihuTalentArticle article : page.getRecords()) {
|
||||||
|
article.setTaihuTalent(taihuTalentService.getOne(new LambdaQueryWrapper<TaihuTalent>()
|
||||||
|
.eq(TaihuTalent::getUserId, article.getUserId())));
|
||||||
|
article.setCommentCount((int) taihuTalentArticleCommentService.count(new LambdaQueryWrapper<TaihuTalentArticleComment>()
|
||||||
|
.eq(TaihuTalentArticleComment::getArticleId,article.getId())));
|
||||||
|
article.setLikeCount((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
|
||||||
|
.eq(TaihuTalentArticleLike::getArticleId,article.getId())));
|
||||||
|
article.setLikeFlag((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
|
||||||
|
.eq(TaihuTalentArticleLike::getArticleId,article.getId())
|
||||||
|
.eq(TaihuTalentArticleLike::getUserId, ShiroUtils.getUId())));
|
||||||
|
}
|
||||||
|
return R.ok().put("page",page);
|
||||||
|
}
|
||||||
|
|
||||||
|
//太湖英才文章详情
|
||||||
|
@RequestMapping("/getArticleInfo")
|
||||||
|
public R getArticleInfo(@RequestBody Map<String,Object> params){
|
||||||
|
TaihuTalentArticle article = taihuTalentArticleService.getById(params.get("articleId").toString());
|
||||||
|
article.setTaihuTalent(taihuTalentService.getOne(new LambdaQueryWrapper<TaihuTalent>()
|
||||||
|
.eq(TaihuTalent::getUserId, article.getUserId())));
|
||||||
|
article.setCommentCount((int) taihuTalentArticleCommentService.count(new LambdaQueryWrapper<TaihuTalentArticleComment>()
|
||||||
|
.eq(TaihuTalentArticleComment::getArticleId,article.getId())));
|
||||||
|
article.setLikeCount((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
|
||||||
|
.eq(TaihuTalentArticleLike::getArticleId,article.getId())));
|
||||||
|
article.setLikeCount((int) taihuTalentArticleLikeService.count(new LambdaQueryWrapper<TaihuTalentArticleLike>()
|
||||||
|
.eq(TaihuTalentArticleLike::getArticleId,article.getId())
|
||||||
|
.eq(TaihuTalentArticleLike::getUserId, ShiroUtils.getUId())));
|
||||||
|
List<TaihuTalentArticleComment> comments = taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
|
||||||
|
.eq(TaihuTalentArticleComment::getArticleId,article.getId())
|
||||||
|
.eq(TaihuTalentArticleComment::getPid,0)
|
||||||
|
.orderByDesc(TaihuTalentArticleComment::getCreateTime));
|
||||||
|
for (TaihuTalentArticleComment comment : comments) {
|
||||||
|
comment.setChildren(taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
|
||||||
|
.eq(TaihuTalentArticleComment::getArticleId,article.getId())
|
||||||
|
.ne(TaihuTalentArticleComment::getPid,0)
|
||||||
|
.orderByAsc(TaihuTalentArticleComment::getCreateTime)));
|
||||||
|
}
|
||||||
|
if (!Objects.equals(article.getUserId(), ShiroUtils.getUId())){
|
||||||
|
article.setReadCount(article.getReadCount()+1);
|
||||||
|
taihuTalentArticleService.updateById(article);
|
||||||
|
}
|
||||||
|
return R.ok().put("article",article).put("comments",comments);
|
||||||
|
}
|
||||||
|
|
||||||
|
//太湖英才文章点赞或取消
|
||||||
|
@RequestMapping("/addOrCancelArticleLike")
|
||||||
|
public R addOrCancelArticleLike(@RequestBody Map<String,Object> params){
|
||||||
|
TaihuTalentArticleLike like = taihuTalentArticleLikeService.getOne(new LambdaQueryWrapper<TaihuTalentArticleLike>()
|
||||||
|
.eq(TaihuTalentArticleLike::getArticleId,params.get("articleId").toString())
|
||||||
|
.eq(TaihuTalentArticleLike::getUserId,ShiroUtils.getUId()));
|
||||||
|
if (like != null) {
|
||||||
|
taihuTalentArticleLikeService.removeById(like);
|
||||||
|
}else {
|
||||||
|
like = new TaihuTalentArticleLike();
|
||||||
|
like.setUserId(ShiroUtils.getUId());
|
||||||
|
like.setArticleId(Integer.parseInt(params.get("articleId").toString()));
|
||||||
|
taihuTalentArticleLikeService.save(like);
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增文章评论
|
||||||
|
@RequestMapping("/addArticleComment")
|
||||||
|
public R addArticleComment(@RequestBody TaihuTalentArticleComment comment){
|
||||||
|
R result = new R();
|
||||||
|
LambdaQueryWrapper<SysSensitiveWords> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.last(" where instr(\""+comment.getContent()+"\",word)>0");
|
||||||
|
List<SysSensitiveWords> list = sysSensitiveWordsService.list(wrapper);
|
||||||
|
if (list.size() > 0){
|
||||||
|
String str = "";
|
||||||
|
for (SysSensitiveWords words:list) {
|
||||||
|
if ("".equals(str)){
|
||||||
|
str = words.getWord();
|
||||||
|
}else {
|
||||||
|
str = str + "、" + words.getWord();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.put("tip","您的评论含有敏感词:"+str+",请重新输入。");
|
||||||
|
}else {
|
||||||
|
taihuTalentArticleCommentService.save(comment);
|
||||||
|
result.put("tip","评论成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//评论提醒
|
||||||
|
@RequestMapping("/getCommentRemind")
|
||||||
|
public R getCommentRemind(@RequestBody Map<String,Object> params){
|
||||||
|
List<TaihuTalentArticleComment> list = new ArrayList<>();
|
||||||
|
List<TaihuTalentArticleComment> userComments = taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
|
||||||
|
.eq(TaihuTalentArticleComment::getUserId,ShiroUtils.getUId())
|
||||||
|
.eq(TaihuTalentArticleComment::getArticleId,params.get("articleId").toString()));
|
||||||
|
for (TaihuTalentArticleComment comment : userComments) {
|
||||||
|
if(comment.getPid().equals(0)){
|
||||||
|
list.addAll(taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
|
||||||
|
.eq(TaihuTalentArticleComment::getPid,comment.getId())
|
||||||
|
.eq(TaihuTalentArticleComment::getReadFlag,0)
|
||||||
|
.eq(TaihuTalentArticleComment::getArticleId,params.get("articleId").toString())));
|
||||||
|
}else {
|
||||||
|
list.addAll(taihuTalentArticleCommentService.list(new LambdaQueryWrapper<TaihuTalentArticleComment>()
|
||||||
|
.eq(TaihuTalentArticleComment::getPid,comment.getPid())
|
||||||
|
.eq(TaihuTalentArticleComment::getReadFlag,0)
|
||||||
|
.eq(TaihuTalentArticleComment::getArticleId,params.get("articleId").toString())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok().put("list",list);
|
||||||
|
}
|
||||||
|
|
||||||
|
//我的文章列表
|
||||||
|
@RequestMapping("/myArticleList")
|
||||||
|
public R myArticleList(@RequestBody Map<String,Object> params){
|
||||||
|
LambdaQueryWrapper<TaihuTalentArticle> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(TaihuTalentArticle::getUserId,ShiroUtils.getUId());
|
||||||
|
wrapper.orderByDesc(TaihuTalentArticle::getCreateTime);
|
||||||
|
Page<TaihuTalentArticle> page = taihuTalentArticleService.page(new Page<>(Long.parseLong(params.get("current").toString()),
|
||||||
|
Long.parseLong(params.get("limit").toString())), wrapper);
|
||||||
|
return R.ok().put("page",page);
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增文章
|
||||||
|
@RequestMapping("/addArticle")
|
||||||
|
public R addArticle(@RequestBody TaihuTalentArticle taihuTalentArticle){
|
||||||
|
taihuTalentArticle.setUserId(ShiroUtils.getUId());
|
||||||
|
taihuTalentArticleService.save(taihuTalentArticle);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user