From e7a970151c40925eefa1fe837ac06e93594fcf82 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 26 五月 2026 09:56:17 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro_娌冲崡楣ゅ' into dev_pro_娌冲崡楣ゅ
---
src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java | 74 +++++++++++++++++++------------------
1 files changed, 38 insertions(+), 36 deletions(-)
diff --git a/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java b/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
index 59309fd..824ef6b 100644
--- a/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
+++ b/src/main/java/com/ruoyi/device/controller/DeviceLedgerController.java
@@ -12,62 +12,61 @@
import com.ruoyi.device.pojo.DeviceMaintenance;
import com.ruoyi.device.service.IDeviceLedgerService;
import com.ruoyi.framework.aspectj.lang.annotation.Anonymous;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.staff.dto.StaffOnJobExcelDto;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-@Api(tags = "璁惧鍙拌处绠$悊")
+@Tag(name = "璁惧鍙拌处绠$悊")
@RequestMapping("/device/ledger")
@RestController
+@AllArgsConstructor
public class DeviceLedgerController {
- @Autowired
private IDeviceLedgerService deviceLedgerService;
-
- @Autowired
private DeviceLedgerMapper deviceLedgerMapper;
-
- @Autowired
private DeviceMaintenanceMapper deviceMaintenanceMapper;
-
- @ApiOperation("璁惧鍙拌处鍒楄〃")
+ @Operation(summary = "璁惧鍙拌处鍒楄〃")
@GetMapping("/page")
- public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) {
- return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger));
+ public AjaxResult page(Page page, DeviceLedgerDto deviceLedger) {
+ return AjaxResult.success(deviceLedgerService.queryPage(page, deviceLedger));
}
+ @Log(title = "鏂板璁惧鍙拌处", businessType = BusinessType.INSERT)
@PostMapping()
- @ApiOperation("娣诲姞璁惧鍙拌处")
- public AjaxResult add(@RequestBody DeviceLedger deviceLedger) {
-
- return deviceLedgerService.saveDeviceLedger(deviceLedger);
+ @Operation(summary = "娣诲姞璁惧鍙拌处")
+ public AjaxResult add(@RequestBody DeviceLedgerDto deviceLedgerDto) {
+ return deviceLedgerService.saveDeviceLedger(deviceLedgerDto);
}
- @ApiOperation("鏍规嵁id鏌ヨ璁惧鍙拌处")
+ @Operation(summary = "鏍规嵁id鏌ヨ璁惧鍙拌处")
@GetMapping("/{id}")
public AjaxResult detail(@PathVariable Long id) {
- return AjaxResult.success(deviceLedgerService.getById(id));
+ DeviceLedgerDto deviceLedgerDto = deviceLedgerService.getDeviceLedgerDetail(id);
+ return AjaxResult.success(deviceLedgerDto);
}
- @PutMapping ()
- @ApiOperation("淇敼璁惧鍙拌处")
- public AjaxResult update(@RequestBody DeviceLedger deviceLedger) {
- return deviceLedgerService.updateDeviceLedger(deviceLedger);
+ @Log(title = "淇敼璁惧鍙拌处", businessType = BusinessType.UPDATE)
+ @PutMapping()
+ @Operation(summary = "淇敼璁惧鍙拌处")
+ public AjaxResult update(@RequestBody DeviceLedgerDto deviceLedgerDto) {
+ return deviceLedgerService.updateDeviceLedger(deviceLedgerDto);
}
+ @Log(title = "鍒犻櫎璁惧鍙拌处", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
- @ApiOperation("鍒犻櫎璁惧鍙拌处")
+ @Operation(summary = "鍒犻櫎璁惧鍙拌处")
public AjaxResult delete(@PathVariable("ids") ArrayList<Long> ids) {
boolean b = deviceLedgerService.removeBatchByIds(ids);
if (!b) {
@@ -76,21 +75,24 @@
return AjaxResult.success();
}
+ @Log(title = "瀵煎嚭璁惧鍙拌处", businessType = BusinessType.EXPORT)
@PostMapping("export")
- @ApiOperation("瀵煎嚭璁惧鍙拌处")
+ @Operation(summary = "瀵煎嚭璁惧鍙拌处")
public void export(HttpServletResponse response, Long[] ids) {
- deviceLedgerService.export(response, ids);
+ deviceLedgerService.export(response, ids);
}
- @ApiOperation("涓嬭浇妯℃澘")
+ @Log(title = "涓嬭浇璁惧鍙拌处妯℃澘", businessType = BusinessType.EXPORT)
+ @Operation(summary = "涓嬭浇妯℃澘")
@PostMapping("/downloadTemplate")
public void downloadTemplate(HttpServletResponse response) {
ExcelUtil<DeviceLedgerExeclDto> util = new ExcelUtil<>(DeviceLedgerExeclDto.class);
util.importTemplateExcel(response, "璁惧瀵煎叆妯℃澘");
}
+ @Log(title = "瀵煎叆璁惧鍙拌处", businessType = BusinessType.IMPORT)
@PostMapping("/import")
- @ApiOperation("瀵煎叆璁惧鍙拌处")
+ @Operation(summary = "瀵煎叆璁惧鍙拌处")
public AjaxResult importData(MultipartFile file) throws IOException {
Boolean b = deviceLedgerService.importData(file);
if (b) {
@@ -101,20 +103,20 @@
@GetMapping("getDeviceLedger")
- @ApiOperation("鑾峰彇璁惧鍙拌处")
- public AjaxResult getDeviceLedger( ) {
+ @Operation(summary = "鑾峰彇璁惧鍙拌处")
+ public AjaxResult getDeviceLedger() {
return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda()
- .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel)));
+ .select(DeviceLedger::getId, DeviceLedger::getDeviceName, DeviceLedger::getDeviceModel)));
}
@GetMapping("scanDevice")
- @ApiOperation("鑾峰彇璁惧鍙拌处")
+ @Operation(summary = "鑾峰彇璁惧鍙拌处")
@Anonymous
public AjaxResult scanDevice(Long id) {
List<DeviceMaintenance> list = deviceMaintenanceMapper.list1(id);
DeviceLedger deviceLedger = deviceLedgerMapper.selectById1(id);
- if (list.size()>0){
- deviceLedger.setUpdateTime(list.get(0).getMaintenanceActuallyTime());//鏈�鍚庣淮鎶ゆ椂闂�
+ if (!list.isEmpty()) {
+ deviceLedger.setUpdateTime(list.getFirst().getMaintenanceActuallyTime());//鏈�鍚庣淮鎶ゆ椂闂�
}
deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//涓嬫缁存姢鏃堕棿
return AjaxResult.success(deviceLedger);
--
Gitblit v1.9.3