123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?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.gxzc.zen.api.sys.mapper.SysMenuMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.gxzc.zen.api.sys.model.SysMenu">
- <result column="id" property="id"/>
- <result column="enable" property="enable"/>
- <result column="remark" property="remark"/>
- <result column="create_time" property="createTime"/>
- <result column="create_by" property="createBy"/>
- <result column="update_time" property="updateTime"/>
- <result column="update_by" property="updateBy"/>
- <result column="parent_id" property="parentId"/>
- <result column="path" property="path"/>
- <result column="code" property="code"/>
- <result column="type" property="type"/>
- <result column="title" property="title"/>
- <result column="uri" property="uri"/>
- <result column="icon" property="icon"/>
- <result column="sort" property="sort"/>
- <result column="ext1" property="ext1"/>
- <result column="ext2" property="ext2"/>
- <result column="ext3" property="ext3"/>
- <result column="ext4" property="ext4"/>
- <result column="ext5" property="ext5"/>
- </resultMap>
- <sql id="CommonColumns">
- ${prefix}.id,
- ${prefix}.enable,
- ${prefix}.remark,
- ${prefix}.create_time AS createTime,
- ${prefix}.create_by AS createBy,
- ${prefix}.update_time AS updateTime,
- ${prefix}.update_by AS updateBy,
- </sql>
- <sql id="Columns">
- <include refid="CommonColumns">
- <property name="prefix" value="${prefix}"/>
- </include>
- ${prefix}.parent_id AS parentId,
- ${prefix}.path,
- ${prefix}.code,
- ${prefix}.type,
- ${prefix}.title,
- ${prefix}.uri,
- ${prefix}.icon,
- ${prefix}.sort,
- ${prefix}.ext1,
- ${prefix}.ext2,
- ${prefix}.ext3,
- ${prefix}.ext4,
- ${prefix}.ext5
- </sql>
- <select id="selectByRoleIds" resultType="com.gxzc.zen.api.sys.model.SysMenu">
- SELECT
- <include refid="Columns">
- <property name="prefix" value="A"/>
- </include>
- FROM
- sys_menu AS A
- INNER JOIN sys_menu_role AS B ON A.id = B.menu_id
- WHERE B.role_id IN
- <foreach collection="roleIds" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- </select>
- <update id="updatePath">
- UPDATE `sys_menu`
- SET path = CONCAT((SELECT path FROM (SELECT * FROM `sys_menu` WHERE id = #{parentId}) AS temp), '-', #{id})
- WHERE id = #{id}
- </update>
- </mapper>
|