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.TabAccessFeedback;
import com.citygis.web.domain.TabAccessReady;
import com.citygis.web.service.ITabAccessFeedbackService;
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;
import java.util.List;

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

    @Resource
    ITabAccessFeedbackService tabAccessFeedbackService;

    @Log(title = "数据准备基本", businessType = BusinessType.SELECT)
    @ApiOperation("接入数据准备基本")
    @GetMapping("getTabAccessFeedbackList")
    public TableDataInfo getTabAccessFeedbackList(TabAccessFeedback tabAccessFeedback) {
        startPage();
        return getDataTable(tabAccessFeedbackService.getTabAccessFeedbackList(tabAccessFeedback));
    }


    @Log(title = "数据准备基本", businessType = BusinessType.SELECT)
    @ApiOperation("接入数据准备基本")
    @GetMapping("getTabAccessFeedbackById/{id}")
    public AjaxResult getTabAccessFeedbackById(@PathVariable Long id) throws NoSuchMethodException {
        return tabAccessFeedbackService.getTabAccessFeedbackById(id);
    }

    @Log(title = "数据准备基本", businessType = BusinessType.INSERT)
    @ApiOperation("添加数据准备基本")
    @PostMapping("insertTabAccessFeedback")
    public AjaxResult insertTabAccessFeedback(@Validated @RequestBody List<TabAccessFeedback> tabAccessFeedback) {
        return tabAccessFeedbackService.insertTabAccessFeedback(tabAccessFeedback);
    }

    @Log(title = "数据准备基本", businessType = BusinessType.UPDATE)
    @ApiOperation("修改数据准备基本")
    @PutMapping("updateTabAccessFeedbackById")
    AjaxResult updateTabAccessFeedbackById(@RequestBody List<TabAccessFeedback> tabAccessFeedback) throws NoSuchMethodException {
        return tabAccessFeedbackService.updateTabAccessFeedbackById(tabAccessFeedback);
    }

    @Log(title = "数据准备基本", businessType = BusinessType.DELETE)
    @ApiOperation("删除数据准备基本")
    @DeleteMapping("falseDeleteTabAccessFeedbackById/{id}")
    public AjaxResult falseDeleteTabAccessFeedbackById(@PathVariable Long id) throws NoSuchMethodException {
        return tabAccessFeedbackService.falseDeleteTabAccessFeedbackById(id);
    }

    @Log(title = "数据准备基本", businessType = BusinessType.SELECT)
    @ApiOperation("根据接入基本准备ID查询数据准备基本")
    @GetMapping("getTabAccessFeedbackListByAccessOnlyId/{accessOnlyId}")
    public AjaxResult getTabAccessFeedbackListByAccessOnlyId(@PathVariable Long accessOnlyId) {
        return tabAccessFeedbackService.getTabAccessFeedbackListByAccessOnlyId(accessOnlyId);
    }

    @Log(title = "数据准备基本", businessType = BusinessType.DELETE)
    @ApiOperation("取消接入反馈")
    @DeleteMapping("deleteTabAccessFeedbackById")
    public AjaxResult deleteTabAccessFeedbackById(@RequestBody TabAccessReady tabAccessReady) {
        return tabAccessFeedbackService.deleteTabAccessFeedbackById(tabAccessReady.getIds());
    }

}

