RmsCargodepController.java 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package com.steerinfo.dil.controller;
  2. import com.steerinfo.dil.util.BaseRESTfulController;
  3. import com.steerinfo.dil.util.ColumnDataUtil;
  4. import com.steerinfo.dil.util.PageListAdd;
  5. import com.steerinfo.framework.controller.RESTfulResult;
  6. import com.steerinfo.framework.service.pagehelper.PageHelper;
  7. import com.steerinfo.framework.service.pagehelper.PageList;
  8. import com.steerinfo.framework.utils.collection.ListUtils;
  9. import com.steerinfo.dil.model.RmsCargodep;
  10. import com.steerinfo.dil.service.IRmsCargodepService;
  11. import io.swagger.annotations.ApiImplicitParam;
  12. import io.swagger.annotations.ApiImplicitParams;
  13. import io.swagger.annotations.ApiOperation;
  14. import org.apache.commons.lang3.StringUtils;
  15. import org.apache.shiro.authz.annotation.RequiresPermissions;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.web.bind.annotation.*;
  18. import java.util.*;
  19. import java.math.BigDecimal;
  20. /**
  21. * RmsCargodep RESTful接口:
  22. * @author generator
  23. * @version 1.0-SNAPSHORT 2022-05-07 12:00
  24. * 类描述
  25. * 修订历史:
  26. * 日期:2022-05-07
  27. * 作者:generator
  28. * 参考:
  29. * 描述:RmsCargodep RESTful接口
  30. * @see null
  31. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  32. */
  33. @RestController
  34. @RequestMapping("/${api.version}/rmscargodeps")
  35. public class RmsCargodepController extends BaseRESTfulController {
  36. @Autowired
  37. IRmsCargodepService rmsCargodepService;
  38. @Autowired
  39. ColumnDataUtil columnDataUtil;
  40. @ApiOperation(value="创建", notes="根据RmsCargoDep对象创建")
  41. @ApiImplicitParam(name = "RmsCargoDep", value = "详细实体RmsCargoDep", required = true, dataType = "RmsCargoDep")
  42. @PostMapping(value = "/insertCargoDep")
  43. public RESTfulResult insertCargoDep(@RequestBody(required = false) Map<String,Object> mapValue){
  44. int result = rmsCargodepService.insetCargoDep(mapValue);
  45. if (result == -1){
  46. return failed("系统已经存在该送达单位,请仔细查找");
  47. }
  48. return success(result);
  49. }
  50. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  51. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  52. @PostMapping(value = "/getCargoDepById/{id}")
  53. public RESTfulResult getCargoDepById(@PathVariable("id") BigDecimal id){
  54. List<Map<String,Object>> list= rmsCargodepService.getCargoDepById(id);
  55. return success(list);
  56. }
  57. @ApiOperation(value="更新", notes="根据RmsCargoDep对象更新")
  58. @ApiImplicitParam(name = "RmsCargoDep", value = "详细实体RmsCargoDep", required = true, dataType = "RmsCargoDep")
  59. @PostMapping(value = "/updateCargoDep")
  60. public RESTfulResult updateCargoDep(@RequestBody(required = false) Map<String,Object> mapValue){
  61. int result = rmsCargodepService.updateCargoDep(mapValue);
  62. return success(result);
  63. }
  64. @ApiOperation(value="删除", notes="根据RmsCargoDep对象删除")
  65. @ApiImplicitParam(name = "RmsCargoDep", value = "详细实体RmsCargoDep", required = true, dataType = "RmsCargoDep")
  66. @PostMapping(value = "/deleteCargoDep")
  67. public RESTfulResult deleteCargoDep(@RequestBody(required = false) Map<String,Object> map){
  68. int result=rmsCargodepService.deleteCargoDep(map);
  69. return success(result);
  70. }
  71. @ApiImplicitParams({
  72. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  73. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
  74. @ApiImplicitParam(name = "apiId", value = "487", required = false, dataType = "BigDecimal"),
  75. })
  76. @PostMapping(value = "/getCargoDep")
  77. public RESTfulResult getCargoDep(@RequestBody(required = false) Map<String, Object> mapValue,
  78. Integer apiId,
  79. Integer pageNum,
  80. Integer pageSize,
  81. String con) {
  82. if (mapValue == null) {
  83. mapValue = new HashMap<>();
  84. }
  85. if (con != null && (con.equals("") || con.equals("undefined")) ) {
  86. con = null;
  87. }
  88. if (con != null && con.length() != 0) {
  89. mapValue.put("con","%" + con + "%");
  90. }
  91. PageHelper.startPage(pageNum, pageSize);
  92. //初始化过滤
  93. List<Map<String, Object>> columnList = rmsCargodepService.getCargoDepList(mapValue);
  94. PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
  95. return success(data);
  96. }
  97. }