All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mapper.MkSecRoleMapper.xml Maven / Gradle / Ivy

There is a newer version: 1.0.0-beta10
Show newest version
<?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>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy