[报表列表接口]新增按标签查询功能

This commit is contained in:
2023-04-21 11:22:33 +08:00
parent e92233eaca
commit 761f8d2002
2 changed files with 33 additions and 4 deletions
@@ -9,17 +9,21 @@ import com.adc.da.report.eo.FileEntity;
import com.adc.da.report.eo.ReportEntity;
import com.adc.da.report.eo.ReportLabelEntity;
import com.adc.da.report.eo.ReportUserEntity;
import com.adc.da.report.service.IReportLabelService;
import com.adc.da.report.service.IReportService;
import com.adc.da.report.service.ITreeLabelService;
import com.adc.da.report.util.*;
import com.adc.da.report.vo.ReportQueryVo;
import com.adc.da.report.vo.ReportVo;
import com.adc.da.util.utils.FileUtil;
import com.adc.da.util.utils.StringUtils;
import com.adc.da.util.utils.UUID;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Resource;
@@ -33,10 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -61,6 +62,12 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
@Resource
private ReportLabelDao reportLabelDao;
@Resource
private IReportLabelService iReportLabelService;
@Resource
private ITreeLabelService iTreeLabelService;
@Resource
private FileDao fileDao;
@@ -195,6 +202,19 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
vo.setUsid(CommonUtils.getUserId());
}
//按照labelId筛选
Set<String> idSet = new HashSet<>();
if (Objects.nonNull(vo.getLabelId()) && !vo.getLabelId().isEmpty()) {
LambdaQueryWrapper<ReportLabelEntity> reportLabelEntityWrapper = new LambdaQueryWrapper<>();
reportLabelEntityWrapper.eq(ReportLabelEntity::getLabelId, vo.getLabelId().get(vo.getLabelId().size() - 1));
List<ReportLabelEntity> reportLabelEntities = reportLabelDao.selectList(reportLabelEntityWrapper);
reportLabelEntities.forEach(reportLabelEntity -> {
idSet.add(reportLabelEntity.getReportId());
});
}
// TODO ES模糊查询
IPage<ReportVo> list = reportDao.list(page, vo, idSet);
IPage<ReportVo> list = reportDao.list(page, vo);
list.getRecords().forEach(c -> {
@@ -134,6 +134,15 @@
</foreach>
</if>
<!--id搜索-->
<if test="idSet !=null and idSet.size() > 0">
and t.id in
<foreach collection="idSet" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--用户搜索-->
<if test="Vo.usid != null and Vo.usid != ''">
and t.userId=#{Vo.usid}