ProductChainMapper.xml
3.29 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
<?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.product.dal.ProductChainMapper" >
<resultMap id="BaseResultMap" type="com.yoho.product.model.ProductChain" >
<id column="tag_id" property="tagId" jdbcType="VARCHAR" />
<result column="chain_id" property="chainId" jdbcType="BIGINT" />
<result column="transaction_id" property="transactionId" jdbcType="VARCHAR" />
<result column="transaction_time" property="transactionTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
tag_id, chain_id, transaction_id, transaction_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from product_chain
where tag_id = #{tagId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from product_chain
where tag_id = #{tagId,jdbcType=VARCHAR}
</delete>
<insert id="updateProductChain" parameterType="com.yoho.product.model.ProductChain" >
insert into product_chain (tag_id, chain_id, transaction_id, transaction_time)
values (#{tagId,jdbcType=VARCHAR}, #{chainId,jdbcType=BIGINT}, #{transactionId,jdbcType=VARCHAR}, #{transactionTime,jdbcType=INTEGER})
ON DUPLICATE KEY UPDATE transaction_time=#{transactionTime, jdbcType=INTEGER}, transaction_id = #{transactionId,jdbcType=VARCHAR}
</insert>
<insert id="insertSelective" parameterType="com.yoho.product.model.ProductChain" >
insert into product_chain
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="tagId != null" >
tag_id,
</if>
<if test="chainId != null" >
chain_id,
</if>
<if test="transactionId != null" >
transaction_id,
</if>
<if test="transactionTime != null" >
transaction_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="tagId != null" >
#{tagId,jdbcType=VARCHAR},
</if>
<if test="chainId != null" >
#{chainId,jdbcType=BIGINT},
</if>
<if test="transactionId != null" >
#{transactionId,jdbcType=VARCHAR},
</if>
<if test="transactionTime != null" >
#{transactionTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.product.model.ProductChain" >
update product_chain
<set >
<if test="chainId != null" >
chain_id = #{chainId,jdbcType=BIGINT},
</if>
<if test="transactionId != null" >
transaction_id = #{transactionId,jdbcType=VARCHAR},
</if>
<if test="transactionTime != null" >
transaction_time = #{transactionTime,jdbcType=INTEGER},
</if>
</set>
where tag_id = #{tagId,jdbcType=VARCHAR}
</update>
<update id="updateTransactionId" >
update product_chain
set transaction_id = #{transactionId,jdbcType=VARCHAR},
where tag_id = #{tagId,jdbcType=VARCHAR}
</update>
<select id="selectProductChain" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_chain
where transaction_id IS NULL limit 200
</select>
</mapper>