ProPackagingMapper.xml
3.89 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
92
<?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.proPackaging.mapper.ProPackagingMapper">
<resultMap type="com.huaheng.pc.config.proPackaging.domain.ProPackaging" id="proPackagingResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="number" column="number" />
<result property="description" column="description" />
<result property="pieceBox" column="pieceBox" />
<result property="price" column="price" />
<result property="boxs" column="boxs" />
<result property="pallet" column="pallet" />
<result property="deleted" column="deleted" />
</resultMap>
<sql id="selectproPackagingVo">
select id, name, number, description, pieceBox, price, boxs, pallet,`deleted` from pro_packaging
</sql>
<update id="truncateTable">
truncate table pro_packaging
</update>
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO pro_packaging
(id, name, number, description, pieceBox, price, boxs, pallet)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.id},#{item.name},#{item.number},#{item.description},#{item.pieceBox},#{item.price},#{item.boxs},#{item.pallet}
)
</foreach>
</insert>
<update id="modifyBatch" parameterType="java.util.List">
update pro_packaging
<trim prefix="set" suffixOverrides=",">
<trim prefix="name =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.name!=null">
when deleted=0 and id=#{item.id}
then #{item.name}
</if>
</foreach>
</trim>
<trim prefix="description =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.description!=null">
when deleted=0 and id=#{item.id}
then #{item.description}
</if>
</foreach>
</trim>
<trim prefix="pieceBox =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.pieceBox!=null">
when deleted=0 and id=#{item.id}
then #{item.pieceBox}
</if>
</foreach>
</trim>
<trim prefix="boxs =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.boxs!=null">
when deleted=0 and id=#{item.id}
then #{item.boxs}
</if>
</foreach>
</trim>
<trim prefix="price =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.price!=null">
when deleted=0 and id=#{item.id}
then #{item.price}
</if>
</foreach>
</trim>
<trim prefix="pallet =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.pallet!=null">
when deleted=0 and id=#{item.id}
then #{item.pallet}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
</mapper>