kongzy
2024-07-01 47a751cb301d05276ae5d75145d57b2d090fe4e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?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="com.nanometer.smartlab.dao.LabReagentReserveDao">
 
   <resultMap id="LaboratoryReagentReserve" type="com.nanometer.smartlab.entity.LaboratoryReagentReserve">
 
    <result property="reagentId" column="reagentId"></result>
       <result property="id" column="id"></result>
    <result property="laboratoryName" column="laboratoryName"></result>
    <result property="containerName" column="containerName"></result>
    <result property="reserve" column="reserve"></result>
       <association property="sysReagent" select="selectReagentById"
                            column="reagentId=reagentId">
       </association>
  </resultMap>
 
    <resultMap id="SysReagent" type="com.nanometer.smartlab.entity.SysReagent">
        <id property="id" column="id"/>
        <result property="name" column="name"></result>
        <result property="cas" column="cas"></result>
        <result property="reagentType" column="reagent_type"></result>
        <result property="reagentCharacter" column="reagent_character"></result>
        <result property="supplierId" column="supplier_id"></result>
        <result property="reagentFormat" column="reagent_format"></result>
        <result property="mainMetering" column="main_metering"></result>
        <result property="reagentUnit" column="reagent_unit"></result>
        <result property="price" column="price"></result>
        <result property="perBox" column="per_box"></result>
        <result property="memo" column="memo"></result>
        <result property="validFlag" column="valid_flag" typeHandler="com.nanometer.smartlab.entity.handler.ValidFlagHandler"></result>
        <result property="createTime" column="create_time"></result>
        <result property="updateTime" column="update_time"></result>
        <result property="supplierName" column="supplierName"></result>
        <result property="deadline" column="deadline"></result>
        <result property="reserve" column="reserve"></result>
        <result property="productSn" column="product_sn"></result>
        <result property="dangerousFlag" column="dangerous_flag" typeHandler="com.nanometer.smartlab.entity.handler.DangerousFlagHandler"></result>
        <result property="controlProducts" column="control_products"></result>
        <result property="controlProductsName" column="control_products_name"></result>
        <result property="productHome" column="product_home"></result>
        <result property="productHomeName" column="product_home_name"></result>
        <result property="type" column="type"></result>
    </resultMap>
 
    <select id="selectReagentById" resultMap="SysReagent">
    select sr.*,ss.name supplierName from sys_reagent sr
    left join sys_supplier ss on ss.id=sr.supplier_id
    where sr.id = #{reagentId}
    </select>
 
  <select id="getList" parameterType="java.util.Map" resultMap="LaboratoryReagentReserve">
 
      select count(0) reserve,CONCAT(a.reagent_id,b.id) id,a.reagent_id reagentId,c.name laboratoryName,b.name containerName from ope_reagent_status a
      left join sys_laboratory_container b on b.id=a.container_id
      left join sys_laboratory c on c.id=b.laboratory_id
      left join sys_reagent d on d.id=a.reagent_id
      WHERE a.`status`=2 and a.valid_flag=1 and b.valid_flag=1 and c.valid_flag=1
      <if test="labName!=null and labName!=''">
        and c.name like concat('%',#{labName},'%')
      </if>
      <if test="reagentName!=null and reagentName!=''">
          and d.name like concat('%',#{reagentName},'%')
      </if>
      GROUP BY b.id,c.id,a.reagent_id
        <if test="first != null and pageSize != null">
          limit #{first}, #{pageSize}
        </if>
  </select>
 
    <select id="getCount" parameterType="java.util.Map" resultType="int">
    select count(1) from ope_reagent_status a
          left join sys_laboratory_container b on b.id=a.container_id
          left join sys_laboratory c on c.id=b.laboratory_id
        left join sys_reagent d on d.id=a.reagent_id
          WHERE a.`status`=2 and a.valid_flag=1 and b.valid_flag=1 and c.valid_flag=1
        <if test="labName!=null and labName!=''">
            and c.name like concat('%',#{labName},'%')
        </if>
        <if test="reagentName!=null and reagentName!=''">
            and d.name like concat('%',#{reagentName},'%')
        </if>
    </select>
 
</mapper>