RttableController.java 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package com.steerinfo.ems.rttable.controller;
  2. import com.steerinfo.ems.rttable.model.Rttable;
  3. import com.steerinfo.ems.rttable.service.IRttableService;
  4. import com.steerinfo.framework.controller.BaseRESTfulController;
  5. import com.steerinfo.framework.controller.RESTfulResult;
  6. import com.steerinfo.framework.service.pagehelper.PageList;
  7. import com.steerinfo.framework.utils.collection.ListUtils;
  8. import io.swagger.annotations.ApiImplicitParam;
  9. import io.swagger.annotations.ApiImplicitParams;
  10. import io.swagger.annotations.ApiOperation;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.*;
  13. import java.math.BigDecimal;
  14. import java.util.Arrays;
  15. import java.util.HashMap;
  16. import java.util.List;
  17. /**
  18. * Rttable RESTful接口:
  19. * @author generator
  20. * @version 1.0-SNAPSHORT 2021-10-15 03:37
  21. * 类描述
  22. * 修订历史:
  23. * 日期:2021-10-15
  24. * 作者:generator
  25. * 参考:
  26. * 描述:Rttable RESTful接口
  27. * @see null
  28. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  29. */
  30. @RestController
  31. @RequestMapping("/${api.version}/rttables")
  32. public class RttableController extends BaseRESTfulController {
  33. @Autowired
  34. IRttableService rttableService;
  35. @ApiOperation(value="获取列表", notes="分页查询")
  36. @ApiImplicitParams({
  37. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  38. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
  39. })
  40. //@RequiresPermissions("rttable:view")
  41. @GetMapping(value = "/")
  42. public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
  43. PageList<Rttable> list = rttableService.queryForPage(parmas, pageNum, pageSize);
  44. return success(list);
  45. }
  46. @ApiOperation(value="获取列表", notes="分页模糊查询")
  47. @ApiImplicitParams({
  48. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  49. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
  50. })
  51. //@RequiresPermissions("rttable:view")
  52. @GetMapping(value = "/like/")
  53. public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
  54. PageList<Rttable> list = rttableService.queryLikeForPage(parmas, pageNum, pageSize);
  55. return success(list);
  56. }
  57. @ApiOperation(value="创建", notes="根据Rttable对象创建")
  58. @ApiImplicitParam(name = "rttable", value = "详细实体rttable", required = true, dataType = "Rttable")
  59. //@RequiresPermissions("rttable:create")
  60. @PostMapping(value = "/")
  61. public RESTfulResult add(@ModelAttribute Rttable model){
  62. Rttable rttable = rttableService.add(model);
  63. return success(rttable);
  64. }
  65. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  66. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  67. //@RequiresPermissions("rttable:view")
  68. @GetMapping(value = "/{id}")
  69. public RESTfulResult get(@PathVariable BigDecimal id){
  70. Rttable rttable = rttableService.getById(id);
  71. return success(rttable);
  72. }
  73. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的rttable信息来更新详细信息")
  74. @ApiImplicitParams({
  75. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal"),
  76. @ApiImplicitParam(name = "rttable", value = "详细实体rttable", required = true, dataType = "Rttable")
  77. })
  78. //@RequiresPermissions("rttable:update")
  79. @PutMapping(value = "/{id}", produces = "application/json;charset=UTF-8")
  80. public RESTfulResult update(@PathVariable BigDecimal id, @RequestBody Rttable model){
  81. model.setId(id);
  82. Rttable rttable = rttableService.modify(model);
  83. return success(rttable);
  84. }
  85. @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
  86. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "BigDecimal")
  87. //@RequiresPermissions("rttable:delete")
  88. @DeleteMapping(value = "/{id}")//BigDecimal
  89. public RESTfulResult delete(@PathVariable String id){
  90. List<String> list = Arrays.asList(id.split(","));
  91. if(ListUtils.isNotEmpty(list)) {
  92. List<BigDecimal> ids = ListUtils.convertList(list);
  93. rttableService.delete(ids);
  94. }
  95. return success();
  96. }
  97. }