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.Wry;
import com.goldenwater.slgc.service.WryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "18. 污染源环保统计管理")
@RestController
@RequestMapping("/slgc/wry")
public class WryController extends BaseController {
    @Autowired
    private WryService wryService;

    @Operation(summary = "18.01 查询污染源环保统计列表")
    @GetMapping("/list")
    public TableDataInfo list(Wry wry) {
        startPage();
        List<Wry> list = wryService.selectWryList(wry);
        return getDataTable(list);
    }

    @Operation(summary = "18.02 获取污染源环保统计详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable String id) {
        return success(wryService.selectWryById(id));
    }

    @Operation(summary = "18.03 新增污染源环保统计")
    @Log(title = "污染源环保统计管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Wry wry) {
        return toAjax(wryService.insertWry(wry));
    }

    @Operation(summary = "18.04 修改污染源环保统计")
    @Log(title = "污染源环保统计管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Wry wry) {
        return toAjax(wryService.updateWry(wry));
    }

    @Operation(summary = "18.05 删除污染源环保统计")
    @Log(title = "污染源环保统计管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(wryService.deleteWryByIds(ids));
    }
}
