Browse Source

1、用量分析接口(多表查询时候)

dev_fgd_scr
3067418132@qq.com 3 weeks ago
parent
commit
272d8cdf04
  1. 36
      mh-system/src/main/java/com/mh/system/mapper/energy/FgdScrEnergyQueryMapper.java

36
mh-system/src/main/java/com/mh/system/mapper/energy/FgdScrEnergyQueryMapper.java

@ -96,9 +96,10 @@ public interface FgdScrEnergyQueryMapper {
@Select("<script>" +
"select " +
" sum(dm.calc_value) as curValue, " +
" CASE dm.device_type " +
" WHEN '5' THEN 'meter' " +
" WHEN '2' THEN 'cloud' " +
" CASE dm.device_num " +
" WHEN 'VD16' THEN 'so1' " +
" WHEN 'VD36' THEN 'so2' " +
" WHEN 'VD56' THEN 'loadCell' " +
" ELSE 'Unknown' " +
" END as deviceType," +
" TO_CHAR(dm.cur_time, " +
@ -124,7 +125,12 @@ public interface FgdScrEnergyQueryMapper {
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') " +
"<if test='haveSO2 == true'> " +
" and dl.device_type in ('31', '32') " +
"</if>" +
"<if test='haveSO2 == false'> " +
" and dl.device_type = '32' " +
"</if>" +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -133,7 +139,7 @@ public interface FgdScrEnergyQueryMapper {
"</if>" +
") " +
"group by " +
" device_type, " +
" device_num, " +
" TO_CHAR(dm.cur_time, " +
" <choose>" +
" <when test='len == 4'>'YYYY'</when>" +
@ -147,9 +153,10 @@ public interface FgdScrEnergyQueryMapper {
"union all " +
"select " +
" sum(dm.calc_value) as curValue, " +
" CASE dm.device_type " +
" WHEN '5' THEN 'meter' " +
" WHEN '2' THEN 'cloud' " +
" CASE dm.device_num " +
" WHEN 'VD16' THEN 'so1' " +
" WHEN 'VD36' THEN 'so2' " +
" WHEN 'VD56' THEN 'loadCell' " +
" ELSE 'Unknown' " +
" END as deviceType," +
" TO_CHAR(dm.cur_time, " +
@ -175,7 +182,12 @@ public interface FgdScrEnergyQueryMapper {
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') " +
"<if test='haveSO2 == true'> " +
" and dl.device_type in ('31', '32') " +
"</if>" +
"<if test='haveSO2 == false'> " +
" and dl.device_type = '32' " +
"</if>" +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -184,7 +196,7 @@ public interface FgdScrEnergyQueryMapper {
"</if>" +
") " +
"group by " +
" device_type, " +
" device_num, " +
" TO_CHAR(dm.cur_time, " +
" <choose>" +
" <when test='len == 4'>'YYYY'</when>" +
@ -202,8 +214,8 @@ public interface FgdScrEnergyQueryMapper {
@Param("curTableName") String curTableName,
@Param("len") String dateLen,
@Param("paramType") String paramType,
@Param("haveMeter") boolean haveMeter,
@Param("haveCloud") boolean haveCloud,
@Param("haveLoadCell") boolean haveLoadCell,
@Param("haveSO2") boolean haveSO2,
@Param("systemType") String systemType);
}

Loading…
Cancel
Save