package com.goldenwater.web.controller.hzz;

import com.goldenwater.common.core.controller.BaseController;
import com.goldenwater.common.core.domain.AjaxResult;
import com.goldenwater.common.core.page.TableDataInfo;
import com.goldenwater.hzz.domain.WpsDTO;
import com.goldenwater.hzz.service.HzzWpsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/hzz/wps")
public class HzzWpsController extends BaseController {
    @Autowired
    private HzzWpsService service;

    @GetMapping("/list")
    public TableDataInfo list(@RequestParam(required = false) String projectName, @RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "10") int pageSize) {
        return getDataTable(service.querySupervision(projectName, startDate, endDate, pageNum, pageSize));
    }

    @PostMapping
    public AjaxResult add(@RequestBody WpsDTO p) {
        return toAjax(service.insertShxmDc(p));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody WpsDTO p) {
        return toAjax(service.updateShxmDc(p));
    }

    @DeleteMapping("/{guid}")
    public AjaxResult del(@PathVariable String guid) {
        return toAjax(service.deleteShxmDc(guid));
    }
}
