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

  <resultMap id="provideServicesOrSuppliesMap" type="digital.laboratory.platform.reagent.entity.ProvideServicesOrSupplies">
    <id property="provideServicesOrSuppliesId" column="provide_services_or_supplies_id"/>
    <result property="reagentConsumableId" column="reagent_consumable_id"/>
    <result property="evaluationFormId" column="evaluation_form_id"/>
    <result property="createTime" column="create_time"/>
    <result property="updateTime" column="update_time"/>
    <result property="createBy" column="create_by"/>
    <result property="updateBy" column="update_by"/>

  </resultMap>

  <resultMap id="provideServicesOrSuppliesVO" type="digital.laboratory.platform.reagent.vo.ProvideServicesOrSuppliesVO" extends="provideServicesOrSuppliesMap">
    <result property="reagentConsumableName" column="reagent_consumable_name"></result>
  </resultMap>

  <select id="getProvideServicesOrSuppliesVOList" resultMap="provideServicesOrSuppliesVO" resultType="digital.laboratory.platform.reagent.vo.ProvideServicesOrSuppliesVO">
    SELECT ps.*,
           (select rc.name
            from reagent_consumables rc
            where rc.reagent_consumable_id = ps.reagent_consumable_id) AS reagent_consumable_name
    FROM provide_services_or_supplies ps
    WHERE ps.provide_services_or_supplies_id = #{provideServicesOrSuppliesId}
  </select>
</mapper>
