|
@@ -1,14 +1,15 @@
|
|
package com.gis.cms.service.impl;
|
|
package com.gis.cms.service.impl;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.gis.cms.entity.dto.CommentPageDto;
|
|
import com.gis.cms.entity.dto.CommentPageDto;
|
|
-import com.gis.cms.entity.dto.SortPageDto;
|
|
|
|
import com.gis.cms.entity.dto.CommentDto;
|
|
import com.gis.cms.entity.dto.CommentDto;
|
|
import com.gis.cms.entity.po.CommentEntity;
|
|
import com.gis.cms.entity.po.CommentEntity;
|
|
import com.gis.cms.mapper.CommentMapper;
|
|
import com.gis.cms.mapper.CommentMapper;
|
|
import com.gis.cms.service.CommentService;
|
|
import com.gis.cms.service.CommentService;
|
|
|
|
+import com.gis.cms.tree.CommentTreeUtil;
|
|
import com.gis.common.base.service.impl.IBaseService;
|
|
import com.gis.common.base.service.impl.IBaseService;
|
|
import com.gis.common.util.BaseUtil;
|
|
import com.gis.common.util.BaseUtil;
|
|
import com.gis.common.util.FileUtils;
|
|
import com.gis.common.util.FileUtils;
|
|
@@ -18,9 +19,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -42,22 +41,50 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, CommentEntity
|
|
public Result search(CommentPageDto param) {
|
|
public Result search(CommentPageDto param) {
|
|
BaseUtil.startPage(param);
|
|
BaseUtil.startPage(param);
|
|
IPage<CommentEntity> page = new Page<>(param.getPageNum() , param.getPageSize());
|
|
IPage<CommentEntity> page = new Page<>(param.getPageNum() , param.getPageSize());
|
|
- IPage<CommentEntity> result = getBaseMapper().search(param, page);
|
|
|
|
|
|
+ BaseUtil.startPage(param);
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<CommentEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(CommentEntity::getStatus, 2);
|
|
|
|
+ String searchKey = param.getSearchKey();
|
|
|
|
+ wrapper.like(StringUtils.isNotBlank(searchKey), CommentEntity::getContent, searchKey);
|
|
|
|
+ wrapper.orderByDesc(CommentEntity::getCreateTime);
|
|
|
|
+ IPage<CommentEntity> result = this.page(page, wrapper);
|
|
return Result.success(result);
|
|
return Result.success(result);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void audit(Long id, Integer status) {
|
|
public void audit(Long id, Integer status) {
|
|
getBaseMapper().setAudit(id, status);
|
|
getBaseMapper().setAudit(id, status);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result voListTree(CommentPageDto param) {
|
|
|
|
+ BaseUtil.startPage(param);
|
|
|
|
+ IPage page = new Page<>(param.getPageNum() , param.getPageSize());
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<CommentEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(CommentEntity::getStatus, 2);
|
|
|
|
+ String searchKey = param.getSearchKey();
|
|
|
|
+ wrapper.like(StringUtils.isNotBlank(searchKey), CommentEntity::getContent, searchKey);
|
|
|
|
+ wrapper.orderByDesc(CommentEntity::getCreateTime);
|
|
|
|
+ IPage result = this.page(page, wrapper);
|
|
|
|
+
|
|
|
|
+ CommentTreeUtil tree = new CommentTreeUtil(result.getRecords());
|
|
|
|
+ result.setRecords(tree.buildTree());
|
|
|
|
+
|
|
|
|
+ return Result.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Result saveEntity(CommentDto param) {
|
|
public Result saveEntity(CommentDto param) {
|
|
CommentEntity entity = new CommentEntity();
|
|
CommentEntity entity = new CommentEntity();
|
|
-// entity.setCreatorId(iBaseService.getUserId());
|
|
|
|
BeanUtils.copyProperties(param, entity);
|
|
BeanUtils.copyProperties(param, entity);
|
|
this.saveOrUpdate(entity);
|
|
this.saveOrUpdate(entity);
|
|
return Result.success();
|
|
return Result.success();
|