<?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="cn.com.basic.dao.SysUserRoleMapper" >
|
<resultMap id="BaseResultMap" type="cn.com.basic.entity.SysUserRole" >
|
<id column="id" property="id" jdbcType="VARCHAR" />
|
<result column="user_id" property="userId" jdbcType="VARCHAR" />
|
<result column="role_id" property="roleId" jdbcType="VARCHAR" />
|
<result column="is_valid" property="isValid" jdbcType="TINYINT" />
|
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
<result column="update_user_id" property="updateUserId" jdbcType="VARCHAR" />
|
</resultMap>
|
<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>
|
<sql id="Update_By_Example_Where_Clause" >
|
<where >
|
<foreach collection="example.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>
|
<sql id="Base_Column_List" >
|
id, user_id, role_id, is_valid, update_time, update_user_id
|
</sql>
|
<select id="selectByExample" resultMap="BaseResultMap" parameterType="cn.com.basic.entity.SysUserRoleExample" >
|
select
|
<if test="distinct" >
|
distinct
|
</if>
|
<include refid="Base_Column_List" />
|
from re_sys_user_role
|
<if test="_parameter != null" >
|
<include refid="Example_Where_Clause" />
|
</if>
|
<if test="orderByClause != null" >
|
order by ${orderByClause}
|
</if>
|
<if test="limitStart != null and limitStart>=0" >
|
limit #{limitStart} , #{limitEnd}
|
</if>
|
</select>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
|
select
|
<include refid="Base_Column_List" />
|
from re_sys_user_role
|
where id = #{id,jdbcType=VARCHAR}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
|
delete from re_sys_user_role
|
where id = #{id,jdbcType=VARCHAR}
|
</delete>
|
<delete id="deleteByExample" parameterType="cn.com.basic.entity.SysUserRoleExample" >
|
delete from re_sys_user_role
|
<if test="_parameter != null" >
|
<include refid="Example_Where_Clause" />
|
</if>
|
</delete>
|
<insert id="insert" parameterType="cn.com.basic.entity.SysUserRole" >
|
insert into re_sys_user_role (id, user_id, role_id,
|
is_valid, update_time, update_user_id
|
)
|
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{roleId,jdbcType=VARCHAR},
|
#{isValid,jdbcType=TINYINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=VARCHAR}
|
)
|
</insert>
|
<insert id="insertSelective" parameterType="cn.com.basic.entity.SysUserRole" >
|
insert into re_sys_user_role
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="id != null" >
|
id,
|
</if>
|
<if test="userId != null" >
|
user_id,
|
</if>
|
<if test="roleId != null" >
|
role_id,
|
</if>
|
<if test="isValid != null" >
|
is_valid,
|
</if>
|
<if test="updateTime != null" >
|
update_time,
|
</if>
|
<if test="updateUserId != null" >
|
update_user_id,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="id != null" >
|
#{id,jdbcType=VARCHAR},
|
</if>
|
<if test="userId != null" >
|
#{userId,jdbcType=VARCHAR},
|
</if>
|
<if test="roleId != null" >
|
#{roleId,jdbcType=VARCHAR},
|
</if>
|
<if test="isValid != null" >
|
#{isValid,jdbcType=TINYINT},
|
</if>
|
<if test="updateTime != null" >
|
#{updateTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateUserId != null" >
|
#{updateUserId,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<select id="countByExample" parameterType="cn.com.basic.entity.SysUserRoleExample" resultType="java.lang.Integer" >
|
select count(*) from re_sys_user_role
|
<if test="_parameter != null" >
|
<include refid="Example_Where_Clause" />
|
</if>
|
</select>
|
<update id="updateByExampleSelective" parameterType="map" >
|
update re_sys_user_role
|
<set >
|
<if test="record.id != null" >
|
id = #{record.id,jdbcType=VARCHAR},
|
</if>
|
<if test="record.userId != null" >
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
</if>
|
<if test="record.roleId != null" >
|
role_id = #{record.roleId,jdbcType=VARCHAR},
|
</if>
|
<if test="record.isValid != null" >
|
is_valid = #{record.isValid,jdbcType=TINYINT},
|
</if>
|
<if test="record.updateTime != null" >
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="record.updateUserId != null" >
|
update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
|
</if>
|
</set>
|
<if test="_parameter != null" >
|
<include refid="Update_By_Example_Where_Clause" />
|
</if>
|
</update>
|
<update id="updateByExample" parameterType="map" >
|
update re_sys_user_role
|
set id = #{record.id,jdbcType=VARCHAR},
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
role_id = #{record.roleId,jdbcType=VARCHAR},
|
is_valid = #{record.isValid,jdbcType=TINYINT},
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
update_user_id = #{record.updateUserId,jdbcType=VARCHAR}
|
<if test="_parameter != null" >
|
<include refid="Update_By_Example_Where_Clause" />
|
</if>
|
</update>
|
<update id="updateByPrimaryKeySelective" parameterType="cn.com.basic.entity.SysUserRole" >
|
update re_sys_user_role
|
<set >
|
<if test="userId != null" >
|
user_id = #{userId,jdbcType=VARCHAR},
|
</if>
|
<if test="roleId != null" >
|
role_id = #{roleId,jdbcType=VARCHAR},
|
</if>
|
<if test="isValid != null" >
|
is_valid = #{isValid,jdbcType=TINYINT},
|
</if>
|
<if test="updateTime != null" >
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateUserId != null" >
|
update_user_id = #{updateUserId,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where id = #{id,jdbcType=VARCHAR}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="cn.com.basic.entity.SysUserRole" >
|
update re_sys_user_role
|
set user_id = #{userId,jdbcType=VARCHAR},
|
role_id = #{roleId,jdbcType=VARCHAR},
|
is_valid = #{isValid,jdbcType=TINYINT},
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
update_user_id = #{updateUserId,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
</update>
|
</mapper>
|