懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?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.material.mapper.BsMaterialInfoMapper">
    <resultMap type="BsMaterialInfo" id="BsMaterialInfoResult">
        <result property="id"    column="id"    />
        <result property="materialCode"    column="material_code"    />
        <result property="materialName"    column="material_name"    />
        <result property="materialView"    column="material_view"    />
        <result property="typeZ"    column="type_z"    />
        <result property="typeL"    column="type_l"    />
        <result property="unit"    column="unit"    />
        <result property="matterVersion"    column="matter_version"    />
        <result property="remarks"    column="remarks"    />
        <result property="createUser"    column="create_user"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="erpSpec"    column="erp_spec"    />
        <result property="dataSource"    column="data_source"    />
        <result property="version"    column="version"    />
        <result property="status"    column="status"    />
        <result property="supplier"    column="supplier"    />
    </resultMap>
 
    <sql id="selectBsMaterialInfoVo">
        select id, material_code, material_name, material_view, type_z, type_l, unit, matter_version, remarks, create_user, create_time, update_user, update_time, erp_spec, data_source, version, status, supplier from bs_material_info
    </sql>
 
    <select id="selectBsMaterialInfoList" parameterType="BsMaterialInfo" resultMap="BsMaterialInfoResult">
        <include refid="selectBsMaterialInfoVo"/>
        <where>  
            <if test="materialCode != null  and materialCode != ''"> and material_code like concat('%', #{materialCode}, '%')</if>
            <if test="materialName != null  and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
            <if test="materialView != null  and materialView != ''"> and material_view = #{materialView}</if>
            <if test="typeZ != null  and typeZ != ''"> and type_z = #{typeZ}</if>
            <if test="typeL != null  and typeL != ''"> and type_l = #{typeL}</if>
            <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
            <if test="matterVersion != null  and matterVersion != ''"> and matter_version = #{matterVersion}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
            <if test="erpSpec != null  and erpSpec != ''"> and erp_spec = #{erpSpec}</if>
            <if test="dataSource != null  and dataSource != ''"> and data_source = #{dataSource}</if>
            <if test="version != null  and version != ''"> and version = #{version}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="supplier != null  and supplier != ''"> and supplier = #{supplier}</if>
        </where>
    </select>
    
    <select id="selectBsMaterialInfoById" parameterType="Long" resultMap="BsMaterialInfoResult">
        <include refid="selectBsMaterialInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBsMaterialInfo" parameterType="BsMaterialInfo">
        insert into bs_material_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="materialView != null">material_view,</if>
            <if test="typeZ != null">type_z,</if>
            <if test="typeL != null">type_l,</if>
            <if test="unit != null">unit,</if>
            <if test="matterVersion != null">matter_version,</if>
            <if test="remarks != null">remarks,</if>
            <if test="createUser != null">create_user,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="erpSpec != null">erp_spec,</if>
            <if test="dataSource != null">data_source,</if>
            <if test="version != null">version,</if>
            <if test="status != null">status,</if>
            <if test="supplier != null">supplier,</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="materialView != null">#{materialView},</if>
            <if test="typeZ != null">#{typeZ},</if>
            <if test="typeL != null">#{typeL},</if>
            <if test="unit != null">#{unit},</if>
            <if test="matterVersion != null">#{matterVersion},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="erpSpec != null">#{erpSpec},</if>
            <if test="dataSource != null">#{dataSource},</if>
            <if test="version != null">#{version},</if>
            <if test="status != null">#{status},</if>
            <if test="supplier != null">#{supplier},</if>
         </trim>
    </insert>
 
    <update id="updateBsMaterialInfo" parameterType="BsMaterialInfo">
        update bs_material_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="materialCode != null">material_code = #{materialCode},</if>
            <if test="materialName != null">material_name = #{materialName},</if>
            <if test="materialView != null">material_view = #{materialView},</if>
            <if test="typeZ != null">type_z = #{typeZ},</if>
            <if test="typeL != null">type_l = #{typeL},</if>
            <if test="unit != null">unit = #{unit},</if>
            <if test="matterVersion != null">matter_version = #{matterVersion},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="erpSpec != null">erp_spec = #{erpSpec},</if>
            <if test="dataSource != null">data_source = #{dataSource},</if>
            <if test="version != null">version = #{version},</if>
            <if test="status != null">status = #{status},</if>
            <if test="supplier != null">supplier = #{supplier},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteBsMaterialInfoById" parameterType="Long">
        delete from bs_material_info where id = #{id}
    </delete>
 
    <delete id="deleteBsMaterialInfoByIds" parameterType="String">
        delete from bs_material_info where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>