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

  <resultMap id="caseEvidenceMap" type="digital.laboratory.platform.entrustment.entity.CaseEvidence">
    <id property="id" column="id"/>
    <result property="evidenceNo" column="evidence_no"/>
    <result property="caseId" column="case_id"/>
    <result property="thirdPartySysEvidenceNo" column="third_party_sys_evidence_no"/>
    <result property="name" column="name"/>
    <result property="type" column="type"/>
    <result property="fieldLabelNo" column="field_label_no"/>
    <result property="source" column="source"/>
    <result property="color" column="color"/>
    <result property="form" column="form"/>
    <result property="fundName" column="fund_name"/>
    <result property="fundQuantity" column="fund_quantity"/>
    <result property="fundUnit" column="fund_unit"/>
    <result property="quantity" column="quantity"/>
    <result property="unit" column="unit"/>
    <result property="additionalProperties" column="additional_properties" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
    <result property="personName" column="person_name"/>
    <result property="personCert" column="person_cert"/>
    <result property="personId" column="person_id"/>
    <result property="personGender" column="person_gender"/>
    <result property="personNationality" column="person_nationality"/>
    <result property="personNation" column="person_nation"/>
    <result property="personAddress" column="person_address"/>
    <result property="personAge" column="person_age"/>
    <result property="pack" column="pack"/>
    <result property="storageMethod" column="storage_method"/>
    <result property="description" column="description"/>
    <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="getMaxEvidenceNo" parameterType="String" resultType="java.lang.String">
    SELECT MAX(evidence_no) AS maxno
    FROM b_case_evidence
    WHERE evidence_no LIKE concat(#{prefix}, '%')
  </select>

</mapper>
