|
@@ -441,14 +441,13 @@
|
|
|
left join sms_scene s on s.SCENE_TYPE_ID =st.id
|
|
|
left join sms_device_parm dp on s.id=dp.PARENT_SCENE_ID
|
|
|
left join sms_year_report r on r.DEVICE_ID= dp.DEVICE_ID and r.ATTRIBUTE_ID = dp.ATTRIBUTE_ID
|
|
|
-
|
|
|
where dp.`STATUS`=1 and s.ENABLE_STATE = 1 and dp.TENANT_ID=#{tenantId}
|
|
|
- <if test="companyOrgId != null">
|
|
|
- and s.COMPANY_ORG_ID = #{companyOrgId}
|
|
|
- </if>
|
|
|
and dp.PARM_TYPE = #{parmType} and st.SCENE_TYPE_NAME = #{sceneType}
|
|
|
and r.year*12 + r.month >= year(CURDATE())*12 + month(CURDATE()) + 1 - #{month}
|
|
|
and r.year*12 + r.month < year(CURDATE())*12 + month(CURDATE()) + 1
|
|
|
+ <if test="companyOrgId != null">
|
|
|
+ and s.COMPANY_ORG_ID = #{companyOrgId}
|
|
|
+ </if>
|
|
|
<if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">
|
|
|
<if test="permissonType == 5 or permissonType == 2">
|
|
|
and ( s.DEPT_ORG_ID in
|
|
@@ -481,22 +480,67 @@
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <!--查询时间段内的取水量供水量-->
|
|
|
- <select id="getDeviceWaterForMonth" resultType="com.huaxu.dto.generalView.DeviceWaterSupply">
|
|
|
+ <!--查询时间段内的取水量供水量 按月查询-->
|
|
|
+<!-- <select id="getDeviceWaterForMonth" resultType="com.huaxu.dto.generalView.DeviceWaterSupply">-->
|
|
|
+<!-- select-->
|
|
|
+<!-- r.year,r.month,r.day,-->
|
|
|
+<!-- sum(r.SUM_VALUE)/10000 as "amount"-->
|
|
|
+<!-- from sms_scene_type st-->
|
|
|
+<!-- left join sms_scene s on s.SCENE_TYPE_ID =st.id-->
|
|
|
+<!-- left join sms_device_parm dp on s.id=dp.PARENT_SCENE_ID-->
|
|
|
+<!-- left join sms_year_report r on r.DEVICE_ID= dp.DEVICE_ID and r.ATTRIBUTE_ID = dp.ATTRIBUTE_ID-->
|
|
|
+<!-- where dp.`STATUS`=1 and s.ENABLE_STATE = 1 and dp.TENANT_ID=#{tenantId}-->
|
|
|
+<!-- and dp.PARM_TYPE = #{parmType} and st.SCENE_TYPE_NAME = #{sceneType}-->
|
|
|
+<!-- and r.year*12 + r.month >= #{startYear}*12 + #{startMonth}-->
|
|
|
+<!-- and r.year*12 + r.month <= #{endYear}*12 + #{endMonth}-->
|
|
|
+<!-- <if test="companyOrgId != null">-->
|
|
|
+<!-- and s.COMPANY_ORG_ID = #{companyOrgId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">-->
|
|
|
+<!-- <if test="permissonType == 5 or permissonType == 2">-->
|
|
|
+<!-- and ( s.DEPT_ORG_ID in-->
|
|
|
+<!-- <foreach collection="programItems" item="item" open="(" close=")" separator=",">-->
|
|
|
+<!-- #{item.orgId}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- or-->
|
|
|
+<!-- s.COMPANY_ORG_ID in-->
|
|
|
+<!-- <foreach collection="programItems" item="item" open="(" close=")" separator=",">-->
|
|
|
+<!-- #{item.orgId}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- )-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="permissonType == 4 or permissonType == 3">-->
|
|
|
+<!-- and s.DEPT_ORG_ID in-->
|
|
|
+<!-- <foreach collection="programItems" item="item" open="(" close=")" separator=",">-->
|
|
|
+<!-- #{item.orgId}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="permissonType == 1">-->
|
|
|
+<!-- and s.COMPANY_ORG_ID in-->
|
|
|
+<!-- <foreach collection="programItems" item="item" open="(" close=")" separator=",">-->
|
|
|
+<!-- #{item.orgId}-->
|
|
|
+<!-- </foreach>-->
|
|
|
+<!-- and (s.DEPT_ORG_ID is null or s.DEPT_ORG_ID =0)-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- group by r.year,r.month,r.day-->
|
|
|
+<!-- order by r.year desc,r.month desc,r.day desc-->
|
|
|
+<!-- </select>-->
|
|
|
+
|
|
|
+ <select id="getDeviceWaterForDay" resultType="com.huaxu.dto.generalView.DeviceWaterSupply">
|
|
|
select
|
|
|
r.year,r.month,r.day,
|
|
|
sum(r.SUM_VALUE)/10000 as "amount"
|
|
|
from sms_scene_type st
|
|
|
left join sms_scene s on s.SCENE_TYPE_ID =st.id
|
|
|
left join sms_device_parm dp on s.id=dp.PARENT_SCENE_ID
|
|
|
- left join sms_year_report r on r.DEVICE_ID= dp.DEVICE_ID and r.ATTRIBUTE_ID = dp.ATTRIBUTE_ID
|
|
|
- where dp.`STATUS`=1 and s.ENABLE_STATE = 1 and dp.TENANT_ID=#{tenantId}
|
|
|
+ left join sms_month_report r on r.DEVICE_ID= dp.DEVICE_ID and r.ATTRIBUTE_ID = dp.ATTRIBUTE_ID
|
|
|
+ where st.`STATUS`=1 and dp.`STATUS`=1 and s.ENABLE_STATE = 1 and dp.TENANT_ID=#{tenantId}
|
|
|
+ and r.COLLECT_DATE >= DATE_SUB(CURDATE(),INTERVAL #{day}-1 day)
|
|
|
+ and dp.PARM_TYPE = #{parmType} and st.SCENE_TYPE_NAME = #{sceneType}
|
|
|
<if test="companyOrgId != null">
|
|
|
and s.COMPANY_ORG_ID = #{companyOrgId}
|
|
|
</if>
|
|
|
- and dp.PARM_TYPE = #{parmType} and st.SCENE_TYPE_NAME = #{sceneType}
|
|
|
- and r.year*12 + r.month >= #{startYear}*12 + #{startMonth}
|
|
|
- and r.year*12 + r.month <= #{endYear}*12 + #{endMonth}
|
|
|
<if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">
|
|
|
<if test="permissonType == 5 or permissonType == 2">
|
|
|
and ( s.DEPT_ORG_ID in
|
|
@@ -527,6 +571,4 @@
|
|
|
group by r.year,r.month,r.day
|
|
|
order by r.year desc,r.month desc,r.day desc
|
|
|
</select>
|
|
|
-
|
|
|
-
|
|
|
</mapper>
|