package com.goldenwater.slgc.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.goldenwater.common.annotation.Log;
import com.goldenwater.common.core.controller.BaseController;
import com.goldenwater.common.core.domain.AjaxResult;
import com.goldenwater.common.core.page.TableDataInfo;
import com.goldenwater.common.enums.BusinessType;
import com.goldenwater.slgc.domain.AttStBase;
import com.goldenwater.slgc.domain.AttIrrBase;
import com.goldenwater.slgc.domain.AttInsiBase;
import com.goldenwater.slgc.domain.AttPoldBase;
import com.goldenwater.slgc.domain.AttFsdaBase;
import com.goldenwater.slgc.domain.AttDpdsBase;
import com.goldenwater.slgc.domain.AttDiscBase;
import com.goldenwater.slgc.domain.AttGrpjBase;
import com.goldenwater.slgc.service.StService;
import com.goldenwater.slgc.service.IrrService;
import com.goldenwater.slgc.service.InsiService;
import com.goldenwater.slgc.service.PoldService;
import com.goldenwater.slgc.service.FsdaService;
import com.goldenwater.slgc.service.DpdsService;
import com.goldenwater.slgc.service.DiscService;
import com.goldenwater.slgc.service.GrpjService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "08. 其他水利工程信息管理")
@RestController
@RequestMapping("/slgc/hydraulic")
public class HydraulicController extends BaseController {
    @Autowired
    private StService stService;
    @Autowired
    private IrrService irrService;
    @Autowired
    private InsiService insiService;
    @Autowired
    private PoldService poldService;
    @Autowired
    private FsdaService fsdaService;
    @Autowired
    private DpdsService dpdsService;
    @Autowired
    private DiscService discService;
    @Autowired
    private GrpjService grpjService;

    @Operation(summary = "08.01 查询水文站信息列表")
    @GetMapping("/st/list")
    public TableDataInfo stList(AttStBase attStBase) {
        startPage();
        List<AttStBase> list = stService.selectAttStBaseList(attStBase);
        return getDataTable(list);
    }

    @Operation(summary = "08.02 获取水文站信息详细信息")
    @GetMapping("/st/{stCode}")
    public AjaxResult stGetInfo(@PathVariable String stCode) {
        return success(stService.selectAttStBaseById(stCode));
    }

    @Operation(summary = "08.03 新增水文站信息")
    @Log(title = "水文站管理", businessType = BusinessType.INSERT)
    @PostMapping("/st")
    public AjaxResult stAdd(@RequestBody AttStBase attStBase) {
        return toAjax(stService.insertAttStBase(attStBase));
    }

    @Operation(summary = "08.04 修改水文站信息")
    @Log(title = "水文站管理", businessType = BusinessType.UPDATE)
    @PutMapping("/st")
    public AjaxResult stEdit(@RequestBody AttStBase attStBase) {
        return toAjax(stService.updateAttStBase(attStBase));
    }

    @Operation(summary = "08.05 删除水文站信息")
    @Log(title = "水文站管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/st/{stCodes}")
    public AjaxResult stRemove(@PathVariable String[] stCodes) {
        return toAjax(stService.deleteAttStBaseByIds(stCodes));
    }

    @Operation(summary = "08.06 查询灌区信息列表")
    @GetMapping("/irr/list")
    public TableDataInfo irrList(AttIrrBase attIrrBase) {
        startPage();
        List<AttIrrBase> list = irrService.selectAttIrrBaseList(attIrrBase);
        return getDataTable(list);
    }

    @Operation(summary = "08.07 获取灌区信息详细信息")
    @GetMapping("/irr/{irrCode}")
    public AjaxResult irrGetInfo(@PathVariable String irrCode) {
        return success(irrService.selectAttIrrBaseById(irrCode));
    }

    @Operation(summary = "08.08 新增灌区信息")
    @Log(title = "灌区管理", businessType = BusinessType.INSERT)
    @PostMapping("/irr")
    public AjaxResult irrAdd(@RequestBody AttIrrBase attIrrBase) {
        return toAjax(irrService.insertAttIrrBase(attIrrBase));
    }

    @Operation(summary = "08.09 修改灌区信息")
    @Log(title = "灌区管理", businessType = BusinessType.UPDATE)
    @PutMapping("/irr")
    public AjaxResult irrEdit(@RequestBody AttIrrBase attIrrBase) {
        return toAjax(irrService.updateAttIrrBase(attIrrBase));
    }

    @Operation(summary = "08.10 删除灌区信息")
    @Log(title = "灌区管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/irr/{irrCodes}")
    public AjaxResult irrRemove(@PathVariable String[] irrCodes) {
        return toAjax(irrService.deleteAttIrrBaseByIds(irrCodes));
    }

    @Operation(summary = "08.11 查询机电排灌信息列表")
    @GetMapping("/insi/list")
    public TableDataInfo insiList(AttInsiBase attInsiBase) {
        startPage();
        List<AttInsiBase> list = insiService.selectAttInsiBaseList(attInsiBase);
        return getDataTable(list);
    }

    @Operation(summary = "08.12 获取机电排灌信息详细信息")
    @GetMapping("/insi/{insiCode}")
    public AjaxResult insiGetInfo(@PathVariable String insiCode) {
        return success(insiService.selectAttInsiBaseById(insiCode));
    }

    @Operation(summary = "08.13 新增机电排灌信息")
    @Log(title = "机电排灌管理", businessType = BusinessType.INSERT)
    @PostMapping("/insi")
    public AjaxResult insiAdd(@RequestBody AttInsiBase attInsiBase) {
        return toAjax(insiService.insertAttInsiBase(attInsiBase));
    }

    @Operation(summary = "08.14 修改机电排灌信息")
    @Log(title = "机电排灌管理", businessType = BusinessType.UPDATE)
    @PutMapping("/insi")
    public AjaxResult insiEdit(@RequestBody AttInsiBase attInsiBase) {
        return toAjax(insiService.updateAttInsiBase(attInsiBase));
    }

    @Operation(summary = "08.15 删除机电排灌信息")
    @Log(title = "机电排灌管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/insi/{insiCodes}")
    public AjaxResult insiRemove(@PathVariable String[] insiCodes) {
        return toAjax(insiService.deleteAttInsiBaseByIds(insiCodes));
    }

    @Operation(summary = "08.16 查询防洪闸信息列表")
    @GetMapping("/pold/list")
    public TableDataInfo poldList(AttPoldBase attPoldBase) {
        startPage();
        List<AttPoldBase> list = poldService.selectAttPoldBaseList(attPoldBase);
        return getDataTable(list);
    }

    @Operation(summary = "08.17 获取防洪闸信息详细信息")
    @GetMapping("/pold/{poldCode}")
    public AjaxResult poldGetInfo(@PathVariable String poldCode) {
        return success(poldService.selectAttPoldBaseById(poldCode));
    }

    @Operation(summary = "08.18 新增防洪闸信息")
    @Log(title = "防洪闸管理", businessType = BusinessType.INSERT)
    @PostMapping("/pold")
    public AjaxResult poldAdd(@RequestBody AttPoldBase attPoldBase) {
        return toAjax(poldService.insertAttPoldBase(attPoldBase));
    }

    @Operation(summary = "08.19 修改防洪闸信息")
    @Log(title = "防洪闸管理", businessType = BusinessType.UPDATE)
    @PutMapping("/pold")
    public AjaxResult poldEdit(@RequestBody AttPoldBase attPoldBase) {
        return toAjax(poldService.updateAttPoldBase(attPoldBase));
    }

    @Operation(summary = "08.20 删除防洪闸信息")
    @Log(title = "防洪闸管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/pold/{poldCodes}")
    public AjaxResult poldRemove(@PathVariable String[] poldCodes) {
        return toAjax(poldService.deleteAttPoldBaseByIds(poldCodes));
    }

    @Operation(summary = "08.21 查询蓄滞洪区信息列表")
    @GetMapping("/fsda/list")
    public TableDataInfo fsdaList(AttFsdaBase attFsdaBase) {
        startPage();
        List<AttFsdaBase> list = fsdaService.selectAttFsdaBaseList(attFsdaBase);
        return getDataTable(list);
    }

    @Operation(summary = "08.22 获取蓄滞洪区信息详细信息")
    @GetMapping("/fsda/{fsdaCode}")
    public AjaxResult fsdaGetInfo(@PathVariable String fsdaCode) {
        return success(fsdaService.selectAttFsdaBaseById(fsdaCode));
    }

    @Operation(summary = "08.23 新增蓄滞洪区信息")
    @Log(title = "蓄滞洪区管理", businessType = BusinessType.INSERT)
    @PostMapping("/fsda")
    public AjaxResult fsdaAdd(@RequestBody AttFsdaBase attFsdaBase) {
        return toAjax(fsdaService.insertAttFsdaBase(attFsdaBase));
    }

    @Operation(summary = "08.24 修改蓄滞洪区信息")
    @Log(title = "蓄滞洪区管理", businessType = BusinessType.UPDATE)
    @PutMapping("/fsda")
    public AjaxResult fsdaEdit(@RequestBody AttFsdaBase attFsdaBase) {
        return toAjax(fsdaService.updateAttFsdaBase(attFsdaBase));
    }

    @Operation(summary = "08.25 删除蓄滞洪区信息")
    @Log(title = "蓄滞洪区管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/fsda/{fsdaCodes}")
    public AjaxResult fsdaRemove(@PathVariable String[] fsdaCodes) {
        return toAjax(fsdaService.deleteAttFsdaBaseByIds(fsdaCodes));
    }

    @Operation(summary = "08.26 查询排水沟信息列表")
    @GetMapping("/dpds/list")
    public TableDataInfo dpdsList(AttDpdsBase attDpdsBase) {
        startPage();
        List<AttDpdsBase> list = dpdsService.selectAttDpdsBaseList(attDpdsBase);
        return getDataTable(list);
    }

    @Operation(summary = "08.27 获取排水沟信息详细信息")
    @GetMapping("/dpds/{dpdsCode}")
    public AjaxResult dpdsGetInfo(@PathVariable String dpdsCode) {
        return success(dpdsService.selectAttDpdsBaseById(dpdsCode));
    }

    @Operation(summary = "08.28 新增排水沟信息")
    @Log(title = "排水沟管理", businessType = BusinessType.INSERT)
    @PostMapping("/dpds")
    public AjaxResult dpdsAdd(@RequestBody AttDpdsBase attDpdsBase) {
        return toAjax(dpdsService.insertAttDpdsBase(attDpdsBase));
    }

    @Operation(summary = "08.29 修改排水沟信息")
    @Log(title = "排水沟管理", businessType = BusinessType.UPDATE)
    @PutMapping("/dpds")
    public AjaxResult dpdsEdit(@RequestBody AttDpdsBase attDpdsBase) {
        return toAjax(dpdsService.updateAttDpdsBase(attDpdsBase));
    }

    @Operation(summary = "08.30 删除排水沟信息")
    @Log(title = "排水沟管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/dpds/{dpdsCodes}")
    public AjaxResult dpdsRemove(@PathVariable String[] dpdsCodes) {
        return toAjax(dpdsService.deleteAttDpdsBaseByIds(dpdsCodes));
    }

    @Operation(summary = "08.31 查询消力池信息列表")
    @GetMapping("/disc/list")
    public TableDataInfo discList(AttDiscBase attDiscBase) {
        startPage();
        List<AttDiscBase> list = discService.selectAttDiscBaseList(attDiscBase);
        return getDataTable(list);
    }

    @Operation(summary = "08.32 获取消力池信息详细信息")
    @GetMapping("/disc/{discCode}")
    public AjaxResult discGetInfo(@PathVariable String discCode) {
        return success(discService.selectAttDiscBaseById(discCode));
    }

    @Operation(summary = "08.33 新增消力池信息")
    @Log(title = "消力池管理", businessType = BusinessType.INSERT)
    @PostMapping("/disc")
    public AjaxResult discAdd(@RequestBody AttDiscBase attDiscBase) {
        return toAjax(discService.insertAttDiscBase(attDiscBase));
    }

    @Operation(summary = "08.34 修改消力池信息")
    @Log(title = "消力池管理", businessType = BusinessType.UPDATE)
    @PutMapping("/disc")
    public AjaxResult discEdit(@RequestBody AttDiscBase attDiscBase) {
        return toAjax(discService.updateAttDiscBase(attDiscBase));
    }

    @Operation(summary = "08.35 删除消力池信息")
    @Log(title = "消力池管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/disc/{discCodes}")
    public AjaxResult discRemove(@PathVariable String[] discCodes) {
        return toAjax(discService.deleteAttDiscBaseByIds(discCodes));
    }

    @Operation(summary = "08.36 查询沟渠信息列表")
    @GetMapping("/grpj/list")
    public TableDataInfo grpjList(AttGrpjBase attGrpjBase) {
        startPage();
        List<AttGrpjBase> list = grpjService.selectAttGrpjBaseList(attGrpjBase);
        return getDataTable(list);
    }

    @Operation(summary = "08.37 获取沟渠信息详细信息")
    @GetMapping("/grpj/{grpjCode}")
    public AjaxResult grpjGetInfo(@PathVariable String grpjCode) {
        return success(grpjService.selectAttGrpjBaseById(grpjCode));
    }

    @Operation(summary = "08.38 新增沟渠信息")
    @Log(title = "沟渠管理", businessType = BusinessType.INSERT)
    @PostMapping("/grpj")
    public AjaxResult grpjAdd(@RequestBody AttGrpjBase attGrpjBase) {
        return toAjax(grpjService.insertAttGrpjBase(attGrpjBase));
    }

    @Operation(summary = "08.39 修改沟渠信息")
    @Log(title = "沟渠管理", businessType = BusinessType.UPDATE)
    @PutMapping("/grpj")
    public AjaxResult grpjEdit(@RequestBody AttGrpjBase attGrpjBase) {
        return toAjax(grpjService.updateAttGrpjBase(attGrpjBase));
    }

    @Operation(summary = "08.40 删除沟渠信息")
    @Log(title = "沟渠管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/grpj/{grpjCodes}")
    public AjaxResult grpjRemove(@PathVariable String[] grpjCodes) {
        return toAjax(grpjService.deleteAttGrpjBaseByIds(grpjCodes));
    }
}
