package com.securitycontrol.background.controller;

import com.securitycontrol.background.service.IDeviceOfBdService;
import com.securitycontrol.common.core.web.controller.BaseController;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.core.web.page.TableDataInfo;
import com.securitycontrol.common.log.annotation.Log;
import com.securitycontrol.common.log.enums.OperationType;
import com.securitycontrol.entity.background.vo.DeviceBdDetailVo;
import com.securitycontrol.entity.background.dto.DeviceBdDto;
import com.securitycontrol.entity.background.vo.DeviceBdChildVo;
import com.securitycontrol.entity.background.vo.DeviceBdVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author：cwchen
 * @date：2024-03-20-13:10
 * @version：1.0
 * @description：边带设备-web层
 */
@RestController
@RequestMapping("/back/deviceBd/")
public class DeviceOfBdController extends BaseController {

    @Resource(name = "IDeviceOfBdService")
    private IDeviceOfBdService service;

    @ApiOperation(value = "获取边带列表")
    @GetMapping("getDeviceBdList")
    @Log(title = "设备管理", menu = "设备管理->边带管理", grade = OperationType.QUERY_BUSINESS, details = "查询边带列表", type = "业务日志")
    public TableDataInfo getDeviceBdList(DeviceBdDto dto) {
        startPage();
        List<DeviceBdVo> list = service.getDeviceBdList(dto);
        return getDataTable(list);
    }

    @ApiOperation(value = "新增边带")
    @PostMapping("addDeviceBd")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.ADD_BUSINESS, details = "新增边带", type = "业务日志")
    public AjaxResult addDeviceBd(@RequestBody DeviceBdVo vo) {
        return service.addOrUpdateDeviceBd(vo);
    }

    @ApiOperation(value = "修改边带设备")
    @PostMapping("editDeviceBd")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.UPDATE_BUSINESS, details = "修改边带", type = "业务日志")
    public AjaxResult editDeviceBd(@RequestBody DeviceBdVo vo) {
        return service.addOrUpdateDeviceBd(vo);
    }

    @ApiOperation(value = "边带详情")
    @GetMapping("getDeviceBdById")
    public AjaxResult getDeviceBdById(DeviceBdDto dto) {
        return service.getDeviceBdById(dto);
    }

    @ApiOperation(value = "删除边带设备")
    @PostMapping("delDeviceBdById")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.DELETE_BUSINESS, details = "删除边带设备", type = "业务日志")
    public AjaxResult delDeviceBdById(@RequestBody DeviceBdDto dto) {
        return service.delDeviceBdById(dto);
    }

    @ApiOperation(value = "获取边带子设备列表")
    @GetMapping("getDeviceBdChildList")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.QUERY_BUSINESS, details = "查询边带子设备列表", type = "业务日志")
    public TableDataInfo getDeviceBdChildList(DeviceBdDto dto) {
        startPage();
        List<DeviceBdChildVo> list = service.getDeviceBdChildList(dto);
        return getDataTable(list);
    }

    @ApiOperation(value = "新增边带子设备")
    @PostMapping("addDeviceBdChild")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.ADD_BUSINESS, details = "新增边带子设备", type = "业务日志")
    public AjaxResult addDeviceBdChild(@RequestBody DeviceBdChildVo vo) {
        return service.addOrUpdateDeviceBdChild(vo);
    }

    @ApiOperation(value = "修改边带子设备")
    @PostMapping("editDeviceBdChild")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.UPDATE_BUSINESS, details = "修改边带子设备", type = "业务日志")
    public AjaxResult editDeviceBdChild(@RequestBody DeviceBdChildVo vo) {
        return service.addOrUpdateDeviceBdChild(vo);
    }

    @ApiOperation(value = "边带子设备详情")
    @GetMapping("getDeviceBdChildById")
    public AjaxResult getDeviceBdChildById(DeviceBdDto dto) {
        return service.getDeviceBdChildById(dto);
    }

    @ApiOperation(value = "删除边带设备")
    @PostMapping("delDeviceBdChildById")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.DELETE_BUSINESS, details = "删除边带设备", type = "业务日志")
    public AjaxResult delDeviceBdChildById(@RequestBody DeviceBdDto dto) {
        return service.delDeviceBdChildById(dto);
    }

    @ApiOperation(value = "获取边带子设备详情列表")
    @GetMapping("getDeviceBdChildDetailList")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.QUERY_BUSINESS, details = "查询边带子设备详情列表", type = "业务日志")
    public TableDataInfo getDeviceBdChildDetailList(DeviceBdDto dto) {
        startPage();
        List<DeviceBdDetailVo> list = service.getDeviceBdChildDetailList(dto);
        return getDataTable(list);
    }

    @ApiOperation(value = "新增边带子设备详情数据")
    @PostMapping("addDeviceBdChildDetail")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.ADD_BUSINESS, details = "新增边带子设备详情数据", type = "业务日志")
    public AjaxResult addDeviceBdChildDetail(@RequestBody DeviceBdDetailVo vo) {
        return service.addOrUpdateDeviceBdChildDetail(vo);
    }

    @ApiOperation(value = "修改边带子设备详情数据")
    @PostMapping("editDeviceBdChildDetail")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.UPDATE_BUSINESS, details = "修改边带子设备详情数据", type = "业务日志")
    public AjaxResult editDeviceBdChildDetail(@RequestBody DeviceBdDetailVo vo) {
        return service.addOrUpdateDeviceBdChildDetail(vo);
    }

    @ApiOperation(value = "边带子设备详情数据")
    @GetMapping("getDeviceBdChildDetailById")
    public AjaxResult getDeviceBdChildDetailById(DeviceBdDto dto) {
        return service.getDeviceBdChildDetailById(dto);
    }

    @ApiOperation(value = "删除边带子设备详情数据")
    @PostMapping("delDeviceBdChildDetail")
    @Log(title = "设备管理", menu = "设备管理->边带设备管理", grade = OperationType.DELETE_BUSINESS, details = "删除边带子设备详情", type = "业务日志")
    public AjaxResult delDeviceBdChildDetail(@RequestBody DeviceBdDto dto) {
        return service.delDeviceBdChildDetail(dto);
    }

}
