<?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.inspection.mapper.TestRecordStandardSolutionMapper">

    <resultMap id="testRecordStandardSolutionMap"
               type="digital.laboratory.platform.inspection.entity.TestRecordStandardSolution">
        <id property="id" column="id"/>
        <result property="number" column="number"/>
        <result property="standardName" column="standard_name"/>
        <result property="dilutionName" column="dilution_name"/>
        <result property="constantVolume" column="constant_volume"/>
        <result property="dilutionFactor" column="dilution_factor"/>
        <result property="originalConcentration" column="original_concentration"/>
        <result property="resultConcentration" column="result_concentration"/>
        <result property="weighingMoving" column="weighing_moving"/>
        <result property="testId" column="test_id"/>
        <result property="reagentCount" column="reagent_count"/>
        <result property="madeDate" column="made_date"/>
        <result property="expirationDate" column="expiration_date"/>
        <result property="standardSubstanceNumList" column="standard_substance_num_list"
                typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
    </resultMap>

    <resultMap id="testRecordStandardSolutionVoMap"
               type="digital.laboratory.platform.inspection.vo.TestRecordStandardSolutionVo"
               extends="testRecordStandardSolutionMap">
        <result property="orderNum" column="order_num"></result>
    </resultMap>

    <sql id="getTestRecordStandardSolutionMapSQL">
        SELECT ts.*, RIGHT (ts.number, 1) as order_num
        FROM b_test_record_standard_solution ts
        where test_id = #{testId}
        order by ts.number asc
    </sql>

    <select id="getTestRecordStandardSolutionMapPage" resultMap="testRecordStandardSolutionVoMap">
        <include refid="getTestRecordStandardSolutionMapSQL"></include>
    </select>

    <select id="getTestRecordStandardSolutionMapList" resultMap="testRecordStandardSolutionVoMap">
        <include refid="getTestRecordStandardSolutionMapSQL"></include>
    </select>


</mapper>
