<?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.RelBisMedMapper">
    <resultMap type="com.goldenwater.slaj.hidd.domain.RelBisMed" id="RelBisMedResult">
        <result property="guid" column="guid"/>
        <result property="bisGuid" column="bis_guid"/>
        <result property="bisTablename" column="bis_tablename"/>
        <result property="medGuid" column="med_guid"/>
        <result property="bisRelColumns" column="bis_rel_columns"/>
        <result property="fromDate" column="from_date"/>
        <result property="toDate" column="to_date"/>
    </resultMap>
    <sql id="selectRelBisMedVo">
        select guid, bis_guid, bis_tablename, med_guid, bis_rel_columns, from_date, to_date
        from rel_bis_med
    </sql>
    <select id="selectRelBisMedByGuid" parameterType="String" resultMap="RelBisMedResult">
        <include refid="selectRelBisMedVo"/>
        where guid = #{guid}
    </select>
    <select id="selectRelBisMedList" parameterType="com.goldenwater.slaj.hidd.domain.RelBisMed" resultMap="RelBisMedResult">
        <include refid="selectRelBisMedVo"/>
        <where>
            <if test="bisGuid != null and bisGuid != ''">AND bis_guid = #{bisGuid}</if>
            <if test="bisTablename != null and bisTablename != ''">AND bis_tablename = #{bisTablename}</if>
            <if test="medGuid != null and medGuid != ''">AND med_guid = #{medGuid}</if>
        </where>
    </select>
    <select id="selectRelBisMedByBisInfo" resultMap="RelBisMedResult">
        <include refid="selectRelBisMedVo"/>
        where bis_tablename = #{bisTablename} and bis_guid = #{bisGuid}
    </select>
    <insert id="insertRelBisMed" parameterType="com.goldenwater.slaj.hidd.domain.RelBisMed">
        insert into rel_bis_med (guid, bis_guid, bis_tablename, med_guid, bis_rel_columns, from_date, to_date)
        values (#{guid}, #{bisGuid}, #{bisTablename}, #{medGuid}, #{bisRelColumns}, #{fromDate}, #{toDate}, )
    </insert>
    <update id="updateRelBisMed" parameterType="com.goldenwater.slaj.hidd.domain.RelBisMed">
        update rel_bis_med
        <set>
            <if test="bisGuid != null">bis_guid = #{bisGuid},</if>
            <if test="bisTablename != null">bis_tablename = #{bisTablename},</if>
            <if test="medGuid != null">med_guid = #{medGuid},</if>
            <if test="bisRelColumns != null">bis_rel_columns = #{bisRelColumns},</if>
            <if test="fromDate != null">from_date = #{fromDate},</if>
            <if test="toDate != null">to_date = #{toDate},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteRelBisMedByGuid" parameterType="String">
        delete from rel_bis_med where guid = #{guid}
    </delete>
    <delete id="deleteRelBisMedByGuids" parameterType="String">
        delete from rel_bis_med where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
    <delete id="deleteRelBisMedByBisInfo">
        delete from rel_bis_med where bis_tablename = #{bisTablename} and bis_guid = #{bisGuid}
    </delete>
</mapper>
