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
<?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.integral.IntegralExchangeRecordMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.integral.IntegralExchangeRecord">
    <id column="er_id" property="id" jdbcType="BIGINT"/>
    <result column="er_uid" property="uid" jdbcType="BIGINT"/>
    <result column="er_exchange_id" property="exchangeId" jdbcType="BIGINT"/>
    <result column="er_create_time" property="createTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">er_id,er_uid,er_exchange_id,er_create_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_integral_exchange_record where er_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_integral_exchange_record where er_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.IntegralExchangeRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_integral_exchange_record (er_id,er_uid,er_exchange_id,er_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{exchangeId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.integral.IntegralExchangeRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_integral_exchange_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">er_id,</if>
      <if test="uid != null">er_uid,</if>
      <if test="exchangeId != null">er_exchange_id,</if>
      <if test="createTime != null">er_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="exchangeId != null">#{exchangeId,jdbcType=BIGINT},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.IntegralExchangeRecord">update yeshi_ec_integral_exchange_record set er_uid = #{uid,jdbcType=BIGINT},er_exchange_id = #{exchangeId,jdbcType=BIGINT},er_create_time = #{createTime,jdbcType=TIMESTAMP} where er_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.integral.IntegralExchangeRecord">update yeshi_ec_integral_exchange_record
    <set>
      <if test="uid != null">er_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="exchangeId != null">er_exchange_id=#{exchangeId,jdbcType=BIGINT},</if>
      <if test="createTime != null">er_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
    </set> where er_id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="countRecordByUid" resultType="Long">
      SELECT IFNULL(COUNT(er_id),0) FROM yeshi_ec_integral_exchange_record
    WHERE er_uid = #{uid} AND er_exchange_id = #{exchangeId} 
        <if test="today = 1">AND TO_DAYS(er_create_time) = TO_DAYS(NOW())</if>
  </select>
</mapper>