feat: 鱼类字典列表

This commit is contained in:
tangwei 2026-06-12 10:27:45 +08:00
parent d7474cefb9
commit aa5f9a76c6
4 changed files with 511 additions and 0 deletions

View File

@ -32,6 +32,12 @@ public class FprMonitorController {
return ResponseResult.successData(fprMonitorService.getMsstbprptList(dataSourceRequest));
}
@PostMapping("/fishDic/GetKendoList")
@Operation(summary = "鱼类字典列表")
public ResponseResult getFishDicList(@RequestBody DataSourceRequest dataSourceRequest) {
return ResponseResult.successData(fprMonitorService.getFishDicList(dataSourceRequest));
}
@PostMapping("/wbsb/GetKendoList")
@Operation(summary = "查询基地/基地流域树数据")
public ResponseResult getWbsbList(@RequestBody DataSourceRequest dataSourceRequest) {

View File

@ -0,0 +1,73 @@
package com.yfd.platform.qgc_env.fpr.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
@Data
@Schema(description = "鱼类字典信息")
public class FprFishDicVo {
private String id;
private String code;
private String name;
private String nameEn;
private String alias;
private String logo;
private String introduce;
private String inffile;
private String orders;
private String family;
private String genus;
private String species;
private Integer type;
private String typeName;
private String fsz;
private Integer rare;
private String rareName;
private Integer specOrigin;
private String specOriginName;
private Integer ptype;
private String ptypeName;
private String rvcd;
private String rvcdName;
private String habitMigrat;
private String feedingHabit;
private String spawnCharact;
private String food;
private String timeFeed;
private String orignDate;
private String pretemp;
private String flowRate;
private String depth;
private String botmMater;
private String wqtq;
private String wqtqName;
private Integer habitat;
private String habitatName;
private Integer situation;
private String situationName;
private Integer resourceType;
private String resourceTypeName;
private String shapedesc;
private String protectlvl;
private String habitation;
private String fid;
private String description;
private Integer enable;
private String enableName;
private Integer internal;
private String internalName;
private Integer orderIndex;
private String recordUser;
private Date recordTime;
private String modifyUser;
private Date modifyTime;
private Integer isDeleted;
private String deleteUser;
private Date deleteTime;
private String spawnMonth;
private String vlsr;
private Date vlsrTm;
}

View File

@ -2,9 +2,12 @@ package com.yfd.platform.qgc_env.fpr.service;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.qgc_env.fpr.entity.vo.FprFishDicVo;
import com.yfd.platform.qgc_env.fpr.entity.vo.FprMsstbprptVo;
public interface FprMonitorService {
DataSourceResult<FprMsstbprptVo> getMsstbprptList(DataSourceRequest dataSourceRequest);
DataSourceResult<FprFishDicVo> getFishDicList(DataSourceRequest dataSourceRequest);
}

View File

@ -9,6 +9,7 @@ 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_env.fpr.entity.vo.FprFishDicVo;
import com.yfd.platform.qgc_env.fpr.entity.vo.FprMsstbprptVo;
import com.yfd.platform.qgc_env.fpr.service.FprMonitorService;
import com.yfd.platform.utils.QgcQueryWrapperUtil;
@ -82,6 +83,60 @@ public class FprMonitorServiceImpl implements FprMonitorService {
return result;
}
@Override
public DataSourceResult<FprFishDicVo> getFishDicList(DataSourceRequest dataSourceRequest) {
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
Map<String, Object> paramMap = new HashMap<>();
String filterSql = buildFishDicFilterCondition(
dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
paramMap,
new int[]{0}
);
if (CollUtil.isNotEmpty(dataSourceRequest == null ? null : dataSourceRequest.getGroup())) {
StringBuilder groupedBaseSql = new StringBuilder("SELECT * FROM (")
.append(buildFishDicBaseSql())
.append(") t WHERE 1 = 1 ");
if (StrUtil.isNotBlank(filterSql)) {
groupedBaseSql.append(" AND ").append(filterSql).append(" ");
}
GroupingInfo[] groupInfos = loadOptions == null ? null : loadOptions.getGroup();
String groupedSql = buildFishDicGroupSql(groupedBaseSql.toString(), groupInfos);
List<Map<String, Object>> rows = microservicDynamicSQLMapper.pageAllList(null, groupedSql, paramMap);
DataSourceResult result = new DataSourceResult();
if (Boolean.TRUE.equals(dataSourceRequest.getGroupResultFlat())) {
result.setData(new GroupHelper().faltGroup(rows, Arrays.asList(groupInfos)));
} else {
result.setData(new GroupHelper().group(rows, Arrays.asList(groupInfos)));
}
result.setTotal((long) rows.size());
result.setAggregates(new HashMap<>());
return result;
}
StringBuilder sql = new StringBuilder("SELECT ")
.append(buildFishDicDetailSelectSql(dataSourceRequest == null ? null : dataSourceRequest.getSelect()))
.append(" FROM (")
.append(buildFishDicBaseSql())
.append(") t WHERE 1 = 1 ");
if (StrUtil.isNotBlank(filterSql)) {
sql.append(" AND ").append(filterSql).append(" ");
}
sql.append(buildFishDicOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
List<FprFishDicVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
page, sql.toString(), paramMap, FprFishDicVo.class
);
DataSourceResult<FprFishDicVo> result = new DataSourceResult<>();
result.setData(list);
result.setTotal(page != null ? page.getTotal() : list.size());
result.setAggregates(new HashMap<>());
return result;
}
private String buildMsstbprptBaseSql() {
return "SELECT " +
"CAST(NULL AS VARCHAR2(36)) AS id, " +
@ -170,6 +225,77 @@ public class FprMonitorServiceImpl implements FprMonitorService {
"WHERE NVL(src.IS_DELETED, 0) = 0 ";
}
private String buildFishDicBaseSql() {
return "SELECT " +
"src.ID AS id, " +
"src.CODE AS code, " +
"src.NAME AS name, " +
"src.NAME_EN AS nameEn, " +
"src.ALIAS AS alias, " +
"src.LOGO AS logo, " +
"src.INTRODUCE AS introduce, " +
"src.INFFILE AS inffile, " +
"src.ORDERS AS orders, " +
"src.FAMILY AS family, " +
"src.GENUS AS genus, " +
"src.SPECIES AS species, " +
"src.TYPE AS type, " +
"CASE WHEN src.TYPE = 1 THEN '淡水' WHEN src.TYPE = 2 THEN '海水' ELSE NULL END AS typeName, " +
"src.FSZ AS fsz, " +
"src.RARE AS rare, " +
"CASE WHEN src.RARE = 1 THEN '是' WHEN src.RARE = 0 THEN '否' ELSE NULL END AS rareName, " +
"src.SPEC_ORIGIN AS specOrigin, " +
"CASE WHEN src.SPEC_ORIGIN = 1 THEN '本土物种' WHEN src.SPEC_ORIGIN = 2 THEN '外来物种' ELSE NULL END AS specOriginName, " +
"src.PTYPE AS ptype, " +
"CASE src.PTYPE " +
"WHEN 1 THEN '濒危' WHEN 2 THEN '极危' WHEN 3 THEN '近危' WHEN 4 THEN '易危' " +
"WHEN 5 THEN '重点保护' WHEN 6 THEN '无危' WHEN 7 THEN '国家二级' WHEN 8 THEN '市二级保护' ELSE NULL END AS ptypeName, " +
"src.RVCD AS rvcd, " +
"rv.RVNM AS rvcdName, " +
"src.HABIT_MIGRAT AS habitMigrat, " +
"src.FEEDING_HABIT AS feedingHabit, " +
"src.SPAWN_CHARACT AS spawnCharact, " +
"src.FOOD AS food, " +
"src.TIME_FEED AS timeFeed, " +
"src.ORIGN_DATE AS orignDate, " +
"src.PRETEMP AS pretemp, " +
"src.FLOW_RATE AS flowRate, " +
"src.DEPTH AS depth, " +
"src.BOTM_MATER AS botmMater, " +
"src.WQTQ AS wqtq, " +
"CASE src.WQTQ " +
"WHEN '1' THEN 'Ⅰ类' WHEN '2' THEN 'Ⅱ类' WHEN '3' THEN 'Ⅲ类' WHEN '4' THEN 'Ⅳ类' WHEN '5' THEN 'Ⅴ类' WHEN '6' THEN '劣V类' ELSE NULL END AS wqtqName, " +
"src.HABITAT AS habitat, " +
"CASE src.HABITAT WHEN 1 THEN '流水生境' WHEN 2 THEN '静缓流生境' WHEN 3 THEN '洞穴生境' ELSE NULL END AS habitatName, " +
"src.SITUATION AS situation, " +
"CASE src.SITUATION WHEN 1 THEN '优势种' WHEN 2 THEN '常见种' WHEN 3 THEN '少见种' WHEN 4 THEN '记录种' ELSE NULL END AS situationName, " +
"src.RESOURCE_TYPE AS resourceType, " +
"CASE src.RESOURCE_TYPE WHEN 1 THEN '保护鱼类' WHEN 2 THEN '特有鱼类' WHEN 3 THEN '重要经济鱼类' WHEN 4 THEN '濒危状况' ELSE NULL END AS resourceTypeName, " +
"src.SHAPEDESC AS shapedesc, " +
"src.PROTECTLVL AS protectlvl, " +
"src.HABITATION AS habitation, " +
"src.FID AS fid, " +
"src.DESCRIPTION AS description, " +
"src.ENABLE AS enable, " +
"CASE WHEN src.ENABLE = 1 THEN '启用' WHEN src.ENABLE = 0 THEN '禁用' ELSE NULL END AS enableName, " +
"src.INTERNAL AS internal, " +
"CASE WHEN src.INTERNAL = 1 THEN '是' WHEN src.INTERNAL = 0 THEN '否' ELSE NULL END AS internalName, " +
"src.ORDER_INDEX AS orderIndex, " +
"src.RECORD_USER AS recordUser, " +
"src.RECORD_TIME AS recordTime, " +
"src.MODIFY_USER AS modifyUser, " +
"src.MODIFY_TIME AS modifyTime, " +
"src.IS_DELETED AS isDeleted, " +
"src.DELETE_USER AS deleteUser, " +
"src.DELETE_TIME AS deleteTime, " +
"src.SPAWN_MONTH AS spawnMonth, " +
"src.VLSR AS vlsr, " +
"src.VLSR_TM AS vlsrTm " +
"FROM SD_FISHDICTORY_B src " +
"LEFT JOIN SD_RVCD_DIC rv ON rv.RVCD = src.RVCD " +
"WHERE NVL(src.IS_DELETED, 0) = 0 ";
}
private String buildMsstbprptDetailSelectSql(List<String> selectFields) {
LinkedHashMap<String, String> columnMap = buildMsstbprptSelectColumnMap();
if (CollUtil.isEmpty(selectFields)) {
@ -243,6 +369,87 @@ public class FprMonitorServiceImpl implements FprMonitorService {
return columnMap;
}
private String buildFishDicDetailSelectSql(List<String> selectFields) {
LinkedHashMap<String, String> columnMap = buildFishDicSelectColumnMap();
if (CollUtil.isEmpty(selectFields)) {
return String.join(", ", columnMap.values());
}
List<String> selectColumns = new ArrayList<>();
for (String field : selectFields) {
String column = columnMap.get(field);
if (StrUtil.isNotBlank(column)) {
selectColumns.add(column);
}
}
return selectColumns.isEmpty() ? String.join(", ", columnMap.values()) : String.join(", ", selectColumns);
}
private LinkedHashMap<String, String> buildFishDicSelectColumnMap() {
LinkedHashMap<String, String> columnMap = new LinkedHashMap<>();
columnMap.put("id", "t.id AS id");
columnMap.put("code", "t.code AS code");
columnMap.put("name", "t.name AS name");
columnMap.put("nameEn", "t.nameEn AS nameEn");
columnMap.put("alias", "t.alias AS alias");
columnMap.put("logo", "t.logo AS logo");
columnMap.put("introduce", "t.introduce AS introduce");
columnMap.put("inffile", "t.inffile AS inffile");
columnMap.put("orders", "t.orders AS orders");
columnMap.put("family", "t.family AS family");
columnMap.put("genus", "t.genus AS genus");
columnMap.put("species", "t.species AS species");
columnMap.put("type", "t.type AS type");
columnMap.put("typeName", "t.typeName AS typeName");
columnMap.put("fsz", "t.fsz AS fsz");
columnMap.put("rare", "t.rare AS rare");
columnMap.put("rareName", "t.rareName AS rareName");
columnMap.put("specOrigin", "t.specOrigin AS specOrigin");
columnMap.put("specOriginName", "t.specOriginName AS specOriginName");
columnMap.put("ptype", "t.ptype AS ptype");
columnMap.put("ptypeName", "t.ptypeName AS ptypeName");
columnMap.put("rvcd", "t.rvcd AS rvcd");
columnMap.put("rvcdName", "t.rvcdName AS rvcdName");
columnMap.put("habitMigrat", "t.habitMigrat AS habitMigrat");
columnMap.put("feedingHabit", "t.feedingHabit AS feedingHabit");
columnMap.put("spawnCharact", "t.spawnCharact AS spawnCharact");
columnMap.put("food", "t.food AS food");
columnMap.put("timeFeed", "t.timeFeed AS timeFeed");
columnMap.put("orignDate", "t.orignDate AS orignDate");
columnMap.put("pretemp", "t.pretemp AS pretemp");
columnMap.put("flowRate", "t.flowRate AS flowRate");
columnMap.put("depth", "t.depth AS depth");
columnMap.put("botmMater", "t.botmMater AS botmMater");
columnMap.put("wqtq", "t.wqtq AS wqtq");
columnMap.put("wqtqName", "t.wqtqName AS wqtqName");
columnMap.put("habitat", "t.habitat AS habitat");
columnMap.put("habitatName", "t.habitatName AS habitatName");
columnMap.put("situation", "t.situation AS situation");
columnMap.put("situationName", "t.situationName AS situationName");
columnMap.put("resourceType", "t.resourceType AS resourceType");
columnMap.put("resourceTypeName", "t.resourceTypeName AS resourceTypeName");
columnMap.put("shapedesc", "t.shapedesc AS shapedesc");
columnMap.put("protectlvl", "t.protectlvl AS protectlvl");
columnMap.put("habitation", "t.habitation AS habitation");
columnMap.put("fid", "t.fid AS fid");
columnMap.put("description", "t.description AS description");
columnMap.put("enable", "t.enable AS enable");
columnMap.put("enableName", "t.enableName AS enableName");
columnMap.put("internal", "t.internal AS internal");
columnMap.put("internalName", "t.internalName AS internalName");
columnMap.put("orderIndex", "t.orderIndex AS orderIndex");
columnMap.put("recordUser", "t.recordUser AS recordUser");
columnMap.put("recordTime", "t.recordTime AS recordTime");
columnMap.put("modifyUser", "t.modifyUser AS modifyUser");
columnMap.put("modifyTime", "t.modifyTime AS modifyTime");
columnMap.put("isDeleted", "t.isDeleted AS isDeleted");
columnMap.put("deleteUser", "t.deleteUser AS deleteUser");
columnMap.put("deleteTime", "t.deleteTime AS deleteTime");
columnMap.put("spawnMonth", "t.spawnMonth AS spawnMonth");
columnMap.put("vlsr", "t.vlsr AS vlsr");
columnMap.put("vlsrTm", "t.vlsrTm AS vlsrTm");
return columnMap;
}
private String buildMsstbprptFilterCondition(DataSourceRequest.FilterDescriptor filter,
Map<String, Object> paramMap,
int[] indexHolder) {
@ -268,6 +475,31 @@ public class FprMonitorServiceImpl implements FprMonitorService {
return String.join("or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ", conditions);
}
private String buildFishDicFilterCondition(DataSourceRequest.FilterDescriptor filter,
Map<String, Object> paramMap,
int[] indexHolder) {
if (filter == null) {
return "";
}
if (StrUtil.isNotBlank(filter.getField())) {
return buildFishDicLeafCondition(filter, paramMap, indexHolder);
}
if (filter.getFilters() == null || filter.getFilters().isEmpty()) {
return "";
}
List<String> conditions = new ArrayList<>();
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
String childSql = buildFishDicFilterCondition(child, paramMap, indexHolder);
if (StrUtil.isNotBlank(childSql)) {
conditions.add("(" + childSql + ")");
}
}
if (conditions.isEmpty()) {
return "";
}
return String.join("or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ", conditions);
}
private String buildMsstbprptLeafCondition(DataSourceRequest.FilterDescriptor filter,
Map<String, Object> paramMap,
int[] indexHolder) {
@ -351,6 +583,75 @@ public class FprMonitorServiceImpl implements FprMonitorService {
}
}
private String buildFishDicLeafCondition(DataSourceRequest.FilterDescriptor filter,
Map<String, Object> paramMap,
int[] indexHolder) {
String field = filter.getField();
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
Object value = filter.getValue();
String column = mapFishDicColumn(field);
if (StrUtil.isBlank(column)) {
return "";
}
if (isFishDicDateField(field)) {
return buildDateCondition(column, operator, value, paramMap, indexHolder, "fishDicP");
}
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 = "fishDicP" + indexHolder[0]++;
paramMap.put(paramKey, item);
placeholders.add("#{map." + paramKey + "}");
}
return column + " IN (" + String.join(", ", placeholders) + ")";
}
if (value == null) {
return "";
}
String paramKey = "fishDicP" + 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 String mapMsstbprptColumn(String field) {
if (StrUtil.isBlank(field)) {
return null;
@ -413,6 +714,76 @@ public class FprMonitorServiceImpl implements FprMonitorService {
};
}
private String mapFishDicColumn(String field) {
if (StrUtil.isBlank(field)) {
return null;
}
return switch (field) {
case "id" -> "t.id";
case "code" -> "t.code";
case "name" -> "t.name";
case "nameEn" -> "t.nameEn";
case "alias" -> "t.alias";
case "logo" -> "t.logo";
case "introduce" -> "t.introduce";
case "inffile" -> "t.inffile";
case "orders" -> "t.orders";
case "family" -> "t.family";
case "genus" -> "t.genus";
case "species" -> "t.species";
case "type" -> "t.type";
case "typeName" -> "t.typeName";
case "fsz" -> "t.fsz";
case "rare" -> "t.rare";
case "rareName" -> "t.rareName";
case "specOrigin" -> "t.specOrigin";
case "specOriginName" -> "t.specOriginName";
case "ptype" -> "t.ptype";
case "ptypeName" -> "t.ptypeName";
case "rvcd" -> "t.rvcd";
case "rvcdName" -> "t.rvcdName";
case "habitMigrat" -> "t.habitMigrat";
case "feedingHabit" -> "t.feedingHabit";
case "spawnCharact" -> "t.spawnCharact";
case "food" -> "t.food";
case "timeFeed" -> "t.timeFeed";
case "orignDate" -> "t.orignDate";
case "pretemp" -> "t.pretemp";
case "flowRate" -> "t.flowRate";
case "depth" -> "t.depth";
case "botmMater" -> "t.botmMater";
case "wqtq" -> "t.wqtq";
case "wqtqName" -> "t.wqtqName";
case "habitat" -> "t.habitat";
case "habitatName" -> "t.habitatName";
case "situation" -> "t.situation";
case "situationName" -> "t.situationName";
case "resourceType" -> "t.resourceType";
case "resourceTypeName" -> "t.resourceTypeName";
case "shapedesc" -> "t.shapedesc";
case "protectlvl" -> "t.protectlvl";
case "habitation" -> "t.habitation";
case "fid" -> "t.fid";
case "description" -> "t.description";
case "enable" -> "t.enable";
case "enableName" -> "t.enableName";
case "internal" -> "t.internal";
case "internalName" -> "t.internalName";
case "orderIndex" -> "t.orderIndex";
case "recordUser" -> "t.recordUser";
case "recordTime" -> "t.recordTime";
case "modifyUser" -> "t.modifyUser";
case "modifyTime" -> "t.modifyTime";
case "isDeleted" -> "t.isDeleted";
case "deleteUser" -> "t.deleteUser";
case "deleteTime" -> "t.deleteTime";
case "spawnMonth" -> "t.spawnMonth";
case "vlsr" -> "t.vlsr";
case "vlsrTm" -> "t.vlsrTm";
default -> null;
};
}
private String buildMsstbprptDetailOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
List<String> orderItems = new ArrayList<>();
if (CollUtil.isNotEmpty(sorts)) {
@ -436,6 +807,28 @@ public class FprMonitorServiceImpl implements FprMonitorService {
return " ORDER BY " + String.join(", ", orderItems);
}
private String buildFishDicOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
List<String> orderItems = new ArrayList<>();
if (CollUtil.isNotEmpty(sorts)) {
for (DataSourceRequest.SortDescriptor sort : sorts) {
if (sort == null || StrUtil.isBlank(sort.getField())) {
continue;
}
String column = mapFishDicColumn(sort.getField());
if (StrUtil.isBlank(column)) {
continue;
}
String direction = ("desc".equalsIgnoreCase(sort.getDir()) || "des".equalsIgnoreCase(sort.getDir()))
? "DESC" : "ASC";
orderItems.add(column + " " + direction + " NULLS LAST");
}
}
if (orderItems.isEmpty()) {
return " ORDER BY t.orderIndex ASC NULLS LAST, t.name ASC";
}
return " ORDER BY " + String.join(", ", orderItems);
}
private String buildMsstbprptGroupSql(String detailSql, GroupingInfo[] groupInfos) {
if (groupInfos == null || groupInfos.length == 0) {
return detailSql;
@ -465,6 +858,35 @@ public class FprMonitorServiceImpl implements FprMonitorService {
" ORDER BY " + String.join(", ", orderItems);
}
private String buildFishDicGroupSql(String detailSql, GroupingInfo[] groupInfos) {
if (groupInfos == null || groupInfos.length == 0) {
return detailSql;
}
List<String> groupFields = new ArrayList<>();
List<String> selectItems = new ArrayList<>();
List<String> orderItems = new ArrayList<>();
for (GroupingInfo item : groupInfos) {
if (item == null || StrUtil.isBlank(item.getSelector())) {
continue;
}
String selector = item.getSelector();
String column = mapFishDicColumn(selector);
if (StrUtil.isBlank(column)) {
continue;
}
groupFields.add(column);
selectItems.add(column + " AS " + selector);
selectItems.add("COUNT(*) AS count_" + selector);
orderItems.add(column + (item.getDesc() ? " DESC" : " ASC"));
}
if (groupFields.isEmpty()) {
return "SELECT * FROM (" + detailSql + ") t WHERE 1 = 0";
}
return "SELECT " + String.join(", ", selectItems) +
" FROM (" + detailSql + ") t GROUP BY " + String.join(", ", groupFields) +
" ORDER BY " + String.join(", ", orderItems);
}
private List<Object> normalizeValues(Object value) {
List<Object> values = new ArrayList<>();
if (value == null) {
@ -500,6 +922,13 @@ public class FprMonitorServiceImpl implements FprMonitorService {
|| "modifyTime".equals(field);
}
private boolean isFishDicDateField(String field) {
return "recordTime".equals(field)
|| "modifyTime".equals(field)
|| "deleteTime".equals(field)
|| "vlsrTm".equals(field);
}
private String buildDateCondition(String column,
String operator,
Object value,