<?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.sooka.system.mapper.TGuijiHousingconstructionYsljcMapper">
    
    <resultMap type="TGuijiHousingconstructionYsljc" id="TGuijiHousingconstructionYsljcResult">
        <result property="id"    column="id"    />
        <result property="createTime"    column="create_time"    />
        <result property="cdTime"    column="cd_time"    />
        <result property="cdBatch"    column="cd_batch"    />
        <result property="cdOperation"    column="cd_operation"    />
        <result property="cdSource"    column="cd_source"    />
        <result property="dnm"    column="dnm"    />
        <result property="snm"    column="snm"    />
        <result property="sensor"    column="sensor"    />
        <result property="name"    column="name"    />
        <result property="time"    column="time"    />
        <result property="value"    column="value"    />
        <result property="ssid"    column="ssid"    />
    </resultMap>

    <sql id="selectTGuijiHousingconstructionYsljcVo">
        select id, create_time, cd_time, cd_batch, cd_operation, cd_source, dnm, snm, sensor, name, time, value, ssid from t_guiji_housingconstruction_ysljc
    </sql>

    <select id="selectTGuijiHousingconstructionYsljcList" parameterType="TGuijiHousingconstructionYsljc" resultMap="TGuijiHousingconstructionYsljcResult">
        <include refid="selectTGuijiHousingconstructionYsljcVo"/>
        <where>  
            <if test="dnm != null  and dnm != ''"> and dnm like concat('%', #{dnm}, '%')</if>
            <if test="snm != null  and snm != ''"> and snm like concat('%', #{snm}, '%')</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
        </where>
        order by create_time desc
    </select>
    
    <select id="selectTGuijiHousingconstructionYsljcById" parameterType="String" resultMap="TGuijiHousingconstructionYsljcResult">
        <include refid="selectTGuijiHousingconstructionYsljcVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTGuijiHousingconstructionYsljc" parameterType="TGuijiHousingconstructionYsljc">
        insert into t_guiji_housingconstruction_ysljc
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="cdTime != null">cd_time,</if>
            <if test="cdBatch != null">cd_batch,</if>
            <if test="cdOperation != null">cd_operation,</if>
            <if test="cdSource != null">cd_source,</if>
            <if test="dnm != null">dnm,</if>
            <if test="snm != null">snm,</if>
            <if test="sensor != null">sensor,</if>
            <if test="name != null">name,</if>
            <if test="time != null">time,</if>
            <if test="value != null">value,</if>
            <if test="ssid != null">ssid,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="cdTime != null">#{cdTime},</if>
            <if test="cdBatch != null">#{cdBatch},</if>
            <if test="cdOperation != null">#{cdOperation},</if>
            <if test="cdSource != null">#{cdSource},</if>
            <if test="dnm != null">#{dnm},</if>
            <if test="snm != null">#{snm},</if>
            <if test="sensor != null">#{sensor},</if>
            <if test="name != null">#{name},</if>
            <if test="time != null">#{time},</if>
            <if test="value != null">#{value},</if>
            <if test="ssid != null">#{ssid},</if>
         </trim>
    </insert>

    <update id="updateTGuijiHousingconstructionYsljc" parameterType="TGuijiHousingconstructionYsljc">
        update t_guiji_housingconstruction_ysljc
        <trim prefix="SET" suffixOverrides=",">
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="cdTime != null">cd_time = #{cdTime},</if>
            <if test="cdBatch != null">cd_batch = #{cdBatch},</if>
            <if test="cdOperation != null">cd_operation = #{cdOperation},</if>
            <if test="cdSource != null">cd_source = #{cdSource},</if>
            <if test="dnm != null">dnm = #{dnm},</if>
            <if test="snm != null">snm = #{snm},</if>
            <if test="sensor != null">sensor = #{sensor},</if>
            <if test="name != null">name = #{name},</if>
            <if test="time != null">time = #{time},</if>
            <if test="value != null">value = #{value},</if>
            <if test="ssid != null">ssid = #{ssid},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTGuijiHousingconstructionYsljcById" parameterType="String">
        delete from t_guiji_housingconstruction_ysljc where id = #{id}
    </delete>

    <delete id="deleteTGuijiHousingconstructionYsljcByIds" parameterType="String">
        delete from t_guiji_housingconstruction_ysljc where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>