package com.citygis.web.controller;


import com.citygis.common.annotation.Log;
import com.citygis.common.core.controller.BaseController;
import com.citygis.common.core.domain.AjaxResult;
import com.citygis.common.core.page.TableDataInfo;
import com.citygis.common.enums.BusinessType;
import com.citygis.web.domain.TabAccessReady;
import com.citygis.web.service.ITabAccessReadyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 接入基本准备表 前端控制器
 * </p>
 *
 * @author citygis
 * @since 2025-01-10
 */
@Api(tags = "接入基本准备")
@RestController
@RequestMapping("/web/tab-access-ready")
public class TabAccessReadyController extends BaseController {

    @Resource
    ITabAccessReadyService tabAccessReadyService;

    @Log(title = "接入基本准备", businessType = BusinessType.SELECT)
    @ApiOperation("接入基本准备详情")
    @GetMapping("/getTabAccessAndReadyById/{id}")
    public AjaxResult getTabAccessAndReadyById(@PathVariable Long id) {
        return tabAccessReadyService.getTabAccessAndReadyById(id);
    }

    @Log(title = "接入基本准备", businessType = BusinessType.INSERT)
    @ApiOperation("添加接入基本准备")
    @PostMapping("/insertTabAccessReady")
    public AjaxResult insertTabAccessReady(@Validated @RequestBody TabAccessReady tabAccessReady) {
        return tabAccessReadyService.insertTabAccessReady(tabAccessReady);
    }

    @Log(title = "修改接入基本准备", businessType = BusinessType.UPDATE)
    @ApiOperation("修改接入基本准备接入方列表")
    @PostMapping("/updateTabAccessReadyById")
    public AjaxResult updateTabAccessReadyById(@RequestBody TabAccessReady tabAccessReady) {
        return tabAccessReadyService.updateTabAccessReadyById(tabAccessReady);
    }

    @Log(title = "删除接入基本准备接入方列表", businessType = BusinessType.DELETE)
    @ApiOperation("删除接入基本准备接入方列表")
    @DeleteMapping("/falseDeleteTabAccessAndReadyById/{id}")
    public AjaxResult falseDeleteTabAccessAndReadyById(@PathVariable Long id) {
        return tabAccessReadyService.falseDeleteTabAccessAndReadyById(id);
    }

    @Log(title = "接入基本准备", businessType = BusinessType.SELECT)
    @ApiOperation("接入基本准备列表")
    @GetMapping("/list")
    public TableDataInfo list(TabAccessReady tabAccessReady) {
        startPage();
        return getDataTable(tabAccessReadyService.list(tabAccessReady));
    }

    @Log(title = "接入基本准备", businessType = BusinessType.UPDATE)
    @ApiOperation("修改接入基本准备状态")
    @PostMapping("/updateStatusById")
    public AjaxResult updateStatusById(@RequestBody TabAccessReady tabAccessReady) {
        return tabAccessReadyService.updateStatusById(tabAccessReady);
    }

    @Log(title = "接入基本准备", businessType = BusinessType.UPDATE)
    @ApiOperation("修改接入基本准备是否启用")
    @PostMapping("/updateIsApplyById")
    public AjaxResult updateIsApplyById(@RequestBody TabAccessReady tabAccessReady) {
        return tabAccessReadyService.updateStatusById(tabAccessReady);
    }
}

