<?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>
|