From 84b7d5223a5f5229866a7d5686d198cca4251453 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 26 九月 2025 15:23:25 +0800
Subject: [PATCH] 代码提交,查询部门下级递归

---
 ruoyi-system/src/main/resources/mapper/system/AssetTypeMapper.xml |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/AssetTypeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/AssetTypeMapper.xml
index 887b27b..b875c8c 100644
--- a/ruoyi-system/src/main/resources/mapper/system/AssetTypeMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/AssetTypeMapper.xml
@@ -55,5 +55,35 @@
         AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
         AND t2.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
     </select>
+    <select id="pageListDetail" resultType="com.ruoyi.system.vo.AssetStatisticsDetailVO">
+        select t1.* ,t2.type_name    as assetTypeName,t4.dept_name as ownershipDeptName,
+        case
+        when t1.use_dept_id is not null and t1.use_dept_id != '' then t3.dept_name
+        when t1.address is not null and t1.address != '' then t1.address
+        when t1.warehouse_name is not null and t1.warehouse_name != '' then t1.warehouse_name
+        else null
+        end as useName from asset_main
+        left join asset_type t2 on t2.id = t1.asset_type_id
+        left join t_dept t3 on t3.id = t1.use_dept_id
+        left join t_dept t4 on t4.id = t1.ownership_dept_id
+
+        where 1=1
+          <if test="query.assetTypeIdSecond != null">
+            AND t1.asset_type_id = #{query.assetTypeIdSecond}
+        </if>
+        <if test="query.deptId != null">
+            AND t1.asset_type_id = #{query.assetTypeIdSecond}
+        </if>
+          AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        <if test="query.assetMainIds != null and query.assetMainIds.size()>0">
+            AND t1.id IN
+            <foreach collection="query.assetMainIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+
+        order by t1.create_time  desc
+
+    </select>
 
 </mapper>

--
Gitblit v1.7.1