<?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.thhy.usercore.modules.sys.pdamenu.mapper.PdaMenuMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
t.id as id,
|
t.create_time as createTime,
|
t.create_user as createUser,
|
t.is_use as isUse,
|
t.menu_icon as menuIcon,
|
t.menu_name as menuName,
|
t.menu_url as menuUrl,
|
t.sort as sort,
|
t.update_time as updateTime,
|
t.update_user as updateUser
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
t.is_use = 1 AND
|
<if test="createTime!=null">
|
t.create_time = #{createTime} AND
|
</if>
|
<if test="createUser!=null and createUser!=''">
|
t.create_user = #{createUser} AND
|
</if>
|
<if test="isUse!=null">
|
t.is_use = #{isUse} AND
|
</if>
|
<if test="menuIcon!=null and menuIcon!=''">
|
t.menu_icon = #{menuIcon} AND
|
</if>
|
<if test="menuName!=null and menuName!=''">
|
t.menu_name LIKE concat('%',#{menuName},'%') AND
|
</if>
|
<if test="menuUrl!=null and menuUrl!=''">
|
t.menu_url = #{menuUrl} AND
|
</if>
|
<if test="sort!=null">
|
t.sort = #{sort} AND
|
</if>
|
<if test="updateTime!=null">
|
t.update_time = #{updateTime} AND
|
</if>
|
<if test="updateUser!=null and updateUser!=''">
|
t.update_user = #{updateUser} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.usercore.modules.sys.pdamenu.entity.PdaMenu">
|
select <include refid="Base_Column_List" />
|
from pda_menu t
|
where t.id=#{id}
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from pda_menu
|
where id=#{id}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.usercore.modules.sys.pdamenu.entity.PdaMenu">
|
SELECT
|
<include refid="Base_Column_List" />
|
from pda_menu t
|
<include refid="condition_query" />
|
order by t.sort
|
</select>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.usercore.modules.sys.pdamenu.entity.PdaMenu">
|
SELECT
|
<include refid="Base_Column_List" />
|
from pda_menu t
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert">
|
insert into pda_menu
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
<if test="id != null">
|
id,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="menuIcon != null">
|
menu_icon,
|
</if>
|
<if test="menuName != null">
|
menu_name,
|
</if>
|
<if test="menuUrl != null">
|
menu_url,
|
</if>
|
<if test="sort != null">
|
sort,
|
</if>
|
<if test="updateTime != null">
|
update_time,
|
</if>
|
<if test="updateUser != null">
|
update_user,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="createTime != null">
|
#{createTime},
|
</if>
|
<if test="createUser != null">
|
#{createUser},
|
</if>
|
<if test="id != null">
|
#{id},
|
</if>
|
<if test="isUse != null">
|
#{isUse},
|
</if>
|
<if test="menuIcon != null">
|
#{menuIcon},
|
</if>
|
<if test="menuName != null">
|
#{menuName},
|
</if>
|
<if test="menuUrl != null">
|
#{menuUrl},
|
</if>
|
<if test="sort != null">
|
#{sort},
|
</if>
|
<if test="updateTime != null">
|
#{updateTime},
|
</if>
|
<if test="updateUser != null">
|
#{updateUser},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update pda_menu
|
<set>
|
<if test="createTime != null">
|
create_time=#{createTime},
|
</if>
|
<if test="createUser != null">
|
create_user=#{createUser},
|
</if>
|
<if test="isUse != null">
|
is_use=#{isUse},
|
</if>
|
<if test="menuIcon != null">
|
menu_icon=#{menuIcon},
|
</if>
|
<if test="menuName != null">
|
menu_name=#{menuName},
|
</if>
|
<if test="menuUrl != null">
|
menu_url=#{menuUrl},
|
</if>
|
<if test="sort != null">
|
sort=#{sort},
|
</if>
|
<if test="updateTime != null">
|
update_time=#{updateTime},
|
</if>
|
<if test="updateUser != null">
|
update_user=#{updateUser},
|
</if>
|
</set>
|
where id=#{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="deletelogic">
|
update pda_menu
|
SET is_use = 0
|
where id=#{id}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteById">
|
delete from pda_menu
|
where id=#{id}
|
</delete>
|
|
<select id="selectList" resultType="com.thhy.usercore.modules.sys.pdamenu.entity.PdaMenuSelectVo">
|
select t.id,t.menu_name as menuName,(select count(id) from pda_menu_role where menu_id = t.id and role_id = #{roleId}) as selected
|
from pda_menu t
|
where t.is_use = 1
|
order by t.sort
|
</select>
|
|
</mapper>
|