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

mybatis.mapper.s_sys_menu.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">

<!-- Automatic generated on 2023-09-06 19:11:11 by CrudCodeGenerator wirtten by Gerald Chen -->

<mapper namespace="com.github.javaclub.base.mapper.SysMenuMapper">

	<resultMap type="com.github.javaclub.base.domain.SysMenu" id="sysMenuMap">
        <result property="id" column="id" />
        <result property="parentId" column="parent_id" />
        <result property="name" column="name" />
        <result property="url" column="url" />
        <result property="perms" column="perms" />
        <result property="type" column="type" />
        <result property="icon" column="icon" />
        <result property="orderNum" column="order_num" />
        <result property="createdTime" column="created_time" />
        <result property="modifiedTime" column="modified_time" />

    </resultMap>
    
    <sql id="Base_Column_List">
		id,
		parent_id,
		name,
		url,
		perms,
		type,
		icon,
		order_num,
		created_time,
		modified_time
    </sql>
    
    <select id="listMenuIdByRoleId" resultType="Long">
		select menu_id from s_sys_role_menu where role_id = #{roleId}
	</select>
	
	<!-- 查询用户的所有菜单 --> 
	<select id="listMenuByUserId" resultType="com.github.javaclub.base.domain.SysMenu">
		SELECT DISTINCT m.id AS id,m.parent_id,m.name,url,m.type,m.icon,m.order_num 
		FROM s_sys_user_role ur 
		LEFT JOIN s_sys_role_menu rm ON ur.role_id = rm.role_id LEFT JOIN s_sys_menu m ON m.`id` = rm.`menu_id`
		WHERE ur.user_id = #{userId} and m.type != 2 order by order_num
	</select>
	<!-- 查询所有菜单 --> 
	<select id="listMenu" resultType="com.github.javaclub.base.domain.SysMenu">
		SELECT 
		<include refid="Base_Column_List" /> 
		FROM s_sys_menu where `type` != 2 order by order_num
	</select>
	
	<select id="listSimpleMenuNoButton" resultType="com.github.javaclub.base.domain.SysMenu">
		select id, parent_id, `name` from s_sys_menu where `type` != 2 order by order_num 
	</select>
	
	<select id="listRootMenu" resultType="com.github.javaclub.base.domain.SysMenu">
		select id,`name` from s_sys_menu where `type` = 0
	</select>
	
	<select id="listChildrenMenuByParentId" resultType="com.github.javaclub.base.domain.SysMenu">
		select id,`name` from s_sys_menu where parent_id = #{parentId}
	</select>
	
	<select id="listMenuAndBtn" resultType="com.github.javaclub.base.domain.SysMenu">
	   SELECT 
	   <include refid="Base_Column_List" /> 
	   FROM s_sys_menu order by order_num
	</select>
    

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy