admin
2024-12-17 75f1ced619b49f354addc1cf8fa1ca320b25edd4
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?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.jcdm.main.bs.batchInfo.mapper.BsBatchInfoMapper">
    
    <resultMap type="BsBatchInfo" id="BsBatchInfoResult">
        <result property="id"    column="id"    />
        <result property="materialCode"    column="material_code"    />
        <result property="materialName"    column="material_name"    />
        <result property="batch"    column="batch"    />
        <result property="changeTime"    column="change_time"    />
        <result property="remarks"    column="remarks"    />
        <result property="createTime"    column="create_time"    />
        <result property="createUser"    column="create_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="stationCode"    column="station_code"    />
        <result property="flag"    column="flag"    />
 
    </resultMap>
 
    <sql id="selectBsBatchInfoVo">
        select  station_code, flag, id, material_code, material_name, batch, change_time, remarks, create_time, create_user, update_time, update_user from bs_batch_info
    </sql>
 
    <select id="selectBsBatchInfoList" parameterType="BsBatchInfo" resultMap="BsBatchInfoResult">
        <include refid="selectBsBatchInfoVo"/>
        <where>  
            <if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
            <if test="materialName != null  and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
            <if test="batch != null  and batch != ''"> and batch = #{batch}</if>
            <if test="flag != null  and flag != ''"> and flag = #{flag}</if>
            <if test="stationCode != null  and stationCode != ''"> and station_code = #{stationCode}</if>
 
        </where>
    </select>
    
    <select id="selectBsBatchInfoById" parameterType="Long" resultMap="BsBatchInfoResult">
        <include refid="selectBsBatchInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBsBatchInfo" parameterType="BsBatchInfo">
        insert into bs_batch_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="materialCode != null">material_code,</if>
            <if test="materialName != null">material_name,</if>
            <if test="batch != null">batch,</if>
            <if test="changeTime != null">change_time,</if>
            <if test="remarks != null">remarks,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createUser != null">create_user,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="stationCode != null">station_code,</if>
            <if test="flag != null">flag,</if>
 
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="materialCode != null">#{materialCode},</if>
            <if test="materialName != null">#{materialName},</if>
            <if test="batch != null">#{batch},</if>
            <if test="changeTime != null">#{changeTime},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="stationCode != null">#{stationCode},</if>
            <if test="flag != null">#{flag},</if>
         </trim>
    </insert>
 
    <update id="updateBsBatchInfo" parameterType="BsBatchInfo">
        update bs_batch_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="materialCode != null">material_code = #{materialCode},</if>
            <if test="materialName != null">material_name = #{materialName},</if>
            <if test="batch != null">batch = #{batch},</if>
            <if test="changeTime != null">change_time = #{changeTime},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="stationCode != null">station_code = #{stationCode},</if>
            <if test="flag != null">flag = #{flag},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteBsBatchInfoById" parameterType="Long">
        delete from bs_batch_info where id = #{id}
    </delete>
 
    <delete id="deleteBsBatchInfoByIds" parameterType="String">
        delete from bs_batch_info where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>