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
<?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.user.UserInviteValidRecordMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord">
    <id column="tvr_id" property="id" jdbcType="BIGINT"/>
    <result column="tvr_uid" property="uid" jdbcType="BIGINT"/>
    <result column="tvr_worker_id" property="workerId" jdbcType="BIGINT"/>
    <result column="tvr_type" property="type" jdbcType="INTEGER"/>
    <result column="tvr_unique_key" property="uniqueKey" jdbcType="VARCHAR"/>
    <result column="tvr_create_time" property="createTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">tvr_id,tvr_uid,tvr_worker_id,tvr_type,tvr_unique_key,tvr_create_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_invite_valid_record where tvr_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_invite_valid_record where tvr_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_invite_valid_record (tvr_id,tvr_uid,tvr_worker_id,tvr_type,tvr_unique_key,tvr_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{workerId,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{uniqueKey,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_invite_valid_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">tvr_id,</if>
      <if test="uid != null">tvr_uid,</if>
      <if test="workerId != null">tvr_worker_id,</if>
      <if test="type != null">tvr_type,</if>
      <if test="uniqueKey != null">tvr_unique_key,</if>
      <if test="createTime != null">tvr_create_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="workerId != null">#{workerId,jdbcType=BIGINT},</if>
      <if test="type != null">#{type,jdbcType=INTEGER},</if>
      <if test="uniqueKey != null">#{uniqueKey,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord">update yeshi_ec_user_invite_valid_record set tvr_uid = #{uid,jdbcType=BIGINT},tvr_worker_id = #{workerId,jdbcType=BIGINT},tvr_type = #{type,jdbcType=INTEGER},tvr_unique_key = #{uniqueKey,jdbcType=VARCHAR},tvr_create_time = #{createTime,jdbcType=TIMESTAMP} where tvr_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInviteValidRecord">update yeshi_ec_user_invite_valid_record
    <set>
      <if test="uid != null">tvr_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="workerId != null">tvr_worker_id=#{workerId,jdbcType=BIGINT},</if>
      <if test="type != null">tvr_type=#{type,jdbcType=INTEGER},</if>
      <if test="uniqueKey != null">tvr_unique_key=#{uniqueKey,jdbcType=VARCHAR},</if>
      <if test="createTime != null">tvr_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
    </set> where tvr_id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="selectByUniqueKey" resultMap="BaseResultMap">
      select * from yeshi_ec_user_invite_valid_record 
      where tvr_unique_key = #{uniqueKey,jdbcType=VARCHAR}
      limit 1
  </select>
  
  <select id="getValidWorkerIdsByUid" resultType="Long">
      select DISTINCT tvr_worker_id from yeshi_ec_user_invite_valid_record 
      where tvr_uid = #{uid} and tvr_type = #{type}
          and tvr_worker_id in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach>
  </select>
  
  <select id="listByTypeAndUid" resultMap="BaseResultMap">
    SELECT * FROM `yeshi_ec_user_invite_valid_record` d
    WHERE d.`tvr_uid` = #{uid} AND d.`tvr_type` = #{type}
    Limit #{start},#{count}
  </select>
  
  <select id="getByUidAndWorkerId" resultMap="BaseResultMap">
    SELECT * FROM `yeshi_ec_user_invite_valid_record` d
    WHERE d.`tvr_uid` = #{uid} AND d.tvr_worker_id = #{workerId}  AND d.`tvr_type` = #{type}
    Limit 1
  </select>
  
  
  
</mapper>