设备操作接口

This commit is contained in:
gong
2025-11-24 14:21:01 +08:00
parent ee41fd2253
commit 97b03a8495
9 changed files with 395 additions and 3 deletions

View File

@@ -0,0 +1,63 @@
package com.czg.controller.admin;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.system.dto.SysDevicesDTO;
import com.czg.system.dto.SysDevicesPageDTO;
import com.czg.system.service.SysDevicesService;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 设备管理
*
* @author yjjie
* @date 2025/11/24 14:02
*/
@RestController
@RequestMapping("/admin/devices")
public class SysDeviceController {
@Resource
private SysDevicesService sysDevicesService;
/**
* 新增设备
*/
@PostMapping
@SaAdminCheckPermission(value = "devices:add", name = "新增设备")
public CzgResult<Long> addDevice(@RequestBody @Validated(InsertGroup.class) SysDevicesDTO param) {
return CzgResult.success(sysDevicesService.addDevice(param));
}
/**
* 修改设备
*/
@PutMapping
@SaAdminCheckPermission(value = "devices:update", name = "修改设备")
public CzgResult<Long> updateDevice(@RequestBody @Validated(UpdateGroup.class) SysDevicesDTO param) {
return CzgResult.success(sysDevicesService.updateDevice(param));
}
/**
* 删除设备
*/
@DeleteMapping("/{id}")
@SaAdminCheckPermission(value = "devices:delete", name = "删除设备")
public CzgResult<Long> deleteDevice(@PathVariable Long id) {
return CzgResult.success(sysDevicesService.deleteDevice(id));
}
/**
* 查询设备分页
*/
@GetMapping("page")
@SaAdminCheckPermission(value = "devices:page", name = "查询设备分页")
public CzgResult<Page<SysDevicesDTO>> queryDevice(SysDevicesPageDTO param) {
return CzgResult.success(sysDevicesService.queryDevice(param));
}
}