添加权限管理功能

This commit is contained in:
zhh
2018-09-30 18:00:01 +08:00
parent 207a72d116
commit 7faffe541a
39 changed files with 5405 additions and 61 deletions

View File

@@ -7,6 +7,11 @@
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="icon" jdbcType="VARCHAR" property="icon" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="nick_name" jdbcType="VARCHAR" property="nickName" />
<result column="note" jdbcType="VARCHAR" property="note" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="login_time" jdbcType="TIMESTAMP" property="loginTime" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@@ -67,7 +72,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, username, password, icon, email
id, username, password, icon, email, nick_name, note, create_time, login_time, status
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsAdminExample" resultMap="BaseResultMap">
select
@@ -104,9 +109,13 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_admin (username, password, icon,
email)
email, nick_name, note,
create_time, login_time, status
)
values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR})
#{email,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{loginTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsAdmin">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@@ -126,6 +135,21 @@
<if test="email != null">
email,
</if>
<if test="nickName != null">
nick_name,
</if>
<if test="note != null">
note,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="loginTime != null">
login_time,
</if>
<if test="status != null">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="username != null">
@@ -140,6 +164,21 @@
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="nickName != null">
#{nickName,jdbcType=VARCHAR},
</if>
<if test="note != null">
#{note,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="loginTime != null">
#{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsAdminExample" resultType="java.lang.Integer">
@@ -166,6 +205,21 @@
<if test="record.email != null">
email = #{record.email,jdbcType=VARCHAR},
</if>
<if test="record.nickName != null">
nick_name = #{record.nickName,jdbcType=VARCHAR},
</if>
<if test="record.note != null">
note = #{record.note,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.loginTime != null">
login_time = #{record.loginTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -177,7 +231,12 @@
username = #{record.username,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
icon = #{record.icon,jdbcType=VARCHAR},
email = #{record.email,jdbcType=VARCHAR}
email = #{record.email,jdbcType=VARCHAR},
nick_name = #{record.nickName,jdbcType=VARCHAR},
note = #{record.note,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
login_time = #{record.loginTime,jdbcType=TIMESTAMP},
status = #{record.status,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@@ -197,6 +256,21 @@
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="nickName != null">
nick_name = #{nickName,jdbcType=VARCHAR},
</if>
<if test="note != null">
note = #{note,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="loginTime != null">
login_time = #{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@@ -205,7 +279,12 @@
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
icon = #{icon,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR}
email = #{email,jdbcType=VARCHAR},
nick_name = #{nickName,jdbcType=VARCHAR},
note = #{note,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
login_time = #{loginTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,196 @@
<?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.macro.mall.mapper.UmsAdminPermissionRelationMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsAdminPermissionRelation">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="admin_id" jdbcType="BIGINT" property="adminId" />
<result column="permission_id" jdbcType="BIGINT" property="permissionId" />
<result column="type" jdbcType="INTEGER" property="type" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, admin_id, permission_id, type
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsAdminPermissionRelationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_admin_permission_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_admin_permission_relation
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_admin_permission_relation
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsAdminPermissionRelationExample">
delete from ums_admin_permission_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsAdminPermissionRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_admin_permission_relation (admin_id, permission_id, type
)
values (#{adminId,jdbcType=BIGINT}, #{permissionId,jdbcType=BIGINT}, #{type,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsAdminPermissionRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_admin_permission_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="adminId != null">
admin_id,
</if>
<if test="permissionId != null">
permission_id,
</if>
<if test="type != null">
type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="adminId != null">
#{adminId,jdbcType=BIGINT},
</if>
<if test="permissionId != null">
#{permissionId,jdbcType=BIGINT},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsAdminPermissionRelationExample" resultType="java.lang.Integer">
select count(*) from ums_admin_permission_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_admin_permission_relation
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.adminId != null">
admin_id = #{record.adminId,jdbcType=BIGINT},
</if>
<if test="record.permissionId != null">
permission_id = #{record.permissionId,jdbcType=BIGINT},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_admin_permission_relation
set id = #{record.id,jdbcType=BIGINT},
admin_id = #{record.adminId,jdbcType=BIGINT},
permission_id = #{record.permissionId,jdbcType=BIGINT},
type = #{record.type,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsAdminPermissionRelation">
update ums_admin_permission_relation
<set>
<if test="adminId != null">
admin_id = #{adminId,jdbcType=BIGINT},
</if>
<if test="permissionId != null">
permission_id = #{permissionId,jdbcType=BIGINT},
</if>
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsAdminPermissionRelation">
update ums_admin_permission_relation
set admin_id = #{adminId,jdbcType=BIGINT},
permission_id = #{permissionId,jdbcType=BIGINT},
type = #{type,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,179 @@
<?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.macro.mall.mapper.UmsAdminRoleRelationMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsAdminRoleRelation">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="admin_id" jdbcType="BIGINT" property="adminId" />
<result column="role_id" jdbcType="BIGINT" property="roleId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, admin_id, role_id
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsAdminRoleRelationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_admin_role_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_admin_role_relation
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_admin_role_relation
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsAdminRoleRelationExample">
delete from ums_admin_role_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsAdminRoleRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_admin_role_relation (admin_id, role_id)
values (#{adminId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsAdminRoleRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_admin_role_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="adminId != null">
admin_id,
</if>
<if test="roleId != null">
role_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="adminId != null">
#{adminId,jdbcType=BIGINT},
</if>
<if test="roleId != null">
#{roleId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsAdminRoleRelationExample" resultType="java.lang.Integer">
select count(*) from ums_admin_role_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_admin_role_relation
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.adminId != null">
admin_id = #{record.adminId,jdbcType=BIGINT},
</if>
<if test="record.roleId != null">
role_id = #{record.roleId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_admin_role_relation
set id = #{record.id,jdbcType=BIGINT},
admin_id = #{record.adminId,jdbcType=BIGINT},
role_id = #{record.roleId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsAdminRoleRelation">
update ums_admin_role_relation
<set>
<if test="adminId != null">
admin_id = #{adminId,jdbcType=BIGINT},
</if>
<if test="roleId != null">
role_id = #{roleId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsAdminRoleRelation">
update ums_admin_role_relation
set admin_id = #{adminId,jdbcType=BIGINT},
role_id = #{roleId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,288 @@
<?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.macro.mall.mapper.UmsPermissionMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsPermission">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pid" jdbcType="BIGINT" property="pid" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="value" jdbcType="VARCHAR" property="value" />
<result column="icon" jdbcType="VARCHAR" property="icon" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="uri" jdbcType="VARCHAR" property="uri" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="sort" jdbcType="INTEGER" property="sort" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, pid, name, value, icon, type, uri, status, create_time, sort
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsPermissionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_permission
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_permission
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_permission
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsPermissionExample">
delete from ums_permission
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsPermission">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_permission (pid, name, value,
icon, type, uri, status,
create_time, sort)
values (#{pid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR},
#{icon,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{uri,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{sort,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsPermission">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_permission
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pid != null">
pid,
</if>
<if test="name != null">
name,
</if>
<if test="value != null">
value,
</if>
<if test="icon != null">
icon,
</if>
<if test="type != null">
type,
</if>
<if test="uri != null">
uri,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="sort != null">
sort,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pid != null">
#{pid,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="value != null">
#{value,jdbcType=VARCHAR},
</if>
<if test="icon != null">
#{icon,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
<if test="uri != null">
#{uri,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsPermissionExample" resultType="java.lang.Integer">
select count(*) from ums_permission
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_permission
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.pid != null">
pid = #{record.pid,jdbcType=BIGINT},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.value != null">
value = #{record.value,jdbcType=VARCHAR},
</if>
<if test="record.icon != null">
icon = #{record.icon,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=INTEGER},
</if>
<if test="record.uri != null">
uri = #{record.uri,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_permission
set id = #{record.id,jdbcType=BIGINT},
pid = #{record.pid,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
value = #{record.value,jdbcType=VARCHAR},
icon = #{record.icon,jdbcType=VARCHAR},
type = #{record.type,jdbcType=INTEGER},
uri = #{record.uri,jdbcType=VARCHAR},
status = #{record.status,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
sort = #{record.sort,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsPermission">
update ums_permission
<set>
<if test="pid != null">
pid = #{pid,jdbcType=BIGINT},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="value != null">
value = #{value,jdbcType=VARCHAR},
</if>
<if test="icon != null">
icon = #{icon,jdbcType=VARCHAR},
</if>
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
<if test="uri != null">
uri = #{uri,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsPermission">
update ums_permission
set pid = #{pid,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
value = #{value,jdbcType=VARCHAR},
icon = #{icon,jdbcType=VARCHAR},
type = #{type,jdbcType=INTEGER},
uri = #{uri,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
sort = #{sort,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,243 @@
<?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.macro.mall.mapper.UmsRoleMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsRole">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="admin_count" jdbcType="INTEGER" property="adminCount" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="sort" jdbcType="INTEGER" property="sort" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, name, description, admin_count, create_time, status, sort
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsRoleExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_role
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_role
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsRoleExample">
delete from ums_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsRole">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_role (name, description, admin_count,
create_time, status, sort
)
values (#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{adminCount,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsRole">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
name,
</if>
<if test="description != null">
description,
</if>
<if test="adminCount != null">
admin_count,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="status != null">
status,
</if>
<if test="sort != null">
sort,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="adminCount != null">
#{adminCount,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsRoleExample" resultType="java.lang.Integer">
select count(*) from ums_role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_role
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
<if test="record.adminCount != null">
admin_count = #{record.adminCount,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_role
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
admin_count = #{record.adminCount,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
status = #{record.status,jdbcType=INTEGER},
sort = #{record.sort,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsRole">
update ums_role
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="adminCount != null">
admin_count = #{adminCount,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsRole">
update ums_role
set name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
admin_count = #{adminCount,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},
sort = #{sort,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,179 @@
<?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.macro.mall.mapper.UmsRolePermissionRelationMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsRolePermissionRelation">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="role_id" jdbcType="BIGINT" property="roleId" />
<result column="permission_id" jdbcType="BIGINT" property="permissionId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, role_id, permission_id
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsRolePermissionRelationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_role_permission_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_role_permission_relation
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_role_permission_relation
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsRolePermissionRelationExample">
delete from ums_role_permission_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsRolePermissionRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_role_permission_relation (role_id, permission_id)
values (#{roleId,jdbcType=BIGINT}, #{permissionId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsRolePermissionRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_role_permission_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roleId != null">
role_id,
</if>
<if test="permissionId != null">
permission_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="roleId != null">
#{roleId,jdbcType=BIGINT},
</if>
<if test="permissionId != null">
#{permissionId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsRolePermissionRelationExample" resultType="java.lang.Integer">
select count(*) from ums_role_permission_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_role_permission_relation
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.roleId != null">
role_id = #{record.roleId,jdbcType=BIGINT},
</if>
<if test="record.permissionId != null">
permission_id = #{record.permissionId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_role_permission_relation
set id = #{record.id,jdbcType=BIGINT},
role_id = #{record.roleId,jdbcType=BIGINT},
permission_id = #{record.permissionId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsRolePermissionRelation">
update ums_role_permission_relation
<set>
<if test="roleId != null">
role_id = #{roleId,jdbcType=BIGINT},
</if>
<if test="permissionId != null">
permission_id = #{permissionId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsRolePermissionRelation">
update ums_role_permission_relation
set role_id = #{roleId,jdbcType=BIGINT},
permission_id = #{permissionId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>