Commit 507cec2d authored by 万成波's avatar 万成波

代码优化

parent b72761d6
...@@ -13,13 +13,6 @@ spring: ...@@ -13,13 +13,6 @@ spring:
url: jdbc:mysql://47.110.32.247:3306/safe_campus_bbs?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&tinyInt1isBit=false&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowMultiQueries=true url: jdbc:mysql://47.110.32.247:3306/safe_campus_bbs?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&tinyInt1isBit=false&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowMultiQueries=true
username: mysql username: mysql
password: passWd2025@tangguo.ren password: passWd2025@tangguo.ren
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url: jdbc:mysql://47.110.32.247:3306/qyweixin-campus-dev?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&tinyInt1isBit=false&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowMultiQueries=true
username: mysql
password: passWd2025@tangguo.ren
# 初始连接数 # 初始连接数
initialSize: 5 initialSize: 5
# 最小连接池数量 # 最小连接池数量
......
# 项目相关配置
ruoyi:
profile: /home/safe-campus-bbs/resources
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://47.110.32.247:3306/safe_campus_bbs?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&tinyInt1isBit=false&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowMultiQueries=true
username: mysql
password: passWd2025@tangguo.ren
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url: jdbc:mysql://47.110.32.247:3306/qyweixin-campus-dev?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&tinyInt1isBit=false&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true&allowMultiQueries=true
username: mysql
password: passWd2025@tangguo.ren
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 10000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: false
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# Redis配置
redis:
# 地址
host: localhost
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
# password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# ActiveMQ配置
activemq:
broker-url: tcp://127.0.0.1:61616
packages:
trust-all: true
user: admin
password: admin
jms:
listener:
max-concurrency: 3
# 企业微信配置
wx:
cp:
corp-id: ww63ca87d5f8647514
app-config:
agent-id: 1000044
secret: GqApjJ2aDuntiU5iQ9yqx8JKQwYDMrg1tTHdeeF0BWA
...@@ -52,9 +52,9 @@ public class MBbsMomentController { ...@@ -52,9 +52,9 @@ public class MBbsMomentController {
*/ */
@MobileAuth @MobileAuth
@GetMapping("/moments") @GetMapping("/moments")
public TableDataInfo getMoments(String content) { public TableDataInfo getMoments(QueryMomentBO bo) {
PageUtils.clearPage(); PageUtils.clearPage();
List<BbsMomentListVO> moments = this.momentService.getMoments(content); List<BbsMomentListVO> moments = this.momentService.getMoments(bo);
return TableDataInfo.getDataTable(moments); return TableDataInfo.getDataTable(moments);
} }
......
...@@ -6,8 +6,10 @@ import com.tangguo.common.mauth.MobileAuth; ...@@ -6,8 +6,10 @@ import com.tangguo.common.mauth.MobileAuth;
import com.tangguo.common.utils.PageUtils; import com.tangguo.common.utils.PageUtils;
import com.tangguo.common.utils.ValidateOperations; import com.tangguo.common.utils.ValidateOperations;
import com.tangguo.domain.bo.CreateTopicBO; import com.tangguo.domain.bo.CreateTopicBO;
import com.tangguo.domain.bo.QueryMomentBO;
import com.tangguo.domain.vo.BbsMomentListVO; import com.tangguo.domain.vo.BbsMomentListVO;
import com.tangguo.domain.vo.BbsTopicListVO; import com.tangguo.domain.vo.BbsTopicListVO;
import com.tangguo.service.IBbsMomentService;
import com.tangguo.service.IBbsTopicService; import com.tangguo.service.IBbsTopicService;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -27,6 +29,9 @@ public class MBbsTopicController { ...@@ -27,6 +29,9 @@ public class MBbsTopicController {
@Resource @Resource
private IBbsTopicService topicService; private IBbsTopicService topicService;
@Resource
private IBbsMomentService momentService;
/** /**
* 查询选择话题 * 查询选择话题
...@@ -66,23 +71,23 @@ public class MBbsTopicController { ...@@ -66,23 +71,23 @@ public class MBbsTopicController {
@MobileAuth @MobileAuth
@GetMapping("/ranking") @GetMapping("/ranking")
public AjaxResult getRankingTopic() { public AjaxResult getRankingTopic() {
List<BbsTopicListVO> topics = this.topicService.getRankingTopic(); List<BbsTopicListVO> dbTopics = this.topicService.getRankingTopic();
return AjaxResult.success(topics); return AjaxResult.success(dbTopics);
} }
/** /**
* 查询话题详情 * 查询话题详情
* *
* @param topicId 话题Id * @param bo 查询参数
* @return 话题明细 * @return 话题明细
*/ */
@MobileAuth @MobileAuth
@GetMapping("/details") @GetMapping("/moments")
public TableDataInfo getTopicDetails(@RequestParam Long topicId) { public TableDataInfo getTopicMoments(QueryMomentBO bo) {
PageUtils.startPage(); PageUtils.clearPage();
List<BbsMomentListVO> details = this.topicService.getTopicDetails(topicId); List<BbsMomentListVO> dbMoments = this.momentService.getMoments(bo);
return TableDataInfo.getDataTable(details); return TableDataInfo.getDataTable(dbMoments);
} }
} }
...@@ -5,7 +5,6 @@ import com.tangguo.common.core.controller.BaseController; ...@@ -5,7 +5,6 @@ import com.tangguo.common.core.controller.BaseController;
import com.tangguo.common.core.domain.AjaxResult; import com.tangguo.common.core.domain.AjaxResult;
import com.tangguo.common.core.page.TableDataInfo; import com.tangguo.common.core.page.TableDataInfo;
import com.tangguo.common.enums.BusinessType; import com.tangguo.common.enums.BusinessType;
import com.tangguo.common.utils.SecurityUtils;
import com.tangguo.domain.BbsMoment; import com.tangguo.domain.BbsMoment;
import com.tangguo.domain.vo.BbsMomentListVO; import com.tangguo.domain.vo.BbsMomentListVO;
import com.tangguo.service.IBbsMomentService; import com.tangguo.service.IBbsMomentService;
......
package com.tangguo.domain.bo;
import lombok.Data;
/**
*
*
* @author 谈笑
* @createTime 2025-09-05 16:42:48 星期五
*/
@Data
public class QueryMomentBO {
/**
* 话题Id
*/
private Long topicId;
/**
* 动态内容
*/
private String content;
}
...@@ -39,4 +39,7 @@ public class BbsCommentDetailVO { ...@@ -39,4 +39,7 @@ public class BbsCommentDetailVO {
/** 是否本人评论:0 否、1 是 */ /** 是否本人评论:0 否、1 是 */
private Integer isSelf; private Integer isSelf;
/** 评论是否精选:0 否、1 是 */
private Integer isFeatured;
} }
...@@ -2,6 +2,7 @@ package com.tangguo.mapper; ...@@ -2,6 +2,7 @@ package com.tangguo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tangguo.domain.BbsMoment; import com.tangguo.domain.BbsMoment;
import com.tangguo.domain.bo.QueryMomentBO;
import com.tangguo.domain.vo.BbsMomentListVO; import com.tangguo.domain.vo.BbsMomentListVO;
import com.tangguo.domain.vo.BbsUserMomentCountVO; import com.tangguo.domain.vo.BbsUserMomentCountVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -25,7 +26,7 @@ public interface BbsMomentMapper extends BaseMapper<BbsMoment> { ...@@ -25,7 +26,7 @@ public interface BbsMomentMapper extends BaseMapper<BbsMoment> {
List<BbsMomentListVO> selectUserMoments(@Param("userName") String userName, @Param("content") String content); List<BbsMomentListVO> selectUserMoments(@Param("userName") String userName, @Param("content") String content);
List<BbsMomentListVO> selectMoments(@Param("userName") String userName, @Param("content") String content); List<BbsMomentListVO> selectMoments(@Param("userName") String userName, @Param("bo") QueryMomentBO bo);
BbsMomentListVO selectMomentDetail(@Param("momentId") Long momentId, @Param("userName") String userName); BbsMomentListVO selectMomentDetail(@Param("momentId") Long momentId, @Param("userName") String userName);
......
...@@ -2,9 +2,7 @@ package com.tangguo.service; ...@@ -2,9 +2,7 @@ package com.tangguo.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.tangguo.domain.BbsMomentComment; import com.tangguo.domain.BbsMomentComment;
import com.tangguo.domain.bo.FeaturedCommentBO;
import com.tangguo.domain.vo.BbsCommentDetailVO; import com.tangguo.domain.vo.BbsCommentDetailVO;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
......
...@@ -54,10 +54,10 @@ public interface IBbsMomentService extends IService<BbsMoment> { ...@@ -54,10 +54,10 @@ public interface IBbsMomentService extends IService<BbsMoment> {
/** /**
* 查询动态列表 * 查询动态列表
* *
* @param content 动态内容 * @param bo 查询参数
* @return 动态列表 * @return 动态列表
*/ */
List<BbsMomentListVO> getMoments(String content); List<BbsMomentListVO> getMoments(QueryMomentBO bo);
/** /**
......
...@@ -3,7 +3,6 @@ package com.tangguo.service; ...@@ -3,7 +3,6 @@ package com.tangguo.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.tangguo.domain.BbsTopic; import com.tangguo.domain.BbsTopic;
import com.tangguo.domain.bo.CreateTopicBO; import com.tangguo.domain.bo.CreateTopicBO;
import com.tangguo.domain.vo.BbsMomentListVO;
import com.tangguo.domain.vo.BbsTopicListVO; import com.tangguo.domain.vo.BbsTopicListVO;
import java.util.List; import java.util.List;
...@@ -80,15 +79,6 @@ public interface IBbsTopicService extends IService<BbsTopic> { ...@@ -80,15 +79,6 @@ public interface IBbsTopicService extends IService<BbsTopic> {
List<BbsTopicListVO> getRankingTopic(); List<BbsTopicListVO> getRankingTopic();
/**
* 查询话题详情
*
* @param topicId 话题Id
* @return 话题明细
*/
List<BbsMomentListVO> getTopicDetails(Long topicId);
/** /**
* 创建话题 * 创建话题
* *
......
package com.tangguo.service.impl; package com.tangguo.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tangguo.common.enums.CommentStatus; import com.tangguo.common.enums.CommentStatus;
import com.tangguo.common.exception.ServiceException; import com.tangguo.common.exception.ServiceException;
import com.tangguo.domain.BbsMomentComment; import com.tangguo.domain.BbsMomentComment;
import com.tangguo.domain.bo.FeaturedCommentBO;
import com.tangguo.domain.vo.BbsCommentDetailVO; import com.tangguo.domain.vo.BbsCommentDetailVO;
import com.tangguo.mapper.BbsMomentCommentMapper; import com.tangguo.mapper.BbsMomentCommentMapper;
import com.tangguo.service.IBbsMomentCommentService; import com.tangguo.service.IBbsMomentCommentService;
......
...@@ -109,13 +109,13 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment ...@@ -109,13 +109,13 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
/** /**
* 查询动态列表 * 查询动态列表
* *
* @param content 动态内容 * @param bo 查询参数
* @return 动态列表 * @return 动态列表
*/ */
@Override @Override
public List<BbsMomentListVO> getMoments(String content) { public List<BbsMomentListVO> getMoments(QueryMomentBO bo) {
String userName = MobileTokenHelper.getUserName(); String userName = MobileTokenHelper.getUserName();
List<BbsMomentListVO> dbMoments = this.baseMapper.selectMoments(userName, content); List<BbsMomentListVO> dbMoments = this.baseMapper.selectMoments(userName, bo);
this.fillMoment(dbMoments, userName); this.fillMoment(dbMoments, userName);
return dbMoments; return dbMoments;
} }
...@@ -174,13 +174,13 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment ...@@ -174,13 +174,13 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
@Override @Override
public void userDeleteMoment(Long momentId) { public void userDeleteMoment(Long momentId) {
String username = MobileTokenHelper.getUserName(); String username = MobileTokenHelper.getUserName();
BbsMoment dbMoment = this.getOne( BbsMoment dbMoment = this.getById(momentId);
Wrappers.lambdaQuery(BbsMoment.class)
.select(BbsMoment::getId).eq(BbsMoment::getUserName, username).eq(BbsMoment::getId, momentId)
);
if (Objects.isNull(dbMoment)) { if (Objects.isNull(dbMoment)) {
throw new ServiceException("删除失败,未查询到当前动态数据。"); throw new ServiceException("删除失败,未查询到当前动态数据。");
} }
if (!dbMoment.getUserName().equals(username)) {
throw new ServiceException("删除失败,没有对当前动态数据的操作权限。");
}
this.removeById(dbMoment.getId()); this.removeById(dbMoment.getId());
} }
...@@ -397,7 +397,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment ...@@ -397,7 +397,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
// 动态类型 // 动态类型
MomentType momentType = MomentType.getMomentType(bo.getType()); MomentType momentType = MomentType.getMomentType(bo.getType());
if (Objects.isNull(momentType)) { if (Objects.isNull(momentType)) {
throw new ServiceException("发布失败,动态类型错误。"); throw new ServiceException("发布失败,当前动态类型错误。");
} }
// 动态附件 // 动态附件
...@@ -409,12 +409,12 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment ...@@ -409,12 +409,12 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
if (MomentType.TEXT == momentType || MomentType.IMAGE == momentType || MomentType.VIDEO == momentType) { if (MomentType.TEXT == momentType || MomentType.IMAGE == momentType || MomentType.VIDEO == momentType) {
if (MomentType.TEXT == momentType) { if (MomentType.TEXT == momentType) {
if (StrUtil.isBlank(content)) { if (StrUtil.isBlank(content)) {
throw new ServiceException("发布失败,动态内容不能为空。"); throw new ServiceException("发布失败,当前动态内容不能为空。");
} }
} }
if (MomentType.IMAGE == momentType || MomentType.VIDEO == momentType) { if (MomentType.IMAGE == momentType || MomentType.VIDEO == momentType) {
if (CollUtil.isEmpty(attachments)) { if (CollUtil.isEmpty(attachments)) {
throw new ServiceException("发布失败,动态附件不能为空。"); throw new ServiceException("发布失败,当前动态附件不能为空。");
} }
} }
if (StrUtil.isNotBlank(content)) { if (StrUtil.isNotBlank(content)) {
...@@ -430,7 +430,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment ...@@ -430,7 +430,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
else if (MomentType.URL == momentType) { else if (MomentType.URL == momentType) {
String linkUrl = bo.getLinkUrl(); String linkUrl = bo.getLinkUrl();
if (StrUtil.isBlank(linkUrl)) { if (StrUtil.isBlank(linkUrl)) {
throw new ServiceException("发布失败,动态链接不能为空。"); throw new ServiceException("发布失败,当前动态链接不能为空。");
} else { } else {
newMoment.setLinkUrl(linkUrl); newMoment.setLinkUrl(linkUrl);
} }
...@@ -454,7 +454,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment ...@@ -454,7 +454,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
if (EnableStatus.QY.getStatus() == isEnableVote) { if (EnableStatus.QY.getStatus() == isEnableVote) {
VoteOptionType voteType = VoteOptionType.getVoteOptionType(bo.getVoteOptionType()); VoteOptionType voteType = VoteOptionType.getVoteOptionType(bo.getVoteOptionType());
if (Objects.isNull(voteType)) { if (Objects.isNull(voteType)) {
throw new ServiceException("发布失败,动态投票选项类型错误。"); throw new ServiceException("发布失败,当前动态投票选项类型错误。");
} else { } else {
newMoment.setVoteOptionType(voteType.name()); newMoment.setVoteOptionType(voteType.name());
newMoment.setVoteTitle(bo.getVoteTitle()); newMoment.setVoteTitle(bo.getVoteTitle());
...@@ -462,13 +462,13 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment ...@@ -462,13 +462,13 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
List<CreateMomentBO.VoteOption> options = bo.getVoteOptions(); List<CreateMomentBO.VoteOption> options = bo.getVoteOptions();
if (CollUtil.isEmpty(options)) { if (CollUtil.isEmpty(options)) {
throw new ServiceException("发布失败,动态投票选项不能为空。"); throw new ServiceException("发布失败,当前动态投票选项不能为空。");
} else { } else {
for (CreateMomentBO.VoteOption option : options) { for (CreateMomentBO.VoteOption option : options) {
long optionCount = options.stream() long optionCount = options.stream()
.filter(o -> o.getName().equals(option.getName())).count(); .filter(o -> o.getName().equals(option.getName())).count();
if (optionCount > 1) { if (optionCount > 1) {
throw new ServiceException("发布失败,动态投票选项重复。"); throw new ServiceException("发布失败,当前动态投票选项重复。");
} }
} }
} }
...@@ -498,19 +498,28 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment ...@@ -498,19 +498,28 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
CompletableFuture<Map<Long, List<BbsMomentAttachment>>> af = CompletableFuture.supplyAsync(() -> { CompletableFuture<Map<Long, List<BbsMomentAttachment>>> af = CompletableFuture.supplyAsync(() -> {
List<BbsMomentAttachment> atts = this.attachmentsService.getAttachments(momentIds); List<BbsMomentAttachment> atts = this.attachmentsService.getAttachments(momentIds);
return atts.stream().collect(Collectors.groupingBy(BbsMomentAttachment::getMomentId)); return atts.stream().collect(Collectors.groupingBy(BbsMomentAttachment::getMomentId));
}).exceptionally(ex -> new HashMap<>(0)); }).exceptionally(e -> {
log.error("=> 查询动态附件失败:", e);
return new HashMap<>(0);
});
// 查询动态投票选项 // 查询动态投票选项
CompletableFuture<Map<Long, List<BbsMomentVoteOption>>> of = CompletableFuture.supplyAsync(() -> { CompletableFuture<Map<Long, List<BbsMomentVoteOption>>> of = CompletableFuture.supplyAsync(() -> {
List<BbsMomentVoteOption> opts = this.voteOptionService.getVoteOptions(momentIds); List<BbsMomentVoteOption> opts = this.voteOptionService.getVoteOptions(momentIds);
return opts.stream().collect(Collectors.groupingBy(BbsMomentVoteOption::getMomentId)); return opts.stream().collect(Collectors.groupingBy(BbsMomentVoteOption::getMomentId));
}).exceptionally(ex -> new HashMap<>(0)); }).exceptionally(e -> {
log.error("=> 查询动态投票选项失败:", e);
return new HashMap<>(0);
});
// 查询动态评论 // 查询动态评论
CompletableFuture<Map<Long, List<BbsMomentComment>>> cf = CompletableFuture.supplyAsync(() -> { CompletableFuture<Map<Long, List<BbsMomentComment>>> cf = CompletableFuture.supplyAsync(() -> {
List<BbsMomentComment> opts = this.commentService.getMomentLimitComments(momentIds, userName); List<BbsMomentComment> opts = this.commentService.getMomentLimitComments(momentIds, userName);
return opts.stream().collect(Collectors.groupingBy(BbsMomentComment::getMomentId)); return opts.stream().collect(Collectors.groupingBy(BbsMomentComment::getMomentId));
}).exceptionally(ex -> new HashMap<>(0)); }).exceptionally(e -> {
log.error("=> 查询动态评论失败:", e);
return new HashMap<>(0);
});
// 等待全部任务处理完毕 // 等待全部任务处理完毕
CompletableFuture.allOf(af, of, cf).join(); CompletableFuture.allOf(af, of, cf).join();
......
...@@ -15,14 +15,12 @@ import com.tangguo.common.utils.SensitiveWordUtils; ...@@ -15,14 +15,12 @@ import com.tangguo.common.utils.SensitiveWordUtils;
import com.tangguo.common.utils.StringUtils; import com.tangguo.common.utils.StringUtils;
import com.tangguo.domain.BbsTopic; import com.tangguo.domain.BbsTopic;
import com.tangguo.domain.bo.CreateTopicBO; import com.tangguo.domain.bo.CreateTopicBO;
import com.tangguo.domain.vo.BbsMomentListVO;
import com.tangguo.domain.vo.BbsTopicListVO; import com.tangguo.domain.vo.BbsTopicListVO;
import com.tangguo.mapper.BbsTopicMapper; import com.tangguo.mapper.BbsTopicMapper;
import com.tangguo.service.IBbsTopicService; import com.tangguo.service.IBbsTopicService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -190,18 +188,6 @@ public class BbsTopicServiceImpl extends ServiceImpl<BbsTopicMapper, BbsTopic> i ...@@ -190,18 +188,6 @@ public class BbsTopicServiceImpl extends ServiceImpl<BbsTopicMapper, BbsTopic> i
} }
/**
* 查询话题详情
*
* @param topicId 话题Id
* @return 话题明细
*/
@Override
public List<BbsMomentListVO> getTopicDetails(Long topicId) {
return Collections.emptyList();
}
/** /**
* 创建话题 * 创建话题
* *
......
...@@ -47,8 +47,8 @@ public class BbsUserService { ...@@ -47,8 +47,8 @@ public class BbsUserService {
WxCpOauth2UserInfo authUserInfo = this.wxCpService.getOauth2Service().getAuthUserInfo(bo.getCode()); WxCpOauth2UserInfo authUserInfo = this.wxCpService.getOauth2Service().getAuthUserInfo(bo.getCode());
userName = authUserInfo.getUserId(); userName = authUserInfo.getUserId();
} catch (WxErrorException e) { } catch (WxErrorException e) {
log.error("=> 移动端用户登录失败,查询企微用户信息失败:", e); log.error("=> 移动端用户登录失败,查询当前企微用户数据失败:", e);
throw new ServiceException("登录失败,查询企微用户信息失败。"); throw new ServiceException("登录失败,查询当前企微用户数据失败。");
} }
QwmhUserInfo dbUser = this.bbsUserMapper.selectQwmhUserInfo(userName); QwmhUserInfo dbUser = this.bbsUserMapper.selectQwmhUserInfo(userName);
...@@ -74,7 +74,7 @@ public class BbsUserService { ...@@ -74,7 +74,7 @@ public class BbsUserService {
if (Objects.nonNull(dbUser)) { if (Objects.nonNull(dbUser)) {
return BeanUtil.beanToMap(dbUser, false, false); return BeanUtil.beanToMap(dbUser, false, false);
} else { } else {
throw new ServiceException("操作失败,未查询到当前用户信息。"); throw new ServiceException("操作失败,未查询到当前登录用户信息。");
} }
} }
......
...@@ -90,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -90,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.content, c.content,
c.parent_id, c.parent_id,
c.reply_nike_name, c.reply_nike_name,
c.is_featured,
IF(c.user_name = #{userName}, 1, 0) AS is_self IF(c.user_name = #{userName}, 1, 0) AS is_self
FROM FROM
bbs_moment_comment c bbs_moment_comment c
......
...@@ -105,8 +105,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -105,8 +105,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
user_name = #{userName} user_name = #{userName}
) v ON v.moment_id = m.id ) v ON v.moment_id = m.id
<where> <where>
<if test="content != null and content != ''"> <if test="bo.content != null and bo.content != ''">
m.content LIKE CONCAT('%', #{content}, '%') m.content LIKE CONCAT('%', #{bo.content}, '%')
</if>
<if test="bo.topicId != null">
AND FIND_IN_SET(#{bo.topicId}, m.topic_ids)
</if> </if>
</where> </where>
ORDER BY ORDER BY
......
...@@ -58,6 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -58,6 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bbs_topic t bbs_topic t
LEFT JOIN LEFT JOIN
bbs_moment m ON FIND_IN_SET(t.id, m.topic_ids) bbs_moment m ON FIND_IN_SET(t.id, m.topic_ids)
GROUP BY
t.id, t.name
ORDER BY ORDER BY
t.is_top DESC, CASE WHEN t.is_top = 1 THEN t.top_time END DESC, t.hot_score DESC, t.create_time DESC t.is_top DESC, CASE WHEN t.is_top = 1 THEN t.top_time END DESC, t.hot_score DESC, t.create_time DESC
LIMIT 10 LIMIT 10
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment