<?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.gkhy.safePlatform.account.repository.MenuInfoRepository" >
|
|
<resultMap id="MenuDo" type="com.gkhy.safePlatform.account.entity.user.MenuInfoDO">
|
<result property="id" column="id"/>
|
<result property="name" column="name" />
|
<result property="path" column="path" />
|
<result property="priority" column="priority" />
|
<result property="description" column="description" />
|
<result property="status" column="status" />
|
<result property="redirect" column="redirect" />
|
<result property="parentId" column="parent_id" />
|
<result property="component" column="component" />
|
<result property="publicEnable" column="public_enable" />
|
<result property="title" column="title"/>
|
<result property="linkEnable" column="link_enable"/>
|
<result property="hideEnable" column="hide_enable"/>
|
<result property="keepAliveEnable" column="keep_alive_enable"/>
|
<result property="affixEnable" column="affix_enable"/>
|
<result property="iframeEnable" column="iframe_enable"/>
|
<result property="icon" column="icon"/>
|
<association property="project" javaType="com.gkhy.safePlatform.account.entity.user.ProjectInfoDO">
|
<result property="id" column="project_id"/>
|
<result property="name" column="project_name"/>
|
<result property="code" column="project_code"/>
|
<result property="status" column="project_status"/>
|
</association>
|
<collection property="roles"
|
javaType="java.util.List"
|
ofType="com.gkhy.safePlatform.account.entity.user.RoleInfoDO"
|
column="{menuId=id}"
|
select="selectRoles">
|
</collection>
|
|
</resultMap>
|
|
<resultMap id="RoleInfoDO" type="com.gkhy.safePlatform.account.entity.user.RoleInfoDO">
|
<result property="id" column="id"/>
|
<result property="name" column="name"/>
|
<result property="code" column="code"/>
|
<result property="info" column="info"/>
|
<result property="status" column="status"/>
|
</resultMap>
|
|
<resultMap id="SimpleMenu" type="com.gkhy.safePlatform.account.entity.user.MenuInfo">
|
<result property="id" column="id"/>
|
<result property="name" column="name" />
|
<result property="path" column="path" />
|
<result property="priority" column="priority" />
|
<result property="description" column="description" />
|
<result property="status" column="status" />
|
<result property="parentId" column="parent_id" />
|
<result property="component" column="component" />
|
</resultMap>
|
<insert id="insertMenu"
|
parameterType="com.gkhy.safePlatform.account.entity.user.MenuInfo"
|
keyProperty="id"
|
useGeneratedKeys="true">
|
insert into sys_menu
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="id != null" >
|
id,
|
</if>
|
<if test="name != null" >
|
name,
|
</if>
|
<if test="path != null" >
|
path,
|
</if>
|
<if test="priority != null" >
|
priority,
|
</if>
|
<if test="description != null" >
|
description,
|
</if>
|
<if test="status != null" >
|
status,
|
</if>
|
<if test="component != null" >
|
component,
|
</if>
|
<if test="redirect != null" >
|
redirect,
|
</if>
|
<if test="title != null" >
|
title,
|
</if>
|
<if test="linkEnable != null" >
|
link_enable,
|
</if>
|
<if test="hideEnable != null" >
|
hide_enable,
|
</if>
|
<if test="keepAliveEnable != null" >
|
keep_alive_enable,
|
</if>
|
<if test="affixEnable != null" >
|
affix_enable,
|
</if>
|
<if test="iframeEnable != null" >
|
iframe_enable,
|
</if>
|
<if test="publicEnable != null" >
|
public_enable,
|
</if>
|
<if test="icon != null" >
|
icon,
|
</if>
|
<if test="parentId != null" >
|
parent_id,
|
</if>
|
<if test="gmtCreate != null" >
|
gmt_create,
|
</if>
|
<if test="gmtModified != null" >
|
gmt_modified,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="id != null" >
|
#{id},
|
</if>
|
<if test="name != null" >
|
#{name},
|
</if>
|
<if test="path != null" >
|
#{path},
|
</if>
|
<if test="priority != null" >
|
#{priority},
|
</if>
|
<if test="description != null" >
|
#{description},
|
</if>
|
<if test="status != null" >
|
#{status},
|
</if>
|
<if test="component != null" >
|
#{component},
|
</if>
|
<if test="redirect != null" >
|
#{redirect},
|
</if>
|
<if test="title != null" >
|
#{title},
|
</if>
|
<if test="linkEnable != null" >
|
#{linkEnable},
|
</if>
|
<if test="hideEnable != null" >
|
#{hideEnable},
|
</if>
|
<if test="keepAliveEnable != null" >
|
#{keepAliveEnable},
|
</if>
|
<if test="affixEnable != null" >
|
#{affixEnable},
|
</if>
|
<if test="iframeEnable != null" >
|
#{iframeEnable},
|
</if>
|
<if test="publicEnable != null" >
|
#{publicEnable},
|
</if>
|
<if test="icon != null" >
|
#{icon},
|
</if>
|
<if test="parentId != null" >
|
#{parentId},
|
</if>
|
<if test="gmtCreate != null" >
|
#{gmtCreate},
|
</if>
|
<if test="gmtModified != null" >
|
#{gmtModified},
|
</if>
|
|
</trim>
|
|
|
</insert>
|
<update id="updateMenu" parameterType="com.gkhy.safePlatform.account.entity.user.MenuInfo">
|
|
update sys_menu
|
<set >
|
<if test="name != null" >
|
name = #{name},
|
</if>
|
<if test="path != null" >
|
path = #{path},
|
</if>
|
<if test="path != null" >
|
path = #{path},
|
</if>
|
<if test="priority != null" >
|
priority = #{priority},
|
</if>
|
<if test="description != null" >
|
description = #{description},
|
</if>
|
<if test="status != null" >
|
status = #{status},
|
</if>
|
<if test="description != null" >
|
description = #{description},
|
</if>
|
<if test="component != null" >
|
component = #{component},
|
</if>
|
<if test="title != null" >
|
title = #{title},
|
</if>
|
<if test="icon != null" >
|
icon = #{icon},
|
</if>
|
<if test="linkEnable != null" >
|
link_enable = #{linkEnable},
|
</if>
|
<if test="hideEnable != null" >
|
hide_enable = #{hideEnable},
|
</if>
|
<if test="keepAliveEnable != null" >
|
keep_alive_enable = #{keepAliveEnable},
|
</if>
|
<if test="affixEnable != null" >
|
affix_enable = #{affixEnable},
|
</if>
|
<if test="iframeEnable != null" >
|
iframe_enable = #{iframeEnable},
|
</if>
|
<if test="publicEnable != null" >
|
public_enable = #{publicEnable},
|
</if>
|
<if test="parentId != null" >
|
parent_id = #{parentId},
|
</if>
|
<if test="gmtModified != null" >
|
gmt_modified = #{gmtModified},
|
</if>
|
redirect = #{redirect}
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
|
|
<select id="getAllMenu" resultMap="MenuDo">
|
select
|
menu.id,
|
menu.name,
|
menu.path,
|
menu.redirect,
|
menu.priority,
|
menu.description,
|
menu.parent_id,
|
menu.status,
|
menu.component,
|
menu.title,
|
menu.link_enable,
|
menu.hide_enable,
|
menu.keep_alive_enable,
|
menu.affix_enable,
|
menu.iframe_enable,
|
menu.public_enable,
|
menu.icon,
|
project.id as project_id,
|
project.name as project_name,
|
project.code as project_code,
|
project.status as project_status
|
from sys_menu as menu,
|
sys_project as project,
|
sys_project_menu as projectMenu
|
where projectMenu.menu_id = menu.id
|
and project.id = projectMenu.project_id
|
and menu.status != -1
|
|
</select>
|
|
<select id="selectRoles" resultMap="RoleInfoDO">
|
select
|
role.id,
|
role.code,
|
role.name,
|
role.status
|
from sys_role as role,
|
sys_role_menu as roleMenu
|
where role.id = roleMenu.role_id
|
and roleMenu.menu_id = #{menuId}
|
</select>
|
|
<select id="getMenuById" parameterType="long" resultMap="SimpleMenu">
|
select
|
menu.id,
|
menu.name,
|
menu.path,
|
menu.redirect,
|
menu.priority,
|
menu.description,
|
menu.parent_id,
|
menu.status,
|
menu.component
|
from sys_menu as menu
|
where menu.id = #{id}
|
|
</select>
|
|
</mapper>
|