<?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.siwei.rsmonitoring.mapper.TDkYwypHgxMapper">
    
    <resultMap type="TDkYwypHgx" id="TDkYwypHgxResult">
        <result property="dkType"    column="dk_type"    />
        <result property="dkYupeValue"    column="dk_yupe_value"    />
        <result property="ywypCode"    column="ywyp_code"    />
    </resultMap>

    <sql id="selectTDkYwypHgxVo">
        select dk_type, dk_yupe_value, ywyp_code from t_dk_ywyp_hgx
    </sql>

    <select id="selectTDkYwypHgxList" parameterType="TDkYwypHgx" resultMap="TDkYwypHgxResult">
        <include refid="selectTDkYwypHgxVo"/>
        <where>  
            <if test="dkType != null  and dkType != ''"> and dk_type = #{dkType}</if>
            <if test="dkYupeValue != null  and dkYupeValue != ''"> and dk_yupe_value = #{dkYupeValue}</if>
            <if test="ywypCode != null  and ywypCode != ''"> and ywyp_code = #{ywypCode}</if>
        </where>
    </select>
    
    <select id="selectTDkYwypHgxByDkType" parameterType="String" resultMap="TDkYwypHgxResult">
        <include refid="selectTDkYwypHgxVo"/>
        where dk_type = #{dkType}
    </select>

    <insert id="insertTDkYwypHgx" parameterType="TDkYwypHgx">
        insert into t_dk_ywyp_hgx
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dkType != null and dkType != ''">dk_type,</if>
            <if test="dkYupeValue != null">dk_yupe_value,</if>
            <if test="ywypCode != null">ywyp_code,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dkType != null and dkType != ''">#{dkType},</if>
            <if test="dkYupeValue != null">#{dkYupeValue},</if>
            <if test="ywypCode != null">#{ywypCode},</if>
         </trim>
    </insert>

    <update id="updateTDkYwypHgx" parameterType="TDkYwypHgx">
        update t_dk_ywyp_hgx
        <trim prefix="SET" suffixOverrides=",">
            <if test="dkYupeValue != null">dk_yupe_value = #{dkYupeValue},</if>
            <if test="ywypCode != null">ywyp_code = #{ywypCode},</if>
        </trim>
        where dk_type = #{dkType}
    </update>

    <delete id="deleteTDkYwypHgxByDkType" parameterType="String">
        delete from t_dk_ywyp_hgx where dk_type = #{dkType}
    </delete>

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