admin
2021-05-29 40d0d99fb89665e6e7702ea62e45fabe2d01e51a
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
<?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.vip.mapper.VipGradeMapper">
  <resultMap id="BaseResultMap" type="com.ks.vip.pojo.DO.VipGrade">
    <id column="g_id" property="id" jdbcType="BIGINT"/>
    <result column="g_name" property="name" jdbcType="VARCHAR"/>
    <result column="g_icon" property="icon" jdbcType="VARCHAR"/>
    <result column="g_identity" property="identity"
            typeHandler="com.ks.vip.pojo.mybatishandler.VIPEnumHandler" />
    <result column="g_sort" property="sort" jdbcType="INTEGER"/>
    <result column="g_state" property="state" jdbcType="INTEGER"/>
    <result column="g_creator_id" property="creatorId" jdbcType="BIGINT"/>
    <result column="g_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="g_updator_id" property="updatorId" jdbcType="BIGINT"/>
    <result column="g_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">g_id,g_name,g_icon,g_identity,g_sort,g_state,g_creator_id,g_create_time,g_updator_id,g_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from vip_grade where g_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from vip_grade where g_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.ks.vip.pojo.DO.VipGrade" useGeneratedKeys="true" keyProperty="id">insert into vip_grade (g_id,g_name,g_icon,g_identity,g_sort,g_state,g_creator_id,g_create_time,g_updator_id,g_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{identity,jdbcType=VARCHAR},#{sort,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{creatorId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updatorId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.ks.vip.pojo.DO.VipGrade" useGeneratedKeys="true" keyProperty="id">insert into vip_grade
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">g_id,</if>
      <if test="name != null">g_name,</if>
      <if test="icon != null">g_icon,</if>
      <if test="identity != null">g_identity,</if>
      <if test="sort != null">g_sort,</if>
      <if test="state != null">g_state,</if>
      <if test="creatorId != null">g_creator_id,</if>
      <if test="createTime != null">g_create_time,</if>
      <if test="updatorId != null">g_updator_id,</if>
      <if test="updateTime != null">g_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="icon != null">#{icon,jdbcType=VARCHAR},</if>
      <if test="identity != null">#{identity,jdbcType=VARCHAR},</if>
      <if test="sort != null">#{sort,jdbcType=INTEGER},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="creatorId != null">#{creatorId,jdbcType=BIGINT},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updatorId != null">#{updatorId,jdbcType=BIGINT},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.ks.vip.pojo.DO.VipGrade">update vip_grade set g_name = #{name,jdbcType=VARCHAR},g_icon = #{icon,jdbcType=VARCHAR},g_identity = #{identity,jdbcType=VARCHAR},g_sort = #{sort,jdbcType=INTEGER},g_state = #{state,jdbcType=INTEGER},g_creator_id = #{creatorId,jdbcType=BIGINT},g_create_time = #{createTime,jdbcType=TIMESTAMP},g_updator_id = #{updatorId,jdbcType=BIGINT},g_update_time = #{updateTime,jdbcType=TIMESTAMP} where g_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.ks.vip.pojo.DO.VipGrade">update vip_grade
    <set>
      <if test="name != null">g_name=#{name,jdbcType=VARCHAR},</if>
      <if test="icon != null">g_icon=#{icon,jdbcType=VARCHAR},</if>
      <if test="identity != null">g_identity=#{identity,jdbcType=VARCHAR},</if>
      <if test="sort != null">g_sort=#{sort,jdbcType=INTEGER},</if>
      <if test="state != null">g_state=#{state,jdbcType=INTEGER},</if>
      <if test="creatorId != null">g_creator_id=#{creatorId,jdbcType=BIGINT},</if>
      <if test="createTime != null">g_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updatorId != null">g_updator_id=#{updatorId,jdbcType=BIGINT},</if>
      <if test="updateTime != null">g_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where g_id = #{id,jdbcType=BIGINT}
  </update>
 
 
  <!-- 非模板 -->
  <sql id="listWhere">
    <if test="query.id!=null">and g_id=#{query.id}</if>
    <if test="query.name!=null">and g_name=#{query.name}</if>
    <if test="query.identity!=null">and g_identity=#{query.identity}</if>
    <if test="query.state!=null">and g_state=#{query.state}</if>
  </sql>
 
 
  <select id="listByPage" resultMap="BaseResultMap">
    select <include refid="Base_Column_List"/>  from vip_grade
    where 1=1
    <include refid="listWhere"/>
    limit #{query.start},#{query.count}
  </select>
 
  <select id="count" resultType="java.lang.Long">
    select count(*) from vip_grade
    where 1=1
    <include refid="listWhere"/>
  </select>
 
 
  <select id="getByIdentity" resultMap="BaseResultMap">
    select <include refid="Base_Column_List"/>  from vip_grade
    where g_identity=#{identity}
  </select>
 
</mapper>