package com.railway.business.catenary.controller; import com.railway.business.catenary.domain.BusJcebGjsfx; import com.railway.business.catenary.domain.vo.JcebQueryVo; import com.railway.business.catenary.service.IBusJcebGjsfxService; import com.railway.common.core.controller.BaseController; import com.railway.common.core.domain.AjaxResult; import com.railway.common.core.page.TableDataInfo; import com.railway.system.service.ISysFileService; 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/catenary/bus/jceb/gjsfx", tags = "检测表 - 关节式分相 ") @RestController @Validated @RequestMapping(value = "business/catenary/bus/jceb/gjsfx") public class BusJcebGjsfxController extends BaseController { private final IBusJcebGjsfxService busJcebGjsfxService; private final ISysFileService sysFileService; public BusJcebGjsfxController(IBusJcebGjsfxService busJcebGjsfxService, ISysFileService sysFileService) { this.busJcebGjsfxService = busJcebGjsfxService; this.sysFileService = sysFileService; } @ApiOperation(value = "新增") @PostMapping("/add") public AjaxResult add(@Validated @RequestBody BusJcebGjsfx busJcebGjsfx) { return toAjax(busJcebGjsfxService.create(busJcebGjsfx)); } @ApiOperation(value = "删除") @DeleteMapping("/{ids}") public AjaxResult delete(@PathVariable(value = "ids") Long[] ids) { return toAjax(busJcebGjsfxService.delete(ids)); } @ApiOperation(value = "更新") @PutMapping("/update") public AjaxResult update(@RequestBody @Valid BusJcebGjsfx busJcebGjsfx) { return toAjax(busJcebGjsfxService.update(busJcebGjsfx)); } @ApiOperation(value = "单个") @GetMapping(value = {"/", "/{id}"}) public AjaxResult getInfo(Long id) { BusJcebGjsfx info = busJcebGjsfxService.getInfo(id); AjaxResult ajax = AjaxResult.success(); ajax.put("info", info); return ajax; } @ApiOperation(value = "列表") @GetMapping(value = "list") public TableDataInfo getList(BusJcebGjsfx busJcebGjsfx) { startPage(); List list = busJcebGjsfxService.getList(busJcebGjsfx); return getDataTable(list); } @ApiOperation(value = "提交") @PutMapping("/submit") public AjaxResult submit(@RequestBody BusJcebGjsfx busJcebGjsfx) { return toAjax(busJcebGjsfxService.submit(busJcebGjsfx)); } @ApiOperation(value = "退回") @PutMapping("/reject") public AjaxResult reject(@RequestBody BusJcebGjsfx busJcebGjsfx) { return toAjax(busJcebGjsfxService.reject(busJcebGjsfx)); } @ApiOperation(value = "确认") @PutMapping("/confirm") public AjaxResult confirm(@RequestBody BusJcebGjsfx busJcebGjsfx) { return toAjax(busJcebGjsfxService.confirm(busJcebGjsfx)); } @ApiOperation(value = "导出excel") @GetMapping(value = "exportExcel") public AjaxResult exportExcel(JcebQueryVo query) { String localFilePath = busJcebGjsfxService.exportExcel(query); return sysFileService.uploadFile(localFilePath); } }