分页查询修改

master
邓文杰 2024-01-25 19:29:43 +08:00
parent 9bc266eda6
commit 8c3b5c6a2d
5 changed files with 23 additions and 23 deletions

View File

@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.servers.Server;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
/**
*

View File

@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Sun Lejun
@ -55,7 +56,7 @@ public class SysDictService extends BaseOrderDao<SysDictBMapper, SysDictB> {
}
//拿出查询出来的PID和ID获取完整的记录
List<SysDictB> records = sysDictVoPage.getRecords();
List<Long> list = records.stream().map(SysDictB::getId).toList();
List<Long> list = records.stream().map(SysDictB::getId).collect(Collectors.toList());
List<SysDictVo> sysDictVos = this.getBaseMapper().queryByPidOrIds(list);
//转换成tree
List<SysDictVo> tree = TreeUtil.list2ListTree(sysDictVos, 0L, SysDictVo::getId, SysDictVo::getPid, SysDictVo::setChildren, null);

View File

@ -50,14 +50,14 @@ public class WaterQualityServiceImpl extends BaseOrderDao<WaterQualityMapper, St
LambdaQueryWrapper<StWaterQualityR> query = Wrappers.lambdaQuery();
if (so.getStm() != null) {
query.ge(StWaterQualityR::getSpt, so.getStm());
if (so.getTimeSo() != null&& so.getTimeSo().hasStart()) {
query.ge(StWaterQualityR::getSpt, so.getTimeSo().getStart());
}
if (so.getEtm() != null) {
query.le(StWaterQualityR::getSpt, so.getEtm());
if (so.getTimeSo() != null&& so.getTimeSo().hasEnd()) {
query.le(StWaterQualityR::getSpt,so.getTimeSo().getEnd());
}
return super.page(so.toPage(), query);
return super.page(so.getPageSo().toPage(), query);
}
/**
@ -73,9 +73,9 @@ public class WaterQualityServiceImpl extends BaseOrderDao<WaterQualityMapper, St
// 生成文件名
String fileName = "水质统计表 "
+ DateFormatUtils.format(so.getStm(), DateFormatString.YYYY_MM_DD_HH_MM_SS)
+ DateFormatUtils.format(so.getTimeSo().getStart(), DateFormatString.YYYY_MM_DD_HH_MM_SS)
+ "至"
+ DateFormatUtils.format(so.getEtm(), DateFormatString.YYYY_MM_DD_HH_MM_SS)
+ DateFormatUtils.format(so.getTimeSo().getEnd(), DateFormatString.YYYY_MM_DD_HH_MM_SS)
+ ".xlsx";
// String tempPath = System.getProperty("java.io.tmpdir") + IdUtil.fastSimpleUUID() + ".xlsx";

View File

@ -2,8 +2,12 @@ package com.gunshi.project.xyt.so;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gunshi.core.dateformat.DateFormatString;
import com.gunshi.db.dto.DateTimeRangeSo;
import com.gunshi.db.dto.PageSo;
import com.gunshi.project.xyt.validate.markers.QueryPage;
import com.gunshi.project.xyt.validate.markers.QueryTimeRange;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
@ -17,20 +21,14 @@ import java.util.Date;
* @author XuSan
* @version 1.0
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class WaterQualityPageSo extends PageSo {
@Schema(description = "查询开始时间", pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS,
example = DateFormatString.YYYY_MM_DD_HH_MM_SS_EXAMPLE)
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
@DateTimeFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS)
private Date stm;
@Schema(description = "查询结束时间", pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS,
example = DateFormatString.YYYY_MM_DD_HH_MM_SS_EXAMPLE)
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
@DateTimeFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS)
private Date etm;
public class WaterQualityPageSo {
@Schema(description = "分页参数")
@NotNull(message = "分页参数不能为空", groups = {QueryPage.class})
private PageSo pageSo;
@Schema(description = "时间范围")
@NotNull(message = "时间范围不能为空")
private DateTimeRangeSo timeSo;
}

View File

@ -74,7 +74,7 @@
<!--&lt;!&ndash; </rollingPolicy>&ndash;&gt;-->
<!-- </appender>-->
<root level="INFO">
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
<!-- <appender-ref ref="ERROR-MONGO" />-->
</root>