<?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.yunfeiyun.agmp.fms.mapper.SysWarnreadMapper">
    
    <resultMap type="SysWarnread" id="SysWarnreadResult">
        <result property="warnreadId"    column="warnreadId"    />
        <result property="warnId"    column="warnId"    />
        <result property="userId"    column="userId"    />
        <result property="warnreadCreateddate"    column="warnreadCreateddate"    />
    </resultMap>

    <sql id="selectSysWarnreadVo">
        select warnreadId, warnId, userId, warnreadCreateddate from SysWarnread
    </sql>

    <select id="selectSysWarnreadList" parameterType="SysWarnread" resultMap="SysWarnreadResult">
        <include refid="selectSysWarnreadVo"/>
        <where>  
            <if test="warnId != null  and warnId != ''"> and warnId = #{warnId}</if>
            <if test="userId != null  and userId != ''"> and userId = #{userId}</if>
            <if test="warnreadCreateddate != null  and warnreadCreateddate != ''"> and warnreadCreateddate = #{warnreadCreateddate}</if>
        </where>
    </select>
    
    <select id="selectSysWarnreadByWarnreadId" parameterType="String" resultMap="SysWarnreadResult">
        <include refid="selectSysWarnreadVo"/>
        where warnreadId = #{warnreadId}
    </select>
        
    <insert id="insertSysWarnread" parameterType="SysWarnread">
        insert into SysWarnread
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="warnreadId != null">warnreadId,</if>
            <if test="warnId != null">warnId,</if>
            <if test="userId != null">userId,</if>
            <if test="warnreadCreateddate != null">warnreadCreateddate,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="warnreadId != null">#{warnreadId},</if>
            <if test="warnId != null">#{warnId},</if>
            <if test="userId != null">#{userId},</if>
            <if test="warnreadCreateddate != null">#{warnreadCreateddate},</if>
         </trim>
    </insert>

    <update id="updateSysWarnread" parameterType="SysWarnread">
        update SysWarnread
        <trim prefix="SET" suffixOverrides=",">
            <if test="warnId != null">warnId = #{warnId},</if>
            <if test="userId != null">userId = #{userId},</if>
            <if test="warnreadCreateddate != null">warnreadCreateddate = #{warnreadCreateddate},</if>
        </trim>
        where warnreadId = #{warnreadId}
    </update>

    <delete id="deleteSysWarnreadByWarnreadId" parameterType="String">
        delete from SysWarnread where warnreadId = #{warnreadId}
    </delete>

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