<?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="digital.laboratory.platform.reagent.mapper.WarehousingContentMapper">

    <resultMap id="warehousingContentMap" type="digital.laboratory.platform.reagent.entity.WarehousingContent">
        <id property="warehousingContentId" column="warehousing_content_id"></id>
        <result property="reagentConsumableId" column="reagent_consumable_id"></result>
        <result property="totalQuantity" column="total_quantity"></result>
        <result property="warehousingRecordFormId" column="warehousing_record_form_id"></result>
        <result property="warehousingQuantity" column="warehousing_quantity"></result>
        <result property="catalogueNumber" column="catalogue_number"></result>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateBy" column="update_by"/>
        <result property="acceptanceRecordFormId" column="acceptance_record_form_id"/>
    </resultMap>

    <resultMap id="warehousingContentVO" type="digital.laboratory.platform.reagent.vo.WarehousingContentVO" extends="warehousingContentMap">
        <result property="reagentConsumableName" column="reagent_consumable_name"></result>
    </resultMap>

    <select id="getWarehousingContentVOList" resultMap="warehousingContentVO" resultType="digital.laboratory.platform.reagent.vo.WarehousingContentVO">
        SELECT wc.*,
               (select rc.reagent_consumable_name
                from reagent_consumables rc
                where rc.reagent_consumable_id = wc.reagent_consumable_id) as reagent_consumable_name
        FROM warehousing_content wc
        WHERE wc.warehousing_record_form_id = #{warehousingRecordFormId}
    </select>
</mapper>