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

  <resultMap id="checkContentMap" type="digital.laboratory.platform.reagent.entity.CheckContent">
    <id property="checkContentId" column="check_content_id"/>
    <result property="brand" column="brand"/>
    <result property="complianceCheckId" column="compliance_check_id"/>
    <result property="reagentConsumableId" column="reagent_consumable_id"/>
    <result property="specificationAndModel" column="specification_and_model"/>

    <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="checkContentVO" type="digital.laboratory.platform.reagent.vo.CheckContentVO" extends="checkContentMap">
    <result property="reagentConsumableName" column="reagent_consumable_name"></result>
  </resultMap>
  
  <select id="getCheckContentVOList" resultMap="checkContentVO" resultType="digital.laboratory.platform.reagent.vo.CheckContentVO">
    SELECT cc.*,
           (select rc.name
            from reagent_consumables rc
            where rc.reagent_consumable_id = cc.reagent_consumable_id)
    FROM check_content cc
    WHERE cc.compliance_check_id = #{complianceCheckId}
  </select>
</mapper>
