From 0e0a6258ce04c9b89fdf1b5507675f35f8a09124 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期六, 08 十月 2022 11:04:18 +0800
Subject: [PATCH] 菜单,单位,数据目录递归查询,批量修改

---
 src/main/resources/mapper/sys/DepMapper.xml |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/main/resources/mapper/sys/DepMapper.xml b/src/main/resources/mapper/sys/DepMapper.xml
index bff0843..ece592a 100644
--- a/src/main/resources/mapper/sys/DepMapper.xml
+++ b/src/main/resources/mapper/sys/DepMapper.xml
@@ -10,9 +10,17 @@
         <result property="updateTime" column="update_time"></result>
     </resultMap>
     <select id="selectDepAll" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity">
-        select * from lf.sys_dep order by id;
+        select * from lf.sys_dep order by order_num;
     </select>
 
+    <select id="selectDepRecursive" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity">
+        with recursive rs as(
+            select * from lf.sys_dep where name='涓浗鐭虫补澶╃劧姘旂閬撳伐绋嬫湁闄愬叕鍙�'
+        union
+            select a.* from lf.sys_dep a, rs b where a.pid=b.id
+        )
+        select * FROM rs order by order_num;
+    </select>
     <select id="selectDep" resultMap="resultMap" resultType="com.lf.server.entity.sys.DepEntity">
         select * from lf.sys_dep where id = #{id}
     </select>
@@ -48,7 +56,20 @@
     </delete>
 
     <update id="updateDep">
-    update lf.sys_dep set pid=#{pid},name=#{name},sname=#{sname},code=#{code},uncode=#{uncode},addr=#{addr},contact=#{contact},fax=#{fax},
-    email=#{email},post=#{post},website=#{website},level=#{level},order_num =#{orderNum},update_user=#{updateUser},update_time=now(),bak=#{bak} where id=#{id}
+        update lf.sys_dep set pid=#{pid},name=#{name},sname=#{sname},code=#{code},uncode=#{uncode},addr=#{addr},contact=#{contact},fax=#{fax},
+        email=#{email},post=#{post},website=#{website},level=#{level},order_num =#{orderNum},update_user=#{updateUser},update_time=now(),bak=#{bak}
+         where id=#{id}
+    </update>
+
+    <update id="updateDeps">
+        <foreach collection="list" item="item" index="index" separator=","  >
+            update lf.sys_menu
+            <set>
+                pid=#{item.pid},name=#{item.name},sname=#{item.sname},code=#{item.code},uncode=#{item.uncode},addr=#{item.addr},contact=#{item.contact},
+                fax=#{item.fax},email=#{item.email},post=#{item.post},website=#{item.website},level=#{item.level},order_num =#{item.orderNum},
+                update_user=#{item.updateUser},update_time=now(),bak=#{item.bak}
+            </set>
+            where id = #{item.id}
+        </foreach>
     </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3