|
@@ -56,4 +56,57 @@
|
|
|
<if test="endDate != null and endDate != 0"> and read_date <![CDATA[ <= ]]> #{endDate} </if>
|
|
|
order by date_create desc
|
|
|
</select>
|
|
|
+ <select id="getDeviceVolume" resultType="java.lang.Double">
|
|
|
+ select ifnull(sum(last_cost),0) from sc_meter_read_record
|
|
|
+ where status = 1 and device_id = #{deviceId} and
|
|
|
+ read_date <![CDATA[ >= ]]> #{startDate} and read_date <![CDATA[ <= ]]> #{endDate}
|
|
|
+ </select>
|
|
|
+ <select id="getRealTimeUseWater" resultType="com.zoniot.ccrc.dto.UseWaterDto">
|
|
|
+ select read_date as date,last_cost as use_volume from sc_meter_read_record
|
|
|
+ where status = 1 and device_id = #{deviceId} and
|
|
|
+ read_date <![CDATA[ >= ]]> #{startDate} and read_date <![CDATA[ <= ]]> #{endDate}
|
|
|
+ order by read_data asc
|
|
|
+ </select>
|
|
|
+ <select id="getUseWaterByMonth" resultType="com.zoniot.ccrc.dto.UseWaterDto">
|
|
|
+ SELECT DATE_FORMAT(read_date,'%Y%m') as date,sum(last_cost) as useVolume FROM sc_meter_read_record
|
|
|
+ where status = 1 and device_id = #{deviceId}
|
|
|
+ and read_date <![CDATA[ >= ]]> #{startDate} and read_date <![CDATA[ <= ]]> #{endDate}
|
|
|
+ GROUP BY date
|
|
|
+ </select>
|
|
|
+ <select id="getYesterReadData" resultType="com.zoniot.ccrc.repository.MongoMeterReadRecord">
|
|
|
+ select last_cost from sc_meter_read_record where status = 1 and device_id = #{deviceId}
|
|
|
+ and read_date=#{date}
|
|
|
+ </select>
|
|
|
+ <select id="findRecordByReadDayAndDeviceId" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from
|
|
|
+ sc_meter_read_record
|
|
|
+ where
|
|
|
+ status = 1
|
|
|
+ and read_date = #{readDate,jdbcType=INTEGER}
|
|
|
+ and device_id = #{deviceId,jdbcType=BIGINT}
|
|
|
+ </select>
|
|
|
+ <insert id="batchInsert" parameterType="map">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ replace into sc_meter_read_record
|
|
|
+ (id, read_date, site_id, sys_id, province, city, region, community, customer_id,
|
|
|
+ concentrator_id, collector_id, building_id, `location`, device_type_id, device_id,
|
|
|
+ device_no, meter_no, meter_file_no, read_time, read_status, read_data, last_valid,
|
|
|
+ last_cost, `status`, date_create, date_update, create_by, update_by,valve_status,meter_status_info)
|
|
|
+ values
|
|
|
+ <foreach collection="list" item="item" separator=",">
|
|
|
+ (#{item.id,jdbcType=BIGINT}, #{item.readDate,jdbcType=INTEGER}, #{item.siteId,jdbcType=INTEGER},
|
|
|
+ #{item.sysId,jdbcType=INTEGER}, #{item.province,jdbcType=INTEGER}, #{item.city,jdbcType=INTEGER},
|
|
|
+ #{item.region,jdbcType=INTEGER}, #{item.community,jdbcType=INTEGER}, #{item.customerId,jdbcType=INTEGER},
|
|
|
+ #{item.concentratorId,jdbcType=INTEGER}, #{item.collectorId,jdbcType=INTEGER},
|
|
|
+ #{item.buildingId,jdbcType=INTEGER}, #{item.location,jdbcType=VARCHAR}, #{item.deviceTypeId,jdbcType=INTEGER},
|
|
|
+ #{item.deviceId,jdbcType=BIGINT}, #{item.deviceNo,jdbcType=VARCHAR}, #{item.meterNo,jdbcType=VARCHAR},
|
|
|
+ #{item.meterFileNo,jdbcType=VARCHAR}, #{item.readTime,jdbcType=TIMESTAMP}, #{item.readStatus,jdbcType=VARCHAR},
|
|
|
+ #{item.readData,jdbcType=VARCHAR}, #{item.lastValid,jdbcType=VARCHAR}, #{item.lastCost,jdbcType=DECIMAL},
|
|
|
+ #{item.status,jdbcType=INTEGER}, #{item.dateCreate,jdbcType=TIMESTAMP}, #{item.dateUpdate,jdbcType=TIMESTAMP},
|
|
|
+ #{item.createBy,jdbcType=VARCHAR}, #{item.updateBy,jdbcType=VARCHAR},
|
|
|
+ #{item.valveState,jdbcType=INTEGER}, #{item.meterStatusInfo,jdbcType=VARCHAR})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
</mapper>
|