|
@@ -2,6 +2,7 @@ package com.gis.cms.service.impl;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -24,6 +25,8 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.validation.constraints.NotBlank;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -52,7 +55,6 @@ public class BbsServiceImpl extends ServiceImpl<BbsMapper, BbsEntity> implements
|
|
|
IPage<BbsEntity> page = new Page<>(param.getPageNum() , param.getPageSize());
|
|
|
|
|
|
StringBuffer sql = new StringBuffer();
|
|
|
-// sql.append("SELECT a.*, COUNT(case when b.status=2 and b.is_delete=0 then 1 end) reply from tb_bbs a left join tb_bbs_message b on b.bbs_id=a.id where a.is_delete=0 ");
|
|
|
sql.append("SELECT a.*, COUNT(case when b.status=2 and b.is_delete=0 and b.bbs_type='reply' then 1 end) reply from tb_bbs a left join tb_bbs b on b.parent_id=a.id where a.is_delete=0 ");
|
|
|
Integer status = param.getStatus();
|
|
|
if (status!=null){
|
|
@@ -113,6 +115,25 @@ public class BbsServiceImpl extends ServiceImpl<BbsMapper, BbsEntity> implements
|
|
|
throw new BaseRuntimeException("审核参数非法:" + status);
|
|
|
}
|
|
|
getBaseMapper().updateAudit(id, status);
|
|
|
+ // 审核通过,需要更新最新信息
|
|
|
+ if (status == 2){
|
|
|
+ updateTopic(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 更新最新回复者信息
|
|
|
+ private void updateTopic(Long replayId){
|
|
|
+ BbsEntity entity = this.getById(replayId);
|
|
|
+ if (entity == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<BbsEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.set(BbsEntity::getReplyName, entity.getCreatorName());
|
|
|
+ updateWrapper.set(BbsEntity::getReplyTime, LocalDateTime.now());
|
|
|
+ updateWrapper.eq(BbsEntity::getId, entity.getParentId());
|
|
|
+ this.update(updateWrapper);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|