RmsPortController.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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.ApiModelProperty;
  13. import io.swagger.annotations.ApiOperation;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.*;
  16. import java.math.BigDecimal;
  17. import java.util.HashMap;
  18. import java.util.List;
  19. import java.util.Map;
  20. /**
  21. * @author luobang
  22. * @create 2021-11-15 15:13
  23. */
  24. @RestController
  25. @RequestMapping("/${api.version}/rmsPort")
  26. public class RmsPortController extends BaseRESTfulController {
  27. @Autowired
  28. RmsPortServiceImpl rmsPortService;
  29. @Autowired
  30. ColumnDataUtil columnDataUtil;
  31. @Autowired
  32. ESFeign esFeign;
  33. /**
  34. * 新增港口
  35. * @param rmsPort
  36. * @return
  37. */
  38. @PostMapping("/insertPort")
  39. public RESTfulResult insertPort(@RequestBody(required = true)RmsPort rmsPort){
  40. Integer integer = rmsPortService.insertPort(rmsPort);
  41. if (
  42. integer!=1
  43. ){
  44. return failed();
  45. }
  46. else{
  47. return success();
  48. }
  49. }
  50. /**
  51. * 修改港口
  52. * @param rmsPort
  53. * @return
  54. */
  55. @PostMapping("/editPort")
  56. public RESTfulResult editPort(@RequestBody(required = true)RmsPort rmsPort){
  57. Integer integer = rmsPortService.updatePort(rmsPort);
  58. if (
  59. integer!=1
  60. ){
  61. return failed();
  62. }
  63. else{
  64. return success();
  65. }
  66. }
  67. /**
  68. * 删除港口
  69. * @param portId
  70. * @return
  71. */
  72. @PostMapping("/deletePort/{portId}")
  73. public RESTfulResult deletePort(@PathVariable("portId") BigDecimal portId){
  74. Integer integer = rmsPortService.deletePort(portId);
  75. if (
  76. integer!=1
  77. ){
  78. return failed();
  79. }
  80. else{
  81. return success();
  82. }
  83. }
  84. @ApiOperation(value="展示港口信息", notes="分页查询")
  85. @ApiImplicitParams({
  86. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  87. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  88. @ApiImplicitParam(name = "apiId", value = "196", required = false, dataType = "BigDecimal"),
  89. })
  90. @PostMapping(value = "/getPort")
  91. public RESTfulResult getPort(@RequestBody(required = false) Map<String,Object> mapVal,
  92. Integer pageNum,
  93. Integer pageSize,
  94. Integer apiId,
  95. String con){
  96. PageHelper.startPage(pageNum, pageSize);
  97. //分页查询数据
  98. List<Map<String, Object>> columnList = rmsPortService.getPort(mapVal);
  99. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  100. return success(data);
  101. }
  102. @ApiModelProperty(value = "边输边查港口名称")
  103. @PostMapping("/getPortName")
  104. public RESTfulResult getPortName(@RequestParam("index") String index) {
  105. List<Map<String, Object>> list = rmsPortService.getPortName(index == null ? "" : index);
  106. return success(list);
  107. }
  108. @ApiModelProperty(value = "边输边查港口名称")
  109. @PostMapping("/getPierName")
  110. public RESTfulResult getPierName(@RequestParam("index") String index) {
  111. List<Map<String, Object>> list = rmsPortService.getPierName(index == null ? "" : index);
  112. return success(list);
  113. }
  114. /**
  115. * 港口类型ID
  116. * @return
  117. */
  118. @GetMapping("/getPortType")
  119. public RESTfulResult getPortType(){
  120. return success(rmsPortService.getPortType());
  121. }
  122. }