Browse Source

修改查询

hzh 2 months ago
parent
commit
0af0112e71

+ 4 - 0
app/dbc-app/src/main/resources/mapper/record/EnterpriseEnergyDataMapper.xml

@@ -624,4 +624,8 @@
 			#{item}
 			#{item}
 		</foreach>
 		</foreach>
 	</select>
 	</select>
+	<select id="getMarks" resultType="java.lang.Integer">
+		select collectRatioMax - collectRatioMin as marks
+		from dict_energy_type_unit_collect where code = #{dataCode}
+	</select>
 </mapper>
 </mapper>

+ 4 - 2
app/dbc-app/src/main/resources/mapper/record/EnterpriseMapper.xml

@@ -457,7 +457,7 @@ END as value
     </select>
     </select>
     <!-- isForce 是否必传(0非必传 1必传); isEnable 是否停用(0启用 1停用)-->
     <!-- isForce 是否必传(0非必传 1必传); isEnable 是否停用(0启用 1停用)-->
     <select id="getValueByNewProcedure" resultType="com.nantian.cloud.dbcapp.vo.ProcedureVO">
     <select id="getValueByNewProcedure" resultType="com.nantian.cloud.dbcapp.vo.ProcedureVO">
-        select id, enterpriseCode, configureCode, configureName, radio, value, energyUseType, collectType, unit, collectUnit, type, name, isForce, isEnable, thresholdInterval
+        select id, enterpriseCode, configureCode, configureName, radio, value, energyUseType, collectType, unit, collectUnit, type, name, isForce, isEnable, thresholdInterval,startTime
         from(
         from(
             select distinct c.id, c.enterpriseCode, c.dataCode as configureCode, c.collectItemName as configureName, t.modulus radio, t.consume_sum value,
             select distinct c.id, c.enterpriseCode, c.dataCode as configureCode, c.collectItemName as configureName, t.modulus radio, t.consume_sum value,
             (select meaning from dict_energy_use where code = substr(c.dataCode,15,2)) energyUseType,
             (select meaning from dict_energy_use where code = substr(c.dataCode,15,2)) energyUseType,
@@ -471,7 +471,9 @@ END as value
             (select distinct case when isForce = '0' then '0' else '1' end isForce from configure_data_collect_new where c.enterpriseCode = enterpriseCode and c.dataCode = dataCode) isForce,
             (select distinct case when isForce = '0' then '0' else '1' end isForce from configure_data_collect_new where c.enterpriseCode = enterpriseCode and c.dataCode = dataCode) isForce,
             (select distinct thresholdInterval from configure_data_collect_new where c.enterpriseCode = enterpriseCode and c.dataCode = dataCode) thresholdInterval,
             (select distinct thresholdInterval from configure_data_collect_new where c.enterpriseCode = enterpriseCode and c.dataCode = dataCode) thresholdInterval,
             (select case when GROUP_CONCAT(id) is null then '0' else '1' end isEnable from configure_data_collect_enable where c.enterpriseCode = enterpriseCode and c.dataCode = dataCode
             (select case when GROUP_CONCAT(id) is null then '0' else '1' end isEnable from configure_data_collect_enable where c.enterpriseCode = enterpriseCode and c.dataCode = dataCode
-                and delFlag = '1' and left(#{startTime},7) between left(startTime,7) and left(IFNULL(NULLIF(endTime, ''), NOW()),7) ) isEnable
+                and delFlag = '1' and left(#{startTime},7) between left(startTime,7) and left(IFNULL(NULLIF(endTime, ''), NOW()),7) ) isEnable,
+            (select startTime from configure_data_collect_enable where c.enterpriseCode = enterpriseCode and c.dataCode = dataCode
+            and delFlag = '1' and left(#{startTime},7) between left(startTime,7) and left(IFNULL(NULLIF(endTime, ''), NOW()),7) ) startTime
             from configure_data_collect c
             from configure_data_collect c
             left join dict_energy_type_unit_collect d1 on d1.code = substr(c.dataCode,11,4)
             left join dict_energy_type_unit_collect d1 on d1.code = substr(c.dataCode,11,4)
             left join dict_energy_substance d2 on d2.code = substr(c.dataCode,11,4)
             left join dict_energy_substance d2 on d2.code = substr(c.dataCode,11,4)