admin
2 天以前 8b389601ea23deddb3318a8a70d0c80e7b6b994c
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
<?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.sc.materialConf.mapper.ScMaterialConfMapper">
 
    <resultMap type="ScMaterialConf" id="ScMaterialConfResult">
        <result property="id"    column="id"    />
        <result property="materialCode"    column="material_code"    />
        <result property="materialName"    column="material_name"    />
        <result property="remark"    column="remark"    />
        <result property="sparefield1"    column="sparefield1"    />
        <result property="sparefield2"    column="sparefield2"    />
        <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="status"    column="status"    />
        <result property="modelCode"    column="model_code"    />
    </resultMap>
 
    <sql id="selectScMaterialConfVo">
        select id, material_code, material_name, remark, sparefield1, sparefield2, create_user, create_time, update_user, update_time, status, model_code from sc_material_conf
    </sql>
 
    <select id="selectScMaterialConfList" parameterType="ScMaterialConf" resultMap="ScMaterialConfResult">
        <include refid="selectScMaterialConfVo"/>
        <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="sparefield1 != null  and sparefield1 != ''"> and sparefield1 = #{sparefield1}</if>
            <if test="sparefield2 != null  and sparefield2 != ''"> and sparefield2 = #{sparefield2}</if>
            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="modelCode != null  and modelCode != ''"> and model_code = #{modelCode}</if>
        </where>
    </select>
 
    <select id="selectScMaterialConfById" parameterType="Long" resultMap="ScMaterialConfResult">
        <include refid="selectScMaterialConfVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertScMaterialConf" parameterType="ScMaterialConf" useGeneratedKeys="true" keyProperty="id">
        insert into sc_material_conf
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="materialCode != null">material_code,</if>
            <if test="materialName != null">material_name,</if>
            <if test="remark != null">remark,</if>
            <if test="sparefield1 != null">sparefield1,</if>
            <if test="sparefield2 != null">sparefield2,</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="status != null">status,</if>
            <if test="modelCode != null">model_code,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="materialCode != null">#{materialCode},</if>
            <if test="materialName != null">#{materialName},</if>
            <if test="remark != null">#{remark},</if>
            <if test="sparefield1 != null">#{sparefield1},</if>
            <if test="sparefield2 != null">#{sparefield2},</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="status != null">#{status},</if>
            <if test="modelCode != null">#{modelCode},</if>
        </trim>
    </insert>
 
    <update id="updateScMaterialConf" parameterType="ScMaterialConf">
        update sc_material_conf
        <trim prefix="SET" suffixOverrides=",">
            <if test="materialCode != null">material_code = #{materialCode},</if>
            <if test="materialName != null">material_name = #{materialName},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="sparefield1 != null">sparefield1 = #{sparefield1},</if>
            <if test="sparefield2 != null">sparefield2 = #{sparefield2},</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="status != null">status = #{status},</if>
            <if test="modelCode != null">model_code = #{modelCode},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteScMaterialConfById" parameterType="Long">
        delete from sc_material_conf where id = #{id}
    </delete>
 
    <delete id="deleteScMaterialConfByIds" parameterType="String">
        delete from sc_material_conf where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>