分页查询修改
parent
9bc266eda6
commit
8c3b5c6a2d
|
|
@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.servers.Server;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类描述
|
* 类描述
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Sun Lejun
|
* @author Sun Lejun
|
||||||
|
|
@ -55,7 +56,7 @@ public class SysDictService extends BaseOrderDao<SysDictBMapper, SysDictB> {
|
||||||
}
|
}
|
||||||
//拿出查询出来的PID和ID,获取完整的记录
|
//拿出查询出来的PID和ID,获取完整的记录
|
||||||
List<SysDictB> records = sysDictVoPage.getRecords();
|
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);
|
List<SysDictVo> sysDictVos = this.getBaseMapper().queryByPidOrIds(list);
|
||||||
//转换成tree
|
//转换成tree
|
||||||
List<SysDictVo> tree = TreeUtil.list2ListTree(sysDictVos, 0L, SysDictVo::getId, SysDictVo::getPid, SysDictVo::setChildren, null);
|
List<SysDictVo> tree = TreeUtil.list2ListTree(sysDictVos, 0L, SysDictVo::getId, SysDictVo::getPid, SysDictVo::setChildren, null);
|
||||||
|
|
|
||||||
|
|
@ -50,14 +50,14 @@ public class WaterQualityServiceImpl extends BaseOrderDao<WaterQualityMapper, St
|
||||||
LambdaQueryWrapper<StWaterQualityR> query = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<StWaterQualityR> query = Wrappers.lambdaQuery();
|
||||||
|
|
||||||
|
|
||||||
if (so.getStm() != null) {
|
if (so.getTimeSo() != null&& so.getTimeSo().hasStart()) {
|
||||||
query.ge(StWaterQualityR::getSpt, so.getStm());
|
query.ge(StWaterQualityR::getSpt, so.getTimeSo().getStart());
|
||||||
}
|
}
|
||||||
if (so.getEtm() != null) {
|
if (so.getTimeSo() != null&& so.getTimeSo().hasEnd()) {
|
||||||
query.le(StWaterQualityR::getSpt, so.getEtm());
|
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 = "水质统计表 "
|
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";
|
+ ".xlsx";
|
||||||
|
|
||||||
// String tempPath = System.getProperty("java.io.tmpdir") + IdUtil.fastSimpleUUID() + ".xlsx";
|
// String tempPath = System.getProperty("java.io.tmpdir") + IdUtil.fastSimpleUUID() + ".xlsx";
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,12 @@ package com.gunshi.project.xyt.so;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.gunshi.core.dateformat.DateFormatString;
|
import com.gunshi.core.dateformat.DateFormatString;
|
||||||
|
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||||
import com.gunshi.db.dto.PageSo;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
@ -17,20 +21,14 @@ import java.util.Date;
|
||||||
* @author XuSan
|
* @author XuSan
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
@Data
|
||||||
public class WaterQualityPageSo extends PageSo {
|
public class WaterQualityPageSo {
|
||||||
|
|
||||||
@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;
|
|
||||||
|
|
||||||
|
@Schema(description = "分页参数")
|
||||||
|
@NotNull(message = "分页参数不能为空", groups = {QueryPage.class})
|
||||||
|
private PageSo pageSo;
|
||||||
|
|
||||||
|
@Schema(description = "时间范围")
|
||||||
|
@NotNull(message = "时间范围不能为空")
|
||||||
|
private DateTimeRangeSo timeSo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
<!--<!– </rollingPolicy>–>-->
|
<!--<!– </rollingPolicy>–>-->
|
||||||
<!-- </appender>-->
|
<!-- </appender>-->
|
||||||
|
|
||||||
<root level="INFO">
|
<root level="DEBUG">
|
||||||
<appender-ref ref="STDOUT"/>
|
<appender-ref ref="STDOUT"/>
|
||||||
<!-- <appender-ref ref="ERROR-MONGO" />-->
|
<!-- <appender-ref ref="ERROR-MONGO" />-->
|
||||||
</root>
|
</root>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue