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
<?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.UserInfoRegisterMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoRegister">
    <id column="regt_id" property="id" jdbcType="BIGINT"/>
    <result column="regt_channel" property="channel" jdbcType="VARCHAR"/>
    <result column="regt_ip" property="ip" jdbcType="VARCHAR"/>
    <result column="regt_device" property="device" jdbcType="VARCHAR"/>
    <result column="regt_create_time" property="createTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">regt_id,regt_channel,regt_ip,regt_device,regt_create_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_info_register where regt_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_info_register where regt_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoRegister" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_register (regt_id,regt_channel,regt_ip,regt_device,regt_create_time) values (#{id,jdbcType=BIGINT},#{channel,jdbcType=VARCHAR},#{ip,jdbcType=VARCHAR},#{device,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoRegister" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_register
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">regt_id,</if>
      <if test="channel != null">regt_channel,</if>
      <if test="ip != null">regt_ip,</if>
      <if test="device != null">regt_device,</if>
      <if test="createTime != null">regt_create_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="channel != null">#{channel,jdbcType=VARCHAR},</if>
      <if test="ip != null">#{ip,jdbcType=VARCHAR},</if>
      <if test="device != null">#{device,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoRegister">update yeshi_ec_user_info_register set regt_channel = #{channel,jdbcType=VARCHAR},regt_ip = #{ip,jdbcType=VARCHAR},regt_device = #{device,jdbcType=VARCHAR},regt_create_time = #{createTime,jdbcType=TIMESTAMP} where regt_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoRegister">update yeshi_ec_user_info_register
    <set>
      <if test="channel != null">regt_channel=#{channel,jdbcType=VARCHAR},</if>
      <if test="ip != null">regt_ip=#{ip,jdbcType=VARCHAR},</if>
      <if test="device != null">regt_device=#{device,jdbcType=VARCHAR},</if>
      <if test="createTime != null">regt_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
    </set> where regt_id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="listByMultipleUids" resultMap="BaseResultMap">
      SELECT * FROM  yeshi_ec_user_info_register d
    WHERE d.`regt_id` IN 
        <foreach collection="list" item="id" open="(" separator="," close=")" >
             #{id} 
        </foreach>
  </select>
  
  <select id="listByMultipleUidAndDay" resultMap="BaseResultMap">
      SELECT * FROM  yeshi_ec_user_info_register d
    WHERE TO_DAYS(regt_create_time) = #{preDay} AND  d.`regt_id` IN 
        <foreach collection="list" item="id" open="(" separator="," close=")" >
             #{id} 
        </foreach>
  </select>
  
  
  <select id="listUidByChannel" resultType="Long">
      SELECT regt_id FROM yeshi_ec_user_info_register
    WHERE regt_channel = #{channel}
  </select>
  
  <select id="listUidByChannelAndDay" resultType="Long">
      SELECT regt_id FROM yeshi_ec_user_info_register
    WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = TO_DAYS(#{preDay})
  </select>
  
  <select id="listByChannelAndDay"  resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_user_info_register
    WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = TO_DAYS(#{preDay})
  </select>
  
  
   <select id="countByChannelAndDay"  resultType="Long">
      SELECT COUNT(regt_id) FROM yeshi_ec_user_info_register
    WHERE regt_channel = #{channel} AND TO_DAYS(regt_create_time) = TO_DAYS(#{preDay})
  </select>
  
  
  <select id="listByDay"  resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_user_info_register
    WHERE TO_DAYS(regt_create_time) = TO_DAYS(#{preDay})
  </select>
  
</mapper>