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.BisOccuDiseHazRec;
import com.goldenwater.slaj.hazard.service.IBisOccuDiseHazRecService;

/**
 * 职业病危害记录
 */
@RestController
@RequestMapping("/hazard/bisoccudisehazrec")
public class BisOccuDiseHazRecController extends BaseController {
    @Autowired
    private IBisOccuDiseHazRecService bisOccuDiseHazRecService;

    @GetMapping("/list")
    public TableDataInfo list(BisOccuDiseHazRec bisOccuDiseHazRec) {
        startPage();
        List<BisOccuDiseHazRec> list = bisOccuDiseHazRecService.selectBisOccuDiseHazRecList(bisOccuDiseHazRec);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody BisOccuDiseHazRec bisOccuDiseHazRec) {
        return toAjax(bisOccuDiseHazRecService.insertBisOccuDiseHazRec(bisOccuDiseHazRec));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody BisOccuDiseHazRec bisOccuDiseHazRec) {
        return toAjax(bisOccuDiseHazRecService.updateBisOccuDiseHazRec(bisOccuDiseHazRec));
    }

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