ResourcesGoodsPoolMapper.xml
2.5 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
<?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.yoho.ufo.dal.ResourcesGoodsPoolMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.resource.ResourcesGoodsPool" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="pool_name" property="poolName" jdbcType="VARCHAR" />
<result column="pool_id" property="poolId" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, create_time, update_time, pool_name, pool_id
</sql>
<insert id="insertOrUpdate">
insert into resources_goods_pool(
id,
create_time,
pool_name,
pool_id)
values
<foreach collection="list" separator="," item="item">
(#{item.id},#{item.createTime},#{item.poolName},#{item.poolId})
</foreach>
on DUPLICATE key update
update_time=values(update_time),
pool_name = case when values(pool_name) is null then pool_name else values(pool_name) end,
pool_id = case when values(pool_id) is null then pool_id else values(pool_id) end
</insert>
<update id="updateBatchByResGoodsPoolBo">
update resources_goods_pool
set pool_name=
<foreach collection="list" item="item" separator=" " open="case id " close="else pool_name end,">
when #{item.id} <if test="item.poolName == null"> and 1=2 </if> then #{item.poolName}
</foreach>
pool_id=
<foreach collection="list" item="item" separator=" " open="case id " close="else pool_id end,">
when #{item.id} <if test="item.poolId == null"> and 1=2 </if> then #{item.poolId}
</foreach>
update_time=
<foreach collection="list" item="item" separator=" " open="case id " close="else update_time end">
when #{item.id} <if test="item.updateTime == null"> and 1=2 </if> then #{item.updateTime}
</foreach>
where id in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<select id="selectAll" resultType="com.yoho.ufo.model.resource.ResourcesGoodsPool">
select <include refid="Base_Column_List" /> from resources_goods_pool
limit 10000
</select>
</mapper>