<?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.gk.firework.Mapper.RoleInfoMapper" >
|
<resultMap id="BaseResultMap" type="com.gk.firework.Domain.RoleInfo" >
|
<!-- -->
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="name" property="name" jdbcType="VARCHAR" />
|
<result column="createdby" property="createdby" jdbcType="VARCHAR" />
|
<result column="createddate" property="createddate" jdbcType="TIMESTAMP" />
|
<result column="lastmodifiedby" property="lastmodifiedby" jdbcType="VARCHAR" />
|
<result column="lastmodifieddate" property="lastmodifieddate" jdbcType="TIMESTAMP" />
|
<result column="description" property="description" jdbcType="VARCHAR" />
|
<result column="code" property="code" jdbcType="VARCHAR" />
|
<result column="btnaccess" property="btnaccess" jdbcType="VARCHAR" />
|
<result column="isdel" property="isdel" jdbcType="TINYINT" />
|
</resultMap>
|
<sql id="Base_Column_List" >
|
<!-- -->
|
id, name, createdby, createddate, lastmodifiedby, lastmodifieddate, description,
|
code, btnaccess,isdel
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
|
<!-- -->
|
select
|
<include refid="Base_Column_List" />
|
from role
|
where id = #{id,jdbcType=BIGINT}
|
</select>
|
<select id="selectRoleByUser" resultType="com.gk.firework.Domain.RoleInfo">
|
SELECT
|
role.id,
|
role.`name`
|
from role
|
LEFT JOIN userroles on userroles.roleid = role.id
|
where
|
userroles.userid = #{id,jdbcType=BIGINT}
|
</select>
|
<select id="selectList" resultType="com.gk.firework.Domain.RoleInfo">
|
select
|
<include refid="Base_Column_List" />
|
from role
|
<where>
|
1=1
|
and isdel = 0
|
<if test="name != null and name !=''">
|
and name = #{name}
|
</if>
|
</where>
|
</select>
|
<select id="selectExistRole" resultType="com.gk.firework.Domain.RoleInfo">
|
select
|
<include refid="Base_Column_List" />
|
from role
|
<where>
|
1=1
|
<if test="name != null and name !=''">
|
and name = #{name}
|
</if>
|
<if test="id != null">
|
and id != #{id}
|
</if>
|
</where>
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
|
<!-- -->
|
delete from role
|
where id = #{id,jdbcType=BIGINT}
|
</delete>
|
<update id="updateByPrimaryKeySelective" parameterType="com.gk.firework.Domain.RoleInfo" >
|
<!-- -->
|
update role
|
<set >
|
<if test="name != null" >
|
name = #{name,jdbcType=VARCHAR},
|
</if>
|
<if test="createdby != null" >
|
createdby = #{createdby,jdbcType=VARCHAR},
|
</if>
|
<if test="createddate != null" >
|
createddate = #{createddate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="lastmodifiedby != null" >
|
lastmodifiedby = #{lastmodifiedby,jdbcType=VARCHAR},
|
</if>
|
<if test="lastmodifieddate != null" >
|
lastmodifieddate = #{lastmodifieddate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="description != null" >
|
description = #{description,jdbcType=VARCHAR},
|
</if>
|
<if test="code != null" >
|
code = #{code,jdbcType=VARCHAR},
|
</if>
|
<if test="btnaccess != null" >
|
btnaccess = #{btnaccess,jdbcType=VARCHAR},
|
</if>
|
<if test="isdel != null">
|
isdel = #{isdel,jdbcType=TINYINT},
|
</if>
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="com.gk.firework.Domain.RoleInfo" >
|
<!-- -->
|
update role
|
set name = #{name,jdbcType=VARCHAR},
|
createdby = #{createdby,jdbcType=VARCHAR},
|
createddate = #{createddate,jdbcType=TIMESTAMP},
|
lastmodifiedby = #{lastmodifiedby,jdbcType=VARCHAR},
|
lastmodifieddate = #{lastmodifieddate,jdbcType=TIMESTAMP},
|
description = #{description,jdbcType=VARCHAR},
|
code = #{code,jdbcType=VARCHAR},
|
btnaccess = #{btnaccess,jdbcType=VARCHAR},
|
isdel = #{isdel,jdbcType=TINYINT},
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
</mapper>
|