192 lines
4.1 KiB
XML
192 lines
4.1 KiB
XML
<?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.zcloud.mapper.dsno2.system.RouteMapper">
|
|
|
|
<resultMap type="com.zcloud.entity.system.Route" id="routeResultMap">
|
|
<id column="ROUTE_ID" property="ROUTE_ID"/>
|
|
<result column="PARENT_ID" property="PARENT_ID"/>
|
|
<result column="PARENT_IDS" property="PARENT_IDS"/>
|
|
<result column="PATH" property="PATH"/>
|
|
<result column="REDIRECT" property="REDIRECT"/>
|
|
<result column="COMPONENT" property="COMPONENT"/>
|
|
<result column="META" property="META"/>
|
|
<result column="ROUTE_ORDER" property="ROUTE_ORDER"/>
|
|
<result column="ROUTE_ICON" property="ROUTE_ICON"/>
|
|
<result column="ROUTE_STATE" property="ROUTE_STATE"/>
|
|
<result column="SHIRO_KEY" property="SHIRO_KEY"/>
|
|
<result column="SHOW_MODEL" property="SHOW_MODEL"/>
|
|
<result column="ROUTE_TYPE" property="ROUTE_TYPE"/>
|
|
<result column="ROUTE_NAME" property="ROUTE_NAME"/>
|
|
</resultMap>
|
|
|
|
<!--表名 -->
|
|
<sql id="tableName">
|
|
SYS_ROUTE
|
|
</sql>
|
|
|
|
<!-- 字段 -->
|
|
<sql id="Field">
|
|
ROUTE_ID,
|
|
PARENT_ID,
|
|
PARENT_IDS,
|
|
PATH,
|
|
REDIRECT,
|
|
COMPONENT,
|
|
META,
|
|
ROUTE_ORDER,
|
|
ROUTE_ICON,
|
|
ROUTE_STATE,
|
|
SHIRO_KEY,
|
|
SHOW_MODEL,
|
|
ROUTE_TYPE,
|
|
ROUTE_NAME
|
|
</sql>
|
|
|
|
<!-- 字段值 -->
|
|
<sql id="FieldValue">
|
|
#{ROUTE_ID},
|
|
#{PARENT_ID},
|
|
#{PARENT_IDS},
|
|
#{PATH},
|
|
#{REDIRECT},
|
|
#{COMPONENT},
|
|
#{META},
|
|
#{ROUTE_ORDER},
|
|
#{ROUTE_ICON},
|
|
#{ROUTE_STATE},
|
|
#{SHIRO_KEY},
|
|
#{SHOW_MODEL},
|
|
#{ROUTE_TYPE},
|
|
#{ROUTE_NAME}
|
|
</sql>
|
|
|
|
<!--新增 -->
|
|
<insert id="add" parameterType="pd">
|
|
insert into
|
|
<include refid="tableName"></include>
|
|
(
|
|
<include refid="Field"></include>
|
|
) values (
|
|
<include refid="FieldValue"></include>
|
|
)
|
|
</insert>
|
|
|
|
<!--编辑 -->
|
|
<update id="edit" parameterType="menu">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
PARENT_ID = #{PARENT_ID},
|
|
PARENT_IDS = #{PARENT_IDS},
|
|
PATH = #{PATH},
|
|
REDIRECT = #{REDIRECT},
|
|
COMPONENT = #{COMPONENT},
|
|
META = #{META},
|
|
ROUTE_ORDER = #{ROUTE_ORDER},
|
|
ROUTE_ICON = #{ROUTE_ICON},
|
|
ROUTE_STATE = #{ROUTE_STATE},
|
|
SHIRO_KEY = #{SHIRO_KEY},
|
|
SHOW_MODEL = #{SHOW_MODEL},
|
|
ROUTE_TYPE = #{ROUTE_TYPE},
|
|
ROUTE_NAME = #{ROUTE_NAME}
|
|
where
|
|
ROUTE_ID=#{ROUTE_ID}
|
|
</update>
|
|
|
|
<!--通过菜单ID获取数据 -->
|
|
<select id="findById" parameterType="pd" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
from
|
|
<include refid="tableName"></include>
|
|
where ROUTE_ID=#{ROUTE_ID}
|
|
</select>
|
|
|
|
<!--取最大ID-->
|
|
<select id="findMaxId" parameterType="pd" resultType="pd">
|
|
select IFNULL(MAX(ROUTE_ID),0) MID from
|
|
<include refid="tableName"></include>
|
|
</select>
|
|
|
|
|
|
<!--获取所有菜单 -->
|
|
<select id="listAll" parameterType="pd" resultType="pd">
|
|
select
|
|
ROUTE_ID,
|
|
PARENT_ID,
|
|
PARENT_IDS,
|
|
PATH path,
|
|
REDIRECT,
|
|
COMPONENT component,
|
|
META meta,
|
|
ROUTE_ORDER,
|
|
ROUTE_ICON,
|
|
ROUTE_STATE,
|
|
SHIRO_KEY,
|
|
SHOW_MODEL,
|
|
ROUTE_TYPE,
|
|
ROUTE_NAME
|
|
from
|
|
<include refid="tableName"></include>
|
|
order by ROUTE_ORDER asc
|
|
</select>
|
|
|
|
<!--删除菜单-->
|
|
<delete id="delete" parameterType="String">
|
|
delete from
|
|
<include refid="tableName"></include>
|
|
where ROUTE_ID=#{ROUTE_ID}
|
|
</delete>
|
|
|
|
<!--保存菜单图标 -->
|
|
<update id="editicon" parameterType="pd">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
ROUTE_ICON = #{ICON}
|
|
where
|
|
ROUTE_ID=#{ROUTE_ID}
|
|
</update>
|
|
|
|
|
|
<!--通过ID获取其子一级菜单 -->
|
|
<select id="listSubRouteByParentId" parameterType="String" resultMap="routeResultMap">
|
|
SELECT
|
|
<include refid="Field"></include>
|
|
FROM
|
|
<include refid="tableName"></include>
|
|
WHERE
|
|
PARENT_ID = #{parentId}
|
|
ORDER BY
|
|
ROUTE_ORDER
|
|
</select>
|
|
|
|
|
|
|
|
<!--获取所有菜单 -->
|
|
<select id="listRouteByParentId" parameterType="String" resultType="pd">
|
|
select
|
|
ROUTE_ID,
|
|
PARENT_ID,
|
|
PARENT_IDS,
|
|
PATH path,
|
|
REDIRECT,
|
|
COMPONENT component,
|
|
META meta,
|
|
ROUTE_ORDER,
|
|
ROUTE_ICON,
|
|
ROUTE_STATE,
|
|
SHIRO_KEY,
|
|
SHOW_MODEL,
|
|
ROUTE_TYPE,
|
|
ROUTE_NAME
|
|
from
|
|
<include refid="tableName"></include>
|
|
WHERE
|
|
PARENT_ID = #{parentId}
|
|
order by ROUTE_ORDER asc
|
|
</select>
|
|
</mapper>
|