feat: 查询生态环保批复文件列表
This commit is contained in:
parent
b908daa9bc
commit
d77c7d60bb
@ -1,17 +1,20 @@
|
||||
package com.yfd.platform.qgc_base.controller;
|
||||
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.qgc_base.service.ISdEngInfoBHService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/env/eng")
|
||||
@RequestMapping("/eng/base")
|
||||
@Tag(name = "电站基础监测")
|
||||
public class SdEngMonitorController {
|
||||
|
||||
@ -23,4 +26,10 @@ public class SdEngMonitorController {
|
||||
public ResponseResult getStInfoByStcd(@RequestParam String stcd) {
|
||||
return ResponseResult.successData(engInfoBHService.getStInfoByStcd(stcd));
|
||||
}
|
||||
|
||||
@PostMapping("/eiaapproval/GetKendoList")
|
||||
@Operation(summary = "查询生态环保批复文件列表")
|
||||
public ResponseResult getEiaapprovalKendoList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(engInfoBHService.getEiaapprovalKendoList(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,125 @@
|
||||
package com.yfd.platform.qgc_base.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "生态环保批复文件列表")
|
||||
public class EngEiaapprovalVo {
|
||||
|
||||
@Schema(description = "主键ID")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "流域")
|
||||
private String basin;
|
||||
|
||||
@Schema(description = "河流")
|
||||
private String river;
|
||||
|
||||
@Schema(description = "电站")
|
||||
private String hydropowerStation;
|
||||
|
||||
@Schema(description = "电站建设状态中文")
|
||||
private String bldsttCName;
|
||||
|
||||
@Schema(description = "批复文号")
|
||||
private String approvalFileNo;
|
||||
|
||||
@Schema(description = "批复文件标题")
|
||||
private String approvalFileTitle;
|
||||
|
||||
@Schema(description = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "附件路径")
|
||||
private String flpath;
|
||||
|
||||
@Schema(description = "生态流量")
|
||||
private String ecologicalFlow;
|
||||
|
||||
@Schema(description = "水环境保护措施")
|
||||
private String waterEnvProtection;
|
||||
|
||||
@Schema(description = "低温水减缓措施")
|
||||
private String coldWaterMitigation;
|
||||
|
||||
@Schema(description = "栖息地保护")
|
||||
private String habitatProtection;
|
||||
|
||||
@Schema(description = "过鱼措施")
|
||||
private String fishPassageMeasures;
|
||||
|
||||
@Schema(description = "鱼类增殖放流")
|
||||
private String fishStocking;
|
||||
|
||||
@Schema(description = "陆生生态保护/水土保持措施")
|
||||
private String terrestrialEcoSoilCons;
|
||||
|
||||
@Schema(description = "珍稀植物保护措施")
|
||||
private String rarePlantProtection;
|
||||
|
||||
@Schema(description = "动物救助")
|
||||
private String animalRescue;
|
||||
|
||||
@Schema(description = "移民安置")
|
||||
private String resettlementMeasures;
|
||||
|
||||
@Schema(description = "施工期防治措施或其他环境保护措施")
|
||||
private String constructionPollutionCtrl;
|
||||
|
||||
@Schema(description = "地下水及地质环境保护措施")
|
||||
private String groundwaterGeoProtect;
|
||||
|
||||
@Schema(description = "风景名胜区保护措施")
|
||||
private String scenicAreaProtection;
|
||||
|
||||
@Schema(description = "环境监测要求")
|
||||
private String envMonitoringRequire;
|
||||
|
||||
@Schema(description = "基地编码")
|
||||
private String baseid;
|
||||
|
||||
@Schema(description = "基地流域编码")
|
||||
private String hbrvcd;
|
||||
|
||||
@Schema(description = "环评表中的电站编码")
|
||||
private String eiaStcd;
|
||||
|
||||
@Schema(description = "电站编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "电站名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "电站类型")
|
||||
private String sttp;
|
||||
|
||||
@Schema(description = "电站类型名称")
|
||||
private String sttpName;
|
||||
|
||||
@Schema(description = "电站建设状态代码")
|
||||
private String bldsttCcode;
|
||||
|
||||
@Schema(description = "电站建设状态")
|
||||
private String bldstt;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private String lgtd;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private String lttd;
|
||||
|
||||
@Schema(description = "基地排序")
|
||||
private Integer baseStepSort;
|
||||
|
||||
@Schema(description = "流域排序")
|
||||
private Integer rvcdStepSort;
|
||||
|
||||
@Schema(description = "电站排序")
|
||||
private Integer rstcdStepSort;
|
||||
|
||||
@Schema(description = "站点排序")
|
||||
private Integer siteStepSort;
|
||||
}
|
||||
@ -2,9 +2,12 @@ package com.yfd.platform.qgc_base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.qgc_base.domain.SdEngInfoBH;
|
||||
import com.yfd.platform.qgc_base.domain.SdEngInfoBHRequest;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngBaseInfoVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngEiaapprovalVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -61,4 +64,6 @@ public interface ISdEngInfoBHService extends IService<SdEngInfoBH> {
|
||||
List<SdEngInfoBH> selectRegDropdown(SdEngInfoBHRequest sdEngInfoBHRequest);
|
||||
|
||||
EngBaseInfoVo getStInfoByStcd(String stcd);
|
||||
|
||||
DataSourceResult<EngEiaapprovalVo> getEiaapprovalKendoList(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -5,12 +5,15 @@ import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||
import com.yfd.platform.qgc_data.domain.SysUserDataScope;
|
||||
import com.yfd.platform.qgc_data.mapper.SysUserDataScopeMapper;
|
||||
import com.yfd.platform.qgc_base.domain.SdEngInfoBH;
|
||||
import com.yfd.platform.qgc_base.domain.SdEngInfoBHRequest;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngBaseInfoVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngEiaapprovalVo;
|
||||
import com.yfd.platform.qgc_base.mapper.SdEngInfoBHMapper;
|
||||
import com.yfd.platform.qgc_base.service.ISdEngInfoBHService;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
@ -19,8 +22,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -202,6 +207,53 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
return this.list(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<EngEiaapprovalVo> getEiaapprovalKendoList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult<EngEiaapprovalVo> result = new DataSourceResult<>();
|
||||
result.setAggregates(new HashMap<>());
|
||||
|
||||
if (dataSourceRequest == null) {
|
||||
result.setData(new ArrayList<>());
|
||||
result.setTotal(0L);
|
||||
return result;
|
||||
}
|
||||
|
||||
// if (!"admin".equals(SecurityUtils.getCurrentUsername())) {
|
||||
// Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||
// if (authorizedStations == null || authorizedStations.isEmpty()) {
|
||||
// result.setData(new ArrayList<>());
|
||||
// result.setTotal(0L);
|
||||
// return result;
|
||||
// }
|
||||
// }
|
||||
|
||||
Page<?> page = null;
|
||||
if (dataSourceRequest.getTake() > 0) {
|
||||
page = new Page<>(dataSourceRequest.getSkip() / dataSourceRequest.getTake() + 1,
|
||||
dataSourceRequest.getTake());
|
||||
}
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
StringBuilder sql = new StringBuilder(buildEiaapprovalBaseSql());
|
||||
|
||||
// if (!"admin".equals(SecurityUtils.getCurrentUsername())) {
|
||||
// appendAuthorizedStations(sql, paramMap, getUserAuthorizedStationCodes());
|
||||
// }
|
||||
|
||||
String filterSql = buildEiaapprovalFilterCondition(dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||
if (StringUtils.hasText(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql);
|
||||
}
|
||||
|
||||
sql.append(buildEiaapprovalOrderBySql(dataSourceRequest.getSort()));
|
||||
|
||||
List<EngEiaapprovalVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page, sql.toString(), paramMap, EngEiaapprovalVo.class);
|
||||
result.setData(list);
|
||||
result.setTotal(page == null ? list.size() : page.getTotal());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EngBaseInfoVo getStInfoByStcd(String stcd) {
|
||||
SdEngInfoBH entity = this.getById(stcd);
|
||||
@ -267,6 +319,263 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
return vo;
|
||||
}
|
||||
|
||||
private String buildEiaapprovalBaseSql() {
|
||||
return "SELECT " +
|
||||
"e.ID AS id, " +
|
||||
"e.BASIN AS basin, " +
|
||||
"e.RIVER AS river, " +
|
||||
"e.ENNM AS hydropowerStation, " +
|
||||
"e.APPROVAL_FILE_NO AS approvalFileNo, " +
|
||||
"e.APPROVAL_FILE_TITLE AS approvalFileTitle, " +
|
||||
"e.FILE_NAME AS fileName, " +
|
||||
"e.FLPATH AS flpath, " +
|
||||
"e.ECOLOGICAL_FLOW AS ecologicalFlow, " +
|
||||
"e.WATER_ENV_PROTECTION AS waterEnvProtection, " +
|
||||
"e.COLD_WATER_MITIGATION AS coldWaterMitigation, " +
|
||||
"e.HABITAT_PROTECTION AS habitatProtection, " +
|
||||
"e.FISH_PASSAGE_MEASURES AS fishPassageMeasures, " +
|
||||
"e.FISH_STOCKING AS fishStocking, " +
|
||||
"e.TERRESTRIAL_ECO_SOIL_CONS AS terrestrialEcoSoilCons, " +
|
||||
"e.RARE_PLANT_PROTECTION AS rarePlantProtection, " +
|
||||
"e.ANIMAL_RESCUE AS animalRescue, " +
|
||||
"e.RESETTLEMENT_MEASURES AS resettlementMeasures, " +
|
||||
"e.CONSTRUCTION_POLLUTION_CTRL AS constructionPollutionCtrl, " +
|
||||
"e.GROUNDWATER_GEO_PROTECT AS groundwaterGeoProtect, " +
|
||||
"e.SCENIC_AREA_PROTECTION AS scenicAreaProtection, " +
|
||||
"e.ENV_MONITORING_REQUIRE AS envMonitoringRequire, " +
|
||||
"e.BASEID AS baseid, " +
|
||||
"e.HBRVCD AS hbrvcd, " +
|
||||
"e.STCD AS eiaStcd, " +
|
||||
"s.STCD AS stcd, " +
|
||||
"s.ENNM AS stnm, " +
|
||||
"sttp.ID AS sttp, " +
|
||||
"sttp.STTP_NAME AS sttpName, " +
|
||||
"TO_CHAR(s.BLDSTT_CODE) AS bldsttCcode, " +
|
||||
"s.BLDSTT AS bldstt, " +
|
||||
"TO_CHAR(s.LGTD) AS lgtd, " +
|
||||
"TO_CHAR(s.LTTD) AS lttd, " +
|
||||
"CASE " +
|
||||
"WHEN s.BLDSTT_CODE = 0 OR s.BLDSTT_CODE IS NULL THEN '未建/规划' " +
|
||||
"WHEN s.BLDSTT_CODE = 1 THEN '在建' " +
|
||||
"WHEN s.BLDSTT_CODE = 2 THEN '已建' " +
|
||||
"ELSE NULL END AS bldsttCName, " +
|
||||
"NVL(hb.ORDER_INDEX, 999999) AS baseStepSort, " +
|
||||
"NVL(along.ORDER_INDEX, 999999) AS rvcdStepSort, " +
|
||||
"NVL(rstSort.SORT, 999999) AS rstcdStepSort, " +
|
||||
"NVL(siteSort.SORT, 999999) AS siteStepSort " +
|
||||
"FROM MS_EIAAPPROVAL_B e " +
|
||||
"LEFT JOIN SD_ENGINFO_B_H s ON e.STCD = s.STCD AND NVL(s.IS_DELETED, 0) = 0 " +
|
||||
"LEFT JOIN SD_STTP_B sttp ON sttp.STTP_CODE = 'ENG' AND NVL(sttp.IS_DELETED, 0) = 0 AND NVL(sttp.ENABLE, 1) = 1 " +
|
||||
"LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = s.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 " +
|
||||
"LEFT JOIN MS_ALONG_B along ON along.RVCD = s.HBRVCD AND along.CODE = 'common' AND NVL(along.IS_DELETED, 0) = 0 " +
|
||||
"LEFT JOIN ( " +
|
||||
" SELECT det.SORT, cfg.RVCD, det.STCD " +
|
||||
" FROM MS_ALONGDET_B det " +
|
||||
" INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID " +
|
||||
" WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common' " +
|
||||
") rstSort ON rstSort.RVCD = s.HBRVCD AND rstSort.STCD = s.STCD " +
|
||||
"LEFT JOIN ( " +
|
||||
" SELECT det.SORT, cfg.RVCD, det.STCD " +
|
||||
" FROM MS_ALONGDET_B det " +
|
||||
" INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID " +
|
||||
" WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common' " +
|
||||
") siteSort ON siteSort.RVCD = s.HBRVCD AND siteSort.STCD = s.STCD " +
|
||||
"WHERE NVL(e.IS_DELETED, 0) = 0";
|
||||
}
|
||||
|
||||
private void appendAuthorizedStations(StringBuilder sql, Map<String, Object> paramMap, Set<String> authorizedStations) {
|
||||
if (authorizedStations == null || authorizedStations.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
int index = 0;
|
||||
for (String stcd : authorizedStations) {
|
||||
String key = "authStcd" + index++;
|
||||
paramMap.put(key, stcd);
|
||||
placeholders.add("#{map." + key + "}");
|
||||
}
|
||||
sql.append(" AND e.STCD IN (").append(String.join(", ", placeholders)).append(")");
|
||||
}
|
||||
|
||||
private String buildEiaapprovalFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
if (filter == null) {
|
||||
return "";
|
||||
}
|
||||
if (StringUtils.hasText(filter.getField())) {
|
||||
return buildEiaapprovalLeafCondition(filter, paramMap, indexHolder);
|
||||
}
|
||||
if (filter.getFilters() == null || filter.getFilters().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
List<String> childConditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildEiaapprovalFilterCondition(child, paramMap, indexHolder);
|
||||
if (StringUtils.hasText(childSql)) {
|
||||
childConditions.add("(" + childSql + ")");
|
||||
}
|
||||
}
|
||||
if (childConditions.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String logic = "or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ";
|
||||
return String.join(logic, childConditions);
|
||||
}
|
||||
|
||||
private String buildEiaapprovalLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
String column = mapEiaapprovalColumn(filter.getField());
|
||||
if (!StringUtils.hasText(column)) {
|
||||
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 = normalizeFilterValues(value);
|
||||
if (values.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (Object item : values) {
|
||||
String key = "eiaParam" + indexHolder[0]++;
|
||||
paramMap.put(key, item);
|
||||
placeholders.add("#{map." + key + "}");
|
||||
}
|
||||
return column + " IN (" + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
String key = "eiaParam" + indexHolder[0]++;
|
||||
return switch (operator) {
|
||||
case "eq" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " = #{map." + key + "}";
|
||||
}
|
||||
case "neq" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " <> #{map." + key + "}";
|
||||
}
|
||||
case "contains" -> {
|
||||
paramMap.put(key, "%" + value + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "startswith" -> {
|
||||
paramMap.put(key, value + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "endswith" -> {
|
||||
paramMap.put(key, "%" + value);
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "gt" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " > #{map." + key + "}";
|
||||
}
|
||||
case "gte" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " >= #{map." + key + "}";
|
||||
}
|
||||
case "lt" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " < #{map." + key + "}";
|
||||
}
|
||||
case "lte" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " <= #{map." + key + "}";
|
||||
}
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private List<Object> normalizeFilterValues(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 mapEiaapprovalColumn(String field) {
|
||||
if (!StringUtils.hasText(field)) {
|
||||
return null;
|
||||
}
|
||||
return switch (field) {
|
||||
case "stcd", "eiaStcd" -> "e.STCD";
|
||||
case "hydropowerStation" -> "e.ENNM";
|
||||
case "baseId", "baseid" -> "e.BASEID";
|
||||
case "hbrvcd" -> "e.HBRVCD";
|
||||
case "envMonitoringRequire" -> "e.ENV_MONITORING_REQUIRE";
|
||||
case "ecologicalFlow" -> "e.ECOLOGICAL_FLOW";
|
||||
case "approvalFileNo" -> "e.APPROVAL_FILE_NO";
|
||||
case "approvalFileTitle" -> "e.APPROVAL_FILE_TITLE";
|
||||
case "fishPassageMeasures" -> "e.FISH_PASSAGE_MEASURES";
|
||||
case "bldsttCcode" -> "s.BLDSTT_CODE";
|
||||
case "bldsttCName" -> "CASE WHEN s.BLDSTT_CODE = 0 OR s.BLDSTT_CODE IS NULL THEN '未建/规划' WHEN s.BLDSTT_CODE = 1 THEN '在建' WHEN s.BLDSTT_CODE = 2 THEN '已建' ELSE NULL END";
|
||||
case "basin" -> "e.BASIN";
|
||||
case "river" -> "e.RIVER";
|
||||
case "stnm" -> "s.ENNM";
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private String buildEiaapprovalOrderBySql(List<DataSourceRequest.SortDescriptor> sortList) {
|
||||
if (sortList == null || sortList.isEmpty()) {
|
||||
return " ORDER BY baseStepSort ASC, rvcdStepSort ASC, rstcdStepSort ASC, siteStepSort ASC, stnm ASC";
|
||||
}
|
||||
List<String> orderItems = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor sortDescriptor : sortList) {
|
||||
if (sortDescriptor == null || !StringUtils.hasText(sortDescriptor.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = switch (sortDescriptor.getField()) {
|
||||
case "baseStepSort" -> "baseStepSort";
|
||||
case "rvcdStepSort" -> "rvcdStepSort";
|
||||
case "rstcdStepSort" -> "rstcdStepSort";
|
||||
case "siteStepSort" -> "siteStepSort";
|
||||
case "stnm" -> "stnm";
|
||||
case "hydropowerStation" -> "e.HYDROPOWER_STATION";
|
||||
case "approvalFileNo" -> "e.APPROVAL_FILE_NO";
|
||||
case "recordTime" -> "e.RECORD_TIME";
|
||||
case "bldsttCcode" -> "s.BLDSTT_CODE";
|
||||
default -> null;
|
||||
};
|
||||
if (!StringUtils.hasText(column)) {
|
||||
continue;
|
||||
}
|
||||
String dir = "desc".equalsIgnoreCase(sortDescriptor.getDir()) ? "DESC" : "ASC";
|
||||
orderItems.add(column + " " + dir);
|
||||
}
|
||||
if (orderItems.isEmpty()) {
|
||||
return " ORDER BY baseStepSort ASC, rvcdStepSort ASC, rstcdStepSort ASC, siteStepSort ASC, stnm ASC";
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderItems);
|
||||
}
|
||||
|
||||
private String resolveBlprdName(Integer blprd) {
|
||||
if (blprd == null) {
|
||||
return null;
|
||||
|
||||
@ -47,8 +47,8 @@ public class EnvWqDataController {
|
||||
public ResponseResult getStTbYsBVoKendoListCust(
|
||||
@RequestParam String stcd,
|
||||
@RequestParam String tbCode,
|
||||
@RequestParam String startTime,
|
||||
@RequestParam String endTime) {
|
||||
@RequestParam(required = false) String startTime,
|
||||
@RequestParam(required = false) String endTime) {
|
||||
return ResponseResult.successData(envWqDataService.getStTbYsBVoKendoListCust(stcd, tbCode, startTime, endTime));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user