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
<?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.push.PushGoodsRecordMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.PushGoodsRecord">
    <id column="rod_id" property="id" jdbcType="BIGINT"/>
    <result column="rod_createtime" property="createTime" jdbcType="TIMESTAMP"/>
    
    <association property="deviceActive" column="rod_device_id" 
        javaType="com.yeshi.fanli.entity.push.DeviceActive">
        <id column="rod_device_id" property="id" jdbcType="BIGINT" />
    </association>    
        
    <association property="pushGoods" column="rod_push_id" 
        javaType="com.yeshi.fanli.entity.push.PushGoods">
        <id column="rod_device_id" property="id" jdbcType="BIGINT" />
    </association>    
        
  </resultMap>
  
  <resultMap id="AllResultMap" type="com.yeshi.fanli.entity.push.PushGoodsRecord">
    <id column="rod_id" property="id" jdbcType="BIGINT"/>
    <result column="rod_createtime" property="createTime" jdbcType="TIMESTAMP"/>
    
    <association property="deviceActive" column="rod_device_id"
        resultMap="com.yeshi.fanli.dao.mybatis.push.DeviceActiveMapper.BaseResultMap"/>
        
    <association property="pushGoods" column="rod_push_id"
        resultMap="com.yeshi.fanli.dao.mybatis.push.PushGoodsMapper.BaseResultMap"/>
  </resultMap>
  
  
  
  <sql id="Base_Column_List">rod_id,rod_push_id,rod_device_id,rod_createtime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_push_goods_record where rod_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_goods_record where rod_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushGoodsRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods_record (rod_id,rod_push_id,rod_device_id,rod_createtime) values (#{id,jdbcType=BIGINT},#{pushGoods.id,jdbcType=VARCHAR},#{deviceActive.id,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushGoodsRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">rod_id,</if>
      <if test="pushGoods != null">rod_push_id,</if>
      <if test="deviceActive != null">rod_device_id,</if>
      <if test="createTime != null">rod_createtime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="pushGoods != null">#{pushGoods.id,jdbcType=VARCHAR},</if>
      <if test="deviceActive != null">#{deviceActive.id,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.PushGoodsRecord">update yeshi_ec_push_goods_record set rod_push_id = #{pushGoods.id,jdbcType=VARCHAR},rod_device_id = #{deviceActive.id,jdbcType=VARCHAR},rod_createtime = #{createTime,jdbcType=TIMESTAMP} where rod_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushGoodsRecord">update yeshi_ec_push_goods_record
    <set>
      <if test="pushGoods != null">rod_push_id=#{pushGoods.id,jdbcType=VARCHAR},</if>
      <if test="deviceActive != null">rod_device_id=#{deviceActive.id,jdbcType=VARCHAR},</if>
      <if test="createTime != null">rod_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
    </set> where rod_id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="listByPushIdAndDeviceId" resultMap="BaseResultMap">
         select <include refid="Base_Column_List"/> from yeshi_ec_push_goods_record 
         where rod_push_id = #{pushId} and rod_device_id = #{deviceId}
  </select>
  
</mapper>