RmsPortController.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.feign.ESFeign;
  3. import com.steerinfo.dil.model.RmsPort;
  4. import com.steerinfo.dil.service.impl.RmsPortServiceImpl;
  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}/rmsPort")
  25. public class RmsPortController extends BaseRESTfulController {
  26. @Autowired
  27. RmsPortServiceImpl rmsPortService;
  28. @Autowired
  29. ColumnDataUtil columnDataUtil;
  30. @Autowired
  31. ESFeign esFeign;
  32. /**
  33. * 新增港口
  34. * @param rmsPort
  35. * @return
  36. */
  37. @PostMapping("/insertPort")
  38. public RESTfulResult insertPort(@RequestBody(required = true)RmsPort rmsPort){
  39. Integer integer = rmsPortService.insertPort(rmsPort);
  40. if (
  41. integer!=1
  42. ){
  43. return failed();
  44. }
  45. else{
  46. return success();
  47. }
  48. }
  49. /**
  50. * 修改港口
  51. * @param rmsPort
  52. * @return
  53. */
  54. @PostMapping("/editPort")
  55. public RESTfulResult editPort(@RequestBody(required = true)RmsPort rmsPort){
  56. Integer integer = rmsPortService.updatePort(rmsPort);
  57. if (
  58. integer!=1
  59. ){
  60. return failed();
  61. }
  62. else{
  63. return success();
  64. }
  65. }
  66. /**
  67. * 删除港口
  68. * @param portId
  69. * @return
  70. */
  71. @PostMapping("/deletePort/{portId}")
  72. public RESTfulResult deletePort(@PathVariable("portId") BigDecimal portId){
  73. Integer integer = rmsPortService.deletePort(portId);
  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 = "/getPort")
  90. public RESTfulResult getPort(@RequestBody(required = false) Map<String,Object> mapVal,
  91. Integer pageNum,
  92. Integer pageSize,
  93. Integer apiId,
  94. String con){
  95. PageHelper.startPage(pageNum, pageSize);
  96. //分页查询数据
  97. List<Map<String, Object>> columnList = rmsPortService.getPort(mapVal);
  98. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  99. return success(data);
  100. }
  101. /**
  102. * 港口类型ID
  103. * @return
  104. */
  105. @GetMapping("/getPortType")
  106. public RESTfulResult getPortType(){
  107. return success(rmsPortService.getPortType());
  108. }
  109. }