<?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.ruoyi.bd.mapper.BdDevcTrailMapper">
    
    <resultMap type="BdDevcTrail" id="BdDevcTrailResult">
        <result property="id"    column="id"    />
        <result property="devcKey"    column="devc_key"    />
        <result property="dt"    column="dt"    />
        <result property="poly"    column="poly"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectBdDevcTrailVo">
        select id, devc_key, dt, poly, update_time, create_time, create_by, update_by from bd_devc_trail
    </sql>

    <select id="selectBdDevcTrailList" parameterType="BdDevcTrail" resultMap="BdDevcTrailResult">
        <include refid="selectBdDevcTrailVo"/>
        <where>  
            <if test="devcKey != null  and devcKey != ''"> and devc_key = #{devcKey}</if>
            <if test="dt != null  and dt != ''"> and dt = #{dt}</if>
            <if test="poly != null  and poly != ''"> and poly = #{poly}</if>
        </where>
    </select>
    
    <select id="selectBdDevcTrailById" parameterType="Long" resultMap="BdDevcTrailResult">
        <include refid="selectBdDevcTrailVo"/>
        where id = #{id}
    </select>

    <insert id="insertBdDevcTrail" parameterType="BdDevcTrail" useGeneratedKeys="true" keyProperty="id">
        insert into bd_devc_trail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="devcKey != null">devc_key,</if>
            <if test="dt != null">dt,</if>
            <if test="poly != null">poly,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="devcKey != null">#{devcKey},</if>
            <if test="dt != null">#{dt},</if>
            <if test="poly != null">#{poly},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
         </trim>
    </insert>

    <update id="updateBdDevcTrail" parameterType="BdDevcTrail">
        update bd_devc_trail
        <trim prefix="SET" suffixOverrides=",">
            <if test="devcKey != null">devc_key = #{devcKey},</if>
            <if test="dt != null">dt = #{dt},</if>
            <if test="poly != null">poly = #{poly},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBdDevcTrailById" parameterType="Long">
        delete from bd_devc_trail where id = #{id}
    </delete>

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