<?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.WarehousingBatchListMapper">

    <resultMap id="warehousingBatchListMap" type="digital.laboratory.platform.reagent.entity.WarehousingBatchList">
        <id property="warehousingBatchListId" column="warehousing_batch_list_id"/>
        <result property="batch" column="batch"/>
        <result property="batchNumber" column="batch_number"/>
        <result property="dateOfProduction" column="date_of_production"/>
        <result property="dateOfPurchase" column="date_of_purchase"/>
        <result property="dateOfReceipt" column="date_of_receipt"/>
        <result property="expirationDate" column="expiration_date"/>
        <result property="quantity" column="quantity"/>
        <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="reagentConsumableId" column="reagent_consumable_id"/>
        <result property="warehousingContentId" column="warehousing_content_id"/>
        <result property="supplierId" column="supplier_id"/>
        <result property="warningValue" column="warning_value"/>
        <result property="depositorId" column="depositor_id"/>
        <result property="latticeId" column="lattice_id"/>

    </resultMap>

    <resultMap id="warehousingBatchListVO" type="digital.laboratory.platform.reagent.vo.WarehousingBatchListVO"
               extends="warehousingBatchListMap">
        <result property="supplierName" column="supplier_name"></result>
        <result property="depositorName" column="depositor_name"></result>
    </resultMap>

    <select id="getWarehousingBatchListVOList" resultMap="warehousingBatchListVO"
            resultType="digital.laboratory.platform.reagent.vo.WarehousingBatchListVO">
        SELECT wbl.*,
               (select user.name
                from dlp_base.sys_user user
        where user.user_id = wbl.depositor_id)
            as signatory_name,
            (
        select si.supplier_name
        from supplier_information si
        where si.supplier_information_id =wbl.supplier_id)
            as supplier_name
        FROM warehousing_batch_list wbl
        WHERE wbl.warehousing_content_id = #{warehousingContentId}
    </select>
</mapper>