SellerOrderStatsResultMapper.xml
2.91 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
<?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.yohoufo.dal.order.SellerOrderStatsResultMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.SellerOrderStatsResult">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="stats_code" property="statsCode" jdbcType="VARCHAR"/>
<result column="uid" property="uid" jdbcType="INTEGER"/>
<result column="enter_type" property="enterType" jdbcType="INTEGER"/>
<result column="begin_time" property="beginTime" jdbcType="INTEGER"/>
<result column="end_time" property="endTime" jdbcType="INTEGER"/>
<result column="quantity" property="quantity" jdbcType="INTEGER"/>
<result column="update_time" property="updateTime" jdbcType="INTEGER"/>
<result column="stats_time" property="statsTime" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, stats_code, uid, enter_type, begin_time, end_time, quantity, update_time, stats_time
</sql>
<select id="selectStatsResult" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from seller_order_stats_result
where uid = #{uid,jdbcType=INTEGER}
and stats_code = #{statsCode,jdbcType=VARCHAR}
and end_time <![CDATA[ >= ]]> #{currentTime,jdbcType=INTEGER}
and begin_time <![CDATA[ <= ]]> #{currentTime,jdbcType=INTEGER}
limit 1
</select>
<insert id="insert" parameterType="com.yohoufo.dal.order.model.SellerOrderStatsResult">
insert into seller_order_stats_result (id, uid, enter_type, stats_code,begin_time, end_time, quantity, update_time, stats_time)
values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=INTEGER}, #{enterType,jdbcType=INTEGER}, #{statsCode,jdbcType=VARCHAR},
#{beginTime,jdbcType=INTEGER}, #{endTime,jdbcType=INTEGER}, #{quantity,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER},#{statsTime,jdbcType=INTEGER})
ON DUPLICATE KEY UPDATE quantity = #{quantity,jdbcType=INTEGER} + quantity, stats_time = #{statsTime,jdbcType=INTEGER}
</insert>
<update id="update" parameterType="com.yohoufo.dal.order.model.SellerOrderStatsResult">
update seller_order_stats_result
<set>
<if test="enterType != null">
enter_type = #{enterType,jdbcType=INTEGER},
</if>
<if test="quantity != null">
quantity = #{quantity,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=INTEGER},
</if>
</set>
where stats_code = #{statsCode,jdbcType=VARCHAR}
and uid = #{uid,jdbcType=INTEGER}
and begin_time = #{beginTime,jdbcType=INTEGER}
and end_time = #{endTime,jdbcType=INTEGER}
</update>
</mapper>