admin
2020-05-19 744594ef1a2f530fc3e86ea9dc48b62247f79420
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.yeshi.fanli.dao.mybatis.integral.IntegralExchangeMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.integral.IntegralExchange">
    <id column="ex_id" property="id" jdbcType="BIGINT"/>
    <result column="ex_name" property="name" jdbcType="VARCHAR"/>
    <result column="ex_picture" property="picture" jdbcType="VARCHAR"/>
    <result column="ex_gold_coin" property="goldCoin" jdbcType="INTEGER"/>
    <result column="ex_tip" property="tip" jdbcType="VARCHAR"/>
    <result column="ex_btn_name" property="btnName" jdbcType="VARCHAR"/>
    <result column="ex_amount" property="amount" jdbcType="DECIMAL"/>
    <result column="ex_upper_limit" property="upperLimit" jdbcType="INTEGER"/>
    <result column="ex_rule_link" property="ruleLink" jdbcType="VARCHAR"/>
    <result column="ex_orderby" property="orderby" jdbcType="INTEGER"/>
    <result column="ex_progress" property="progress" jdbcType="VARCHAR"/>
    <result column="ex_state" property="state" jdbcType="INTEGER"/>
    <result column="ex_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="ex_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="ex_type" property="type" typeHandler="com.yeshi.fanli.util.mybatishandler.integral.ExchangeTypeEnumHandler"/>
  </resultMap>
  <sql id="Base_Column_List">ex_id,ex_name,ex_picture,ex_gold_coin,ex_tip,ex_btn_name,ex_amount,ex_upper_limit,ex_rule_link,ex_orderby,ex_type,ex_progress,ex_state,ex_create_time,ex_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_integral_exchange where ex_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_integral_exchange where ex_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.IntegralExchange" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_integral_exchange (ex_id,ex_name,ex_picture,ex_gold_coin,ex_tip,ex_btn_name,ex_amount,ex_upper_limit,ex_rule_link,ex_orderby,ex_type,ex_progress,ex_state,ex_create_time,ex_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{tip,jdbcType=VARCHAR},#{btnName,jdbcType=VARCHAR},#{amount,jdbcType=DECIMAL},#{upperLimit,jdbcType=INTEGER},#{ruleLink,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{type,jdbcType=VARCHAR},#{progress,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.integral.IntegralExchange" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_integral_exchange
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">ex_id,</if>
      <if test="name != null">ex_name,</if>
      <if test="picture != null">ex_picture,</if>
      <if test="goldCoin != null">ex_gold_coin,</if>
      <if test="tip != null">ex_tip,</if>
      <if test="btnName != null">ex_btn_name,</if>
      <if test="amount != null">ex_amount,</if>
      <if test="upperLimit != null">ex_upper_limit,</if>
      <if test="ruleLink != null">ex_rule_link,</if>
      <if test="orderby != null">ex_orderby,</if>
      <if test="type != null">ex_type,</if>
      <if test="progress != null">ex_progress,</if>
      <if test="state != null">ex_state,</if>
      <if test="createTime != null">ex_create_time,</if>
      <if test="updateTime != null">ex_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
      <if test="goldCoin != null">#{goldCoin,jdbcType=INTEGER},</if>
      <if test="tip != null">#{tip,jdbcType=VARCHAR},</if>
      <if test="btnName != null">#{btnName,jdbcType=VARCHAR},</if>
      <if test="amount != null">#{amount,jdbcType=DECIMAL},</if>
      <if test="upperLimit != null">#{upperLimit,jdbcType=INTEGER},</if>
      <if test="ruleLink != null">#{ruleLink,jdbcType=VARCHAR},</if>
      <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if>
      <if test="type != null">#{type,jdbcType=VARCHAR},</if>
      <if test="progress != null">#{progress,jdbcType=VARCHAR},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.IntegralExchange">update yeshi_ec_integral_exchange set ex_name = #{name,jdbcType=VARCHAR},ex_picture = #{picture,jdbcType=VARCHAR},ex_gold_coin = #{goldCoin,jdbcType=INTEGER},ex_tip = #{tip,jdbcType=VARCHAR},ex_btn_name = #{btnName,jdbcType=VARCHAR},ex_amount = #{amount,jdbcType=DECIMAL},ex_upper_limit = #{upperLimit,jdbcType=INTEGER},ex_rule_link = #{ruleLink,jdbcType=VARCHAR},ex_orderby = #{orderby,jdbcType=INTEGER},ex_type = #{type,jdbcType=VARCHAR},ex_progress = #{progress,jdbcType=VARCHAR},ex_state = #{state,jdbcType=INTEGER},ex_create_time = #{createTime,jdbcType=TIMESTAMP},ex_update_time = #{updateTime,jdbcType=TIMESTAMP} where ex_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.integral.IntegralExchange">update yeshi_ec_integral_exchange
    <set>
      <if test="name != null">ex_name=#{name,jdbcType=VARCHAR},</if>
      <if test="picture != null">ex_picture=#{picture,jdbcType=VARCHAR},</if>
      <if test="goldCoin != null">ex_gold_coin=#{goldCoin,jdbcType=INTEGER},</if>
      <if test="tip != null">ex_tip=#{tip,jdbcType=VARCHAR},</if>
      <if test="btnName != null">ex_btn_name=#{btnName,jdbcType=VARCHAR},</if>
      <if test="amount != null">ex_amount=#{amount,jdbcType=DECIMAL},</if>
      <if test="upperLimit != null">ex_upper_limit=#{upperLimit,jdbcType=INTEGER},</if>
      <if test="ruleLink != null">ex_rule_link=#{ruleLink,jdbcType=VARCHAR},</if>
      <if test="orderby != null">ex_orderby=#{orderby,jdbcType=INTEGER},</if>
      <if test="type != null">ex_type=#{type,jdbcType=VARCHAR},</if>
      <if test="progress != null">ex_progress=#{progress,jdbcType=VARCHAR},</if>
      <if test="state != null">ex_state=#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">ex_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">ex_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where ex_id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="listValid" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_integral_exchange
    WHERE ex_state = 1
    ORDER BY ex_orderby
    LIMIT #{start},#{count}
  </select>
  
  <select id="countValid" resultType="Long">
      SELECT IFNULL(COUNT(ex_id),0) FROM yeshi_ec_integral_exchange
    WHERE ex_state = 1
  </select>
  
  <select id="getValidByType" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_integral_exchange
    WHERE ex_state = 1 AND ex_type = #{type}
    LIMIT 1
  </select>
</mapper>