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

/**
 * 重大建筑物字典
 */
@RestController
@RequestMapping("/hazard/tdictmajorbuilding")
public class TDictMajorBuildingController extends BaseController {
    @Autowired
    private ITDictMajorBuildingService tDictMajorBuildingService;

    @GetMapping("/list")
    public TableDataInfo list(TDictMajorBuilding tDictMajorBuilding) {
        startPage();
        List<TDictMajorBuilding> list = tDictMajorBuildingService.selectTDictMajorBuildingList(tDictMajorBuilding);
        return getDataTable(list);
    }

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

    @PostMapping
    public AjaxResult add(@RequestBody TDictMajorBuilding tDictMajorBuilding) {
        return toAjax(tDictMajorBuildingService.insertTDictMajorBuilding(tDictMajorBuilding));
    }

    @PutMapping
    public AjaxResult edit(@RequestBody TDictMajorBuilding tDictMajorBuilding) {
        return toAjax(tDictMajorBuildingService.updateTDictMajorBuilding(tDictMajorBuilding));
    }

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