From 82cc32a8af4aee9c414f5b26627b54923cfb1dde Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期二, 30 九月 2025 18:32:48 +0800
Subject: [PATCH] 资产维修记录列表查询接口实体类

---
 ruoyi-system/src/main/resources/mapper/system/OaApprovalApplicationStorageMapper.xml |   48 +++++++++++++++++++++++++++---------------------
 1 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/OaApprovalApplicationStorageMapper.xml b/ruoyi-system/src/main/resources/mapper/system/OaApprovalApplicationStorageMapper.xml
index be9dd4f..695809a 100644
--- a/ruoyi-system/src/main/resources/mapper/system/OaApprovalApplicationStorageMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/OaApprovalApplicationStorageMapper.xml
@@ -20,46 +20,52 @@
     <!-- 分页查询:资产入库申请列表(关联审批记录与资产类型) -->
     <select id="selectApplicationStoragePage" resultType="com.ruoyi.system.vo.asset.OaApprovalApplicationStoragePageVO">
         SELECT
-            oas.id                               AS id,
-            aaa.dept_name                        AS deptName,
-            aaa.application_code                 AS applicationCode,
-            oas.title                            AS title,
-            CASE WHEN at2.level = 2 THEN at1.type_name ELSE at2.type_name END AS firstAssetTypeName,
-            CASE WHEN at2.level = 2 THEN at2.type_name ELSE NULL END         AS secondAssetTypeName,
-            aaa.applicant_name                   AS applicantName,
-            oas.storage_time                     AS storageTime,
-            oas.storage_type                     AS storageType,
-            aaa.approval_status                  AS approvalStatus
+        aaa.id,
+        oas.asset_type_id,
+        aaa.dept_name,
+        aaa.application_code,
+        oas.title,
+        CASE WHEN at2.level = 2 THEN at1.type_name ELSE at2.type_name END AS firstAssetTypeName,
+        CASE WHEN at2.level = 2 THEN at2.type_name ELSE NULL END AS secondAssetTypeName,
+        aaa.applicant_name,
+        oas.storage_time,
+        oas.storage_type,
+        aaa.approval_status
         FROM oa_approval_application_storage oas
-                 INNER JOIN oa_approval_applications aaa ON aaa.id = oas.approval_application_id
-                 LEFT JOIN asset_type at2 ON at2.id = oas.asset_type_id
-                 LEFT JOIN asset_type at1 ON at1.id = (CASE WHEN at2.level = 2 THEN at2.parent_id ELSE at2.id END)
+        INNER JOIN oa_approval_applications aaa ON aaa.id = oas.approval_application_id
+        LEFT JOIN asset_type at2 ON at2.id = oas.asset_type_id
+        LEFT JOIN asset_type at1 ON at1.id = (CASE WHEN at2.level = 2 THEN at2.parent_id ELSE at2.id END)
+        LEFT JOIN t_dept d ON aaa.dept_id = d.id
         <where>
             AND aaa.disabled = 0
             <if test="query != null and query.keyword != null and query.keyword != ''">
                 AND (
                 oas.title LIKE CONCAT('%', #{query.keyword}, '%')
-                OR  aaa.application_code LIKE CONCAT('%', #{query.keyword}, '%')
-                OR  aaa.dept_name LIKE CONCAT('%', #{query.keyword}, '%')
+                OR aaa.application_code LIKE CONCAT('%', #{query.keyword}, '%')
+                OR aaa.dept_name LIKE CONCAT('%', #{query.keyword}, '%')
                 )
+            </if>
+            <if test="query.deptId != null">
+                AND (d.id = #{query.deptId} OR FIND_IN_SET(#{query.deptId}, d.parent_id))
             </if>
         </where>
         ORDER BY oas.storage_time DESC, oas.id DESC
     </select>
     <select id="pageList" resultType="com.ruoyi.system.vo.StorageListVO">
-        select t1.*,t2.type_name    as assetTypeName,
+        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 oa_approval_application_storage_asset t1
+                             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 t1.approval_application_id = #{query.id}
+          AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
 
-
-               from asset_main t1
-                             left join asset_type t2 on t3.id = t1.asset_type_id
-                             left join t_dept t3 on t4.id = t3.ownership_dept_id
-        where t1.approval_application_id = #{query.approvalApplicationId}
         order by t1.create_time  desc
 
 

--
Gitblit v1.7.1