admin
2021-06-24 df4441322e9801c102299451da41d7c40b4502e9
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
<?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.ks.lucky.mapper.LuckyActivityAwardsMapper">
    <resultMap id="BaseResultMap" type="com.ks.lucky.pojo.DO.LuckyActivityAwards">
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="activity_id" jdbcType="BIGINT" property="activityId"/>
        <result column="level" jdbcType="INTEGER" property="level"/>
        <result column="count" jdbcType="INTEGER" property="count"/>
        <result column="award_name" property="awardName" jdbcType="VARCHAR"/>
        <result column="award_poster" property="awardPoster" jdbcType="VARCHAR"/>
        <result column="award_way" jdbcType="INTEGER" property="awardWay"/>
        <result column="award_params" jdbcType="VARCHAR" property="awardParams"/>
        <result column="material_id" jdbcType="VARCHAR" property="materialId"/>
        <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="real_drawn_percent" property="realDrawnPercent" jdbcType="DECIMAL"/>
    </resultMap>
    <sql id="Base_Column_List">id, activity_id, level, count, award_way, award_params, material_id, remarks, create_time, update_time,award_name,award_poster,real_drawn_percent</sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">select
        <include refid="Base_Column_List"/>
        from lucky_activity_awards where id = #{id,jdbcType=BIGINT}
    </select>
    <!-- 非模板-->
    <sql id="listWhere">
        <if test="query.activityId!=null">and activity_id=#{query.activityId}</if>
        <if test="query.level!=null">and `level`=#{query.level}</if>
        <if test="query.minCreateTime!=null">and create_time&gt;=#{query.minCreateTime}</if>
        <if test="query.maxCreateTime!=null">and #{query.maxCreateTime}&gt;create_time</if>
    </sql>
    <select id="list" resultMap="BaseResultMap">select
        <include refid="Base_Column_List"/>
        from lucky_activity_awards where 1=1
        <include refid="listWhere"/>
        <if test="query.sortList!=null">
            <foreach collection="query.sortList" item="item" separator="," open=" order by ">${item}</foreach>
        </if>
        limit #{query.start},#{query.count}
    </select>
    <select id="count" resultType="java.lang.Long">select count(*) from lucky_activity_awards where 1=1
        <include refid="listWhere"/>
    </select>
    <delete id="deleteByPrimaryKey"
            parameterType="java.lang.Long">delete from lucky_activity_awards where id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" useGeneratedKeys="true" keyProperty="id"
            parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">insert into lucky_activity_awards (id, activity_id, level, count, award_way, award_params, material_id, remarks, create_time, update_time,id,award_name,award_poster,real_drawn_percent) values (#{id,jdbcType=BIGINT}, #{activityId,jdbcType=BIGINT}, #{level,jdbcType=INTEGER}, #{count,jdbcType=INTEGER}, #{awardWay,jdbcType=INTEGER}, #{awardParams,jdbcType=VARCHAR}, #{materialId,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{awardName,jdbcType=VARCHAR},#{awardPoster,jdbcType=VARCHAR},#{realDrawnPercent,jdbcType=DECIMAL})</insert>
    <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id"
            parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">insert into lucky_activity_awards
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="activityId != null">activity_id,</if>
            <if test="level != null">level,</if>
            <if test="count != null">count,</if>
            <if test="awardWay != null">award_way,</if>
            <if test="awardParams != null">award_params,</if>
            <if test="materialId != null">material_id,</if>
            <if test="remarks != null">remarks,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="awardName != null">award_name,</if>
            <if test="awardPoster != null">award_poster,</if>
            <if test="realDrawnPercent != null">real_drawn_percent,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="activityId != null">#{activityId,jdbcType=BIGINT},</if>
            <if test="level != null">#{level,jdbcType=INTEGER},</if>
            <if test="count != null">#{count,jdbcType=INTEGER},</if>
            <if test="awardWay != null">#{awardWay,jdbcType=INTEGER},</if>
            <if test="awardParams != null">#{awardParams,jdbcType=VARCHAR},</if>
            <if test="materialId != null">#{materialId,jdbcType=VARCHAR},</if>
            <if test="remarks != null">#{remarks,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="awardName != null">#{awardName,jdbcType=VARCHAR},</if>
            <if test="awardPoster != null">#{awardPoster,jdbcType=VARCHAR},</if>
            <if test="realDrawnPercent != null">#{realDrawnPercent,jdbcType=DECIMAL}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">update
        lucky_activity_awards
        <set>
            <if test="activityId != null">activity_id = #{activityId,jdbcType=BIGINT},</if>
            <if test="level != null">level = #{level,jdbcType=INTEGER},</if>
            <if test="count != null">count = #{count,jdbcType=INTEGER},</if>
            <if test="awardWay != null">award_way = #{awardWay,jdbcType=INTEGER},</if>
            <if test="awardParams != null">award_params = #{awardParams,jdbcType=VARCHAR},</if>
            <if test="materialId != null">material_id = #{materialId,jdbcType=VARCHAR},</if>
            <if test="remarks != null">remarks = #{remarks,jdbcType=VARCHAR},</if>
            <if test="createTime != null">create_time = #{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="awardName !=null">award_name =#{awardName,jdbcType=VARCHAR},</if>
            <if test="awardPoster !=null">award_poster =#{awardPoster,jdbcType=VARCHAR},</if>
            <if test="realDrawnPercent !=null">real_drawn_percent =#{realDrawnPercent,jdbcType=DECIMAL},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey"
            parameterType="com.ks.lucky.pojo.DO.LuckyActivityAwards">update lucky_activity_awards set activity_id = #{activityId,jdbcType=BIGINT}, level = #{level,jdbcType=INTEGER}, count = #{count,jdbcType=INTEGER}, award_way = #{awardWay,jdbcType=INTEGER}, award_params = #{awardParams,jdbcType=VARCHAR}, material_id = #{materialId,jdbcType=VARCHAR}, remarks = #{remarks,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} ,award_name =#{awardName,jdbcType=VARCHAR} ,award_poster =#{awardPoster,jdbcType=VARCHAR} ,real_drawn_percent =#{realDrawnPercent,jdbcType=DECIMAL} where id = #{id,jdbcType=BIGINT}</update>
</mapper>