123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- package org.jeecg.modules.demo.hzz.lochistory.controller;
- import java.util.Arrays;
- import java.util.List;
- import java.util.Map;
- import java.util.stream.Collectors;
- import java.io.IOException;
- import java.io.UnsupportedEncodingException;
- import java.net.URLDecoder;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.jeecg.common.api.vo.Result;
- import org.jeecg.common.aspect.annotation.PermissionData;
- import org.jeecg.common.system.query.QueryGenerator;
- import org.jeecg.common.util.oConvertUtils;
- import org.jeecg.modules.demo.hzz.lochistory.entity.LocHistory;
- import org.jeecg.modules.demo.hzz.lochistory.service.ILocHistoryService;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import lombok.extern.slf4j.Slf4j;
- import org.jeecgframework.poi.excel.ExcelImportUtil;
- import org.jeecgframework.poi.excel.def.NormalExcelConstants;
- import org.jeecgframework.poi.excel.entity.ExportParams;
- import org.jeecgframework.poi.excel.entity.ImportParams;
- import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
- import org.jeecg.common.system.base.controller.JeecgController;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import org.springframework.web.multipart.MultipartHttpServletRequest;
- import org.springframework.web.servlet.ModelAndView;
- import com.alibaba.fastjson.JSON;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.jeecg.common.aspect.annotation.AutoLog;
- /**
- * @Description: 定位信息历史表
- * @Author: jeecg-boot
- * @Date: 2022-01-20
- * @Version: V1.0
- */
- @Api(tags="定位信息历史表")
- @RestController
- @RequestMapping("/hzz.lochistory/locHistory")
- @Slf4j
- public class LocHistoryController extends JeecgController<LocHistory, ILocHistoryService> {
- @Autowired
- private ILocHistoryService locHistoryService;
-
- /**
- * 分页列表查询
- *
- * @param locHistory
- * @param pageNo
- * @param pageSize
- * @param req
- * @return
- */
- @AutoLog(value = "定位信息历史表-分页列表查询")
- @ApiOperation(value="定位信息历史表-分页列表查询", notes="定位信息历史表-分页列表查询")
- @GetMapping(value = "/list")
- @PermissionData(pageComponent = "hzz/lochistory/LocHistoryList")
- public Result<?> queryPageList(LocHistory locHistory,
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
- HttpServletRequest req) {
- QueryWrapper<LocHistory> queryWrapper = QueryGenerator.initQueryWrapper(locHistory, req.getParameterMap());
- Page<LocHistory> page = new Page<LocHistory>(pageNo, pageSize);
- IPage<LocHistory> pageList = locHistoryService.page(page, queryWrapper);
- return Result.OK(pageList);
- }
-
- /**
- * 添加
- *
- * @param locHistory
- * @return
- */
- @AutoLog(value = "定位信息历史表-添加")
- @ApiOperation(value="定位信息历史表-添加", notes="定位信息历史表-添加")
- @PostMapping(value = "/add")
- public Result<?> add(@RequestBody LocHistory locHistory) {
- locHistoryService.save(locHistory);
- return Result.OK("添加成功!");
- }
-
- /**
- * 编辑
- *
- * @param locHistory
- * @return
- */
- @AutoLog(value = "定位信息历史表-编辑")
- @ApiOperation(value="定位信息历史表-编辑", notes="定位信息历史表-编辑")
- @PostMapping(value = "/edit")
- public Result<?> edit(@RequestBody LocHistory locHistory) {
- locHistoryService.updateById(locHistory);
- return Result.OK("编辑成功!");
- }
-
- /**
- * 通过id删除
- *
- * @param id
- * @return
- */
- @AutoLog(value = "定位信息历史表-通过id删除")
- @ApiOperation(value="定位信息历史表-通过id删除", notes="定位信息历史表-通过id删除")
- @PostMapping(value = "/delete")
- public Result<?> delete(@RequestParam(name="id",required=true) String id) {
- locHistoryService.removeById(id);
- return Result.OK("删除成功!");
- }
-
- /**
- * 批量删除
- *
- * @param ids
- * @return
- */
- @AutoLog(value = "定位信息历史表-批量删除")
- @ApiOperation(value="定位信息历史表-批量删除", notes="定位信息历史表-批量删除")
- @PostMapping(value = "/deleteBatch")
- public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
- this.locHistoryService.removeByIds(Arrays.asList(ids.split(",")));
- return Result.OK("批量删除成功!");
- }
-
- /**
- * 通过id查询
- *
- * @param id
- * @return
- */
- @AutoLog(value = "定位信息历史表-通过id查询")
- @ApiOperation(value="定位信息历史表-通过id查询", notes="定位信息历史表-通过id查询")
- @GetMapping(value = "/queryById")
- public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
- LocHistory locHistory = locHistoryService.getById(id);
- if(locHistory==null) {
- return Result.error("未找到对应数据");
- }
- return Result.OK(locHistory);
- }
- /**
- * 导出excel
- *
- * @param request
- * @param locHistory
- */
- @RequestMapping(value = "/exportXls")
- public ModelAndView exportXls(HttpServletRequest request, LocHistory locHistory) {
- return super.exportXls(request, locHistory, LocHistory.class, "定位信息历史表");
- }
- /**
- * 通过excel导入数据
- *
- * @param request
- * @param response
- * @return
- */
- @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
- public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
- return super.importExcel(request, response, LocHistory.class);
- }
- }
|