f6f0b1df2dbe9b226f5aa2ae2b4bd3ed8d693ea0.svn-base 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. package org.jeecg.modules.demo.hzz.hlxx.controller;
  2. import java.util.Arrays;
  3. import java.util.List;
  4. import java.util.Map;
  5. import java.util.stream.Collectors;
  6. import java.io.IOException;
  7. import java.io.UnsupportedEncodingException;
  8. import java.net.URLDecoder;
  9. import javax.servlet.http.HttpServletRequest;
  10. import javax.servlet.http.HttpServletResponse;
  11. import org.jeecg.common.api.vo.Result;
  12. import org.jeecg.common.system.query.QueryGenerator;
  13. import org.jeecg.common.util.oConvertUtils;
  14. import org.jeecg.modules.demo.hzz.hlxx.entity.RmRiver;
  15. import org.jeecg.modules.demo.hzz.hlxx.service.IRmRiverService;
  16. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  17. import com.baomidou.mybatisplus.core.metadata.IPage;
  18. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  19. import lombok.extern.slf4j.Slf4j;
  20. import org.jeecg.modules.demo.hzz.yhyc.service.IRmRwqdService;
  21. import org.jeecgframework.poi.excel.ExcelImportUtil;
  22. import org.jeecgframework.poi.excel.def.NormalExcelConstants;
  23. import org.jeecgframework.poi.excel.entity.ExportParams;
  24. import org.jeecgframework.poi.excel.entity.ImportParams;
  25. import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
  26. import org.jeecg.common.system.base.controller.JeecgController;
  27. import org.jetbrains.annotations.TestOnly;
  28. import org.simpleframework.xml.Text;
  29. import org.springframework.beans.factory.annotation.Autowired;
  30. import org.springframework.web.bind.annotation.*;
  31. import org.springframework.web.multipart.MultipartFile;
  32. import org.springframework.web.multipart.MultipartHttpServletRequest;
  33. import org.springframework.web.servlet.ModelAndView;
  34. import com.alibaba.fastjson.JSON;
  35. import io.swagger.annotations.Api;
  36. import io.swagger.annotations.ApiOperation;
  37. import org.jeecg.common.aspect.annotation.AutoLog;
  38. /**
  39. * @Description: 河流信息表
  40. * @Author: jeecg-boot
  41. * @Date: 2021-12-31
  42. * @Version: V1.0
  43. */
  44. @Api(tags="河流信息表")
  45. @RestController
  46. @RequestMapping("/hzz.hlxx/rmRiver")
  47. @Slf4j
  48. public class RmRiverController extends JeecgController<RmRiver, IRmRiverService> {
  49. @Autowired
  50. private IRmRiverService rmRiverService;
  51. /**
  52. * 分页列表查询
  53. *
  54. * @param rmRiver
  55. * @param pageNo
  56. * @param pageSize
  57. * @param req
  58. * @return
  59. */
  60. @AutoLog(value = "河流信息表-分页列表查询")
  61. @ApiOperation(value="河流信息表-分页列表查询", notes="河流信息表-分页列表查询")
  62. @GetMapping(value = "/list")
  63. public Result<?> queryPageList(RmRiver rmRiver,
  64. @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
  65. @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
  66. HttpServletRequest req) {
  67. QueryWrapper<RmRiver> queryWrapper = QueryGenerator.initQueryWrapper(rmRiver, req.getParameterMap());
  68. Page<RmRiver> page = new Page<RmRiver>(pageNo, pageSize);
  69. IPage<RmRiver> pageList = rmRiverService.page(page, queryWrapper);
  70. return Result.OK(pageList);
  71. }
  72. /**
  73. * 添加
  74. *
  75. * @param rmRiver
  76. * @return
  77. */
  78. @AutoLog(value = "河流信息表-添加")
  79. @ApiOperation(value="河流信息表-添加", notes="河流信息表-添加")
  80. @PostMapping(value = "/add")
  81. public Result<?> add(@RequestBody RmRiver rmRiver) {
  82. rmRiverService.save(rmRiver);
  83. return Result.OK("添加成功!");
  84. }
  85. /**
  86. * 统计
  87. *
  88. * @param
  89. * @return
  90. */
  91. @AutoLog(value = "河流信息统计")
  92. @ApiOperation(value="河流信息统计", notes="河流信息统计")
  93. @GetMapping(value = "/countriver")
  94. public Result<?> countriver() {
  95. List<Integer> count = rmRiverService.countriver();
  96. return Result.OK("添加成功!",count);
  97. }
  98. /**
  99. * 编辑
  100. *
  101. * @param rmRiver
  102. * @return
  103. */
  104. @AutoLog(value = "河流信息表-编辑")
  105. @ApiOperation(value="河流信息表-编辑", notes="河流信息表-编辑")
  106. @PostMapping(value = "/edit")
  107. public Result<?> edit(@RequestBody RmRiver rmRiver) {
  108. rmRiverService.updateById(rmRiver);
  109. return Result.OK("编辑成功!");
  110. }
  111. /**
  112. * 通过id删除
  113. *
  114. * @param id
  115. * @return
  116. */
  117. @AutoLog(value = "河流信息表-通过id删除")
  118. @ApiOperation(value="河流信息表-通过id删除", notes="河流信息表-通过id删除")
  119. @PostMapping(value = "/delete")
  120. public Result<?> delete(@RequestParam(name="id",required=true) String id) {
  121. rmRiverService.removeById(id);
  122. return Result.OK("删除成功!");
  123. }
  124. /**
  125. * 批量删除
  126. *
  127. * @param ids
  128. * @return
  129. */
  130. @AutoLog(value = "河流信息表-批量删除")
  131. @ApiOperation(value="河流信息表-批量删除", notes="河流信息表-批量删除")
  132. @PostMapping(value = "/deleteBatch")
  133. public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
  134. this.rmRiverService.removeByIds(Arrays.asList(ids.split(",")));
  135. return Result.OK("批量删除成功!");
  136. }
  137. /**
  138. * 通过id查询
  139. *
  140. * @param id
  141. * @return
  142. */
  143. @AutoLog(value = "河流信息表-通过id查询")
  144. @ApiOperation(value="河流信息表-通过id查询", notes="河流信息表-通过id查询")
  145. @GetMapping(value = "/queryById")
  146. public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
  147. RmRiver rmRiver = rmRiverService.getById(id);
  148. if(rmRiver==null) {
  149. return Result.error("未找到对应数据");
  150. }
  151. return Result.OK(rmRiver);
  152. }
  153. /**
  154. * 导出excel
  155. *
  156. * @param request
  157. * @param rmRiver
  158. */
  159. @RequestMapping(value = "/exportXls")
  160. public ModelAndView exportXls(HttpServletRequest request, RmRiver rmRiver) {
  161. return super.exportXls(request, rmRiver, RmRiver.class, "河流信息表");
  162. }
  163. /**
  164. * 通过excel导入数据
  165. *
  166. * @param request
  167. * @param response
  168. * @return
  169. */
  170. @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
  171. public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
  172. return super.importExcel(request, response, RmRiver.class);
  173. }
  174. }