You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
848 B
37 lines
848 B
<?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.learn.dao.SysUserRoleDao">
|
|
|
|
<select id="queryList" resultType="com.learn.entity.SysUserRoleEntity">
|
|
select * from sys_user_role
|
|
<where>
|
|
<if test="userId != null">
|
|
user_id = #{userId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<insert id="save">
|
|
insert into sys_user_role
|
|
(
|
|
`user_id`,
|
|
`role_id`
|
|
)
|
|
values
|
|
<foreach collection="roleIdList" item="item" index="index" separator="," >
|
|
(
|
|
#{userId},
|
|
#{item}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<delete id="delete">
|
|
delete from sys_user_role where user_id = #{value}
|
|
</delete>
|
|
|
|
<select id="queryRoleIdList" resultType="long">
|
|
select role_id from sys_user_role where user_id = #{value}
|
|
</select>
|
|
</mapper> |