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
<?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.OpeLaboratoryReserveDao">
    <resultMap id="OpeLaboratoryReserve" type="com.nanometer.smartlab.entity.OpeLaboratoryReserve">
        <id property="id" column="id"/>
        <result property="reagentId" column="reagent_id"></result>
        <result property="articleNumber" column="article_number"></result>
        <result property="reserve" column="reserve"></result>
        <result property="updateTime" column="update_time"></result>
        <result property="validFlag" column="valid_flag" typeHandler="com.nanometer.smartlab.entity.handler.ValidFlagHandler"></result>
        <result property="userId" column="user_id"></result>
        <result property="houseId" column="house_id"></result>
        <result property="containerId" column="container_id"></result>
    </resultMap>
 
    <insert id="insertOpeLaboratoryReserve" parameterType="com.nanometer.smartlab.entity.OpeLaboratoryReserve" useGeneratedKeys = "true" keyProperty = "id">
        insert into ope_laboratory_reserve( reagent_id, article_number,reserve, valid_flag, update_time,user_id,house_id,container_id)
        values (#{reagentId},#{articleNumber},#{reserve},#{validFlag},now(),#{userId},#{houseId},#{containerId})
    </insert>
 
    <insert id="batchInsert">
        insert into ope_laboratory_reserve( reagent_id, article_number,reserve, valid_flag, user_id,house_id,container_id)
        values
        <foreach collection="list" item="item" separator=",">
            (#{item.reagentId},#{item.articleNumber},#{item.reserve},#{item.validFlag},#{item.userId},#{item.houseId},#{item.containerId})
        </foreach>
    </insert>
 
    <select id="selectByReId" resultMap="OpeLaboratoryReserve">
        select * from ope_laboratory_reserve where reagent_id=#{id}
    </select>
 
    <update id="updateByReId" parameterType="java.util.Map">
        update ope_laboratory_reserve set reagent_id=#{newReId} where reagent_id=#{oldReId}
    </update>
    <update id="updateByReagent">
        update ope_laboratory_reserve
        set valid_flag = 0
        where reagent_id=#{reagentId}
        and house_id = #{houseId}
        and container_id = #{containerId}
        and user_id = #{userId}
        and valid_flag = 1
    </update>
</mapper>