<?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.moral.mapper.RoleMapper">
|
|
<resultMap id="BaseResultMap" type="com.moral.entity.Role">
|
<id column="id" property="id" jdbcType="INTEGER" />
|
<result column="role_code" property="roleCode" jdbcType="VARCHAR" />
|
<result column="role_name" property="roleName" jdbcType="VARCHAR" />
|
<result column="is_delete" property="isDelete" jdbcType="CHAR" />
|
<result column="role_remark" property="roleRemark" jdbcType="VARCHAR" />
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
<result column="create_user" property="createUser" jdbcType="VARCHAR" />
|
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
<result column="update_user" property="updateUser" jdbcType="VARCHAR" />
|
</resultMap>
|
|
<sql id="Base_Column_List" >
|
id, role_code, role_name, is_delete, role_remark, create_time, create_user,
|
update_time, update_user
|
</sql>
|
|
<sql id="Example_Where_Clause" >
|
<where >
|
<foreach collection="oredCriteria" item="criteria" separator="or" >
|
<if test="criteria.valid" >
|
<trim prefix="(" suffix=")" prefixOverrides="and" >
|
<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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
#{listItem}
|
</foreach>
|
</when>
|
</choose>
|
</foreach>
|
</trim>
|
</if>
|
</foreach>
|
</where>
|
</sql>
|
|
<select id="getRoleListByName" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from role
|
where is_delete=0
|
<if test="roleName != 'null'">
|
and role_name like concat('%',#{roleName},'%')
|
</if>
|
</select>
|
|
<select id="getRoleList" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from role
|
<if test="_parameter != null" >
|
<include refid="Example_Where_Clause" />
|
</if>
|
<if test="orderByClause != null" >
|
order by ${orderByClause}
|
</if>
|
</select>
|
|
<update id="updateByPrimaryKey" parameterType="com.moral.entity.Role" >
|
update role
|
<set >
|
<if test="roleCode != null" >
|
role_code = #{roleCode,jdbcType=VARCHAR},
|
</if>
|
<if test="roleName != null" >
|
role_name = #{roleName,jdbcType=VARCHAR},
|
</if>
|
<if test="channelId != null" >
|
channel_id = #{channelId,jdbcType=INTEGER},
|
</if>
|
<if test="isDelete != null" >
|
is_delete = #{isDelete,jdbcType=CHAR},
|
</if>
|
<if test="roleRemark != null" >
|
role_remark = #{roleRemark,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null" >
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null" >
|
create_user = #{createUser,jdbcType=VARCHAR},
|
</if>
|
<if test="updateTime != null" >
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateUser != null" >
|
update_user = #{updateUser,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
|
</mapper>
|