feat: 根据条件查询过鱼设施基础列表
This commit is contained in:
parent
0ad86754e7
commit
3acd4386f0
@ -40,6 +40,12 @@ public class FishPassageController {
|
||||
return ResponseResult.successData(fpBuildService.processKendoList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/vmsstbprpt/GetKendoList")
|
||||
@Operation(summary = "根据条件查询过鱼设施基础列表")
|
||||
public ResponseResult getVmsstbprptList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(fpBuildService.getVmsstbprptList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@GetMapping("/run/qgc/year/GetYearFpStatistics")
|
||||
@Operation(summary = "全过程过鱼统计总数,根据基地分组")
|
||||
public ResponseResult getYearFpStatic(@RequestParam("year") String year) {
|
||||
|
||||
243
backend/src/main/java/com/yfd/platform/env/fp/entity/vo/FpVmsstbprptVo.java
vendored
Normal file
243
backend/src/main/java/com/yfd/platform/env/fp/entity/vo/FpVmsstbprptVo.java
vendored
Normal file
@ -0,0 +1,243 @@
|
||||
package com.yfd.platform.env.fp.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "过鱼设施基础列表")
|
||||
public class FpVmsstbprptVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "过鱼设施编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "过鱼设施名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "过鱼设施类型编码")
|
||||
private String sttpCode;
|
||||
|
||||
@Schema(description = "过鱼设施类型名称")
|
||||
private String sttpName;
|
||||
|
||||
@Schema(description = "过鱼设施类型全路径")
|
||||
private String sttpFullPath;
|
||||
|
||||
@Schema(description = "过鱼设施类型层级")
|
||||
private Integer sttpTreeLevel;
|
||||
|
||||
@Schema(description = "所属电站编码")
|
||||
private String rstcd;
|
||||
|
||||
@Schema(description = "所属电站名称")
|
||||
private String ennm;
|
||||
|
||||
@Schema(description = "基地编码")
|
||||
private String baseId;
|
||||
|
||||
@Schema(description = "基地名称")
|
||||
private String baseName;
|
||||
|
||||
@Schema(description = "基地流域编码")
|
||||
private String hbrvcd;
|
||||
|
||||
@Schema(description = "基地流域名称")
|
||||
private String hbrvcdName;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private BigDecimal lgtd;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private BigDecimal lttd;
|
||||
|
||||
@Schema(description = "高程")
|
||||
private BigDecimal elev;
|
||||
|
||||
@Schema(description = "站址")
|
||||
private String stlc;
|
||||
|
||||
@Schema(description = "数据是否接入")
|
||||
private Integer dtin;
|
||||
|
||||
@Schema(description = "接入状态中文")
|
||||
private String dtinName;
|
||||
|
||||
@Schema(description = "数据接入时间")
|
||||
private Date dtinTm;
|
||||
|
||||
@Schema(description = "建设状态分类")
|
||||
private Integer bldsttCcode;
|
||||
|
||||
@Schema(description = "建设状态中文")
|
||||
private String bldsttCcodeName;
|
||||
|
||||
@Schema(description = "规划设计日期")
|
||||
private Date stdsdt;
|
||||
|
||||
@Schema(description = "计划开工日期")
|
||||
private Date pststdt;
|
||||
|
||||
@Schema(description = "计划完工日期")
|
||||
private Date pesstdt;
|
||||
|
||||
@Schema(description = "开工日期")
|
||||
private Date swdt;
|
||||
|
||||
@Schema(description = "建成日期")
|
||||
private Date jcdt;
|
||||
|
||||
@Schema(description = "退役/拆除日期")
|
||||
private Date wddt;
|
||||
|
||||
@Schema(description = "简介")
|
||||
private String introduce;
|
||||
|
||||
@Schema(description = "鱼道型式")
|
||||
private String ydxs;
|
||||
|
||||
@Schema(description = "鱼道总长度")
|
||||
private BigDecimal ydzcd;
|
||||
|
||||
@Schema(description = "鱼道进口运行设计水位")
|
||||
private BigDecimal ydjkz;
|
||||
|
||||
@Schema(description = "鱼道进口数量")
|
||||
private Integer ydjkcnt;
|
||||
|
||||
@Schema(description = "进口高程")
|
||||
private BigDecimal jkhg;
|
||||
|
||||
@Schema(description = "鱼道进口诱鱼型式")
|
||||
private String ydyyxs;
|
||||
|
||||
@Schema(description = "鱼道出口运行设计水位")
|
||||
private BigDecimal ydckz;
|
||||
|
||||
@Schema(description = "鱼道出口数量")
|
||||
private Integer ydckcnt;
|
||||
|
||||
@Schema(description = "出口高程")
|
||||
private BigDecimal ckhg;
|
||||
|
||||
@Schema(description = "鱼道池室设计流速")
|
||||
private BigDecimal ydcsv;
|
||||
|
||||
@Schema(description = "鱼道每级池室长")
|
||||
private BigDecimal ydcscd;
|
||||
|
||||
@Schema(description = "鱼道每级池室宽")
|
||||
private BigDecimal ydcskd;
|
||||
|
||||
@Schema(description = "鱼道池室坡度")
|
||||
private String ydcspd;
|
||||
|
||||
@Schema(description = "鱼道池室数量")
|
||||
private Integer ydcscnt;
|
||||
|
||||
@Schema(description = "鱼道休息池个数")
|
||||
private Integer ydxxccnt;
|
||||
|
||||
@Schema(description = "鱼道或仿自然通道流速")
|
||||
private String v;
|
||||
|
||||
@Schema(description = "仿自然通道断面形状")
|
||||
private String fzrdmxz;
|
||||
|
||||
@Schema(description = "仿自然通道长度宽度")
|
||||
private String fzrtdsz;
|
||||
|
||||
@Schema(description = "仿自然通道运行水深")
|
||||
private BigDecimal fzryxwdp;
|
||||
|
||||
@Schema(description = "仿自然通道坡降")
|
||||
private BigDecimal fzrpj;
|
||||
|
||||
@Schema(description = "上游码头位置")
|
||||
private String symtlc;
|
||||
|
||||
@Schema(description = "上游码头型式")
|
||||
private String symtxs;
|
||||
|
||||
@Schema(description = "下游码头位置")
|
||||
private String xymtlc;
|
||||
|
||||
@Schema(description = "下游码头型式")
|
||||
private String xymtxs;
|
||||
|
||||
@Schema(description = "集诱鱼方式")
|
||||
private String jyfs;
|
||||
|
||||
@Schema(description = "运鱼设施方式")
|
||||
private String yyfs;
|
||||
|
||||
@Schema(description = "升鱼机集鱼槽数量")
|
||||
private Integer syjcnt;
|
||||
|
||||
@Schema(description = "升鱼机集鱼槽进口高程")
|
||||
private BigDecimal syjhg;
|
||||
|
||||
@Schema(description = "升鱼机集鱼槽流量")
|
||||
private String syjq;
|
||||
|
||||
@Schema(description = "升鱼机断面尺寸")
|
||||
private String syjsz;
|
||||
|
||||
@Schema(description = "升鱼机集鱼槽水深")
|
||||
private String syjwdp;
|
||||
|
||||
@Schema(description = "设计过鱼规模")
|
||||
private Integer sjgycnt;
|
||||
|
||||
@Schema(description = "主要过鱼对象描述")
|
||||
private String zygydxms;
|
||||
|
||||
@Schema(description = "兼顾过鱼对象描述")
|
||||
private String jggydxms;
|
||||
|
||||
@Schema(description = "过鱼时间")
|
||||
private String gytm;
|
||||
|
||||
@Schema(description = "运行时间")
|
||||
private String yxtm;
|
||||
|
||||
@Schema(description = "主要过鱼月份")
|
||||
private String fpssmn;
|
||||
|
||||
@Schema(description = "数据监测频次")
|
||||
private Integer dtfrqcy;
|
||||
|
||||
@Schema(description = "基本特性参数")
|
||||
private String jbtxcs;
|
||||
|
||||
@Schema(description = "是否上行")
|
||||
private Integer isUp;
|
||||
|
||||
@Schema(description = "是否下行")
|
||||
private Integer isDown;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "数据来源")
|
||||
private String vlsr;
|
||||
|
||||
@Schema(description = "数据来源时间")
|
||||
private Date vlsrTm;
|
||||
|
||||
@Schema(description = "基地排序")
|
||||
private Integer baseStepSort;
|
||||
|
||||
@Schema(description = "流域排序")
|
||||
private Integer rvcdStepSort;
|
||||
|
||||
@Schema(description = "电站排序")
|
||||
private Integer rstcdStepSort;
|
||||
|
||||
@Schema(description = "站点排序")
|
||||
private Integer siteStepSort;
|
||||
}
|
||||
@ -3,8 +3,11 @@ package com.yfd.platform.env.fp.service;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.env.fp.entity.vo.FpConstructionSituationVo;
|
||||
import com.yfd.platform.env.fp.entity.vo.FpVmsstbprptVo;
|
||||
|
||||
public interface FpBuildService {
|
||||
|
||||
DataSourceResult<FpConstructionSituationVo> processKendoList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FpVmsstbprptVo> getVmsstbprptList(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -7,13 +7,17 @@ import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||
import com.yfd.platform.common.PageInfo;
|
||||
import com.yfd.platform.env.fp.entity.vo.FpConstructionSituationVo;
|
||||
import com.yfd.platform.env.fp.entity.vo.FpVmsstbprptVo;
|
||||
import com.yfd.platform.env.fp.service.FpBuildService;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class FpBuildServiceImpl implements FpBuildService {
|
||||
@ -51,4 +55,301 @@ public class FpBuildServiceImpl implements FpBuildService {
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<FpVmsstbprptVo> getVmsstbprptList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append("fp.STCD AS stcd, ")
|
||||
.append("fp.STNM AS stnm, ")
|
||||
.append("fp.STTP AS sttpCode, ")
|
||||
.append("sttp.STTP_NAME AS sttpName, ")
|
||||
.append("sttp.FULL_PATH AS sttpFullPath, ")
|
||||
.append("sttp.TREE_LEVEL AS sttpTreeLevel, ")
|
||||
.append("fp.RSTCD AS rstcd, ")
|
||||
.append("eng.ENNM AS ennm, ")
|
||||
.append("eng.BASE_ID AS baseId, ")
|
||||
.append("hb.BASENAME AS baseName, ")
|
||||
.append("eng.HBRVCD AS hbrvcd, ")
|
||||
.append("hbrv.HBRVNM AS hbrvcdName, ")
|
||||
.append("fp.LGTD AS lgtd, ")
|
||||
.append("fp.LTTD AS lttd, ")
|
||||
.append("fp.ELEV AS elev, ")
|
||||
.append("fp.STLC AS stlc, ")
|
||||
.append("fp.DTIN AS dtin, ")
|
||||
.append("CASE WHEN NVL(fp.DTIN, 0) = 1 THEN '已接入' ELSE '未接入' END AS dtinName, ")
|
||||
.append("fp.DTIN_TM AS dtinTm, ")
|
||||
.append("fp.BLDSTT_CODE AS bldsttCcode, ")
|
||||
.append("CASE ")
|
||||
.append("WHEN fp.BLDSTT_CODE IN (1, 10, 11) THEN '已建' ")
|
||||
.append("WHEN fp.BLDSTT_CODE IN (2, 7, 8) THEN '在建' ")
|
||||
.append("ELSE '未建/规划' END AS bldsttCcodeName, ")
|
||||
.append("fp.STDSDT AS stdsdt, ")
|
||||
.append("fp.PSTSTDT AS pststdt, ")
|
||||
.append("fp.PESSTDT AS pesstdt, ")
|
||||
.append("fp.SWDT AS swdt, ")
|
||||
.append("fp.JCDT AS jcdt, ")
|
||||
.append("fp.WDDT AS wddt, ")
|
||||
.append("fp.INTRODUCE AS introduce, ")
|
||||
.append("fp.YDXS AS ydxs, ")
|
||||
.append("fp.YDZCD AS ydzcd, ")
|
||||
.append("fp.YDJKZ AS ydjkz, ")
|
||||
.append("fp.YDJKCNT AS ydjkcnt, ")
|
||||
.append("fp.JKHG AS jkhg, ")
|
||||
.append("fp.YDYYXS AS ydyyxs, ")
|
||||
.append("fp.YDCKZ AS ydckz, ")
|
||||
.append("fp.YDCKCNT AS ydckcnt, ")
|
||||
.append("fp.CKHG AS ckhg, ")
|
||||
.append("fp.YDCSV AS ydcsv, ")
|
||||
.append("fp.YDCSCD AS ydcscd, ")
|
||||
.append("fp.YDCSKD AS ydcskd, ")
|
||||
.append("fp.YDCSPD AS ydcspd, ")
|
||||
.append("fp.YDCSCNT AS ydcscnt, ")
|
||||
.append("fp.YDXXCCNT AS ydxxccnt, ")
|
||||
.append("fp.V AS v, ")
|
||||
.append("fp.FZRDMXZ AS fzrdmxz, ")
|
||||
.append("fp.FZRTDSZ AS fzrtdsz, ")
|
||||
.append("fp.FZRYXWDP AS fzryxwdp, ")
|
||||
.append("fp.FZRPJ AS fzrpj, ")
|
||||
.append("fp.SYMTLC AS symtlc, ")
|
||||
.append("fp.SYMTXS AS symtxs, ")
|
||||
.append("fp.XYMTLC AS xymtlc, ")
|
||||
.append("fp.XYMTXS AS xymtxs, ")
|
||||
.append("fp.JYFS AS jyfs, ")
|
||||
.append("fp.YYFS AS yyfs, ")
|
||||
.append("fp.SYJCNT AS syjcnt, ")
|
||||
.append("fp.SYJHG AS syjhg, ")
|
||||
.append("fp.SYJQ AS syjq, ")
|
||||
.append("fp.SYJSZ AS syjsz, ")
|
||||
.append("fp.SYJWDP AS syjwdp, ")
|
||||
.append("fp.SJGYCNT AS sjgycnt, ")
|
||||
.append("fp.ZYGYDXMS AS zygydxms, ")
|
||||
.append("fp.JGGYDXMS AS jggydxms, ")
|
||||
.append("fp.GYTM AS gytm, ")
|
||||
.append("fp.YXTM AS yxtm, ")
|
||||
.append("fp.FPSSMN AS fpssmn, ")
|
||||
.append("fp.DTFRQCY AS dtfrqcy, ")
|
||||
.append("fp.JBTXCS AS jbtxcs, ")
|
||||
.append("fp.IS_UP AS isUp, ")
|
||||
.append("fp.IS_DOWN AS isDown, ")
|
||||
.append("fp.REMARK AS remark, ")
|
||||
.append("fp.VLSR AS vlsr, ")
|
||||
.append("fp.VLSR_TM AS vlsrTm, ")
|
||||
.append("NVL(hb.ORDER_INDEX, 999999) AS baseStepSort, ")
|
||||
.append("NVL(hbrv.ORDER_INDEX, 999999) AS rvcdStepSort, ")
|
||||
.append("NVL(eng.ORDER_INDEX, 999999) AS rstcdStepSort, ")
|
||||
.append("NVL(fp.ORDER_INDEX, 999999) AS siteStepSort ")
|
||||
.append("FROM SD_FPSS_B_H fp ")
|
||||
.append("LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = fp.RSTCD ")
|
||||
.append("LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_HBRV_DIC hbrv ON hbrv.HBRVCD = eng.HBRVCD AND hbrv.BASEID = eng.BASE_ID ")
|
||||
.append(" AND NVL(hbrv.IS_DELETED, 0) = 0 AND NVL(hbrv.ENABLED, 1) = 1 ")
|
||||
.append("LEFT JOIN SD_STTP_B sttp ON sttp.STTP_CODE = fp.STTP ")
|
||||
.append(" AND NVL(sttp.IS_DELETED, 0) = 0 AND NVL(sttp.ENABLE, 1) = 1 ")
|
||||
.append("WHERE 1 = 1 ");
|
||||
|
||||
String filterSql = buildVmsstbprptFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
|
||||
paramMap, new int[]{0});
|
||||
if (!filterSql.isBlank()) {
|
||||
sql.append(" AND ").append(filterSql);
|
||||
}
|
||||
|
||||
sql.append(buildVmsstbprptOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
|
||||
|
||||
List<FpVmsstbprptVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page, sql.toString(), paramMap, FpVmsstbprptVo.class);
|
||||
|
||||
DataSourceResult<FpVmsstbprptVo> result = new DataSourceResult<>();
|
||||
result.setData(list);
|
||||
result.setTotal(page != null ? page.getTotal() : list.size());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
private String buildVmsstbprptFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
if (filter == null) {
|
||||
return "";
|
||||
}
|
||||
if (filter.getField() != null && !filter.getField().isBlank()) {
|
||||
return buildVmsstbprptLeafCondition(filter, paramMap, indexHolder);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(filter.getFilters())) {
|
||||
return "";
|
||||
}
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildVmsstbprptFilterCondition(child, paramMap, indexHolder);
|
||||
if (!childSql.isBlank()) {
|
||||
conditions.add("(" + childSql + ")");
|
||||
}
|
||||
}
|
||||
if (conditions.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String logic = "or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ";
|
||||
return String.join(logic, conditions);
|
||||
}
|
||||
|
||||
private String buildVmsstbprptLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
String column = mapVmsstbprptColumn(filter.getField());
|
||||
if (column == null || column.isBlank()) {
|
||||
return "";
|
||||
}
|
||||
String operator = filter.getOperator() == null ? "eq" : filter.getOperator().toLowerCase();
|
||||
Object value = filter.getValue();
|
||||
if ("isnull".equals(operator)) {
|
||||
return column + " IS NULL";
|
||||
}
|
||||
if ("isnotnull".equals(operator)) {
|
||||
return column + " IS NOT NULL";
|
||||
}
|
||||
if ("in".equals(operator)) {
|
||||
List<Object> values = normalizeValues(value);
|
||||
if (values.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (Object item : values) {
|
||||
String paramKey = "fpVmsParam" + indexHolder[0]++;
|
||||
paramMap.put(paramKey, item);
|
||||
placeholders.add("#{map." + paramKey + "}");
|
||||
}
|
||||
return column + " IN (" + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
String paramKey = "fpVmsParam" + indexHolder[0]++;
|
||||
switch (operator) {
|
||||
case "eq":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " = #{map." + paramKey + "}";
|
||||
case "neq":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " <> #{map." + paramKey + "}";
|
||||
case "contains":
|
||||
paramMap.put(paramKey, "%" + value + "%");
|
||||
return column + " LIKE #{map." + paramKey + "}";
|
||||
case "startswith":
|
||||
paramMap.put(paramKey, value + "%");
|
||||
return column + " LIKE #{map." + paramKey + "}";
|
||||
case "endswith":
|
||||
paramMap.put(paramKey, "%" + value);
|
||||
return column + " LIKE #{map." + paramKey + "}";
|
||||
case "gt":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " > #{map." + paramKey + "}";
|
||||
case "gte":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " >= #{map." + paramKey + "}";
|
||||
case "lt":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " < #{map." + paramKey + "}";
|
||||
case "lte":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " <= #{map." + paramKey + "}";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private List<Object> normalizeValues(Object value) {
|
||||
List<Object> values = new ArrayList<>();
|
||||
if (value instanceof List<?> list) {
|
||||
for (Object item : list) {
|
||||
if (item != null) {
|
||||
values.add(item);
|
||||
}
|
||||
}
|
||||
return values;
|
||||
}
|
||||
if (value instanceof Object[] array) {
|
||||
for (Object item : array) {
|
||||
if (item != null) {
|
||||
values.add(item);
|
||||
}
|
||||
}
|
||||
return values;
|
||||
}
|
||||
if (value != null) {
|
||||
values.add(value);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private String mapVmsstbprptColumn(String field) {
|
||||
if (field == null || field.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> columnMap = new HashMap<>();
|
||||
columnMap.put("stcd", "fp.STCD");
|
||||
columnMap.put("stnm", "fp.STNM");
|
||||
columnMap.put("sttpCode", "fp.STTP");
|
||||
columnMap.put("sttpName", "sttp.STTP_NAME");
|
||||
columnMap.put("sttpFullPath", "sttp.FULL_PATH");
|
||||
columnMap.put("rstcd", "fp.RSTCD");
|
||||
columnMap.put("ennm", "eng.ENNM");
|
||||
columnMap.put("baseId", "eng.BASE_ID");
|
||||
columnMap.put("baseName", "hb.BASENAME");
|
||||
columnMap.put("hbrvcd", "eng.HBRVCD");
|
||||
columnMap.put("dtin", "fp.DTIN");
|
||||
columnMap.put("dtinName", "CASE WHEN NVL(fp.DTIN, 0) = 1 THEN '已接入' ELSE '未接入' END");
|
||||
columnMap.put("bldsttCcode", "fp.BLDSTT_CODE");
|
||||
columnMap.put("bldsttCcodeName", "CASE WHEN fp.BLDSTT_CODE IN (1, 10, 11) THEN '已建' WHEN fp.BLDSTT_CODE IN (2, 7, 8) THEN '在建' ELSE '未建/规划' END");
|
||||
columnMap.put("ydxs", "fp.YDXS");
|
||||
columnMap.put("siteStepSort", "fp.ORDER_INDEX");
|
||||
columnMap.put("rstcdStepSort", "eng.ORDER_INDEX");
|
||||
columnMap.put("baseStepSort", "hb.ORDER_INDEX");
|
||||
columnMap.put("rvcdStepSort", "hbrv.ORDER_INDEX");
|
||||
return columnMap.get(field);
|
||||
}
|
||||
|
||||
private String buildVmsstbprptOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
|
||||
if (sorts == null || sorts.isEmpty()) {
|
||||
return " ORDER BY NVL(hb.ORDER_INDEX, 999999) ASC, NVL(hbrv.ORDER_INDEX, 999999) ASC, " +
|
||||
"NVL(eng.ORDER_INDEX, 999999) ASC, NVL(fp.ORDER_INDEX, 999999) ASC, fp.STCD ASC";
|
||||
}
|
||||
Map<String, String> sortMap = new HashMap<>();
|
||||
sortMap.put("stcd", "fp.STCD");
|
||||
sortMap.put("stnm", "fp.STNM");
|
||||
sortMap.put("sttpCode", "fp.STTP");
|
||||
sortMap.put("sttpName", "sttp.STTP_NAME");
|
||||
sortMap.put("rstcd", "fp.RSTCD");
|
||||
sortMap.put("ennm", "eng.ENNM");
|
||||
sortMap.put("baseId", "eng.BASE_ID");
|
||||
sortMap.put("baseName", "hb.BASENAME");
|
||||
sortMap.put("hbrvcd", "eng.HBRVCD");
|
||||
sortMap.put("dtin", "fp.DTIN");
|
||||
sortMap.put("bldsttCcode", "fp.BLDSTT_CODE");
|
||||
sortMap.put("baseStepSort", "hb.ORDER_INDEX");
|
||||
sortMap.put("rvcdStepSort", "hbrv.ORDER_INDEX");
|
||||
sortMap.put("rstcdStepSort", "eng.ORDER_INDEX");
|
||||
sortMap.put("siteStepSort", "fp.ORDER_INDEX");
|
||||
|
||||
List<String> orderItems = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor sort : sorts) {
|
||||
if (sort == null || sort.getField() == null || sort.getField().isBlank()) {
|
||||
continue;
|
||||
}
|
||||
String column = sortMap.get(sort.getField());
|
||||
if (column == null) {
|
||||
continue;
|
||||
}
|
||||
String direction = "desc".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC";
|
||||
orderItems.add(column + " " + direction);
|
||||
}
|
||||
if (orderItems.isEmpty()) {
|
||||
return " ORDER BY NVL(hb.ORDER_INDEX, 999999) ASC, NVL(hbrv.ORDER_INDEX, 999999) ASC, " +
|
||||
"NVL(eng.ORDER_INDEX, 999999) ASC, NVL(fp.ORDER_INDEX, 999999) ASC, fp.STCD ASC";
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderItems);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user