mapper.MkSecRoleMapper.xml Maven / Gradle / Ivy
<?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.github.xujiaji.mk.security.mapper.MkSecRoleMapper"> <insert id="roleSetPermissions"> DELETE FROM mk_sec_role_permission WHERE role_id = ${id}; INSERT INTO mk_sec_role_permission(role_id, permission_id, create_time) VALUES <foreach collection="permissionIds" item="permissionId" separator=","> (${id}, ${permissionId}, NOW()) </foreach> </insert> <select id="selectBySecUserId" resultType="com.github.xujiaji.mk.security.entity.MkSecRole"> SELECT mk_sec_role.* FROM mk_sec_role, mk_sec_user, mk_sec_user_role WHERE mk_sec_user.id = mk_sec_user_role.sec_user_id AND mk_sec_role.id = mk_sec_user_role.role_id AND mk_sec_user.id = ${secUserId} </select> <select id="rolePage" resultType="com.github.xujiaji.mk.security.dto.RoleDTO"> SELECT * FROM mk_sec_role </select> <select id="countRoleByRoleIds" resultType="java.lang.Integer"> SELECT COUNT(*) FROM mk_sec_role WHERE id IN <foreach collection="ids" item="id" separator="," open="(" close=")"> id </foreach> </select> </mapper>