<?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.BusiOutlineGisExperimentDataMapper">

	<sql id="Base_Column_List">
		id as id,
		equipment_id as equipmentId,
		site_id as siteId,
		type as type,
		experiment_date_time as experimentDateTime,
		create_time as createTime,
		a_pressure as aPressure,
		b_pressure as bPressure,
		c_pressure as cPressure,
		a_water as aWater,
		b_water as bWater,
		c_water as cWater,
		a_temperature as aTemperature,
		b_temperature as bTemperature,
		c_temperature as cTemperature,
		a_ddhl_resistance as aDdhlResistance,
		b_ddhl_resistance as bDdhlResistance,
		c_ddhl_resistance as cDdhlResistance,
		a_pressure_dlq as aPressureDlq,
		b_pressure_dlq as bPressureDlq,
		c_pressure_dlq as cPressureDlq,
		a_water_dlq as aWaterDlq,
		b_water_dlq as bWaterDlq,
		c_water_dlq as cWaterDlq,
		a_temperature_dlq as aTemperatureDlq,
		b_temperature_dlq as bTemperatureDlq,
		c_temperature_dlq as cTemperatureDlq,
		a_ddhl_resistance_dlq as aDdhlResistanceDlq,
		b_ddhl_resistance_dlq as bDdhlResistanceDlq,
		c_ddhl_resistance_dlq as cDdhlResistanceDlq
	</sql>
	
	<select id="selectBusiOutlineGisExperimentDataPage"
		resultType="com.huatek.busi.vo.BusiOutlineGisExperimentDataVo">
		SELECT
		<include refid="Base_Column_List" />
		FROM
		busi_outline_gis_experiment_data t
		 where t.equipment_id = #{mainTreeId}
	    <if test="startTime != null" >
	   		 and experiment_date_time <![CDATA[>=]]> #{startTime}
	    </if>
	    <if test="endTime != null">
	    	and experiment_date_time <![CDATA[<=]]> #{endTime}
	    </if>
	    order by t.experiment_date_time desc
	    
		<!-- WHERE 1=1
		<if test="id != null and id != ''">
			and t.id = #{id}
		</if>
		<if test="equipmentId != null and equipmentId != ''">
			and t.equipment_id = #{equipmentId}
		</if>
		<if test="siteId != null and siteId != ''">
			and t.site_id = #{siteId}
		</if>
		<if test="type != null and type != ''">
			and t.type = #{type}
		</if>
		<if test="experimentDateTime != null">
			and t.experiment_date_time = #{experimentDateTime}
		</if>
		<if test="createTime != null">
			and t.create_time = #{createTime}
		</if>
		<if test="aPressure != null and aPressure != ''">
			and t.a_pressure = #{aPressure}
		</if>
		<if test="bPressure != null and bPressure != ''">
			and t.b_pressure = #{bPressure}
		</if>
		<if test="cPressure != null and cPressure != ''">
			and t.c_pressure = #{cPressure}
		</if>
		<if test="aWater != null and aWater != ''">
			and t.a_water = #{aWater}
		</if>
		<if test="bWater != null and bWater != ''">
			and t.b_water = #{bWater}
		</if>
		<if test="cWater != null and cWater != ''">
			and t.c_water = #{cWater}
		</if>
		<if test="aTemperature != null and aTemperature != ''">
			and t.a_temperature = #{aTemperature}
		</if>
		<if test="bTemperature != null and bTemperature != ''">
			and t.b_temperature = #{bTemperature}
		</if>
		<if test="cTemperature != null and cTemperature != ''">
			and t.c_temperature = #{cTemperature}
		</if>
		<if test="aDdhlResistance != null and aDdhlResistance != ''">
			and t.a_ddhl_resistance = #{aDdhlResistance}
		</if>
		<if test="bDdhlResistance != null and bDdhlResistance != ''">
			and t.b_ddhl_resistance = #{bDdhlResistance}
		</if>
		<if test="cDdhlResistance != null and cDdhlResistance != ''">
			and t.c_ddhl_resistance = #{cDdhlResistance}
		</if>
		<if test="aPressureDlq != null and aPressureDlq != ''">
			and t.a_pressure_dlq = #{aPressureDlq}
		</if>
		<if test="bPressureDlq != null and bPressureDlq != ''">
			and t.b_pressure_dlq = #{bPressureDlq}
		</if>
		<if test="cPressureDlq != null and cPressureDlq != ''">
			and t.c_pressure_dlq = #{cPressureDlq}
		</if>
		<if test="aWaterDlq != null and aWaterDlq != ''">
			and t.a_water_dlq = #{aWaterDlq}
		</if>
		<if test="bWaterDlq != null and bWaterDlq != ''">
			and t.b_water_dlq = #{bWaterDlq}
		</if>
		<if test="cWaterDlq != null and cWaterDlq != ''">
			and t.c_water_dlq = #{cWaterDlq}
		</if>
		<if test="aTemperatureDlq != null and aTemperatureDlq != ''">
			and t.a_temperature_dlq = #{aTemperatureDlq}
		</if>
		<if test="bTemperatureDlq != null and bTemperatureDlq != ''">
			and t.b_temperature_dlq = #{bTemperatureDlq}
		</if>
		<if test="cTemperatureDlq != null and cTemperatureDlq != ''">
			and t.c_temperature_dlq = #{cTemperatureDlq}
		</if>
		<if test="aDdhlResistanceDlq != null and aDdhlResistanceDlq != ''">
			and t.a_ddhl_resistance_dlq = #{aDdhlResistanceDlq}
		</if>
		<if test="bDdhlResistanceDlq != null and bDdhlResistanceDlq != ''">
			and t.b_ddhl_resistance_dlq = #{bDdhlResistanceDlq}
		</if>
		<if test="cDdhlResistanceDlq != null and cDdhlResistanceDlq != ''">
			and t.c_ddhl_resistance_dlq = #{cDdhlResistanceDlq}
		</if> -->
	</select>

	<delete id="batchDel">
		delete from busi_outline_gis_experiment_data where id in
		<foreach collection="idList" item="id" separator="," open="("
			close=")">
			#{id}
		</foreach>
	</delete>

	<select id="findBusiOutlineDataByEquip" parameterType="java.lang.String"
		resultType="com.huatek.busi.entity.BusiOutlineGisExperimentData">
		SELECT
		<include refid="Base_Column_List" />
		FROM
		busi_outline_gis_experiment_data t
		WHERE t.equipment_id = #{equipmentId}
		AND t.site_id = #{siteId}
		ORDER BY experiment_date_time DESC
		limit 1
	</select>
	<!-- 导出GIS评测数据 -->
	<select id="exportGisExperimentData"
		parameterType="java.lang.String"
		resultType="com.huatek.busi.vo.BusiOutlineGisExperimentDataVo">
		SELECT
		<include refid="Base_Column_List" />
		FROM
		busi_outline_gis_experiment_data t
		<where>
			<if test="equipmentId != null and equipmentId != ''">
				t.equipment_id = #{equipmentId}
			</if>
			<if test="startTime != null">
				and t.experiment_date_time <![CDATA[ >= ]]> #{startTime}
			</if>
			<if test="endTime != null">
				and t.experiment_date_time <![CDATA[ <= ]]> #{endTime}
			</if>
		</where>
	</select>
</mapper>