forked from github/dataease
145 lines
5.3 KiB
XML
145 lines
5.3 KiB
XML
<?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="io.dataease.base.mapper.SysUsersRolesMapper">
|
|
<resultMap id="BaseResultMap" type="io.dataease.base.domain.SysUsersRolesKey">
|
|
<id column="user_id" jdbcType="BIGINT" property="userId" />
|
|
<id 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">
|
|
user_id, role_id
|
|
</sql>
|
|
<select id="selectByExample" parameterType="io.dataease.base.domain.SysUsersRolesExample" resultMap="BaseResultMap">
|
|
select
|
|
<if test="distinct">
|
|
distinct
|
|
</if>
|
|
<include refid="Base_Column_List" />
|
|
from sys_users_roles
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
<if test="orderByClause != null">
|
|
order by ${orderByClause}
|
|
</if>
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="io.dataease.base.domain.SysUsersRolesKey">
|
|
delete from sys_users_roles
|
|
where user_id = #{userId,jdbcType=BIGINT}
|
|
and role_id = #{roleId,jdbcType=BIGINT}
|
|
</delete>
|
|
<delete id="deleteByExample" parameterType="io.dataease.base.domain.SysUsersRolesExample">
|
|
delete from sys_users_roles
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
</delete>
|
|
<insert id="insert" parameterType="io.dataease.base.domain.SysUsersRolesKey">
|
|
insert into sys_users_roles (user_id, role_id)
|
|
values (#{userId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT})
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="io.dataease.base.domain.SysUsersRolesKey">
|
|
insert into sys_users_roles
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">
|
|
user_id,
|
|
</if>
|
|
<if test="roleId != null">
|
|
role_id,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">
|
|
#{userId,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="roleId != null">
|
|
#{roleId,jdbcType=BIGINT},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<select id="countByExample" parameterType="io.dataease.base.domain.SysUsersRolesExample" resultType="java.lang.Long">
|
|
select count(*) from sys_users_roles
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
</select>
|
|
<update id="updateByExampleSelective" parameterType="map">
|
|
update sys_users_roles
|
|
<set>
|
|
<if test="record.userId != null">
|
|
user_id = #{record.userId,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 sys_users_roles
|
|
set user_id = #{record.userId,jdbcType=BIGINT},
|
|
role_id = #{record.roleId,jdbcType=BIGINT}
|
|
<if test="_parameter != null">
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
</if>
|
|
</update>
|
|
</mapper> |