From 72a372cb26c4ba489efae6b65dbf9fdfea1b5815 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期三, 19 十一月 2025 16:53:11 +0800
Subject: [PATCH] yys 1.劳保台账修改

---
 src/main/java/com/ruoyi/device/mapper/DeviceMaintenanceMapper.java |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/ruoyi/device/mapper/DeviceMaintenanceMapper.java b/src/main/java/com/ruoyi/device/mapper/DeviceMaintenanceMapper.java
index 5fde866..4225bf0 100644
--- a/src/main/java/com/ruoyi/device/mapper/DeviceMaintenanceMapper.java
+++ b/src/main/java/com/ruoyi/device/mapper/DeviceMaintenanceMapper.java
@@ -1,13 +1,19 @@
 package com.ruoyi.device.mapper;
 
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.device.dto.DeviceMaintenanceDto;
 import com.ruoyi.device.dto.DeviceRepairDto;
+import com.ruoyi.device.dto.RepairAmountGroupDTO;
 import com.ruoyi.device.pojo.DeviceMaintenance;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 @Mapper
 public interface DeviceMaintenanceMapper extends BaseMapper<DeviceMaintenance> {
@@ -15,4 +21,34 @@
     IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto);
 
     DeviceMaintenanceDto detailById(Long id);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<DeviceMaintenance> list1(Long id);
+
+    /**
+     * 鎸夆�滄寚瀹氬勾浠界殑骞存湀+璁惧鍙拌处id鈥濆垎缁勶紝姹傚拰鎶ヤ慨閲戦
+     * @param year 鍓嶇浼犲叆鐨勫勾浠斤紙濡�"2025"锛�
+     */
+    @Select("SELECT " +
+            "  DATE_FORMAT(maintenance_actually_time, '%m') AS repairYearMonth, " +
+            "  device_ledger_id AS deviceLedgerId, " +
+            "  SUM(maintenance_price) AS totalRepairPrice " +
+            "FROM device_maintenance " +
+            "WHERE DATE_FORMAT(maintenance_actually_time, '%Y') = #{year} " + // 鍙煡璇㈡寚瀹氬勾浠界殑鏁版嵁
+            "GROUP BY device_ledger_id,DATE_FORMAT(maintenance_actually_time, '%Y-%m')  " +
+            "ORDER BY repairYearMonth ASC") // 鎸夋湀浠芥帓搴忥紝鏂逛究鍓嶇灞曠ず
+    List<RepairAmountGroupDTO> groupByMonthAndDeviceLedger(@Param("year") String year);
+
+    /**
+     * 鎸夆�滆澶囧彴璐d鈥濆垎缁勶紝姹傚拰鎶ヤ慨閲戦
+     * @param year 鍓嶇浼犲叆鐨勫勾浠斤紙濡�"2025"锛�
+     */
+    @Select("SELECT " +
+            "  device_ledger_id AS deviceLedgerId, " +
+            "  SUM(maintenance_price) AS totalRepairPrice " +
+            "FROM device_maintenance " +
+            "WHERE DATE_FORMAT(maintenance_actually_time, '%Y') = #{year} " + // 鍙煡璇㈡寚瀹氬勾浠界殑鏁版嵁
+            "GROUP BY device_ledger_id ") // 鎸夋湀浠芥帓搴忥紝鏂逛究鍓嶇灞曠ず
+    List<RepairAmountGroupDTO> groupByDeviceLedger(@Param("year") String year);
+
 }

--
Gitblit v1.9.3