From 781c2e20a4bb844dae3f4eafbf5f0e494b942ea8 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 25 五月 2023 18:07:08 +0800
Subject: [PATCH] optimize
---
java110-db/src/main/resources/mapper/community/MenuServiceDaoImplMapper.xml | 97 +++++++++++++++++++++---------------------------
1 files changed, 42 insertions(+), 55 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/community/MenuServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/community/MenuServiceDaoImplMapper.xml
index c6bb93e..7e04a54 100755
--- a/java110-db/src/main/resources/mapper/community/MenuServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/community/MenuServiceDaoImplMapper.xml
@@ -1,20 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="menuServiceDaoImpl">
-
<!-- 淇濆瓨璺敱淇℃伅鑷� instance琛ㄤ腑 add by wuxw 2018-07-03 -->
<insert id="saveMenuGroupInfo" parameterType="Map">
- insert into m_menu_group(
- g_id,name,icon,label,seq,description,group_type,store_type
- ) values (
- #{gId},#{name},#{icon},#{label},#{seq},#{description},#{groupType},#{storeType}
- )
-
+ insert into m_menu_group(g_id, name, icon, label, seq, description, group_type, store_type)
+ values (#{gId}, #{name}, #{icon}, #{label}, #{seq}, #{description}, #{groupType}, #{storeType})
</insert>
-
<!-- 鏌ヨ璺敱淇℃伅 add by wuxw 2018-07-03 -->
<select id="getMenuGroupInfo" parameterType="Map" resultType="Map">
@@ -42,7 +35,6 @@
<if test="seq !=null">
and t.seq= #{seq}
</if>
-
<if test="description !=null and description != ''">
and t.description= #{description}
</if>
@@ -50,9 +42,7 @@
<if test="page != -1 and page != null ">
limit #{page}, #{row}
</if>
-
</select>
-
<!-- 淇敼璺敱淇℃伅 add by wuxw 2018-07-03 -->
<update id="updateMenuGroupInfo" parameterType="Map">
@@ -84,7 +74,6 @@
</if>
</set>
where t.g_id= #{gId}
-
</update>
<!-- 鏌ヨ璺敱鏁伴噺 add by wuxw 2018-07-03 -->
@@ -121,28 +110,17 @@
</if>
</select>
-
<!-- 淇濆瓨璺敱淇℃伅鑷� instance琛ㄤ腑 add by wuxw 2018-07-03 -->
<insert id="saveBasePrivilegeRelInfo" parameterType="Map">
- insert into p_privilege_rel(
- p_id,pg_id
- ) values (
- #{pId},#{pgId}
- )
-
+ insert into p_privilege_rel(p_id, pg_id)
+ values (#{pId}, #{pgId})
</insert>
-
<!-- 淇濆瓨璺敱淇℃伅鑷� instance琛ㄤ腑 add by wuxw 2018-07-03 -->
<insert id="saveBasePrivilegeInfo" parameterType="Map">
- insert into p_privilege(
- p_id,name,resource,domain,description,m_id
- ) values (
- #{pId},#{name},#{resource},#{domain},#{description},#{mId}
- )
-
+ insert into p_privilege(p_id, name, resource, domain, description, m_id)
+ values (#{pId}, #{name}, #{resource}, #{domain}, #{description}, #{mId})
</insert>
-
<!-- 鏌ヨ璺敱淇℃伅 add by wuxw 2018-07-03 -->
<select id="getBasePrivilegeInfo" parameterType="Map" resultType="Map">
@@ -169,9 +147,7 @@
<if test="page != -1 and page != null ">
limit #{page}, #{row}
</if>
-
</select>
-
<!-- 淇敼璺敱淇℃伅 add by wuxw 2018-07-03 -->
<update id="updateBasePrivilegeInfo" parameterType="Map">
@@ -194,7 +170,6 @@
</if>
</set>
where t.p_id= #{pId}
-
</update>
<!-- 淇敼璺敱淇℃伅 add by wuxw 2018-07-03 -->
@@ -210,9 +185,7 @@
</set>
where t.p_id= #{pId}
-
</update>
-
<!-- 鏌ヨ璺敱鏁伴噺 add by wuxw 2018-07-03 -->
<select id="queryBasePrivilegesCount" parameterType="Map" resultType="Map">
@@ -239,22 +212,17 @@
</if>
</select>
-
<!-- 淇濆瓨璺敱淇℃伅鑷� instance琛ㄤ腑 add by wuxw 2018-07-03 -->
<insert id="saveMenuInfo" parameterType="Map">
- insert into m_menu(
- m_id,name,g_id,url,seq,p_id,description,is_show
- ) values (
- #{mId},#{name},#{gId},#{url},#{seq},'-1',#{description},#{isShow}
- )
+ insert into m_menu(m_id, name, g_id, url, seq, p_id, description, is_show)
+ values (#{mId}, #{name}, #{gId}, #{url}, #{seq}, '-1', #{description}, #{isShow})
</insert>
-
<!-- 鏌ヨ璺敱淇℃伅 add by wuxw 2018-07-03 -->
<select id="getMenuInfo" parameterType="Map" resultType="Map">
select DISTINCT t.m_id mId,t.name,t.g_id gId,t.url,t.seq,t.p_id pId,t.description,t.is_show isShow,
if(t.is_show='Y','鏄剧ず','涓嶆樉绀�') isShowName,
- t.m_id pId,t.name pName,mg.name menuGroupName,mg.store_type,st.name storeTypeName
+ t.m_id pId,t.name pName,mg.name gName,mg.store_type,st.name storeTypeName
from m_menu t,p_privilege p,m_menu_group mg,store_type st
where t.status_cd= '0'
and p.status_cd= '0'
@@ -264,13 +232,15 @@
<if test="gId !=null and gId != ''">
and t.g_id= #{gId}
</if>
+ <if test="gName !=null and gName != ''">
+ and mg.name= #{gName}
+ </if>
<if test="name !=null and name != ''">
and t.name like concat('%',#{name},'%')
</if>
<if test="mName !=null and mName != ''">
and t.name like concat('%',#{mName},'%')
</if>
-
<if test="domain !=null and domain != ''">
and p.domain= #{domain}
</if>
@@ -319,17 +289,13 @@
AND ppr.status_cd = '0'
)
</if>
- order by t.m_id desc
+ order by t.seq
<if test="page != -1 and page != null ">
limit #{page}, #{row}
</if>
-
</select>
-
- <!-- 淇敼璺敱淇℃伅
- ,t.description,t.is_show isShow
- add by wuxw 2018-07-03 -->
+ <!-- 淇敼璺敱淇℃伅 add by wuxw 2018-07-03 -->
<update id="updateMenuInfo" parameterType="Map">
update m_menu t
<set>
@@ -356,7 +322,6 @@
</if>
</set>
where t.m_id= #{mId}
-
</update>
<!-- 鏌ヨ璺敱鏁伴噺 add by wuxw 2018-07-03 -->
@@ -371,6 +336,9 @@
<if test="gId !=null and gId != ''">
and t.g_id= #{gId}
</if>
+ <if test="gName !=null and gName != ''">
+ and mg.name= #{gName}
+ </if>
<if test="name !=null and name != ''">
and t.name like concat('%',#{name},'%')
</if>
@@ -378,7 +346,7 @@
and t.name like concat('%',#{mName},'%')
</if>
<if test="pId !=null and pId != ''">
- and t.p_id= #{pId}
+ and p.p_id= #{pId}
</if>
<if test="domain !=null and domain != ''">
and p.domain= #{domain}
@@ -388,9 +356,6 @@
</if>
<if test="mId !=null and mId != ''">
and p.m_id= #{mId}
- </if>
- <if test="pId !=null and pId != ''">
- and t.p_id= #{pId}
</if>
<if test="isShow !=null and isShow != ''">
and t.is_show= #{isShow}
@@ -457,5 +422,27 @@
AND ppr.status_cd = '0'
</select>
-
+ <select id="hasPrivilege" parameterType="Map" resultType="Map">
+ SELECT DISTINCT tt.p_id `pId`,tt.name,tt.pg_id pgId,tt.pg_name pgName,tt.description,tt.create_time createTime FROM (
+ SELECT pp.*,'-1' AS pg_id,'' AS pg_name FROM p_privilege_user ppu,p_privilege pp
+ WHERE ppu.`p_id` = pp.`p_id`
+ AND pp.p_id = #{pId}
+ AND ppu.`privilege_flag` = '0'
+ AND ppu.`user_id` = #{userId}
+ AND ppu.`status_cd` = '0'
+ AND pp.`status_cd` = '0'
+ UNION
+ SELECT pp.*,ppg.pg_id,ppg.name pg_name FROM p_privilege_user ppu,p_privilege_group ppg,p_privilege pp,p_privilege_rel ppr
+ WHERE ppu.`p_id` = ppr.pg_id
+ AND ppr.pg_id = ppg.pg_id
+ AND ppr.p_id = pp.`p_id`
+ AND pp.p_id = #{pId}
+ AND ppu.`privilege_flag` = '1'
+ AND ppu.`user_id` = #{userId}
+ AND ppu.`status_cd` = '0'
+ AND pp.`status_cd` = '0'
+ AND ppg.status_cd = '0'
+ AND ppr.status_cd = '0'
+ ) tt
+ </select>
</mapper>
--
Gitblit v1.8.0