<?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.goldenwater.slaj.hidd.mapper.AttMedBaseMapper">
    <resultMap type="com.goldenwater.slaj.hidd.domain.AttMedBase" id="AttMedBaseResult">
        <result property="guid" column="guid"/>
        <result property="medName" column="med_name"/>
        <result property="medTitl" column="med_titl"/>
        <result property="keyWord" column="key_word"/>
        <result property="estaPop" column="esta_pop"/>
        <result property="estaDate" column="esta_date"/>
        <result property="estaWiunName" column="esta_wiun_name"/>
        <result property="medType" column="med_type"/>
        <result property="medPath" column="med_path"/>
        <result property="medSize" column="med_size"/>
        <result property="medExt" column="med_ext"/>
        <result property="isSec" column="is_sec"/>
        <result property="secGrad" column="sec_grad"/>
        <result property="docLang" column="doc_lang"/>
        <result property="imgShootTm" column="img_shoot_tm"/>
        <result property="imgViewTp" column="img_view_tp"/>
        <result property="vidLen" column="vid_len"/>
        <result property="abs" column="abs"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
    </resultMap>
    <sql id="selectAttMedBaseVo">
        select guid, med_name, med_titl, key_word, esta_pop, esta_date, esta_wiun_name,
               med_type, med_path, med_size, med_ext, is_sec, sec_grad, doc_lang,
               img_shoot_tm, img_view_tp, vid_len, abs, note, coll_time, upd_time, rec_pers
        from att_med_base
    </sql>
    <select id="selectAttMedBaseByGuid" parameterType="String" resultMap="AttMedBaseResult">
        <include refid="selectAttMedBaseVo"/>
        where guid = #{guid}
    </select>
    <select id="selectAttMedBaseList" parameterType="com.goldenwater.slaj.hidd.domain.AttMedBase" resultMap="AttMedBaseResult">
        <include refid="selectAttMedBaseVo"/>
        <where>
            <if test="medName != null and medName != ''">AND med_name like '%' || #{medName} || '%'</if>
            <if test="medType != null and medType != ''">AND med_type = #{medType}</if>
            <if test="medExt != null and medExt != ''">AND med_ext = #{medExt}</if>
            <if test="keyWord != null and keyWord != ''">AND key_word like '%' || #{keyWord} || '%'</if>
        </where>
    </select>
    <insert id="insertAttMedBase" parameterType="com.goldenwater.slaj.hidd.domain.AttMedBase">
        insert into att_med_base (guid, med_name, med_titl, key_word, esta_pop, esta_date, esta_wiun_name, med_type, med_path, med_size, med_ext, is_sec, sec_grad, doc_lang, img_shoot_tm, img_view_tp, vid_len, abs, note, coll_time, upd_time, rec_pers)
        values (#{guid}, #{medName}, #{medTitl}, #{keyWord}, #{estaPop}, #{estaDate}, #{estaWiunName}, #{medType}, #{medPath}, #{medSize}, #{medExt}, #{isSec}, #{secGrad}, #{docLang}, #{imgShootTm}, #{imgViewTp}, #{vidLen}, #{abs}, #{note}, #{collTime}, #{updTime}, #{recPers}, )
    </insert>
    <update id="updateAttMedBase" parameterType="com.goldenwater.slaj.hidd.domain.AttMedBase">
        update att_med_base
        <set>
            <if test="medName != null">med_name = #{medName},</if>
            <if test="medTitl != null">med_titl = #{medTitl},</if>
            <if test="keyWord != null">key_word = #{keyWord},</if>
            <if test="estaPop != null">esta_pop = #{estaPop},</if>
            <if test="estaDate != null">esta_date = #{estaDate},</if>
            <if test="estaWiunName != null">esta_wiun_name = #{estaWiunName},</if>
            <if test="medType != null">med_type = #{medType},</if>
            <if test="medPath != null">med_path = #{medPath},</if>
            <if test="medSize != null">med_size = #{medSize},</if>
            <if test="medExt != null">med_ext = #{medExt},</if>
            <if test="isSec != null">is_sec = #{isSec},</if>
            <if test="secGrad != null">sec_grad = #{secGrad},</if>
            <if test="docLang != null">doc_lang = #{docLang},</if>
            <if test="imgShootTm != null">img_shoot_tm = #{imgShootTm},</if>
            <if test="imgViewTp != null">img_view_tp = #{imgViewTp},</if>
            <if test="vidLen != null">vid_len = #{vidLen},</if>
            <if test="abs != null">abs = #{abs},</if>
            <if test="note != null">note = #{note},</if>
            <if test="collTime != null">coll_time = #{collTime},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null">rec_pers = #{recPers},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteAttMedBaseByGuid" parameterType="String">
        delete from att_med_base where guid = #{guid}
    </delete>
    <delete id="deleteAttMedBaseByGuids" parameterType="String">
        delete from att_med_base where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
