package com.mosty.spxl.controller;

import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.entity.log.BusinessType;
import com.mosty.common.base.entity.log.Log;
import com.mosty.common.token.JwtSysUser;
import com.mosty.base.model.dto.spxl.TbSpxlSpxlfaInsertDto;
import com.mosty.base.model.entity.spxl.TbSpxlSpxlfa;
import com.mosty.spxl.service.TbSpxlSpxlfaSxtService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author dw
 * @since 2022/7/11
 **/
@Api(tags = "视频巡逻方案-摄像头接口")
@RestController
@AllArgsConstructor
@RequestMapping("/tbSpxlSpxlfaSxt")
public class TbSpxlSpxlfaSxtController {

    private final TbSpxlSpxlfaSxtService tbSpxlSpxlfaSxtService;

    @ApiOperation("添加摄像头配置信息")
    @JwtSysUser
    @Log(title = "添加摄像头配置信息", businessType = BusinessType.INSERT)
    @PostMapping
    public ResponseResult<Integer> insertEntity(@RequestBody TbSpxlSpxlfaInsertDto dto) {
        return ResponseResult.success(this.tbSpxlSpxlfaSxtService.insertEntity(dto));
    }

    @ApiOperation("修改摄像头配置信息")
    @JwtSysUser
    @Log(title = "修改摄像头配置信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public ResponseResult<Integer> updateSxtPz(@RequestBody TbSpxlSpxlfaInsertDto dto) {
        return ResponseResult.success(this.tbSpxlSpxlfaSxtService.updateSxtPz(dto));
    }

    @ApiOperation("查询摄像头配置信息")
    @JwtSysUser
    @GetMapping
    public ResponseResult<TbSpxlSpxlfa> pzInfo(String faid) {
        return ResponseResult.success(this.tbSpxlSpxlfaSxtService.pzInfo(faid));
    }
}
