package com.goldenwater.slaj.hazard.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.goldenwater.common.core.controller.BaseController;
import com.goldenwater.common.core.domain.AjaxResult;
import com.goldenwater.common.core.page.TableDataInfo;
import com.goldenwater.slaj.hazard.domain.BisHazMajRegWritRegTime;
import com.goldenwater.slaj.hazard.service.IBisHazMajRegWritRegTimeService;

/**
 * 备案核销时间关联
 */
@RestController
@RequestMapping("/hazard/bishazmajregwritregtime")
public class BisHazMajRegWritRegTimeController extends BaseController {
    @Autowired
    private IBisHazMajRegWritRegTimeService bisHazMajRegWritRegTimeService;

    @GetMapping("/list")
    public TableDataInfo list(BisHazMajRegWritRegTime bisHazMajRegWritRegTime) {
        startPage();
        List<BisHazMajRegWritRegTime> list = bisHazMajRegWritRegTimeService.selectBisHazMajRegWritRegTimeList(bisHazMajRegWritRegTime);
        return getDataTable(list);
    }

    @GetMapping("/{guid}")
    public AjaxResult getInfo(@PathVariable String guid) {
        return AjaxResult.success(bisHazMajRegWritRegTimeService.selectBisHazMajRegWritRegTimeByGuid(guid));
    }

    @PostMapping
    public AjaxResult add(@RequestBody BisHazMajRegWritRegTime bisHazMajRegWritRegTime) {
        return toAjax(bisHazMajRegWritRegTimeService.insertBisHazMajRegWritRegTime(bisHazMajRegWritRegTime));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisHazMajRegWritRegTime bisHazMajRegWritRegTime) {
        return toAjax(bisHazMajRegWritRegTimeService.updateBisHazMajRegWritRegTime(bisHazMajRegWritRegTime));
    }

    @DeleteMapping("/{guids}")
    public AjaxResult remove(@PathVariable String[] guids) {
        return toAjax(bisHazMajRegWritRegTimeService.deleteBisHazMajRegWritRegTimeByGuids(guids));
    }
}
