admin
2019-12-06 cd637932a970e7935b17d41568fe89c92775bccc
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
<?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.redpack.RedPackWinInviteMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.redpack.RedPackWinInvite">
    <id column="rwr_id" property="id" jdbcType="BIGINT"/>
    <result column="rwr_uid" property="uid" jdbcType="BIGINT"/>
    <result column="rwr_team_uid" property="teamUid" jdbcType="BIGINT"/>
    <result column="rwr_money" property="money" jdbcType="DECIMAL"/>
    <result column="rwr_source" property="source" jdbcType="INTEGER"/>
    <result column="rwr_identify_code" property="identifyCode" jdbcType="VARCHAR"/>
    <result column="rwr_order_no" property="orderNo" jdbcType="VARCHAR"/>
    <result column="rwr_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="rwr_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="rwr_type" property="type" typeHandler="com.yeshi.fanli.util.mybatishandler.redpack.RedPackWinInviteTypeEnumHandler"/>
  </resultMap>
  <sql id="Base_Column_List">rwr_id,rwr_uid,rwr_team_uid,rwr_money,rwr_type,rwr_source,rwr_identify_code,rwr_order_no,rwr_create_time,rwr_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_red_pack_win_invite where rwr_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_red_pack_win_invite where rwr_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.redpack.RedPackWinInvite" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_win_invite (rwr_id,rwr_uid,rwr_team_uid,rwr_money,rwr_type,rwr_source,rwr_identify_code,rwr_order_no,rwr_create_time,rwr_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{teamUid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=VARCHAR},#{source,jdbcType=INTEGER},#{identifyCode,jdbcType=VARCHAR},#{orderNo,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackWinInvite" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_red_pack_win_invite
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">rwr_id,</if>
      <if test="uid != null">rwr_uid,</if>
      <if test="teamUid != null">rwr_team_uid,</if>
      <if test="money != null">rwr_money,</if>
      <if test="type != null">rwr_type,</if>
      <if test="source != null">rwr_source,</if>
      <if test="identifyCode != null">rwr_identify_code,</if>
      <if test="orderNo != null">rwr_order_no,</if>
      <if test="createTime != null">rwr_create_time,</if>
      <if test="updateTime != null">rwr_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
      <if test="teamUid != null">#{teamUid,jdbcType=BIGINT},</if>
      <if test="money != null">#{money,jdbcType=DECIMAL},</if>
      <if test="type != null">#{type,jdbcType=VARCHAR},</if>
      <if test="source != null">#{source,jdbcType=INTEGER},</if>
      <if test="identifyCode != null">#{identifyCode,jdbcType=VARCHAR},</if>
      <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</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.redpack.RedPackWinInvite">update yeshi_ec_red_pack_win_invite set rwr_uid = #{uid,jdbcType=BIGINT},rwr_team_uid = #{teamUid,jdbcType=BIGINT},rwr_money = #{money,jdbcType=DECIMAL},rwr_type = #{type,jdbcType=VARCHAR},rwr_source = #{source,jdbcType=INTEGER},rwr_identify_code = #{identifyCode,jdbcType=VARCHAR},rwr_order_no = #{orderNo,jdbcType=VARCHAR},rwr_create_time = #{createTime,jdbcType=TIMESTAMP},rwr_update_time = #{updateTime,jdbcType=TIMESTAMP} where rwr_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.redpack.RedPackWinInvite">update yeshi_ec_red_pack_win_invite
    <set>
      <if test="uid != null">rwr_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="teamUid != null">rwr_team_uid=#{teamUid,jdbcType=BIGINT},</if>
      <if test="money != null">rwr_money=#{money,jdbcType=DECIMAL},</if>
      <if test="type != null">rwr_type=#{type,jdbcType=VARCHAR},</if>
      <if test="source != null">rwr_source=#{source,jdbcType=INTEGER},</if>
      <if test="identifyCode != null">rwr_identify_code=#{identifyCode,jdbcType=VARCHAR},</if>
      <if test="orderNo != null">rwr_order_no=#{orderNo,jdbcType=VARCHAR},</if>
      <if test="createTime != null">rwr_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">rwr_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where rwr_id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="countByUidAndType" resultType="Long">
      SELECT IFNULL(COUNT(d.`rwr_id`),0) FROM yeshi_ec_red_pack_win_invite d
    WHERE d.`rwr_uid` = #{uid} AND d.`rwr_type` = #{type}
  </select>
  
  <select id="countByUidAndTeamUidAndType" resultType="Integer">
      SELECT IFNULL(COUNT(d.`rwr_id`),0) FROM yeshi_ec_red_pack_win_invite d
    WHERE d.`rwr_uid` = #{uid} AND d.`rwr_team_uid` = #{teamUid} AND d.`rwr_type` = #{type}
  </select>
  
  
  <select id="getRewardList" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_red_pack_win_invite d
    WHERE d.`rwr_uid` = #{uid}
    ORDER BY d.`rwr_id` DESC
    LIMIT #{start},#{count}
  </select>
  
  <select id="countRewardRecord" resultType="Long">
      SELECT IFNULL(COUNT(d.`rwr_id`),0) FROM yeshi_ec_red_pack_win_invite d
    WHERE d.`rwr_uid` = #{uid}
  </select>
  
  <select id="getRewardMoney" resultType="BigDecimal">
      SELECT IFNULL(SUM(d.`rwr_money`),0) FROM yeshi_ec_red_pack_win_invite d
    WHERE d.`rwr_uid` = #{uid}
  </select>
</mapper>