From 3e35dfd20aeef3473c4a07578724a955b91c4d09 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期四, 23 十月 2025 21:04:45 +0800
Subject: [PATCH] bug修改
---
ruoyi-system/src/main/resources/mapper/system/AssetMainMapper.xml | 18 +++++++++++++++---
ruoyi-system/src/main/java/com/ruoyi/system/query/AssetMainPageQuery.java | 3 +++
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/AssetMainPageQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/AssetMainPageQuery.java
index ada367e..0d8a410 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/query/AssetMainPageQuery.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/AssetMainPageQuery.java
@@ -27,6 +27,9 @@
@ApiModelProperty("关键字(资产名称/资产编码)")
private String keyword;
+ @ApiModelProperty("使用部门")
+ private String useDeptOrLocation;
+
@ApiModelProperty("所属部门ID,前端不传")
private Integer deptId;
}
diff --git a/ruoyi-system/src/main/resources/mapper/system/AssetMainMapper.xml b/ruoyi-system/src/main/resources/mapper/system/AssetMainMapper.xml
index 5b99324..65c5362 100644
--- a/ruoyi-system/src/main/resources/mapper/system/AssetMainMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/AssetMainMapper.xml
@@ -47,7 +47,8 @@
<!-- 分页查询:审批通过的资产列表(关联审批记录、资产类型与部门) -->
<select id="selectApprovedAssetPage" resultType="com.ruoyi.system.vo.asset.AssetMainPageVO">
SELECT
- am.id AS id,
+ DISTINCT
+ am.id,
am.asset_code AS assetCode,
am.asset_name AS assetName,
at.type_name AS assetTypeName,
@@ -80,7 +81,7 @@
AND IFNULL(am.is_borrowed, 0) = 0
AND ( oaa.id IS NULL OR oaa.approval_status != 0 )
<if test="query != null and query.assetTypeId != null">
- AND am.asset_type_id = #{query.assetTypeId}
+ AND (am.asset_type_id = #{query.assetTypeId} OR FIND_IN_SET(#{query.assetTypeId},at.parent_id))
</if>
<if test="query != null and query.ownershipDeptId != null">
AND am.ownership_dept_id = #{query.ownershipDeptId}
@@ -95,11 +96,17 @@
<if test="query.deptId != null">
AND (od.id = #{query.deptId} OR FIND_IN_SET(#{query.deptId}, od.parent_id))
</if>
+ <if test="query.useDeptOrLocation!=null and query.useDeptOrLocation!=''">
+ AND ((ud.dept_name LIKE CONCAT('%',#{query.useDeptOrLocation}, '%') AND am.address_type = 0)
+ OR (am.warehouse_name LIKE CONCAT('%',#{query.useDeptOrLocation}, '%') AND am.address_type = 1)
+ OR (am.address LIKE CONCAT('%',#{query.useDeptOrLocation}, '%') AND am.address_type = 2))
+ </if>
</where>
ORDER BY COALESCE(oas.storage_time, DATE(am.create_time)) DESC, am.id DESC
</select>
<select id="getAssetPageList" resultType="com.ruoyi.system.vo.asset.AssetMainPageVO">
SELECT
+ DISTINCT
am.*,
at.type_name AS assetTypeName,
od.dept_name AS ownershipDeptName,
@@ -127,7 +134,7 @@
AND IFNULL(aaa.disabled, 0) = 0
AND aaa.approval_status = 2 AND aaa.approval_id = '${@com.ruoyi.system.emums.ApprovalTypeEnum@IN_STOCK.getCode()}'
<if test="query != null and query.assetTypeId != null">
- AND am.asset_type_id = #{query.assetTypeId}
+ AND (am.asset_type_id = #{query.assetTypeId} OR FIND_IN_SET(#{query.assetTypeId},at.parent_id))
</if>
<if test="query != null and query.ownershipDeptId != null">
AND am.ownership_dept_id = #{query.ownershipDeptId}
@@ -142,6 +149,11 @@
<if test="query.deptId != null">
AND (od.id = #{query.deptId} OR FIND_IN_SET(#{query.deptId}, od.parent_id))
</if>
+ <if test="query.useDeptOrLocation!=null and query.useDeptOrLocation!=''">
+ AND ((ud.dept_name LIKE CONCAT('%',#{query.useDeptOrLocation}, '%') AND am.address_type = 0)
+ OR (am.warehouse_name LIKE CONCAT('%',#{query.useDeptOrLocation}, '%') AND am.address_type = 1)
+ OR (am.address LIKE CONCAT('%',#{query.useDeptOrLocation}, '%') AND am.address_type = 2))
+ </if>
</where>
ORDER BY COALESCE(oas.storage_time, DATE(am.create_time)) DESC, am.id DESC
</select>
--
Gitblit v1.7.1