|
@@ -32,16 +32,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="selectPgSupplyHList" parameterType="com.ruoyi.ems.domain.ElecPgSupplyH" resultMap="PgSupplyHResult">
|
|
|
<include refid="selectPgSupplyHVo"/>
|
|
|
<where>
|
|
|
- <if test="areaCode != null and areaCode != ''"> and pg.`area_code` = #{areaCode}</if>
|
|
|
- <if test="facsCode != null and facsCode != ''"> and pg.`facs_code` = #{facsCode}</if>
|
|
|
- <if test="date != null "> and pg.`date` = #{date}</if>
|
|
|
- <if test="time != null "> and pg.`time` = #{time}</if>
|
|
|
- <if test="timeIndex != null "> and pg.`time_index` = #{timeIndex}</if>
|
|
|
- <if test="meterType != null "> and pg.`meter_type` = #{meterType}</if>
|
|
|
- <if test="meterUnitPrice != null "> and pg.`meter_unit_price` = #{meterUnitPrice}</if>
|
|
|
- <if test="useElecQuantity != null "> and pg.`use_elec_quantity` = #{useElecQuantity}</if>
|
|
|
- <if test="useElecCost != null "> and pg.`use_elec_cost` = #{useElecCost}</if>
|
|
|
+ <if test="areaCode != null and areaCode != ''">and pg.`area_code` = #{areaCode}</if>
|
|
|
+ <if test="facsCode != null and facsCode != ''">and pg.`facs_code` = #{facsCode}</if>
|
|
|
+ <if test="date != null ">and pg.`date` = #{date}</if>
|
|
|
+ <if test="time != null ">and pg.`time` = #{time}</if>
|
|
|
+ <if test="timeIndex != null ">and pg.`time_index` = #{timeIndex}</if>
|
|
|
+ <if test="meterType != null ">and pg.`meter_type` = #{meterType}</if>
|
|
|
+ <if test="meterUnitPrice != null ">and pg.`meter_unit_price` = #{meterUnitPrice}</if>
|
|
|
+ <if test="useElecQuantity != null ">and pg.`use_elec_quantity` = #{useElecQuantity}</if>
|
|
|
+ <if test="useElecCost != null ">and pg.`use_elec_cost` = #{useElecCost}</if>
|
|
|
+ <if test="startRecTime != null and startRecTime != '' and endRecTime != null and endRecTime !=''">
|
|
|
+ and pg.`record_time` >= #{startRecTime} and pg.`record_time` <= #{endRecTime}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
+ ORDER BY pg.`date` DESC,
|
|
|
+ pg.`time` DESC,
|
|
|
+ pg.`time_index`
|
|
|
+ </select>
|
|
|
+ <select id="selectPgSupplyHAllArea" parameterType="com.ruoyi.ems.domain.ElecPgSupplyH" resultMap="PgSupplyHResult">
|
|
|
+ SELECT facCategory.`code` facs_code,
|
|
|
+ facCategory.`name` facs_name,
|
|
|
+ pg.`date`,
|
|
|
+ pg.`time`,
|
|
|
+ pg.`time_index`,
|
|
|
+ pg.`meter_type`,
|
|
|
+ pg.`meter_unit_price`,
|
|
|
+ sum(COALESCE(pg.`use_elec_quantity`, 0)) use_elec_quantity,
|
|
|
+ sum(COALESCE(pg.`use_elec_cost`, 0)) use_elec_cost
|
|
|
+ FROM adm_ems_pg_supply_h pg
|
|
|
+ inner JOIN adm_service_area a ON pg.`area_code` = a.`area_code`
|
|
|
+ inner JOIN adm_ems_facs f ON pg.`facs_code` = f.`facs_code`
|
|
|
+ inner JOIN dim_ems_facs_category facCategory ON f.facs_category = facCategory.`code`
|
|
|
+ <where>
|
|
|
+ <if test="areaCode != null and areaCode != ''">and pg.`area_code` = #{areaCode}</if>
|
|
|
+ <if test="startRecTime != null and startRecTime != '' and endRecTime != null and endRecTime !=''">
|
|
|
+ and pg.`record_time` >= #{startRecTime} and pg.`record_time` <= #{endRecTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY facCategory.`code`,
|
|
|
+ pg.DATE,
|
|
|
+ pg.time_index,
|
|
|
+ pg.TIME
|
|
|
+ ORDER BY pg.`date` DESC,
|
|
|
+ pg.`time` DESC,
|
|
|
+ pg.`time_index`
|
|
|
+ </select>
|
|
|
+ <select id="calThisDaySupply" parameterType="String" resultType="Map">
|
|
|
+ SELECT sum(
|
|
|
+ COALESCE(CAST(use_elec_cost AS DECIMAL(10, 2)), 0)) cost,
|
|
|
+ sum(
|
|
|
+ COALESCE(CAST(use_elec_quantity AS DECIMAL(10, 2)), 0)) quantity
|
|
|
+ FROM adm_ems_pg_supply_h
|
|
|
+ WHERE
|
|
|
+ DATE = #{thisDay}
|
|
|
+ GROUP BY
|
|
|
+ DATE
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="calThisDaySupplyByH" parameterType="String" resultType="Map">
|
|
|
+ SELECT time_index timeIndex,
|
|
|
+ sum(
|
|
|
+ COALESCE(CAST(use_elec_cost AS DECIMAL(10, 2)), 0)) cost,
|
|
|
+ sum(
|
|
|
+ COALESCE(CAST(use_elec_quantity AS DECIMAL(10, 2)), 0)) quantity
|
|
|
+ FROM adm_ems_pg_supply_h
|
|
|
+ WHERE
|
|
|
+ DATE = #{thisDay}
|
|
|
+ GROUP BY
|
|
|
+ DATE, time_index
|
|
|
</select>
|
|
|
|
|
|
<select id="selectPgSupplyH" parameterType="com.ruoyi.ems.domain.vo.QueryIndex" resultMap="PgSupplyHResult">
|