feat: 沿程对象视图(V_MS_STBPRP_T)条件过滤数据列表
This commit is contained in:
parent
469dac2655
commit
b481256080
@ -32,4 +32,10 @@ public class OverviewController {
|
||||
public ResponseResult getOpedList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(overviewService.getOpedList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/vmsstbprpt/GetKendoList")
|
||||
@Operation(summary = "沿程对象视图(V_MS_STBPRP_T)条件过滤数据列表")
|
||||
public ResponseResult getVmsstbprptList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(overviewService.getVmsstbprptList(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package com.yfd.platform.qgc_env.overview.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 = "沿程对象视图(V_MS_STBPRP_T)查询结果")
|
||||
public class OverviewVmsstbprptVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String stcd;
|
||||
private String stnm;
|
||||
private String ennm;
|
||||
private String sttp;
|
||||
private String sttpCode;
|
||||
private String sttpName;
|
||||
private String sttpFullPath;
|
||||
private Integer sttpTreeLevel;
|
||||
private String rstcd;
|
||||
private String baseId;
|
||||
private String baseName;
|
||||
private String hbrvcd;
|
||||
private String hbrvcdName;
|
||||
private String rvcd;
|
||||
private String rvcdName;
|
||||
private String addvcd;
|
||||
private String addvnm;
|
||||
private String hycd;
|
||||
private String hynm;
|
||||
private String topHycd;
|
||||
private String topHynm;
|
||||
private BigDecimal lgtd;
|
||||
private BigDecimal lttd;
|
||||
private String stlc;
|
||||
private Integer usfl;
|
||||
private Integer dtin;
|
||||
private Date dtinTm;
|
||||
private Integer bldsttCode;
|
||||
private String introduce;
|
||||
private String logo;
|
||||
private String inffile;
|
||||
private BigDecimal inv;
|
||||
private Integer invinmn;
|
||||
private Date stdsdt;
|
||||
private Date pststdt;
|
||||
private Date pesstdt;
|
||||
private Date swdt;
|
||||
private Date jcdt;
|
||||
private Date wddt;
|
||||
private Integer orderIndex;
|
||||
private String remark;
|
||||
private String vlsr;
|
||||
private String stindx;
|
||||
private String coenvwState;
|
||||
private String dvtpName;
|
||||
private Date vlsrTm;
|
||||
private String recordUser;
|
||||
private Date recordTime;
|
||||
private String modifyUser;
|
||||
private Date modifyTime;
|
||||
private Integer isDeleted;
|
||||
private String deleteUser;
|
||||
private Date deleteTime;
|
||||
private String dataSource;
|
||||
}
|
||||
@ -4,10 +4,13 @@ import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.qgc_env.overview.entity.vo.OverviewMsstbprptVo;
|
||||
import com.yfd.platform.qgc_env.overview.entity.vo.OverviewOpedVo;
|
||||
import com.yfd.platform.qgc_env.overview.entity.vo.OverviewVmsstbprptVo;
|
||||
|
||||
public interface OverviewService {
|
||||
|
||||
DataSourceResult<OverviewMsstbprptVo> getMsstbprptList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<OverviewOpedVo> getOpedList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<OverviewVmsstbprptVo> getVmsstbprptList(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -9,8 +9,11 @@ import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.common.GroupHelper;
|
||||
import com.yfd.platform.common.GroupingInfo;
|
||||
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||
import com.yfd.platform.qgc_base.domain.vo.DataScopeApplyResult;
|
||||
import com.yfd.platform.qgc_base.service.IDataScopeFilterService;
|
||||
import com.yfd.platform.qgc_env.overview.entity.vo.OverviewMsstbprptVo;
|
||||
import com.yfd.platform.qgc_env.overview.entity.vo.OverviewOpedVo;
|
||||
import com.yfd.platform.qgc_env.overview.entity.vo.OverviewVmsstbprptVo;
|
||||
import com.yfd.platform.qgc_env.overview.service.OverviewService;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -31,6 +34,9 @@ public class OverviewServiceImpl implements OverviewService {
|
||||
@Resource
|
||||
private MicroservicDynamicSQLMapper microservicDynamicSQLMapper;
|
||||
|
||||
@Resource
|
||||
private IDataScopeFilterService dataScopeFilterService;
|
||||
|
||||
@Override
|
||||
public DataSourceResult<OverviewMsstbprptVo> getMsstbprptList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
@ -109,6 +115,47 @@ public class OverviewServiceImpl implements OverviewService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<OverviewVmsstbprptVo> getVmsstbprptList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
List<String> selectFields = resolveVmsstbprptSelectFields(dataSourceRequest == null ? null : dataSourceRequest.getSelect());
|
||||
// "CASE eng.DVTP WHEN '1' THEN '堤坝式' WHEN '2' THEN '引水式' WHEN '3' THEN '混合式' ELSE '未知' END AS dvtpName,"+
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append(buildVmsstbprptSelectSql(selectFields))
|
||||
.append(" FROM V_MS_STBPRP_T t WHERE 1 = 1 ");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
String filterSql = buildVmsstbprptFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql);
|
||||
}
|
||||
|
||||
// 数据权限过滤:基于当前用户有权限的电站编码过滤
|
||||
// DataScopeApplyResult scopeResult = dataScopeFilterService.appendCurrentUserStationScope(sql, paramMap, "t.STCD");
|
||||
// if (scopeResult.isEmptyResult()) {
|
||||
// DataSourceResult<OverviewVmsstbprptVo> result = new DataSourceResult<>();
|
||||
// result.setData(new ArrayList<>());
|
||||
// result.setTotal(0L);
|
||||
// result.setAggregates(new HashMap<>());
|
||||
// return result;
|
||||
// }
|
||||
|
||||
sql.append(buildVmsstbprptOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
|
||||
|
||||
Page<?> page = loadOptions == null ? null
|
||||
: QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<OverviewVmsstbprptVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page, sql.toString(), paramMap, OverviewVmsstbprptVo.class
|
||||
);
|
||||
|
||||
DataSourceResult<OverviewVmsstbprptVo> result = new DataSourceResult<>();
|
||||
result.setData(list);
|
||||
result.setTotal(page == null ? list.size() : page.getTotal());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
private DataSourceResult<OverviewOpedVo> queryOpedSummaryList(DataSourceRequest dataSourceRequest,
|
||||
DataSourceLoadOptionsBase loadOptions,
|
||||
Map<String, Object> paramMap) {
|
||||
@ -1340,4 +1387,286 @@ public class OverviewServiceImpl implements OverviewService {
|
||||
}
|
||||
values.add(value);
|
||||
}
|
||||
|
||||
// ======================== V_MS_STBPRP_T helper methods ========================
|
||||
|
||||
private List<String> resolveVmsstbprptSelectFields(List<String> select) {
|
||||
List<String> fields = CollUtil.isEmpty(select)
|
||||
? new ArrayList<>(buildVmsstbprptSelectMap().keySet())
|
||||
: new ArrayList<>(select);
|
||||
LinkedHashSet<String> uniqueFields = new LinkedHashSet<>();
|
||||
for (String field : fields) {
|
||||
if (StrUtil.isNotBlank(field)) {
|
||||
uniqueFields.add(field.trim());
|
||||
}
|
||||
}
|
||||
if (uniqueFields.isEmpty()) {
|
||||
uniqueFields.add("stcd");
|
||||
}
|
||||
return new ArrayList<>(uniqueFields);
|
||||
}
|
||||
|
||||
private String buildVmsstbprptSelectSql(List<String> selectFields) {
|
||||
Map<String, String> columnMap = buildVmsstbprptSelectMap();
|
||||
List<String> selectParts = new ArrayList<>();
|
||||
for (String field : selectFields) {
|
||||
String column = columnMap.get(field);
|
||||
if (StrUtil.isNotBlank(column)) {
|
||||
selectParts.add(column);
|
||||
if(field.equals("sttpCode")){
|
||||
selectParts.add("t.STTP_NAME sttpName");
|
||||
}
|
||||
} else {
|
||||
selectParts.add("NULL AS \"" + field + "\"");
|
||||
}
|
||||
}
|
||||
if (selectParts.isEmpty()) {
|
||||
selectParts.add("t.STCD AS \"stcd\"");
|
||||
}
|
||||
return String.join(", ", selectParts);
|
||||
}
|
||||
|
||||
private Map<String, String> buildVmsstbprptSelectMap() {
|
||||
Map<String, String> columnMap = new LinkedHashMap<>();
|
||||
columnMap.put("stcd", "t.STCD AS \"stcd\"");
|
||||
columnMap.put("stnm", "t.STNM AS \"stnm\"");
|
||||
columnMap.put("ennm", "t.ENNM AS \"ennm\"");
|
||||
columnMap.put("sttp", "t.STTP AS \"sttp\"");
|
||||
columnMap.put("sttpCode", "t.STTP_CODE AS \"sttpCode\"");
|
||||
columnMap.put("sttpName", "t.STTP_NAME AS \"sttpName\"");
|
||||
columnMap.put("sttpFullPath", "t.STTP_FULL_PATH AS \"sttpFullPath\"");
|
||||
columnMap.put("sttpTreeLevel", "t.STTP_TREE_LEVEL AS \"sttpTreeLevel\"");
|
||||
columnMap.put("rstcd", "t.RSTCD AS \"rstcd\"");
|
||||
columnMap.put("baseId", "t.BASE_ID AS \"baseId\"");
|
||||
columnMap.put("baseName", "t.BASE_NAME AS \"baseName\"");
|
||||
columnMap.put("hbrvcd", "t.HBRVCD AS \"hbrvcd\"");
|
||||
columnMap.put("hbrvcdName", "t.HBRVCD_NAME AS \"hbrvcdName\"");
|
||||
columnMap.put("rvcd", "t.RVCD AS \"rvcd\"");
|
||||
columnMap.put("rvcdName", "t.RVCD_NAME AS \"rvcdName\"");
|
||||
columnMap.put("addvcd", "t.ADDVCD AS \"addvcd\"");
|
||||
columnMap.put("addvnm", "t.ADDVNM AS \"addvnm\"");
|
||||
columnMap.put("hycd", "t.HYCD AS \"hycd\"");
|
||||
columnMap.put("hynm", "t.HYNM AS \"hynm\"");
|
||||
columnMap.put("topHycd", "t.TOP_HYCD AS \"topHycd\"");
|
||||
columnMap.put("topHynm", "t.TOP_HYNM AS \"topHynm\"");
|
||||
columnMap.put("lgtd", "t.LGTD AS \"lgtd\"");
|
||||
columnMap.put("lttd", "t.LTTD AS \"lttd\"");
|
||||
columnMap.put("stlc", "t.STLC AS \"stlc\"");
|
||||
columnMap.put("usfl", "t.USFL AS \"usfl\"");
|
||||
columnMap.put("dtin", "t.DTIN AS \"dtin\"");
|
||||
columnMap.put("dtinTm", "t.DTIN_TM AS \"dtinTm\"");
|
||||
columnMap.put("bldsttCode", "t.BLDSTT_CODE AS \"bldsttCode\"");
|
||||
columnMap.put("introduce", "t.INTRODUCE AS \"introduce\"");
|
||||
columnMap.put("logo", "t.LOGO AS \"logo\"");
|
||||
columnMap.put("inffile", "t.INFFILE AS \"inffile\"");
|
||||
columnMap.put("inv", "t.INV AS \"inv\"");
|
||||
columnMap.put("invinmn", "t.INVINMN AS \"invinmn\"");
|
||||
columnMap.put("stdsdt", "t.STDSDT AS \"stdsdt\"");
|
||||
columnMap.put("pststdt", "t.PSTSTDT AS \"pststdt\"");
|
||||
columnMap.put("pesstdt", "t.PESSTDT AS \"pesstdt\"");
|
||||
columnMap.put("swdt", "t.SWDT AS \"swdt\"");
|
||||
columnMap.put("jcdt", "t.JCDT AS \"jcdt\"");
|
||||
columnMap.put("wddt", "t.WDDT AS \"wddt\"");
|
||||
columnMap.put("orderIndex", "t.ORDER_INDEX AS \"orderIndex\"");
|
||||
columnMap.put("remark", "t.REMARK AS \"remark\"");
|
||||
columnMap.put("stindx", "t.STINDX AS \"stindx\"");
|
||||
columnMap.put("coenvwState", "t.COENVW_STATE AS \"coenvwState\"");
|
||||
columnMap.put("dvtp", "CASE t.DVTP WHEN '1' THEN '堤坝式' WHEN '2' THEN '引水式' WHEN '3' THEN '混合式' ELSE '未知' END AS \"dvtpName\" ");
|
||||
columnMap.put("vlsr", "t.VLSR AS \"vlsr\"");
|
||||
columnMap.put("vlsrTm", "t.VLSR_TM AS \"vlsrTm\"");
|
||||
columnMap.put("recordUser", "t.RECORD_USER AS \"recordUser\"");
|
||||
columnMap.put("recordTime", "t.RECORD_TIME AS \"recordTime\"");
|
||||
columnMap.put("modifyUser", "t.MODIFY_USER AS \"modifyUser\"");
|
||||
columnMap.put("modifyTime", "t.MODIFY_TIME AS \"modifyTime\"");
|
||||
columnMap.put("isDeleted", "t.IS_DELETED AS \"isDeleted\"");
|
||||
columnMap.put("deleteUser", "t.DELETE_USER AS \"deleteUser\"");
|
||||
columnMap.put("deleteTime", "t.DELETE_TIME AS \"deleteTime\"");
|
||||
columnMap.put("dataSource", "t.DATA_SOURCE AS \"dataSource\"");
|
||||
return columnMap;
|
||||
}
|
||||
|
||||
private String buildVmsstbprptFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
if (filter == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(filter.getField())) {
|
||||
return buildVmsstbprptLeafCondition(filter, paramMap, indexHolder);
|
||||
}
|
||||
if (CollUtil.isEmpty(filter.getFilters())) {
|
||||
return "";
|
||||
}
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildVmsstbprptFilterCondition(child, paramMap, indexHolder);
|
||||
if (StrUtil.isNotBlank(childSql)) {
|
||||
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 field = filter.getField();
|
||||
if (StrUtil.isBlank(field)) {
|
||||
return "";
|
||||
}
|
||||
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||
String column = mapVmsstbprptColumn(field);
|
||||
if (StrUtil.isBlank(column)) {
|
||||
return "";
|
||||
}
|
||||
if ("isnull".equals(operator)) {
|
||||
return column + " IS NULL";
|
||||
}
|
||||
if ("isnotnull".equals(operator)) {
|
||||
return column + " IS NOT NULL";
|
||||
}
|
||||
if ("isempty".equals(operator)) {
|
||||
return "(" + column + " IS NULL OR " + column + " = '')";
|
||||
}
|
||||
if ("isnotempty".equals(operator)) {
|
||||
return "(" + column + " IS NOT NULL AND " + column + " <> '')";
|
||||
}
|
||||
if ("in".equals(operator) || "ni".equals(operator)) {
|
||||
List<Object> values = normalizeValues(filter.getValue());
|
||||
if (values.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (Object item : values) {
|
||||
String key = "vmsp" + indexHolder[0]++;
|
||||
paramMap.put(key, item);
|
||||
placeholders.add("#{map." + key + "}");
|
||||
}
|
||||
if (placeholders.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return column + ("ni".equals(operator) ? " NOT IN (" : " IN (") + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
Object value = filter.getValue();
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
String key = "vmsp" + indexHolder[0]++;
|
||||
paramMap.put(key, value);
|
||||
return switch (operator) {
|
||||
case "eq" -> column + " = #{map." + key + "}";
|
||||
case "neq" -> column + " <> #{map." + key + "}";
|
||||
case "contains" -> {
|
||||
paramMap.put(key, "%" + value + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "doesnotcontain" -> {
|
||||
paramMap.put(key, "%" + value + "%");
|
||||
yield column + " NOT 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" -> column + " > #{map." + key + "}";
|
||||
case "gte" -> column + " >= #{map." + key + "}";
|
||||
case "lt" -> column + " < #{map." + key + "}";
|
||||
case "lte" -> column + " <= #{map." + key + "}";
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private String mapVmsstbprptColumn(String field) {
|
||||
if (StrUtil.isBlank(field)) {
|
||||
return null;
|
||||
}
|
||||
return switch (field) {
|
||||
case "stcd" -> "t.STCD";
|
||||
case "stnm" -> "t.STNM";
|
||||
case "ennm" -> "t.ENNM";
|
||||
case "sttp" -> "t.STTP";
|
||||
case "sttpCode" -> "t.STTP_CODE";
|
||||
case "sttpName" -> "t.STTP_NAME";
|
||||
case "sttpFullPath" -> "t.STTP_FULL_PATH";
|
||||
case "sttpTreeLevel" -> "t.STTP_TREE_LEVEL";
|
||||
case "rstcd" -> "t.RSTCD";
|
||||
case "baseId" -> "t.BASE_ID";
|
||||
case "baseName" -> "t.BASE_NAME";
|
||||
case "hbrvcd" -> "t.HBRVCD";
|
||||
case "hbrvcdName" -> "t.HBRVCD_NAME";
|
||||
case "rvcd" -> "t.RVCD";
|
||||
case "rvcdName" -> "t.RVCD_NAME";
|
||||
case "addvcd" -> "t.ADDVCD";
|
||||
case "addvnm" -> "t.ADDVNM";
|
||||
case "hycd" -> "t.HYCD";
|
||||
case "hynm" -> "t.HYNM";
|
||||
case "topHycd" -> "t.TOP_HYCD";
|
||||
case "topHynm" -> "t.TOP_HYNM";
|
||||
case "lgtd" -> "t.LGTD";
|
||||
case "lttd" -> "t.LTTD";
|
||||
case "stlc" -> "t.STLC";
|
||||
case "usfl" -> "t.USFL";
|
||||
case "dtin" -> "t.DTIN";
|
||||
case "DTIN" -> "t.DTIN";
|
||||
case "dtinType" -> "t.DTIN_TYPE";
|
||||
case "mway" -> "t.MWAY";
|
||||
case "dtinTm" -> "t.DTIN_TM";
|
||||
case "bldsttCcode" -> "t.BLDSTT_CODE";
|
||||
case "introduce" -> "t.INTRODUCE";
|
||||
case "runState" -> "t.RUN_STATE";
|
||||
case "logo" -> "t.LOGO";
|
||||
case "inffile" -> "t.INFFILE";
|
||||
case "inv" -> "t.INV";
|
||||
case "invinmn" -> "t.INVINMN";
|
||||
case "stdsdt" -> "t.STDSDT";
|
||||
case "pststdt" -> "t.PSTSTDT";
|
||||
case "pesstdt" -> "t.PESSTDT";
|
||||
case "swdt" -> "t.SWDT";
|
||||
case "jcdt" -> "t.JCDT";
|
||||
case "wddt" -> "t.WDDT";
|
||||
case "orderIndex" -> "t.ORDER_INDEX";
|
||||
case "remark" -> "t.REMARK";
|
||||
case "vlsr" -> "t.VLSR";
|
||||
case "vlsrTm" -> "t.VLSR_TM";
|
||||
case "recordUser" -> "t.RECORD_USER";
|
||||
case "recordTime" -> "t.RECORD_TIME";
|
||||
case "modifyUser" -> "t.MODIFY_USER";
|
||||
case "modifyTime" -> "t.MODIFY_TIME";
|
||||
case "isDeleted" -> "t.IS_DELETED";
|
||||
case "deleteUser" -> "t.DELETE_USER";
|
||||
case "deleteTime" -> "t.DELETE_TIME";
|
||||
case "dataSource" -> "t.DATA_SOURCE";
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private String buildVmsstbprptOrderBySql(List<DataSourceRequest.SortDescriptor> sortList) {
|
||||
if (CollUtil.isEmpty(sortList)) {
|
||||
return " ORDER BY t.ORDER_INDEX ASC NULLS LAST, t.STNM ASC";
|
||||
}
|
||||
List<String> orderItems = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor sort : sortList) {
|
||||
if (sort == null || StrUtil.isBlank(sort.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = mapVmsstbprptColumn(sort.getField());
|
||||
if (StrUtil.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
String dir = "desc".equalsIgnoreCase(sort.getDir()) || "des".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC";
|
||||
orderItems.add(column + " " + dir + " NULLS LAST");
|
||||
}
|
||||
if (orderItems.isEmpty()) {
|
||||
return " ORDER BY t.ORDER_INDEX ASC NULLS LAST, t.STNM ASC";
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderItems);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user