FoldTheValuesController.java 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. package com.steerinfo.ems.foldthevalues.controller;
  2. import com.steerinfo.ems.foldthevalues.mapper.FoldTheValuesMapper;
  3. import com.steerinfo.framework.controller.BaseRESTfulController;
  4. import com.steerinfo.framework.controller.RESTfulResult;
  5. import com.steerinfo.framework.service.pagehelper.PageList;
  6. import com.steerinfo.framework.utils.collection.ListUtils;
  7. import com.steerinfo.ems.foldthevalues.model.FoldTheValues;
  8. import com.steerinfo.ems.foldthevalues.service.IFoldTheValuesService;
  9. import io.swagger.annotations.ApiImplicitParam;
  10. import io.swagger.annotations.ApiImplicitParams;
  11. import io.swagger.annotations.ApiModelProperty;
  12. import io.swagger.annotations.ApiOperation;
  13. import org.apache.commons.lang3.StringUtils;
  14. import org.apache.shiro.authz.annotation.RequiresPermissions;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.*;
  17. import javax.script.ScriptException;
  18. import java.text.ParseException;
  19. import java.util.*;
  20. import java.math.BigDecimal;
  21. /**
  22. * FoldTheValues RESTful接口:
  23. * @author generator
  24. * @version 1.0-SNAPSHORT 2021-10-14 02:33
  25. * 类描述
  26. * 修订历史:
  27. * 日期:2021-10-14
  28. * 作者:generator
  29. * 参考:
  30. * 描述:FoldTheValues RESTful接口
  31. * @see null
  32. * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
  33. */
  34. @RestController
  35. @RequestMapping("/${api.version}/foldthevaluess")
  36. public class FoldTheValuesController extends BaseRESTfulController {
  37. @Autowired
  38. IFoldTheValuesService foldTheValuesService;
  39. @Autowired
  40. FoldTheValuesMapper foldTheValuesMapper;
  41. @ApiOperation(value="获取列表", notes="分页查询")
  42. @ApiImplicitParams({
  43. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  44. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
  45. })
  46. //@RequiresPermissions("foldthevalues:view")
  47. @GetMapping(value = "/")
  48. public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
  49. PageList<FoldTheValues> list = foldTheValuesService.queryForPage(parmas, pageNum, pageSize);
  50. return success(list);
  51. }
  52. @ApiOperation(value="获取列表", notes="分页模糊查询")
  53. @ApiImplicitParams({
  54. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  55. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
  56. })
  57. //@RequiresPermissions("foldthevalues:view")
  58. @GetMapping(value = "/like/")
  59. public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
  60. PageList<FoldTheValues> list = foldTheValuesService.queryLikeForPage(parmas, pageNum, pageSize);
  61. return success(list);
  62. }
  63. @ApiOperation(value="创建", notes="根据FoldTheValues对象创建")
  64. @ApiImplicitParam(name = "foldTheValues", value = "详细实体foldTheValues", required = true, dataType = "FoldTheValues")
  65. //@RequiresPermissions("foldthevalues:create")
  66. @PostMapping(value = "/")
  67. public RESTfulResult add(@ModelAttribute FoldTheValues model){
  68. FoldTheValues foldTheValues = foldTheValuesService.add(model);
  69. return success(foldTheValues);
  70. }
  71. @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
  72. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
  73. //@RequiresPermissions("foldthevalues:view")
  74. @GetMapping(value = "/{id}")
  75. public RESTfulResult get(@PathVariable String id){
  76. FoldTheValues foldTheValues = foldTheValuesService.getById(id);
  77. return success(foldTheValues);
  78. }
  79. @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的foldTheValues信息来更新详细信息")
  80. @ApiImplicitParams({
  81. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String"),
  82. @ApiImplicitParam(name = "foldTheValues", value = "详细实体foldTheValues", required = true, dataType = "FoldTheValues")
  83. })
  84. //@RequiresPermissions("foldthevalues:update")
  85. @PutMapping(produces = "application/json;charset=UTF-8")
  86. public RESTfulResult update( @RequestBody FoldTheValues[] models){
  87. for (FoldTheValues model : models) {
  88. foldTheValuesMapper.updateByPrimaryKey(model);
  89. }
  90. return success();
  91. }
  92. @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
  93. @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
  94. //@RequiresPermissions("foldthevalues:delete")
  95. @DeleteMapping(value = "/{id}")//String
  96. public RESTfulResult delete(@PathVariable String id){
  97. List<String> list = Arrays.asList(id.split(","));
  98. if(ListUtils.isNotEmpty(list)) {
  99. List<String> ids = ListUtils.convertList(list);
  100. foldTheValuesService.delete(ids);
  101. }
  102. return success();
  103. }
  104. @GetMapping("/aaa")
  105. public RESTfulResult getdate() throws ScriptException, ParseException {
  106. // foldTheValuesService.getDate();
  107. //foldTheValuesService.getMonthData();
  108. //foldTheValuesService.getDataForwl();
  109. //foldTheValuesService.insertNewDate();
  110. return success();
  111. }
  112. @ApiOperation(value="获取列表", notes="分页模糊查询")
  113. @ApiImplicitParams({
  114. @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
  115. @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
  116. })
  117. //@RequiresPermissions("foldthevalues:view")
  118. @GetMapping(value = "/getDateForPage")
  119. public RESTfulResult getDateForPage (@RequestParam HashMap<String, Object> parmas,Integer pageNum, Integer pageSize) {
  120. if(parmas.get("energyid") != null && !parmas.get("energyid").toString().isEmpty()){
  121. String energyid = parmas.get("energyid").toString();
  122. if(!energyid.startsWith("'")){
  123. energyid = "'" + energyid.replaceAll(",", "','").replaceAll(",", "','") + "'";
  124. }
  125. parmas.put("energyid", energyid);
  126. }
  127. PageList<Map<String, Object>> forPage = foldTheValuesService.getDateForPage(parmas, pageNum, pageSize);
  128. return success(forPage);
  129. }
  130. }