admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
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
93
94
95
96
97
98
99
100
101
102
103
104
105
<?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.yeshi.fanli.dao.mybatis.order.UserOrderWeiQuanRecordMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord">
        <id column="wr_id" property="id" jdbcType="BIGINT" />
        <result column="wr_source_type" property="sourceType" jdbcType="INTEGER" />
        <result column="wr_trade_id" property="tradeId" jdbcType="VARCHAR" />
        <result column="wr_uid" property="uid" jdbcType="BIGINT" />
        <result column="wr_money" property="money" jdbcType="DECIMAL" />
        <result column="wr_state" property="state" jdbcType="INTEGER" />
        <result column="wr_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="wr_update_time" property="updateTime" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">wr_id,wr_source_type,wr_trade_id,wr_uid,wr_money,wr_state,wr_create_time,wr_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_order_weiquan_record where wr_id =
        #{id,jdbcType=BIGINT}
    </select>
 
 
    <select id="selectByOrderInfoAndUid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_order_weiquan_record where wr_trade_id =#{tradeId}
        and wr_source_type=#{sourceType} and wr_uid=#{uid}
    </select>
 
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user_order_weiquan_record where wr_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_user_order_weiquan_record
        (wr_id,wr_source_type,wr_trade_id,wr_uid,wr_money,wr_state,wr_create_time,wr_update_time)
        values
        (#{id,jdbcType=BIGINT},#{sourceType,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user_order_weiquan_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">wr_id,</if>
            <if test="sourceType != null">wr_source_type,</if>
            <if test="tradeId != null">wr_trade_id,</if>
            <if test="uid != null">wr_uid,</if>
            <if test="money != null">wr_money,</if>
            <if test="state != null">wr_state,</if>
            <if test="createTime != null">wr_create_time,</if>
            <if test="updateTime != null">wr_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if>
            <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR},</if>
            <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
            <if test="money != null">#{money,jdbcType=DECIMAL},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord">update
        yeshi_ec_user_order_weiquan_record set wr_source_type =
        #{sourceType,jdbcType=INTEGER},wr_trade_id =
        #{tradeId,jdbcType=VARCHAR},wr_uid = #{uid,jdbcType=BIGINT},wr_money =
        #{money,jdbcType=DECIMAL},wr_state =
        #{state,jdbcType=INTEGER},wr_create_time =
        #{createTime,jdbcType=TIMESTAMP},wr_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where wr_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord">
        update yeshi_ec_user_order_weiquan_record
        <set>
            <if test="sourceType != null">wr_source_type=#{sourceType,jdbcType=INTEGER},</if>
            <if test="tradeId != null">wr_trade_id=#{tradeId,jdbcType=VARCHAR},</if>
            <if test="uid != null">wr_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="money != null">wr_money=#{money,jdbcType=DECIMAL},</if>
            <if test="state != null">wr_state=#{state,jdbcType=INTEGER},</if>
            <if test="createTime != null">wr_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">wr_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where wr_id = #{id,jdbcType=BIGINT}
    </update>
    
        
    <select id="countWeiQaunOrderNumberByDate" resultType="Integer">
        SELECT COUNT(1) FROM (SELECT co.`co_id` FROM `yeshi_ec_user_order_weiquan_record` w
        LEFT JOIN `yeshi_ec_common_order` co ON (w.`wr_trade_id` = co.`co_trade_id` AND w.`wr_source_type` = co.`co_source_type`)
        WHERE DATE_FORMAT(w.`wr_create_time`,'%Y-%m-%d') = #{preDay}
        GROUP BY co.`co_order_no`,co.`co_source_type`)A
    </select>
    
    <select id="countWeiQaunOrderMoneyByDate" resultType="BigDecimal">
        SELECT SUM(w.`wr_money`) FROM `yeshi_ec_user_order_weiquan_record` w
        WHERE DATE_FORMAT(w.`wr_create_time`,'%Y-%m-%d') = #{preDay}
    </select>
    
</mapper>