SellerOrderStatsResultMapper.xml
1.92 KB
<?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="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"/>
</resultMap>
<sql id="Base_Column_List">
id, stats_code, uid, begin_time, end_time, quantity, update_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, stats_code,begin_time, end_time, quantity, update_time)
values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=INTEGER}, #{statsCode,jdbcType=VARCHAR},
#{beginTime,jdbcType=INTEGER}, #{endTime,jdbcType=INTEGER}, #{quantity,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER})
ON DUPLICATE KEY UPDATE quantity = #{quantity,jdbcType=INTEGER} + quantity,update_time = #{updateTime,jdbcType=INTEGER}
</insert>
</mapper>