|
@@ -19,6 +19,12 @@
|
|
|
<result property="elecQuantity" column="elec_quantity"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap type="com.ruoyi.ems.domain.vo.ElecUseSta" id="elecUseResult">
|
|
|
+ <result property="objCode" column="obj_code"/>
|
|
|
+ <result property="objName" column="obj_name"/>
|
|
|
+ <result property="elecQuantity" column="elec_quantity"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<sql id="selectElecUseHVo">
|
|
|
select u.id,
|
|
|
u.area_code,
|
|
@@ -123,7 +129,7 @@
|
|
|
u.`time_index`
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectSumBySubCategory" parameterType="com.ruoyi.ems.domain.ElecUseH" resultMap="elecUseHResult">
|
|
|
+ <select id="selectSumBySubCategory" parameterType="com.ruoyi.ems.domain.ElecUseH" resultMap="elecUseResult">
|
|
|
select
|
|
|
sc.`code` as obj_code, sc.`name` as obj_name, sum(t.elec_quantity) as elec_quantity
|
|
|
from dim_ems_facs_subcategory sc
|
|
@@ -136,6 +142,7 @@
|
|
|
<where>
|
|
|
f.facs_category = 'Z'
|
|
|
and u.obj_type = 1
|
|
|
+ <if test="areaCode != null and areaCode != '' and areaCode != '-1'">and f.ref_area = #{areaCode}</if>
|
|
|
<if test="startRecTime != null and startRecTime != '' and endRecTime != null and endRecTime !=''">
|
|
|
and u.record_time >= #{startRecTime} and u.record_time <= #{endRecTime}
|
|
|
</if>
|
|
@@ -146,6 +153,23 @@
|
|
|
GROUP BY sc.`code`, sc.`name`;
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectSumByFacs" parameterType="com.ruoyi.ems.domain.ElecUseH" resultMap="elecUseResult">
|
|
|
+ select
|
|
|
+ f.facs_code as obj_code, f.facs_name as obj_name, sum(u.elec_quantity) as elec_quantity
|
|
|
+ from
|
|
|
+ adm_ems_facs f
|
|
|
+ left join adm_ems_obj_use_h u on f.facs_code = u.obj_code
|
|
|
+ <where>
|
|
|
+ and u.obj_type = 1
|
|
|
+ <if test="areaCode != null and areaCode != '' and areaCode != '-1'">and u.area_code = #{areaCode}</if>
|
|
|
+ <if test="facsSubCategory != null and facsSubCategory != ''">and f.facs_subcategory = #{facsSubCategory}</if>
|
|
|
+ <if test="startRecTime != null and startRecTime != '' and endRecTime != null and endRecTime !=''">
|
|
|
+ and u.record_time >= #{startRecTime} and u.record_time <= #{endRecTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY f.facs_code, f.facs_name
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="selectElecUseHById" parameterType="Long" resultMap="elecUseHResult">
|
|
|
<include refid="selectElecUseHVo"/>
|
|
|
where u.`id` = #{id}
|