<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
	namespace="com.huatek.busi.mapper.GeneratorPdStatisticsMapper">
	<sql id="Base_Column_List">
		id as id,
		site_id as siteId,
		sensor_id as sensorId,
		main_tree_id as mainTreeId,
		sub_tree_id as subTreeId,
		d_time as dTime,
		count as count,
		electric_quantity as electricQuantity,
		crateTime as cratetime
	</sql>

	<select id="findGeneratorPdStatistics" resultType="com.huatek.busi.entity.BusiGeneratorPdStatistics">
		select
			<include refid="Base_Column_List" />
		from
		busi_generator_pd_statistics t
		<where>
			<if test="siteId != null and siteId != ''">
				and t.site_id = #{siteId}
			</if>
			<if test="mainTreeId != null and mainTreeId != ''">
				and t.main_tree_id = #{mainTreeId}
			</if>
		</where>
	</select>

	<delete id="deleteItem">
		delete from transformer_pd_statistics where main_tree_id = #{mainTreeId} and d_time = #{day}
	</delete>
</mapper>