<?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.entrustment.mapper.SampleBoxMapper">

  <resultMap id="sampleBoxMap" type="digital.laboratory.platform.sys.entity.entrustment.SampleBox">
    <id property="id" column="id"/>
    <result property="boxNo" column="box_no"/>
    <result property="boxType" column="box_type"/>
    <result property="storageMethod" column="storage_method"/>
    <result property="source" column="source"/>
    <result property="entrustmentId" column="entrustment_id"/>
    <result property="jobId" column="job_id"/>
    <result property="sampleType" column="sample_type"/>
    <result property="sealedUser1Id" column="sealed_user1_id"/>
    <result property="sealedUser2Id" column="sealed_user2_id"/>
    <result property="comments" column="comments"/>
    <result property="createTime" column="create_time"/>
    <result property="createBy" column="create_by"/>
    <result property="updateTime" column="update_time"/>
    <result property="updateBy" column="update_by"/>
  </resultMap>


  <!-- 取最大盒子号, 目的是为了生成新的盒子号 -->
  <select id="getMaxBoxNo" parameterType="String" resultType="java.lang.String">
    SELECT MAX(box_no) AS maxno
    FROM b_sample_box
    WHERE box_no LIKE concat(#{prefix}, '%')
  </select>
</mapper>
