159 lines
5.2 KiB
XML
159 lines
5.2 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.cool.store.mapper.SysMenuMapper">
|
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.SysMenuDO">
|
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
|
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
|
|
<result column="code" jdbcType="VARCHAR" property="code"/>
|
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
|
<result column="path" jdbcType="VARCHAR" property="path"/>
|
|
<result column="sort" jdbcType="INTEGER" property="sort"/>
|
|
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
|
<result column="deleted" jdbcType="BIT" property="deleted"/>
|
|
<result column="icon" jdbcType="VARCHAR" property="icon"/>
|
|
<result column="menu_type" jdbcType="TINYINT" property="menuType"/>
|
|
<result column="env" jdbcType="VARCHAR" property="env"/>
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, parent_id, code, name, path, sort, remark, deleted, icon, menu_type, env
|
|
</sql>
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
|
|
insert into sys_menu
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="parentId != null">
|
|
parent_id,
|
|
</if>
|
|
<if test="code != null">
|
|
code,
|
|
</if>
|
|
<if test="name != null">
|
|
name,
|
|
</if>
|
|
<if test="path != null">
|
|
path,
|
|
</if>
|
|
<if test="sort != null">
|
|
sort,
|
|
</if>
|
|
<if test="remark != null">
|
|
remark,
|
|
</if>
|
|
<if test="deleted != null">
|
|
deleted,
|
|
</if>
|
|
<if test="icon != null">
|
|
icon,
|
|
</if>
|
|
<if test="menuType != null">
|
|
menu_type,
|
|
</if>
|
|
<if test="env != null">
|
|
env,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="parentId != null">
|
|
#{parentId},
|
|
</if>
|
|
<if test="code != null">
|
|
#{code},
|
|
</if>
|
|
<if test="name != null">
|
|
#{name},
|
|
</if>
|
|
<if test="path != null">
|
|
#{path},
|
|
</if>
|
|
<if test="sort != null">
|
|
#{sort},
|
|
</if>
|
|
<if test="remark != null">
|
|
#{remark},
|
|
</if>
|
|
<if test="deleted != null">
|
|
#{deleted},
|
|
</if>
|
|
<if test="icon != null">
|
|
#{icon},
|
|
</if>
|
|
<if test="menuType != null">
|
|
#{menuType},
|
|
</if>
|
|
<if test="env != null">
|
|
#{env},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="batchUpdateMenu">
|
|
<foreach collection="recordList" separator=";" item="record">
|
|
update sys_menu
|
|
<set>
|
|
<if test="record.parentId != null">
|
|
parent_id = #{record.parentId},
|
|
</if>
|
|
<if test="record.code != null">
|
|
code = #{record.code},
|
|
</if>
|
|
<if test="record.name != null">
|
|
name = #{record.name},
|
|
</if>
|
|
<if test="record.path != null">
|
|
path = #{record.path},
|
|
</if>
|
|
<if test="record.sort != null">
|
|
sort = #{record.sort},
|
|
</if>
|
|
<if test="record.remark != null">
|
|
remark = #{record.remark},
|
|
</if>
|
|
<if test="record.deleted != null">
|
|
deleted = #{record.deleted},
|
|
</if>
|
|
<if test="record.icon != null">
|
|
icon = #{record.icon},
|
|
</if>
|
|
<if test="record.menuType != null">
|
|
menu_type = #{record.menuType},
|
|
</if>
|
|
<if test="record.env != null">
|
|
env = #{record.env},
|
|
</if>
|
|
</set>
|
|
where id = #{record.id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="selectMenuAll" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from
|
|
sys_menu
|
|
where
|
|
deleted = '0'
|
|
<if test="list!=null and list.size>0">
|
|
and parent_id in
|
|
<foreach collection="list" item="parentId" open="(" close=")" separator=",">
|
|
#{parentId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectMaxSort" resultType="java.lang.Integer">
|
|
select sort
|
|
from sys_menu
|
|
order by sort desc
|
|
limit 0,1
|
|
</select>
|
|
|
|
<update id="batchDeleteMenu">
|
|
update
|
|
sys_menu
|
|
set
|
|
deleted = '1'
|
|
where
|
|
id in
|
|
<foreach collection="list" open="(" item="item" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</update>
|
|
</mapper> |