init web
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
package com.sunyard.chsm.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sunyard.chsm.dto.DeviceGroupDTO;
|
||||
import com.sunyard.chsm.model.R;
|
||||
import com.sunyard.chsm.service.DeviceGroupService;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 设备组管理接口
|
||||
*
|
||||
* @author liulu
|
||||
* @since 2024/10/21
|
||||
*/
|
||||
@RestController("sp_DeviceGroupController")
|
||||
@RequestMapping("/device/group")
|
||||
public class DeviceGroupController {
|
||||
|
||||
@Resource
|
||||
private DeviceGroupService deviceGroupService;
|
||||
|
||||
/**
|
||||
* 分页查询设备组列表
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @return 分页列表
|
||||
*/
|
||||
@GetMapping("/pageList")
|
||||
public R<Page<DeviceGroupDTO.View>> servicePageList(DeviceGroupDTO.Query query) {
|
||||
|
||||
Page<DeviceGroupDTO.View> page = deviceGroupService.selectPageList(query);
|
||||
|
||||
return R.data(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加设备组
|
||||
*
|
||||
* @param save 参数
|
||||
* @return id
|
||||
*/
|
||||
@PostMapping
|
||||
public R<String> save(@Valid @RequestBody DeviceGroupDTO.Save save) {
|
||||
Long id = deviceGroupService.save(save);
|
||||
return R.data(String.valueOf(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备组
|
||||
*
|
||||
* @param update 参数
|
||||
* @return void
|
||||
*/
|
||||
@PutMapping
|
||||
public R<Void> update(@Valid @RequestBody DeviceGroupDTO.Save update) {
|
||||
deviceGroupService.update(update);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备组
|
||||
*
|
||||
* @param id id
|
||||
* @return void
|
||||
*/
|
||||
@DeleteMapping
|
||||
public R<Void> delete(Long id) {
|
||||
deviceGroupService.delete(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user