FlexValuesMapper.xml
3.86 KB
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
<?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.huaheng.pc.config.flexValues.mapper.FlexValuesMapper">
<resultMap type="com.huaheng.pc.config.flexValues.domain.FlexValues" id="flexValuesResult">
<result property="entryId" column="entryId" />
<result property="id" column="id" />
<result property="name" column="name" />
<result property="number" column="number" />
<result property="flexValueNumber" column="flexValueNumber" />
<result property="flexValueName" column="flexValueName" />
<result property="useOrgId" column="useOrgId" />
<result property="deleted" column="deleted" />
</resultMap>
<sql id="selectflexValuesVo">
select entryId,id, name, number, flexValueNumber,flexValueName,useOrgId,deleted from flex_values
</sql>
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO flex_values
(entryId,id, name, number, flexValueNumber,flexValueName,useOrgId) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.entryId},#{item.id},#{item.name},#{item.number},#{item.flexValueNumber},#{item.flexValueName},#{item.useOrgId}
)
</foreach>
</insert>
<update id="modifyBatch" parameterType="java.util.List">
update flex_values
<trim prefix="set" suffixOverrides=",">
<trim prefix="id =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.id!=null">
when entryId=#{item.entryId}
then #{item.id}
</if>
</foreach>
</trim>
<trim prefix="name =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.name!=null">
when entryId=#{item.entryId}
then #{item.name}
</if>
</foreach>
</trim>
<trim prefix="number =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.number!=null">
when entryId=#{item.entryId}
then #{item.number}
</if>
</foreach>
</trim>
<trim prefix="flexValueNumber =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.flexValueNumber!=null">
when entryId=#{item.entryId}
then #{item.flexValueNumber}
</if>
</foreach>
</trim>
<trim prefix="flexValueName =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.flexValueName!=null">
when entryId=#{item.entryId}
then #{item.flexValueName}
</if>
</foreach>
</trim>
<trim prefix="useOrgId =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.useOrgId!=null">
when entryId=#{item.entryId}
then #{item.useOrgId}
</if>
</foreach>
</trim>
</trim>
where entryId in
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
#{item.entryId}
</foreach>
</update>
<update id="truncateTable">
truncate table flex_values
</update>
</mapper>