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

/**
 * 重大工程字典
 */
@RestController
@RequestMapping("/hazard/tdictmajored")
public class TDictMajorEdController extends BaseController {
    @Autowired
    private ITDictMajorEdService tDictMajorEdService;

    @GetMapping("/list")
    public TableDataInfo list(TDictMajorEd tDictMajorEd) {
        startPage();
        List<TDictMajorEd> list = tDictMajorEdService.selectTDictMajorEdList(tDictMajorEd);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TDictMajorEd tDictMajorEd) {
        return toAjax(tDictMajorEdService.insertTDictMajorEd(tDictMajorEd));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TDictMajorEd tDictMajorEd) {
        return toAjax(tDictMajorEdService.updateTDictMajorEd(tDictMajorEd));
    }

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