package com.chuanxia.mcp.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chuanxia.mcp.bean.dto.UaQueryDto;
import com.chuanxia.mcp.bean.model.CdnUa;
import com.chuanxia.mcp.bean.vo.Result;
import com.chuanxia.mcp.service.CdnUaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@Slf4j
@RequestMapping("cdnUa")
@Api("ua管理")
public class CdnUaController {
    private final CdnUaService uaService;

    @PostMapping("listPage")
    @ApiOperation("ua分页列表")
    public Result<IPage<CdnUa>> listPage(@RequestBody UaQueryDto queryDto) {
        return uaService.listPage(queryDto);
    }

    @PostMapping("saveUa")
    @ApiOperation("新增ua")
    public Result<String> saveUa(@RequestBody CdnUa ua) {
        return uaService.saveUa(ua);
    }

    @PostMapping("updateUa")
    @ApiOperation("修改ua")
    public Result<String> updateUa(@RequestBody CdnUa ua) {
        return uaService.updateUa(ua);
    }
}
