package com.om.controller.admin;


import com.om.entity.dto.VciQueryPageDTO;
import com.om.entity.po.VciInfo;
import com.om.entity.vo.UserVciVO;
import com.om.entity.vo.VciQueryPageVO;
import com.om.service.IVciInfoService;
import com.om.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

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

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bmmx
 * @since 2024-02-27
 */
@RestController
@Api(tags = "vci设备信息模块")
@RequestMapping("/web/vci-info")
public class VciInfoController {
    @Resource
    private IVciInfoService vciInfoService;

    @PostMapping("add")
    @ApiOperation("新增vci设备")
    public Result addVci(@RequestBody VciInfo vciInfo){
        return vciInfoService.addVci(vciInfo);
    }

    @PostMapping("addList")
    @ApiOperation("批量新增vci设备")
    public Result addList(@RequestBody List<VciInfo> vciInfos){
        return vciInfoService.addList(vciInfos);
    }


    @GetMapping("deleteByNum")
    @ApiOperation("根据VciNum删除vci设备")
    public Result deleteByNum(@RequestParam String vciNum){
        return vciInfoService.deleteByNum(vciNum);
    }

    @GetMapping("updateState")
    @ApiOperation("修改vci设备状态")
    public Result updateState(@RequestParam("id") Integer id ,@RequestParam("state") Integer state){
        return vciInfoService.updateState(id,state);
    }

    @GetMapping("getList")
    @ApiOperation("获取vci设备列表")
    public Result getList(){
        return vciInfoService.getList();
    }

    @GetMapping("getUserList")
    @ApiOperation("根据vciid获取用户列表")
    public Result<List<UserVciVO>> getUserList(@RequestParam Integer vciId){
        return vciInfoService.getUserList(vciId);
    }

    @PostMapping("getPageList")
    @ApiOperation("分页获取vci设备列表")
    public Result<VciQueryPageVO> getPageList(@RequestBody VciQueryPageDTO dto){
        return vciInfoService.getPageList(dto);
    }



}
