admin
2020-04-13 dd5b15229cb15459fa7c31ccea77dac28cbfafbd
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?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.tlj.UserTaoLiJinRecordMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord">
    <id column="utlj_id" property="id" jdbcType="BIGINT"/>
    <result column="utlj_uid" property="uid" jdbcType="BIGINT"/>
    <result column="utlj_goods_id" property="goodsId" jdbcType="BIGINT"/>
    <result column="utlj_total_num" property="totalNum" jdbcType="INTEGER"/>
    <result column="utlj_name" property="name" jdbcType="VARCHAR"/>
    <result column="utlj_per_face" property="perFace" jdbcType="DECIMAL"/>
    <result column="utlj_send_start_time" property="sendStartTime" jdbcType="TIMESTAMP"/>
    <result column="utlj_send_end_time" property="sendEndTime" jdbcType="TIMESTAMP"/>
    <result column="utlj_use_start_time" property="useStartTime" jdbcType="TIMESTAMP"/>
    <result column="utlj_use_end_time" property="useEndTime" jdbcType="TIMESTAMP"/>
    <result column="utlj_rights_id" property="rightsId" jdbcType="VARCHAR"/>
    <result column="utlj_send_url" property="sendUrl" jdbcType="VARCHAR"/>
    <result column="utlj_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="utlj_use_type" property="useType" jdbcType="INTEGER"/>
  </resultMap>
  
  <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO">
    <result column="utlj_goods_id" property="auctionId" jdbcType="BIGINT"/>
    <result column="utlj_total_num" property="totalNum" jdbcType="INTEGER"/>
    <result column="utlj_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    
    <result column="utr_refund_num" property="refundNum" jdbcType="INTEGER"/>
    <result column="utr_use_num" property="useNum" jdbcType="INTEGER"/>
    <result column="utr_win_num" property="winNum" jdbcType="INTEGER"/>
    <result column="utr_pre_commission_amount" property="commission" jdbcType="DECIMAL"/>
  </resultMap>
  
  <sql id="Base_Column_List">utlj_id,utlj_uid,utlj_goods_id,utlj_total_num,utlj_name,utlj_per_face,utlj_send_start_time,utlj_send_end_time,utlj_use_start_time,utlj_use_end_time,utlj_rights_id,utlj_send_url,utlj_create_time,utlj_use_type</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_taolijin_record where utlj_id = #{id,jdbcType=BIGINT}
  </select>
  
  <select id="getRecordByUid" resultMap="ResultVOMap">
      SELECT * FROM yeshi_ec_user_taolijin_record d
    LEFT JOIN yeshi_ec_user_taolijin_report p ON d.`utlj_rights_id` = p.`utr_id`
    WHERE d.`utlj_uid` = #{uid} AND p.`utr_id` IS NOT NULL AND d.utlj_use_type = 2
    ORDER BY d.`utlj_create_time` DESC
    LIMIT ${start},${count}
  </select>
 
  <select id="countRecordByUid" resultType="Long">
      SELECT IFNULL(COUNT(d.`utlj_id`),0) FROM yeshi_ec_user_taolijin_record d
    WHERE d.`utlj_uid` = #{uid}
  </select>
  
  
 <select id="countShareRecordByUid" resultType="Long">
      SELECT IFNULL(COUNT(d.`utlj_id`),0) FROM yeshi_ec_user_taolijin_record d
    WHERE d.`utlj_uid` = #{uid} AND d.utlj_use_type = 2
  </select>
 
 
  <select id="countTodayNum" resultType="Long">
      SELECT IFNULL(count(d.utlj_id),0) FROM `yeshi_ec_user_taolijin_record` d
    WHERE d.`utlj_uid` = #{uid} AND TO_DAYS(d.`utlj_create_time`) = TO_DAYS(NOW())
            AND d.utlj_use_type = 2
  </select>
  
  <select id="getShareHongBaoByUidAndGoodsId" resultType="java.math.BigDecimal">
      SELECT utlj_per_face FROM `yeshi_ec_user_taolijin_record` d
    WHERE d.`utlj_uid` =#{uid}  AND d.`utlj_goods_id`=#{goodsId}
    LIMIT 1
  </select>
  
  <select id="getByRightsId" resultMap="BaseResultMap">
      SELECT * FROM `yeshi_ec_user_taolijin_record` d
    WHERE d.`utlj_rights_id` =#{rightsId}  
    LIMIT 1
  </select>
  
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_taolijin_record where utlj_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_record (utlj_id,utlj_uid,utlj_goods_id,utlj_total_num,utlj_name,utlj_per_face,utlj_send_start_time,utlj_send_end_time,utlj_use_start_time,utlj_use_end_time,utlj_rights_id,utlj_send_url,utlj_create_time,utlj_use_type) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{goodsId,jdbcType=BIGINT},#{totalNum,jdbcType=INTEGER},#{name,jdbcType=VARCHAR},#{perFace,jdbcType=DECIMAL},#{sendStartTime,jdbcType=TIMESTAMP},#{sendEndTime,jdbcType=TIMESTAMP},#{useStartTime,jdbcType=TIMESTAMP},#{useEndTime,jdbcType=TIMESTAMP},#{rightsId,jdbcType=VARCHAR},#{sendUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{useType,jdbcType=INTEGER})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">utlj_id,</if>
      <if test="uid != null">utlj_uid,</if>
      <if test="goodsId != null">utlj_goods_id,</if>
      <if test="totalNum != null">utlj_total_num,</if>
      <if test="name != null">utlj_name,</if>
      <if test="perFace != null">utlj_per_face,</if>
      <if test="sendStartTime != null">utlj_send_start_time,</if>
      <if test="sendEndTime != null">utlj_send_end_time,</if>
      <if test="useStartTime != null">utlj_use_start_time,</if>
      <if test="useEndTime != null">utlj_use_end_time,</if>
      <if test="rightsId != null">utlj_rights_id,</if>
      <if test="sendUrl != null">utlj_send_url,</if>
      <if test="createTime != null">utlj_create_time,</if>
      <if test="useType != null">utlj_use_type,</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="goodsId != null">#{goodsId,jdbcType=BIGINT},</if>
      <if test="totalNum != null">#{totalNum,jdbcType=INTEGER},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="perFace != null">#{perFace,jdbcType=DECIMAL},</if>
      <if test="sendStartTime != null">#{sendStartTime,jdbcType=TIMESTAMP},</if>
      <if test="sendEndTime != null">#{sendEndTime,jdbcType=TIMESTAMP},</if>
      <if test="useStartTime != null">#{useStartTime,jdbcType=TIMESTAMP},</if>
      <if test="useEndTime != null">#{useEndTime,jdbcType=TIMESTAMP},</if>
      <if test="rightsId != null">#{rightsId,jdbcType=VARCHAR},</if>
      <if test="sendUrl != null">#{sendUrl,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="useType != null">#{useType,jdbcType=INTEGER},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord">update yeshi_ec_user_taolijin_record set utlj_uid = #{uid,jdbcType=BIGINT},utlj_goods_id = #{goodsId,jdbcType=BIGINT},utlj_total_num = #{totalNum,jdbcType=INTEGER},utlj_name = #{name,jdbcType=VARCHAR},utlj_per_face = #{perFace,jdbcType=DECIMAL},utlj_send_start_time = #{sendStartTime,jdbcType=TIMESTAMP},utlj_send_end_time = #{sendEndTime,jdbcType=TIMESTAMP},utlj_use_start_time = #{useStartTime,jdbcType=TIMESTAMP},utlj_use_end_time = #{useEndTime,jdbcType=TIMESTAMP},utlj_rights_id = #{rightsId,jdbcType=VARCHAR},utlj_send_url = #{sendUrl,jdbcType=VARCHAR},utlj_create_time = #{createTime,jdbcType=TIMESTAMP},utlj_use_type = #{useType,jdbcType=INTEGER} where utlj_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord">update yeshi_ec_user_taolijin_record
    <set>
      <if test="uid != null">utlj_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="goodsId != null">utlj_goods_id=#{goodsId,jdbcType=BIGINT},</if>
      <if test="totalNum != null">utlj_total_num=#{totalNum,jdbcType=INTEGER},</if>
      <if test="name != null">utlj_name=#{name,jdbcType=VARCHAR},</if>
      <if test="perFace != null">utlj_per_face=#{perFace,jdbcType=DECIMAL},</if>
      <if test="sendStartTime != null">utlj_send_start_time=#{sendStartTime,jdbcType=TIMESTAMP},</if>
      <if test="sendEndTime != null">utlj_send_end_time=#{sendEndTime,jdbcType=TIMESTAMP},</if>
      <if test="useStartTime != null">utlj_use_start_time=#{useStartTime,jdbcType=TIMESTAMP},</if>
      <if test="useEndTime != null">utlj_use_end_time=#{useEndTime,jdbcType=TIMESTAMP},</if>
      <if test="rightsId != null">utlj_rights_id=#{rightsId,jdbcType=VARCHAR},</if>
      <if test="sendUrl != null">utlj_send_url=#{sendUrl,jdbcType=VARCHAR},</if>
      <if test="createTime != null">utlj_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="useType != null">utlj_use_type=#{useType,jdbcType=INTEGER},</if>
    </set> where utlj_id = #{id,jdbcType=BIGINT}
  </update>
</mapper>