fix: 优化水温模块接口逻辑
This commit is contained in:
parent
30d0522a9c
commit
88a2d81953
@ -162,6 +162,29 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
|
||||
String coenvwState = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "coenvwState");
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
boolean queryEngDirectly = "ENG".equalsIgnoreCase(sttpCode);
|
||||
if (queryEngDirectly) {
|
||||
sql.append("SELECT ")
|
||||
.append("hb.BASENAME AS baseName, ")
|
||||
.append("eng.ENNM AS stnm, ")
|
||||
.append("eng.ENNM AS ennm, ")
|
||||
.append("eng.JCDT AS jcdt, ")
|
||||
.append("NULL AS stindx, ")
|
||||
.append("CASE WHEN NVL(eng.DTIN, 0) = 1 THEN 1 ELSE 0 END AS coenvwState, ")
|
||||
.append("'ENG' AS sttpCode, ")
|
||||
.append("eng.STCD AS stcd, ")
|
||||
.append("eng.STCD AS rstcd, ")
|
||||
.append("NULL AS stCode, ")
|
||||
.append("NULL AS stName, ")
|
||||
.append("eng.DVTP AS dvtp, ")
|
||||
.append("hb.ORDER_INDEX AS baseStepSort, ")
|
||||
.append("eng.HBRVCD AS hbrvcd, ")
|
||||
.append("eng.ORDER_INDEX AS rstcdStepSort, ")
|
||||
.append("eng.ORDER_INDEX AS siteStepSort ")
|
||||
.append("FROM SD_ENGINFO_B_H eng ")
|
||||
.append("LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 ")
|
||||
.append("WHERE 1 = 1 ");
|
||||
} else {
|
||||
sql.append("SELECT ")
|
||||
.append("hb.BASENAME AS baseName, ")
|
||||
.append("wq.STNM AS stnm, ")
|
||||
@ -184,32 +207,49 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
|
||||
.append("LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN (SELECT DISTINCT STCD FROM SD_WQ_R WHERE NVL(IS_DELETED, 0) = 0 AND TM >= SYSDATE - 1) recent ON recent.STCD = wq.STCD ")
|
||||
.append("WHERE NVL(wq.IS_DELETED, 0) = 0 ");
|
||||
}
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
if (StrUtil.isNotBlank(mway)) {
|
||||
if (!queryEngDirectly && StrUtil.isNotBlank(mway)) {
|
||||
paramMap.put("mway", mway);
|
||||
sql.append("AND wq.MWAY = #{map.mway} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(sttpCode)) {
|
||||
if (!queryEngDirectly && StrUtil.isNotBlank(sttpCode)) {
|
||||
paramMap.put("sttpCode", sttpCode);
|
||||
sql.append("AND wq.STTP = #{map.sttpCode} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(dtinType)) {
|
||||
paramMap.put("dtinType", dtinType);
|
||||
if (queryEngDirectly) {
|
||||
sql.append("AND NVL(eng.DTIN, 0) = #{map.dtinType} ");
|
||||
} else {
|
||||
sql.append("AND wq.DTIN_TYPE = #{map.dtinType} ");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(rstcd)) {
|
||||
paramMap.put("rstcd", rstcd);
|
||||
if (queryEngDirectly) {
|
||||
sql.append("AND eng.STCD = #{map.rstcd} ");
|
||||
} else {
|
||||
sql.append("AND wq.RSTCD = #{map.rstcd} ");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(stnm)) {
|
||||
paramMap.put("stnm", "%" + stnm + "%");
|
||||
if (queryEngDirectly) {
|
||||
sql.append("AND eng.ENNM LIKE #{map.stnm} ");
|
||||
} else {
|
||||
sql.append("AND wq.STNM LIKE #{map.stnm} ");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(coenvwState)) {
|
||||
paramMap.put("coenvwState", coenvwState);
|
||||
if (queryEngDirectly) {
|
||||
sql.append("AND CASE WHEN NVL(eng.DTIN, 0) = 1 THEN 1 ELSE 0 END = #{map.coenvwState} ");
|
||||
} else {
|
||||
sql.append("AND CASE WHEN recent.STCD IS NOT NULL THEN 1 ELSE 0 END = #{map.coenvwState} ");
|
||||
}
|
||||
}
|
||||
|
||||
// sql.append(buildEnvWqOrderBySql(dataSourceRequest.getSort()));
|
||||
PageInfo pageInfo = QgcQueryWrapperUtil.getPageInfo(loadOptions);
|
||||
|
||||
@ -161,7 +161,7 @@ public class SdWTMonitorController {
|
||||
return ResponseResult.successData(sdWtMonitorService.getEvnmAutoMonitorList());
|
||||
}
|
||||
|
||||
@PostMapping("/base/vmsstbprpt/GetKendoList")
|
||||
@PostMapping("/vmsstbprpt/GetKendoList")
|
||||
@Operation(summary = "根据类型查询水温表基本数据")
|
||||
public ResponseResult getVmsstbprptList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(sdWtMonitorService.getVmsstbprptList(dataSourceRequest));
|
||||
|
||||
@ -155,8 +155,31 @@ public class SdWtMonitorServiceImpl implements SdWtMonitorService {
|
||||
String rstcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "rstcd");
|
||||
String stnm = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stnm");
|
||||
String coenvwState = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "coenvwState");
|
||||
|
||||
String dtin = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "dtin");
|
||||
StringBuilder sql = new StringBuilder();
|
||||
boolean queryEngDirectly = "ENG".equalsIgnoreCase(sttpCode);
|
||||
if (queryEngDirectly) {
|
||||
sql.append("SELECT ")
|
||||
.append("hb.BASENAME AS baseName, ")
|
||||
.append("eng.ENNM AS stnm, ")
|
||||
.append("eng.ENNM AS ennm, ")
|
||||
.append("eng.JCDT AS jcdt, ")
|
||||
.append("NULL AS stindx, ")
|
||||
.append("CASE WHEN NVL(eng.DTIN, 0) = 1 THEN 1 ELSE 0 END AS coenvwState, ")
|
||||
.append("'ENG' AS sttpCode, ")
|
||||
.append("eng.STCD AS stcd, ")
|
||||
.append("eng.STCD AS rstcd, ")
|
||||
.append("NULL AS stCode, ")
|
||||
.append("NULL AS stName, ")
|
||||
.append("eng.DVTP AS dvtp, ")
|
||||
.append("hb.ORDER_INDEX AS baseStepSort, ")
|
||||
.append("eng.HBRVCD AS hbrvcd, ")
|
||||
.append("eng.ORDER_INDEX AS rstcdStepSort, ")
|
||||
.append("eng.ORDER_INDEX AS siteStepSort ")
|
||||
.append("FROM SD_ENGINFO_B_H eng ")
|
||||
.append("LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID ")
|
||||
.append("WHERE 1=1 ");
|
||||
} else {
|
||||
sql.append("SELECT ")
|
||||
.append("hb.BASENAME AS baseName, ")
|
||||
.append("wt.STNM AS stnm, ")
|
||||
@ -183,31 +206,53 @@ public class SdWtMonitorServiceImpl implements SdWtMonitorService {
|
||||
.append("LEFT JOIN (SELECT DISTINCT STCD FROM SD_WTRV_R WHERE IS_DELETED = 0 AND TM >= SYSDATE - 1) rvRecent ON rvRecent.STCD = wt.STCD ")
|
||||
.append("LEFT JOIN (SELECT DISTINCT STCD FROM SD_WTVT_R WHERE IS_DELETED = 0 AND TM >= SYSDATE - 1) vtRecent ON vtRecent.STCD = wt.STCD ")
|
||||
.append("WHERE wt.IS_DELETED = 0 AND wt.DTIN_TYPE = 0 ");
|
||||
}
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
if (mway != null && !mway.isBlank()) {
|
||||
if (!queryEngDirectly && mway != null && !mway.isBlank()) {
|
||||
paramMap.put("mway", mway);
|
||||
sql.append("AND wt.MWAY = #{map.mway} ");
|
||||
}
|
||||
if (sttpCode != null && !sttpCode.isBlank()) {
|
||||
if (!queryEngDirectly && sttpCode != null && !sttpCode.isBlank()) {
|
||||
paramMap.put("sttpCode", sttpCode);
|
||||
sql.append("AND wt.STTP = #{map.sttpCode} ");
|
||||
}
|
||||
if (rstcd != null && !rstcd.isBlank()) {
|
||||
paramMap.put("rstcd", rstcd);
|
||||
if (queryEngDirectly) {
|
||||
sql.append("AND eng.STCD = #{map.rstcd} ");
|
||||
} else {
|
||||
sql.append("AND wt.RSTCD = #{map.rstcd} ");
|
||||
}
|
||||
}
|
||||
if (stnm != null && !stnm.isBlank()) {
|
||||
paramMap.put("stnm", "%" + stnm + "%");
|
||||
if (queryEngDirectly) {
|
||||
sql.append("AND eng.ENNM LIKE #{map.stnm} ");
|
||||
} else {
|
||||
sql.append("AND wt.STNM LIKE #{map.stnm} ");
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(dtin)) {
|
||||
paramMap.put("dtin", dtin);
|
||||
if (queryEngDirectly) {
|
||||
sql.append("AND NVL(eng.DTIN, 0) = #{map.dtin} ");
|
||||
} else {
|
||||
sql.append("AND wt.DTIN = #{map.dtin} ");
|
||||
}
|
||||
}
|
||||
if (coenvwState != null && !coenvwState.isBlank()) {
|
||||
paramMap.put("coenvwState", coenvwState);
|
||||
if (queryEngDirectly) {
|
||||
sql.append("AND CASE WHEN NVL(eng.DTIN, 0) = 1 THEN 1 ELSE 0 END = #{map.coenvwState} ");
|
||||
} else {
|
||||
sql.append("AND CASE ")
|
||||
.append("WHEN wt.STTP = 'WTRV' AND rvRecent.STCD IS NOT NULL THEN 1 ")
|
||||
.append("WHEN wt.STTP = 'WTVT' AND vtRecent.STCD IS NOT NULL THEN 1 ")
|
||||
.append("ELSE 0 END = #{map.coenvwState} ");
|
||||
}
|
||||
}
|
||||
|
||||
sql.append(buildVmsstbprptOrderBySql(dataSourceRequest.getSort()));
|
||||
Page<?> page = buildPage(loadOptions);
|
||||
@ -493,7 +538,7 @@ public class SdWtMonitorServiceImpl implements SdWtMonitorService {
|
||||
} else if ("rstcdStepSort".equals(field)) {
|
||||
orderColumns.add("NVL(eng.ORDER_INDEX, 999999) " + dir);
|
||||
} else if ("siteStepSort".equals(field)) {
|
||||
orderColumns.add("NVL(wt.ORDER_INDEX, 999999) " + dir);
|
||||
// orderColumns.add("NVL(wt.ORDER_INDEX, 999999) " + dir);
|
||||
} else if ("stnm".equals(field)) {
|
||||
orderColumns.add("wt.STNM " + dir);
|
||||
} else if ("ennm".equals(field)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user