| <?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.dy.pipIrrGlobal.daoRm.RmSoilLastMapper"> | 
|   <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmSoilLast"> | 
|     <!--@mbg.generated--> | 
|     <!--@Table rm_soil_last--> | 
|     <id column="id" jdbcType="BIGINT" property="id" /> | 
|     <result column="last_history_id" jdbcType="BIGINT" property="lastHistoryId" /> | 
|     <result column="soil_id" jdbcType="BIGINT" property="soilId" /> | 
|     <result column="dt" jdbcType="TIMESTAMP" property="dt" /> | 
|     <result column="soil_humidity1" jdbcType="FLOAT" property="soilHumidity1" /> | 
|     <result column="soil_humidity2" jdbcType="FLOAT" property="soilHumidity2" /> | 
|     <result column="soil_humidity3" jdbcType="FLOAT" property="soilHumidity3" /> | 
|     <result column="soil_humidity4" jdbcType="FLOAT" property="soilHumidity4" /> | 
|     <result column="soil_humidity5" jdbcType="FLOAT" property="soilHumidity5" /> | 
|     <result column="soil_temperature1" jdbcType="FLOAT" property="soilTemperature1" /> | 
|     <result column="soil_temperature2" jdbcType="FLOAT" property="soilTemperature2" /> | 
|     <result column="soil_temperature3" jdbcType="FLOAT" property="soilTemperature3" /> | 
|     <result column="soil_temperature4" jdbcType="FLOAT" property="soilTemperature4" /> | 
|     <result column="soil_temperature5" jdbcType="FLOAT" property="soilTemperature5" /> | 
|   </resultMap> | 
|   <sql id="Base_Column_List"> | 
|     <!--@mbg.generated--> | 
|     id, last_history_id, soil_id, dt, soil_humidity1, soil_humidity2, soil_humidity3,  | 
|     soil_humidity4, soil_humidity5, soil_temperature1, soil_temperature2, soil_temperature3,  | 
|     soil_temperature4, soil_temperature5 | 
|   </sql> | 
|   | 
|   <sql id="Base_Column_List_with_alias"> | 
|     <!--@mbg.generated--> | 
|     ${alias}.id, ${alias}.last_history_id, ${alias}.soil_id, ${alias}.dt, ${alias}.soil_humidity1, | 
|     ${alias}.soil_humidity2, ${alias}.soil_humidity3, ${alias}.soil_humidity4, | 
|     ${alias}.soil_humidity5, ${alias}.soil_temperature1, ${alias}.soil_temperature2, | 
|     ${alias}.soil_temperature3, ${alias}.soil_temperature4, ${alias}.soil_temperature5 | 
|   </sql> | 
|   | 
|   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|     <!--@mbg.generated--> | 
|     select  | 
|     <include refid="Base_Column_List" /> | 
|     from rm_soil_last | 
|     where id = #{id,jdbcType=BIGINT} | 
|   </select> | 
|   | 
|   <!--根据指定条件获取记录--> | 
|   <select id="selectRmSoilLast" resultType="com.dy.pipIrrGlobal.pojoRm.RmSoilLast"> | 
|     select | 
|     <include refid="Base_Column_List" /> | 
|     from rm_soil_last | 
|     <where> | 
|       <if test="stSoilId != null and stSoilId != ''"> | 
|         and soil_id = #{stSoilId} | 
|       </if> | 
|     </where> | 
|     limit 0,1 | 
|   </select> | 
|   | 
|   | 
|   | 
|   <!--根据指定条件查询记录数量--> | 
|   <select id="selectCount" resultType="java.lang.Long"> | 
|     SELECT | 
|     COUNT(*) AS recordCount | 
|     FROM rm_soil_last ltb | 
|     INNER JOIN pr_st_soil mtb ON mtb.id = ltb.soil_id | 
|     <where> | 
|       <if test="soilId != null"> | 
|         AND ltb.soil_id = #{soilId} | 
|       </if> | 
|       <if test = "no != null"> | 
|         AND mtb.no = #{no} | 
|       </if> | 
|       <if test = "name != null and name !=''"> | 
|         AND mtb.name LIKE CONCAT('%',#{name},'%') | 
|       </if> | 
|       <if test = "timeStart != null and timeStart !='' and timeStop != null and timeStop != ''"> | 
|         AND ltb.dt BETWEEN #{timeStart} AND #{timeStop} | 
|       </if> | 
|     </where> | 
|   </select> | 
|   | 
|   <!--根据指定条件查询记录--> | 
|   <select id="selectSome" resultType="com.dy.pipIrrGlobal.voRm.VoSoil"> | 
|     SELECT | 
|     <include refid="Base_Column_List_with_alias" > | 
|       <property name="alias" value="ltb"/> | 
|     </include>, | 
|     mtb.`name` AS soilName | 
|     FROM rm_soil_last ltb | 
|     INNER JOIN pr_st_soil mtb ON mtb.id = ltb.soil_id | 
|     <where> | 
|       <if test="soilId != null"> | 
|         AND ltb.soil_id = #{soilId} | 
|       </if> | 
|       <if test = "no != null"> | 
|         AND mtb.no = #{no} | 
|       </if> | 
|       <if test = "name != null and name !=''"> | 
|         AND mtb.name LIKE CONCAT('%',#{name},'%') | 
|       </if> | 
|       <if test = "timeStart != null and timeStart !='' and timeStop != null and timeStop != ''"> | 
|         AND ltb.dt BETWEEN #{timeStart} AND #{timeStop} | 
|       </if> | 
|     </where> | 
|     ORDER BY ltb.soil_id DESC | 
|     <trim prefix="limit " > | 
|       <if test="start != null and count != null"> | 
|         #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
|       </if> | 
|     </trim> | 
|   </select> | 
|   | 
|   <!--根据指定条件获取记录--> | 
|   <select id="selectSomeBySoilId" resultType="com.dy.pipIrrGlobal.voRm.VoSoil"> | 
|     select | 
|     <include refid="Base_Column_List" /> | 
|     from rm_soil_last | 
|     <where> | 
|       <if test="soilId != null"> | 
|         and soil_id = #{soilId} | 
|       </if> | 
|     </where> | 
|     limit 0,1 | 
|   </select> | 
|   | 
|   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> | 
|     <!--@mbg.generated--> | 
|     delete from rm_soil_last | 
|     where id = #{id,jdbcType=BIGINT} | 
|   </delete> | 
|   <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmSoilLast"> | 
|     <!--@mbg.generated--> | 
|     insert into rm_soil_last (id, last_history_id, soil_id,  | 
|       dt, soil_humidity1, soil_humidity2,  | 
|       soil_humidity3, soil_humidity4, soil_humidity5,  | 
|       soil_temperature1, soil_temperature2, soil_temperature3,  | 
|       soil_temperature4, soil_temperature5) | 
|     values (#{id,jdbcType=BIGINT}, #{lastHistoryId,jdbcType=BIGINT}, #{soilId,jdbcType=BIGINT},  | 
|       #{dt,jdbcType=TIMESTAMP}, #{soilHumidity1,jdbcType=FLOAT}, #{soilHumidity2,jdbcType=FLOAT},  | 
|       #{soilHumidity3,jdbcType=FLOAT}, #{soilHumidity4,jdbcType=FLOAT}, #{soilHumidity5,jdbcType=FLOAT},  | 
|       #{soilTemperature1,jdbcType=FLOAT}, #{soilTemperature2,jdbcType=FLOAT}, #{soilTemperature3,jdbcType=FLOAT},  | 
|       #{soilTemperature4,jdbcType=FLOAT}, #{soilTemperature5,jdbcType=FLOAT}) | 
|   </insert> | 
|   <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmSoilLast"> | 
|     <!--@mbg.generated--> | 
|     insert into rm_soil_last | 
|     <trim prefix="(" suffix=")" suffixOverrides=","> | 
|       <if test="id != null"> | 
|         id, | 
|       </if> | 
|       <if test="lastHistoryId != null"> | 
|         last_history_id, | 
|       </if> | 
|       <if test="soilId != null"> | 
|         soil_id, | 
|       </if> | 
|       <if test="dt != null"> | 
|         dt, | 
|       </if> | 
|       <if test="soilHumidity1 != null"> | 
|         soil_humidity1, | 
|       </if> | 
|       <if test="soilHumidity2 != null"> | 
|         soil_humidity2, | 
|       </if> | 
|       <if test="soilHumidity3 != null"> | 
|         soil_humidity3, | 
|       </if> | 
|       <if test="soilHumidity4 != null"> | 
|         soil_humidity4, | 
|       </if> | 
|       <if test="soilHumidity5 != null"> | 
|         soil_humidity5, | 
|       </if> | 
|       <if test="soilTemperature1 != null"> | 
|         soil_temperature1, | 
|       </if> | 
|       <if test="soilTemperature2 != null"> | 
|         soil_temperature2, | 
|       </if> | 
|       <if test="soilTemperature3 != null"> | 
|         soil_temperature3, | 
|       </if> | 
|       <if test="soilTemperature4 != null"> | 
|         soil_temperature4, | 
|       </if> | 
|       <if test="soilTemperature5 != null"> | 
|         soil_temperature5, | 
|       </if> | 
|     </trim> | 
|     <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|       <if test="id != null"> | 
|         #{id,jdbcType=BIGINT}, | 
|       </if> | 
|       <if test="lastHistoryId != null"> | 
|         #{lastHistoryId,jdbcType=BIGINT}, | 
|       </if> | 
|       <if test="soilId != null"> | 
|         #{soilId,jdbcType=BIGINT}, | 
|       </if> | 
|       <if test="dt != null"> | 
|         #{dt,jdbcType=TIMESTAMP}, | 
|       </if> | 
|       <if test="soilHumidity1 != null"> | 
|         #{soilHumidity1,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilHumidity2 != null"> | 
|         #{soilHumidity2,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilHumidity3 != null"> | 
|         #{soilHumidity3,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilHumidity4 != null"> | 
|         #{soilHumidity4,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilHumidity5 != null"> | 
|         #{soilHumidity5,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature1 != null"> | 
|         #{soilTemperature1,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature2 != null"> | 
|         #{soilTemperature2,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature3 != null"> | 
|         #{soilTemperature3,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature4 != null"> | 
|         #{soilTemperature4,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature5 != null"> | 
|         #{soilTemperature5,jdbcType=FLOAT}, | 
|       </if> | 
|     </trim> | 
|   </insert> | 
|   <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmSoilLast"> | 
|     <!--@mbg.generated--> | 
|     update rm_soil_last | 
|     <set> | 
|       <if test="lastHistoryId != null"> | 
|         last_history_id = #{lastHistoryId,jdbcType=BIGINT}, | 
|       </if> | 
|       <if test="soilId != null"> | 
|         soil_id = #{soilId,jdbcType=BIGINT}, | 
|       </if> | 
|       <if test="dt != null"> | 
|         dt = #{dt,jdbcType=TIMESTAMP}, | 
|       </if> | 
|       <if test="soilHumidity1 != null"> | 
|         soil_humidity1 = #{soilHumidity1,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilHumidity2 != null"> | 
|         soil_humidity2 = #{soilHumidity2,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilHumidity3 != null"> | 
|         soil_humidity3 = #{soilHumidity3,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilHumidity4 != null"> | 
|         soil_humidity4 = #{soilHumidity4,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilHumidity5 != null"> | 
|         soil_humidity5 = #{soilHumidity5,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature1 != null"> | 
|         soil_temperature1 = #{soilTemperature1,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature2 != null"> | 
|         soil_temperature2 = #{soilTemperature2,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature3 != null"> | 
|         soil_temperature3 = #{soilTemperature3,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature4 != null"> | 
|         soil_temperature4 = #{soilTemperature4,jdbcType=FLOAT}, | 
|       </if> | 
|       <if test="soilTemperature5 != null"> | 
|         soil_temperature5 = #{soilTemperature5,jdbcType=FLOAT}, | 
|       </if> | 
|     </set> | 
|     where id = #{id,jdbcType=BIGINT} | 
|   </update> | 
|   <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmSoilLast"> | 
|     <!--@mbg.generated--> | 
|     update rm_soil_last | 
|     set last_history_id = #{lastHistoryId,jdbcType=BIGINT}, | 
|       soil_id = #{soilId,jdbcType=BIGINT}, | 
|       dt = #{dt,jdbcType=TIMESTAMP}, | 
|       soil_humidity1 = #{soilHumidity1,jdbcType=FLOAT}, | 
|       soil_humidity2 = #{soilHumidity2,jdbcType=FLOAT}, | 
|       soil_humidity3 = #{soilHumidity3,jdbcType=FLOAT}, | 
|       soil_humidity4 = #{soilHumidity4,jdbcType=FLOAT}, | 
|       soil_humidity5 = #{soilHumidity5,jdbcType=FLOAT}, | 
|       soil_temperature1 = #{soilTemperature1,jdbcType=FLOAT}, | 
|       soil_temperature2 = #{soilTemperature2,jdbcType=FLOAT}, | 
|       soil_temperature3 = #{soilTemperature3,jdbcType=FLOAT}, | 
|       soil_temperature4 = #{soilTemperature4,jdbcType=FLOAT}, | 
|       soil_temperature5 = #{soilTemperature5,jdbcType=FLOAT} | 
|     where id = #{id,jdbcType=BIGINT} | 
|   </update> | 
| </mapper> |