From 9a30a3a8d3862a9b2ce898535b7cb51c3ddac816 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期三, 20 五月 2026 16:01:11 +0800
Subject: [PATCH] refactor(controller): 将控制器响应结果统一为R类型并继承BaseController
---
src/main/java/com/ruoyi/device/service/impl/DeviceMaintenanceServiceImpl.java | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenanceServiceImpl.java b/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenanceServiceImpl.java
index fbf03ad..779714f 100644
--- a/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenanceServiceImpl.java
+++ b/src/main/java/com/ruoyi/device/service/impl/DeviceMaintenanceServiceImpl.java
@@ -15,7 +15,7 @@
import com.ruoyi.device.service.IDeviceMaintenanceService;
import com.ruoyi.device.vo.DeviceMaintenanceVo;
import com.ruoyi.device.vo.DeviceRepairVo;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper;
import com.ruoyi.measuringinstrumentledger.pojo.SpareParts;
import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord;
@@ -48,19 +48,19 @@
@Override
@Transactional(rollbackFor = Exception.class)
- public AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) {
+ public R<?> saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) {
boolean save = this.save(deviceMaintenance);
if (save){
// 澶勭悊鍥剧墖涓婁紶
fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs());
- return AjaxResult.success();
+ return R.ok();
}
- return AjaxResult.error();
+ return R.fail();
}
@Override
@Transactional(rollbackFor = Exception.class)
- public AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance) {
+ public R<?> updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance) {
DeviceMaintenance oldDeviceMaintenance = this.getById(deviceMaintenance.getId());
// 澶勭悊澶囦欢浣跨敤鎯呭喌
if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(deviceMaintenance.getSparePartsUseList())) {
@@ -85,7 +85,7 @@
record.setQuantity(sparePartUse.getQuantity());
sparePartsRequisitionRecordService.save(record);
} else {
- return AjaxResult.error("澶囦欢 " + spareParts.getName() + " 鏁伴噺涓嶈冻");
+ return R.fail("澶囦欢 " + spareParts.getName() + " 鏁伴噺涓嶈冻");
}
}
}
@@ -98,9 +98,9 @@
if (this.updateById(deviceMaintenance)) {
// 澶勭悊鍥剧墖涓婁紶
fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs());
- return AjaxResult.success();
+ return R.ok();
}
- return AjaxResult.error();
+ return R.fail();
}
@Override
--
Gitblit v1.9.3