From c62fa713ee37db1ff7520d2ca6545f569395bb40 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 10 四月 2026 16:59:16 +0800
Subject: [PATCH] yys 1.app推送接口 2.数采缓存 3.数采历史数据
---
src/main/resources/mapper/device/DeviceLedgerMapper.xml | 103 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 64 insertions(+), 39 deletions(-)
diff --git a/src/main/resources/mapper/device/DeviceLedgerMapper.xml b/src/main/resources/mapper/device/DeviceLedgerMapper.xml
index 4a8f435..67522aa 100644
--- a/src/main/resources/mapper/device/DeviceLedgerMapper.xml
+++ b/src/main/resources/mapper/device/DeviceLedgerMapper.xml
@@ -7,70 +7,95 @@
<select id="queryPage" resultType="com.ruoyi.device.dto.DeviceLedgerDto">
SELECT
- dl.id,
- dl.device_name,
- dl.device_model,
- dl.supplier_name,
- dl.unit,
- dl.number,
- dl.tax_including_price_unit,
- dl.tax_including_price_total,
- dl.tax_rate,
- dl.un_tax_including_price_total,
- dl.create_time,
- dl.update_time ,
- su.user_name AS createUser,
- dl.update_user,
- dl.tenant_id
+ dl.id,
+ dl.device_name,
+ dl.device_model,
+ dl.device_brand,
+ dl.storage_location,
+ dl.area_id,
+ da.area_name,
+ dl.supplier_name,
+ dl.unit,
+ dl.number,
+ dl.status,
+ dl.plan_runtime_time,
+ dl.start_runtime_time,
+ dl.end_runtime_time,
+ dl.runtime_duration,
+ dl.tax_including_price_unit,
+ dl.tax_including_price_total,
+ dl.tax_rate,
+ dl.un_tax_including_price_total,
+ dl.create_time,
+ dl.update_time,
+ su.nick_name AS createUser,
+ dl.update_user,
+ dl.tenant_id,
+ dl.is_depr,
+ dl.annual_depreciation_amount,
+ dl.type
FROM device_ledger dl
- left join sys_user su on dl.create_user = su.user_id
+ LEFT JOIN sys_user su ON dl.create_user = su.user_id
+ LEFT JOIN device_area da ON dl.area_id = da.id
<where>
- <!-- 璁惧鍚嶇О -->
<if test="deviceLedger.deviceName != null and deviceLedger.deviceName != ''">
- AND device_name LIKE CONCAT('%', #{deviceLedger.deviceName}, '%')
+ AND dl.device_name LIKE CONCAT('%', #{deviceLedger.deviceName}, '%')
</if>
-
- <!-- 瑙勬牸鍨嬪彿 -->
<if test="deviceLedger.deviceModel != null and deviceLedger.deviceModel != ''">
- AND device_model LIKE CONCAT('%', #{deviceLedger.deviceModel}, '%')
+ AND dl.device_model LIKE CONCAT('%', #{deviceLedger.deviceModel}, '%')
</if>
-
- <!-- 渚涘簲鍟嗗悕绉� -->
<if test="deviceLedger.supplierName != null and deviceLedger.supplierName != ''">
- AND supplier_name LIKE CONCAT('%', #{deviceLedger.supplierName}, '%')
+ AND dl.supplier_name LIKE CONCAT('%', #{deviceLedger.supplierName}, '%')
</if>
-
- <!-- 鍗曚綅 -->
+ <if test="deviceLedger.areaId != null">
+ AND dl.area_id = #{deviceLedger.areaId}
+ </if>
+ <if test="deviceLedger.areaName != null and deviceLedger.areaName != ''">
+ AND da.area_name LIKE CONCAT('%', #{deviceLedger.areaName}, '%')
+ </if>
<if test="deviceLedger.unit != null and deviceLedger.unit != ''">
- AND unit = #{deviceLedger.unit}
+ AND dl.unit = #{deviceLedger.unit}
</if>
-
- <!-- 褰曞叆浜� -->
<if test="deviceLedger.createUser != null and deviceLedger.createUser != ''">
- AND create_user LIKE CONCAT('%', #{deviceLedger.createUser}, '%')
+ AND dl.create_user LIKE CONCAT('%', #{deviceLedger.createUser}, '%')
</if>
-
- <!-- 鏇存柊浜� -->
<if test="deviceLedger.updateUser != null and deviceLedger.updateUser != ''">
- AND update_user LIKE CONCAT('%', #{deviceLedger.updateUser}, '%')
+ AND dl.update_user LIKE CONCAT('%', #{deviceLedger.updateUser}, '%')
</if>
-
<if test="deviceLedger.entryDateStart != null and deviceLedger.entryDateStart != '' ">
AND dl.create_time >= DATE_FORMAT(#{deviceLedger.entryDateStart},'%Y-%m-%d')
</if>
<if test="deviceLedger.entryDateEnd != null and deviceLedger.entryDateEnd != '' ">
- AND dl.create_time <= DATE_FORMAT(#{deviceLedger.entryDateEnd},'%Y-%m-%d')
+ AND dl.create_time <= DATE_FORMAT(#{deviceLedger.entryDateEnd},'%Y-%m-%d')
</if>
-
- <!-- 绉熸埛ID -->
<if test="deviceLedger.tenantId != null">
- AND tenant_id = #{deviceLedger.tenantId}
+ AND dl.tenant_id = #{deviceLedger.tenantId}
</if>
</where>
- ORDER BY create_time DESC
+ ORDER BY dl.create_time DESC
</select>
+
<select id="deviceLedgerExportList" resultType="com.ruoyi.device.execl.DeviceLedgerExeclDto">
</select>
+ <select id="selectById1" resultType="com.ruoyi.device.pojo.DeviceLedger">
+ select *
+ from device_ledger
+ where id = #{id}
+ </select>
+
+ <select id="getDeviceTypeDistributionByYear"
+ resultType="com.ruoyi.account.dto.DeviceTypeDetail"
+ parameterType="java.lang.Integer">
+ SELECT
+ `type`,
+ SUM(`number`) AS `count`,
+ SUM(tax_including_price_unit) AS amount
+ FROM device_ledger
+ WHERE YEAR(create_time) = #{year}
+ AND type IS NOT NULL
+ GROUP BY type
+ </select>
+
</mapper>
--
Gitblit v1.9.3