admin
2018-12-25 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c
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
<?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.SpecialCardMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.SpecialCard">
    <id column="cd_id" property="id" jdbcType="BIGINT"/>
    <result column="cd_name" property="name" jdbcType="VARCHAR"/>
    <result column="cd_card" property="card" jdbcType="VARCHAR"/>
    <result column="cd_state" property="state" jdbcType="INTEGER"/>
    <result column="cd_createtime" property="createtime" jdbcType="TIMESTAMP"/>
    <result column="cd_updatetime" property="updatetime" jdbcType="TIMESTAMP"/>
  </resultMap>
  
  <sql id="Base_Column_List">cd_id,cd_name,cd_card,cd_state,cd_createtime,cd_updatetime</sql>
 
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_special_card where cd_id = #{id,jdbcType=BIGINT}
  </select>
  
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_special_card where cd_id = #{id,jdbcType=BIGINT}</delete>
  
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.SpecialCard" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_special_card (cd_id,cd_name,cd_card,cd_state,cd_createtime,cd_updatetime) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{card,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
 
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.SpecialCard" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_special_card
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">cd_id,</if>
      <if test="name != null">cd_name,</if>
      <if test="card != null">cd_card,</if>
      <if test="state != null">cd_state,</if>
      <if test="createtime != null">cd_createtime,</if>
      <if test="updatetime != null">cd_updatetime,</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="card != null">#{card,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.bus.homemodule.SpecialCard">update yeshi_ec_special_card set cd_name = #{name,jdbcType=VARCHAR},cd_card = #{card,jdbcType=VARCHAR},cd_state = #{state,jdbcType=INTEGER},cd_createtime = #{createtime,jdbcType=TIMESTAMP},cd_updatetime = #{updatetime,jdbcType=TIMESTAMP} where cd_id = #{id,jdbcType=BIGINT}</update>
 
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.SpecialCard">update yeshi_ec_special_card
    <set>
      <if test="name != null">cd_name=#{name,jdbcType=VARCHAR},</if>
      <if test="card != null">cd_card=#{card,jdbcType=VARCHAR},</if>
      <if test="state != null">cd_state=#{state,jdbcType=INTEGER},</if>
      <if test="createtime != null">cd_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="updatetime != null">cd_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
    </set> where cd_id = #{id,jdbcType=BIGINT}
  </update>
  
   <select id="listQuery" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_special_card
        WHERE 1=1
           <if test='key != null and key != ""'>
                  AND (cd_name like '%${key}%' OR cd_card like '%${key}%') 
           </if>
           ORDER BY cd_createtime <if test='sort == 1'>DESC</if>
        LIMIT ${start},${count}
   </select>
   
   <select id="countlistQuery" resultType="java.lang.Long">
        SELECT IFNULL(count(cd_id),0)  FROM yeshi_ec_special_card 
        WHERE 1=1
           <if test='key != null and key != ""'>
                  AND (cd_name like '%${key}%' OR cd_card like '%${key}%') 
           </if>
    </select>
    
    <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
        delete from yeshi_ec_special_card WHERE cd_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
    </delete>
    
</mapper>