<?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.web.modules.architecture.mapper.BizDrugIncompatibilityCompanionMapper">

    <resultMap type="com.ruoyi.web.modules.architecture.domain.BizDrugIncompatibilityCompanion" id="BizDrugIncompatibilityCompanionResult">
        <id     property="id"                   column="id"/>
        <result property="standardId"          column="standard_id"/>
        <result property="companionDrugName"   column="companion_drug_name"/>
        <result property="sortOrder"           column="sort_order"/>
    </resultMap>

    <select id="selectBizDrugIncompatibilityCompanionListByStandardId" parameterType="long" resultMap="BizDrugIncompatibilityCompanionResult">
        select id, standard_id, companion_drug_name, sort_order
        from biz_drug_incompatibility_companion
        where standard_id = #{standardId}
        order by sort_order asc, id asc
    </select>

    <delete id="deleteBizDrugIncompatibilityCompanionByStandardId" parameterType="long">
        delete from biz_drug_incompatibility_companion where standard_id = #{standardId}
    </delete>

    <insert id="insertBizDrugIncompatibilityCompanion" parameterType="com.ruoyi.web.modules.architecture.domain.BizDrugIncompatibilityCompanion" useGeneratedKeys="true" keyProperty="id">
        insert into biz_drug_incompatibility_companion (standard_id, companion_drug_name, sort_order)
        values (#{standardId}, #{companionDrugName}, #{sortOrder})
    </insert>
</mapper>
