2d2f0e6440f45ee122b98a10e74852d1d1fe588a.svn-base 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. package org.jeecg.modules.online.cgreport.controller;
  2. import java.util.Arrays;
  3. import javax.servlet.http.HttpServletRequest;
  4. import javax.servlet.http.HttpServletResponse;
  5. import org.jeecg.common.api.vo.Result;
  6. import org.jeecg.common.aspect.annotation.AutoLog;
  7. import org.jeecg.common.system.base.controller.JeecgController;
  8. import org.jeecg.common.system.query.QueryGenerator;
  9. import org.jeecg.modules.online.cgreport.entity.DiagramCombinationQueryConfig;
  10. import org.jeecg.modules.online.cgreport.service.IDiagramCombinationQueryConfigService;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.PostMapping;
  13. import org.springframework.web.bind.annotation.GetMapping;
  14. import org.springframework.web.bind.annotation.PostMapping;
  15. import org.springframework.web.bind.annotation.PostMapping;
  16. import org.springframework.web.bind.annotation.RequestBody;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RequestMethod;
  19. import org.springframework.web.bind.annotation.RequestParam;
  20. import org.springframework.web.bind.annotation.RestController;
  21. import org.springframework.web.servlet.ModelAndView;
  22. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  23. import com.baomidou.mybatisplus.core.metadata.IPage;
  24. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  25. import io.swagger.annotations.Api;
  26. import io.swagger.annotations.ApiOperation;
  27. import lombok.extern.slf4j.Slf4j;
  28. /**
  29. * @Description: 查询配置
  30. * @Author: jeecg-boot
  31. * @Date: 2020-11-13
  32. * @Version: V1.0
  33. */
  34. @Api(tags="查询配置")
  35. @RestController
  36. @RequestMapping("/diagram/diagramCombinationQueryConfig")
  37. @Slf4j
  38. public class DiagramCombinationQueryConfigController extends JeecgController<DiagramCombinationQueryConfig, IDiagramCombinationQueryConfigService> {
  39. @Autowired
  40. private IDiagramCombinationQueryConfigService diagramCombinationQueryConfigService;
  41. /**
  42. * 分页列表查询
  43. *
  44. * @param diagramCombinationQueryConfig
  45. * @param pageNo
  46. * @param pageSize
  47. * @param req
  48. * @return
  49. */
  50. @AutoLog(value = "查询配置-分页列表查询")
  51. @ApiOperation(value="查询配置-分页列表查询", notes="查询配置-分页列表查询")
  52. @GetMapping(value = "/list")
  53. public Result<?> queryPageList(DiagramCombinationQueryConfig diagramCombinationQueryConfig,
  54. @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
  55. @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
  56. HttpServletRequest req) {
  57. QueryWrapper<DiagramCombinationQueryConfig> queryWrapper = QueryGenerator.initQueryWrapper(diagramCombinationQueryConfig, req.getParameterMap());
  58. Page<DiagramCombinationQueryConfig> page = new Page<DiagramCombinationQueryConfig>(pageNo, pageSize);
  59. IPage<DiagramCombinationQueryConfig> pageList = diagramCombinationQueryConfigService.page(page, queryWrapper);
  60. return Result.ok(pageList);
  61. }
  62. /**
  63. * 添加
  64. *
  65. * @param diagramCombinationQueryConfig
  66. * @return
  67. */
  68. @AutoLog(value = "查询配置-添加")
  69. @ApiOperation(value="查询配置-添加", notes="查询配置-添加")
  70. @PostMapping(value = "/add")
  71. public Result<?> add(@RequestBody DiagramCombinationQueryConfig diagramCombinationQueryConfig) {
  72. diagramCombinationQueryConfigService.save(diagramCombinationQueryConfig);
  73. return Result.ok("添加成功!");
  74. }
  75. /**
  76. * 编辑
  77. *
  78. * @param diagramCombinationQueryConfig
  79. * @return
  80. */
  81. @AutoLog(value = "查询配置-编辑")
  82. @ApiOperation(value="查询配置-编辑", notes="查询配置-编辑")
  83. @PostMapping(value = "/edit")
  84. public Result<?> edit(@RequestBody DiagramCombinationQueryConfig diagramCombinationQueryConfig) {
  85. diagramCombinationQueryConfigService.updateById(diagramCombinationQueryConfig);
  86. return Result.ok("编辑成功!");
  87. }
  88. /**
  89. * 通过id删除
  90. *
  91. * @param id
  92. * @return
  93. */
  94. @AutoLog(value = "查询配置-通过id删除")
  95. @ApiOperation(value="查询配置-通过id删除", notes="查询配置-通过id删除")
  96. @PostMapping(value = "/delete")
  97. public Result<?> delete(@RequestParam(name="id",required=true) String id) {
  98. diagramCombinationQueryConfigService.removeById(id);
  99. return Result.ok("删除成功!");
  100. }
  101. /**
  102. * 批量删除
  103. *
  104. * @param ids
  105. * @return
  106. */
  107. @AutoLog(value = "查询配置-批量删除")
  108. @ApiOperation(value="查询配置-批量删除", notes="查询配置-批量删除")
  109. @PostMapping(value = "/deleteBatch")
  110. public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
  111. this.diagramCombinationQueryConfigService.removeByIds(Arrays.asList(ids.split(",")));
  112. return Result.ok("批量删除成功!");
  113. }
  114. /**
  115. * 通过id查询
  116. *
  117. * @param id
  118. * @return
  119. */
  120. @AutoLog(value = "查询配置-通过id查询")
  121. @ApiOperation(value="查询配置-通过id查询", notes="查询配置-通过id查询")
  122. @GetMapping(value = "/queryById")
  123. public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
  124. DiagramCombinationQueryConfig diagramCombinationQueryConfig = diagramCombinationQueryConfigService.getById(id);
  125. if(diagramCombinationQueryConfig==null) {
  126. return Result.error("未找到对应数据");
  127. }
  128. return Result.ok(diagramCombinationQueryConfig);
  129. }
  130. /**
  131. * 导出excel
  132. *
  133. * @param request
  134. * @param diagramCombinationQueryConfig
  135. */
  136. @RequestMapping(value = "/exportXls")
  137. public ModelAndView exportXls(HttpServletRequest request, DiagramCombinationQueryConfig diagramCombinationQueryConfig) {
  138. return super.exportXls(request, diagramCombinationQueryConfig, DiagramCombinationQueryConfig.class, "查询配置");
  139. }
  140. /**
  141. * 通过excel导入数据
  142. *
  143. * @param request
  144. * @param response
  145. * @return
  146. */
  147. @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
  148. public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
  149. return super.importExcel(request, response, DiagramCombinationQueryConfig.class);
  150. }
  151. }