From 4f3a98f19143865cdc1de4791e8a95d96bd40c65 Mon Sep 17 00:00:00 2001 From: maven <2163098428@qq.com> Date: 星期五, 01 八月 2025 13:27:59 +0800 Subject: [PATCH] yys 密码已重置 --- cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java | 81 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-) diff --git a/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java new file mode 100644 index 0000000..46fadff --- /dev/null +++ b/cnas-device/src/main/java/com/ruoyi/device/controller/DeviceMaintenanceController.java @@ -0,0 +1,81 @@ +package com.ruoyi.device.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.Result; +import com.ruoyi.common.core.domain.entity.User; +import com.ruoyi.device.dto.DeviceMaintenanceDto; +import com.ruoyi.device.pojo.DeviceMaintenance; +import com.ruoyi.device.service.DeviceMaintenanceService; +import com.ruoyi.system.mapper.UserMapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; + +/** + * todo: 瀛欐渤婊� + */ +@RestController +@Api(tags = "璁惧缁存姢淇濆吇") +@RequestMapping("/deviceMaintain") +public class DeviceMaintenanceController { + + @Autowired + private DeviceMaintenanceService deviceMaintenanceService; + + @Autowired + private UserMapper userMapper; + + + /** + * 璁惧缁存姢鍒嗛〉鏌ヨ + * @param deviceMaintenance + * @return + */ + @ApiOperation(value = "璁惧缁存姢鍒嗛〉鏌ヨ") + @GetMapping("/selectDeviceMaintenancePage") + public Result selectDeviceMaintenancePage(Page page, DeviceMaintenanceDto deviceMaintenance){ + return Result.success(deviceMaintenanceService.selectDeviceMaintenancePage(page, deviceMaintenance)); + } + + + /** + * 鏂板淇敼璁惧缁存姢淇濆吇 + * @param deviceMaintenance + * @return + */ + @ApiOperation(value = "鏂板淇敼璁惧缁存姢淇濆吇") + @PostMapping("/addDeviceMaintenance") + public Result addDeviceMaintenance(@RequestBody DeviceMaintenance deviceMaintenance){ + if (deviceMaintenance.getDeviceId() == null) { + throw new RuntimeException("缂哄皯璁惧id"); + } + User user = userMapper.selectById(deviceMaintenance.getMaintenanceUserId()); + deviceMaintenance.setMaintenanceUserName(user.getName()); + + return Result.success(deviceMaintenanceService.saveOrUpdate(deviceMaintenance)); + } + + /** + * 鍒犻櫎淇敼璁惧缁存姢淇濆吇 + * @param id + * @return + */ + @ApiOperation(value = "鍒犻櫎淇敼璁惧缁存姢淇濆吇") + @DeleteMapping("/deleteDeviceMaintenance") + public Result deleteDeviceMaintenance(Integer id){ + return Result.success(deviceMaintenanceService.removeById(id)); + } + + /** + * 瀵煎嚭璁惧缁存姢淇濆吇 + */ + @ApiOperation("瀵煎嚭璁惧缁存姢淇濆吇") + @GetMapping("/exportDeviceMaintenance") + public void exportDeviceMaintenance(@RequestParam("deviceId") Integer deviceId, HttpServletResponse response) { + deviceMaintenanceService.exportDeviceMaintenance(deviceId, response); + } + +} -- Gitblit v1.9.3