RmsPierController.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.model.RmsPier;
  4. import com.steerinfo.dil.service.impl.RmsPierServiceImpl;
  5. import com.steerinfo.dil.util.BaseRESTfulController;
  6. import com.steerinfo.dil.util.ColumnDataUtil;
  7. import com.steerinfo.dil.util.PageListAdd;
  8. import com.steerinfo.framework.controller.RESTfulResult;
  9. import com.steerinfo.framework.service.pagehelper.PageHelper;
  10. import io.swagger.annotations.ApiImplicitParam;
  11. import io.swagger.annotations.ApiImplicitParams;
  12. import io.swagger.annotations.ApiOperation;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.web.bind.annotation.*;
  15. import java.math.BigDecimal;
  16. import java.util.HashMap;
  17. import java.util.List;
  18. import java.util.Map;
  19. /**
  20. * @author luobang
  21. * @create 2021-11-15 15:13
  22. */
  23. @RestController
  24. @RequestMapping("/${api.version}/rmsPier")
  25. public class RmsPierController extends BaseRESTfulController {
  26. @Autowired
  27. RmsPierServiceImpl rmsPierService;
  28. @Autowired
  29. ColumnDataUtil columnDataUtil;
  30. @Autowired
  31. ESFeign esFeign;
  32. /**
  33. * 新增码头
  34. * @param rmsPier
  35. * @return
  36. */
  37. @PostMapping("/insertPier")
  38. public RESTfulResult insertPier(@RequestBody(required = true) RmsPier rmsPier){
  39. Integer integer = rmsPierService.insertPier(rmsPier);
  40. if (
  41. integer!=1
  42. ){
  43. return failed();
  44. }
  45. else{
  46. return success();
  47. }
  48. }
  49. /**
  50. * 修改码头
  51. * @param rmsPier
  52. * @return
  53. */
  54. @PostMapping("/editPier")
  55. public RESTfulResult editPier(@RequestBody(required = true)RmsPier rmsPier){
  56. Integer integer = rmsPierService.updatePier(rmsPier);
  57. if (
  58. integer!=1
  59. ){
  60. return failed();
  61. }
  62. else{
  63. return success();
  64. }
  65. }
  66. /**
  67. * 删除码头
  68. * @param
  69. * @return
  70. */
  71. @PostMapping("/deletePier/{pierId}")
  72. public RESTfulResult deletePort(@PathVariable("pierId") BigDecimal pierId){
  73. Integer integer = rmsPierService.deletePier(pierId);
  74. if (
  75. integer!=1
  76. ){
  77. return failed();
  78. }
  79. else{
  80. return success();
  81. }
  82. }
  83. @ApiOperation(value="展示码头信息", notes="分页查询")
  84. @ApiImplicitParams({
  85. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  86. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  87. @ApiImplicitParam(name = "apiId", value = "196", required = false, dataType = "BigDecimal"),
  88. })
  89. @PostMapping(value = "/getPier")
  90. public RESTfulResult getPier(@RequestBody(required = false) Map<String,Object> mapVal,
  91. Integer pageNum,
  92. Integer pageSize,
  93. Integer apiId,
  94. String con){
  95. mapVal.put("con",con);
  96. List<Map<String,Object>> pierList = rmsPierService.getPier(mapVal);
  97. PageHelper.startPage(pageNum, pageSize);
  98. //分页查询数据
  99. List<Map<String, Object>> columnList = rmsPierService.getPier(mapVal);
  100. PageListAdd data = columnDataUtil.tableColumnData(apiId, pierList, columnList);
  101. return success(data);
  102. }
  103. /**
  104. * 港口ID
  105. * @return
  106. */
  107. @GetMapping("/getPortId")
  108. public RESTfulResult getPortId(){
  109. return success(rmsPierService.getPortId());
  110. }
  111. }