d549f7e2918d69162fb09b4ff52b46e60baa6e77.svn-base 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. package org.jeecg.modules.demo.hzz.lochistory.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.aspect.annotation.PermissionData;
  13. import org.jeecg.common.system.query.QueryGenerator;
  14. import org.jeecg.common.util.oConvertUtils;
  15. import org.jeecg.modules.demo.hzz.lochistory.entity.LocHistory;
  16. import org.jeecg.modules.demo.hzz.lochistory.service.ILocHistoryService;
  17. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  18. import com.baomidou.mybatisplus.core.metadata.IPage;
  19. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  20. import lombok.extern.slf4j.Slf4j;
  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.springframework.beans.factory.annotation.Autowired;
  28. import org.springframework.web.bind.annotation.*;
  29. import org.springframework.web.multipart.MultipartFile;
  30. import org.springframework.web.multipart.MultipartHttpServletRequest;
  31. import org.springframework.web.servlet.ModelAndView;
  32. import com.alibaba.fastjson.JSON;
  33. import io.swagger.annotations.Api;
  34. import io.swagger.annotations.ApiOperation;
  35. import org.jeecg.common.aspect.annotation.AutoLog;
  36. /**
  37. * @Description: 定位信息历史表
  38. * @Author: jeecg-boot
  39. * @Date: 2022-01-20
  40. * @Version: V1.0
  41. */
  42. @Api(tags="定位信息历史表")
  43. @RestController
  44. @RequestMapping("/hzz.lochistory/locHistory")
  45. @Slf4j
  46. public class LocHistoryController extends JeecgController<LocHistory, ILocHistoryService> {
  47. @Autowired
  48. private ILocHistoryService locHistoryService;
  49. /**
  50. * 分页列表查询
  51. *
  52. * @param locHistory
  53. * @param pageNo
  54. * @param pageSize
  55. * @param req
  56. * @return
  57. */
  58. @AutoLog(value = "定位信息历史表-分页列表查询")
  59. @ApiOperation(value="定位信息历史表-分页列表查询", notes="定位信息历史表-分页列表查询")
  60. @GetMapping(value = "/list")
  61. @PermissionData(pageComponent = "hzz/lochistory/LocHistoryList")
  62. public Result<?> queryPageList(LocHistory locHistory,
  63. @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
  64. @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
  65. HttpServletRequest req) {
  66. QueryWrapper<LocHistory> queryWrapper = QueryGenerator.initQueryWrapper(locHistory, req.getParameterMap());
  67. Page<LocHistory> page = new Page<LocHistory>(pageNo, pageSize);
  68. IPage<LocHistory> pageList = locHistoryService.page(page, queryWrapper);
  69. return Result.OK(pageList);
  70. }
  71. /**
  72. * 添加
  73. *
  74. * @param locHistory
  75. * @return
  76. */
  77. @AutoLog(value = "定位信息历史表-添加")
  78. @ApiOperation(value="定位信息历史表-添加", notes="定位信息历史表-添加")
  79. @PostMapping(value = "/add")
  80. public Result<?> add(@RequestBody LocHistory locHistory) {
  81. locHistoryService.save(locHistory);
  82. return Result.OK("添加成功!");
  83. }
  84. /**
  85. * 编辑
  86. *
  87. * @param locHistory
  88. * @return
  89. */
  90. @AutoLog(value = "定位信息历史表-编辑")
  91. @ApiOperation(value="定位信息历史表-编辑", notes="定位信息历史表-编辑")
  92. @PostMapping(value = "/edit")
  93. public Result<?> edit(@RequestBody LocHistory locHistory) {
  94. locHistoryService.updateById(locHistory);
  95. return Result.OK("编辑成功!");
  96. }
  97. /**
  98. * 通过id删除
  99. *
  100. * @param id
  101. * @return
  102. */
  103. @AutoLog(value = "定位信息历史表-通过id删除")
  104. @ApiOperation(value="定位信息历史表-通过id删除", notes="定位信息历史表-通过id删除")
  105. @PostMapping(value = "/delete")
  106. public Result<?> delete(@RequestParam(name="id",required=true) String id) {
  107. locHistoryService.removeById(id);
  108. return Result.OK("删除成功!");
  109. }
  110. /**
  111. * 批量删除
  112. *
  113. * @param ids
  114. * @return
  115. */
  116. @AutoLog(value = "定位信息历史表-批量删除")
  117. @ApiOperation(value="定位信息历史表-批量删除", notes="定位信息历史表-批量删除")
  118. @PostMapping(value = "/deleteBatch")
  119. public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
  120. this.locHistoryService.removeByIds(Arrays.asList(ids.split(",")));
  121. return Result.OK("批量删除成功!");
  122. }
  123. /**
  124. * 通过id查询
  125. *
  126. * @param id
  127. * @return
  128. */
  129. @AutoLog(value = "定位信息历史表-通过id查询")
  130. @ApiOperation(value="定位信息历史表-通过id查询", notes="定位信息历史表-通过id查询")
  131. @GetMapping(value = "/queryById")
  132. public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
  133. LocHistory locHistory = locHistoryService.getById(id);
  134. if(locHistory==null) {
  135. return Result.error("未找到对应数据");
  136. }
  137. return Result.OK(locHistory);
  138. }
  139. /**
  140. * 导出excel
  141. *
  142. * @param request
  143. * @param locHistory
  144. */
  145. @RequestMapping(value = "/exportXls")
  146. public ModelAndView exportXls(HttpServletRequest request, LocHistory locHistory) {
  147. return super.exportXls(request, locHistory, LocHistory.class, "定位信息历史表");
  148. }
  149. /**
  150. * 通过excel导入数据
  151. *
  152. * @param request
  153. * @param response
  154. * @return
  155. */
  156. @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
  157. public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
  158. return super.importExcel(request, response, LocHistory.class);
  159. }
  160. }