package com.railway.business.baseinfo.controller; import com.railway.business.baseinfo.domain.BasePreventTree; import com.railway.business.baseinfo.service.IBasePreventTreeService; import com.railway.common.core.controller.BaseController; import com.railway.common.core.domain.AjaxResult; import com.railway.common.core.page.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import java.util.List; import javax.validation.Valid; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author wuhonghao */ @Api(value = "rest/baseinfo/base/prevent/tree", tags = "基础数据 - 九防台账-防树") @RestController @Validated @RequestMapping(value = "business/baseinfo/base/prevent/tree") public class BasePreventTreeController extends BaseController { private final IBasePreventTreeService basePreventTreeService; public BasePreventTreeController(IBasePreventTreeService basePreventTreeService) { this.basePreventTreeService = basePreventTreeService; } @ApiOperation(value = "新增") @PostMapping("/add") public AjaxResult add(@Validated @RequestBody BasePreventTree basePreventTree) { return toAjax(basePreventTreeService.create(basePreventTree)); } @ApiOperation(value = "删除") @DeleteMapping("/{ids}") public AjaxResult delete(@PathVariable(value = "ids") String[] ids) { return toAjax(basePreventTreeService.delete(ids)); } @ApiOperation(value = "更新") @PutMapping("/update") public AjaxResult update(@RequestBody @Valid BasePreventTree basePreventTree) { return toAjax(basePreventTreeService.update(basePreventTree)); } @ApiOperation(value = "单个") @GetMapping(value = {"/", "/{id}"}) public AjaxResult getInfo(String id) { BasePreventTree info = basePreventTreeService.getInfo(id); AjaxResult ajax = AjaxResult.success(); ajax.put("info", info); return ajax; } @ApiOperation(value = "列表") @GetMapping(value = "list") public TableDataInfo getList(BasePreventTree basePreventTree) { startPage(); List list = basePreventTreeService.getList(basePreventTree); return getDataTable(list); } }