admin
2020-05-06 24a8d17e007545f7426c48352109aa1a9c6587ee
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
<?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.homemodule.AdActivityVersionControlMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl">
        <id column="vc_id" property="id" jdbcType="BIGINT" />
        <result column="vc_type" property="type"
            typeHandler="com.yeshi.fanli.util.mybatishandler.homemodule.AdActivityTypeEnumHandler" />
        <result column="vc_source_id" property="sourceId" jdbcType="BIGINT" />
        <result column="vc_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <association property="version" column="vc_version"
            javaType="com.yeshi.fanli.entity.AppVersionInfo">
            <id column="vc_version" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">vc_id,vc_type,vc_source_id,vc_version,vc_create_time</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_ad_activity_version_control where vc_id =
        #{id,jdbcType=BIGINT}
    </select>
 
 
    <select id="selectBySourceIdAndTypeAndVersion" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_ad_activity_version_control where vc_source_id =
        #{sourceId} and vc_type=#{type} and vc_version=#{versionId}
    </select>
 
    <select id="listByTypeAndSourceId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_ad_activity_version_control where vc_source_id =
        #{sourceId} and vc_type=#{type}
    </select>
 
 
    <select id="listByVersionAndSourceId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_ad_activity_version_control where vc_type=#{type}
        <foreach collection="sourceIdList" item="sourceId" open=" and ("
            close=")" separator=" or ">
            vc_source_id=#{sourceId}
        </foreach>
 
        <foreach collection="versionIdList" item="versionId" open=" and ("
            close=")" separator=" or ">
            vc_version=#{versionId}
        </foreach>
    </select>
 
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_ad_activity_version_control where vc_id =
        #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_ad_activity_version_control
        (vc_id,vc_type,vc_source_id,vc_version,vc_create_time) values
        (#{id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{sourceId,jdbcType=BIGINT},#{version.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective"
        parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_ad_activity_version_control
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">vc_id,</if>
            <if test="type != null">vc_type,</if>
            <if test="sourceId != null">vc_source_id,</if>
            <if test="version != null">vc_version,</if>
            <if test="createTime != null">vc_create_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="sourceId != null">#{sourceId,jdbcType=BIGINT},</if>
            <if test="version != null">#{version.id,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl">update yeshi_ec_ad_activity_version_control set
        vc_type
        =
        #{type,jdbcType=VARCHAR},vc_source_id =
        #{sourceId,jdbcType=BIGINT},vc_version =
        #{version.id,jdbcType=BIGINT},vc_create_time =
        #{createTime,jdbcType=TIMESTAMP} where vc_id =
        #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl">
        update yeshi_ec_ad_activity_version_control
        <set>
            <if test="type != null">vc_type=#{type,jdbcType=VARCHAR},</if>
            <if test="sourceId != null">vc_source_id=#{sourceId,jdbcType=BIGINT},</if>
            <if test="version != null">vc_version=#{version.id,jdbcType=BIGINT},</if>
            <if test="createTime != null">vc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
        </set>
        where vc_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>