diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaCxLsjlController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaCxLsjlController.java index 15c0c3e2a..f68ee5540 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaCxLsjlController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/controller/OtaBaCxLsjlController.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import com.jero.common.api.vo.Result; import com.jero.common.system.query.QueryGenerator; import com.jero.modules.ota.entity.OtaBaCxLsjl; @@ -22,164 +23,164 @@ import io.swagger.annotations.ApiOperation; import com.jero.common.aspect.annotation.AutoLog; - /** +/** * @Description: 车型备案-历史记录 * @Author: jero-boot - * @Date: 2023-03-17 + * @Date: 2023-03-17 * @Version: V1.0 */ -@Api(tags="车型备案-历史记录") +@Api(tags = "车型备案-历史记录") @RestController @RequestMapping("/ota/otaBaCxLsjl") @Slf4j public class OtaBaCxLsjlController extends JeroController { - @Autowired - private IOtaBaCxLsjlService otaBaCxLsjlService; - - /** - * 分页列表查询 - * - * @param otaBaCxLsjl - * @param pageNo - * @param pageSize - * @param req - * @return - */ - @AutoLog(value = "车型备案-历史记录-分页列表查询") - @ApiOperation(value="车型备案-历史记录-分页列表查询", notes="车型备案-历史记录-分页列表查询") - @GetMapping(value = "/page") - public Result queryPageList(OtaBaCxLsjl otaBaCxLsjl, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(otaBaCxLsjl, req.getParameterMap()); - queryWrapper.orderByDesc("create_time"); - Page page = new Page(pageNo, pageSize); - IPage pageList = otaBaCxLsjlService.page(page, queryWrapper); - return Result.OK(pageList); - } + @Autowired + private IOtaBaCxLsjlService otaBaCxLsjlService; /** - * 列表查询 - * - * @return - */ - @AutoLog(value = "车型备案-历史记录-列表查询") - @ApiOperation(value="车型备案-历史记录-列表查询", notes="车型备案-历史记录-列表查询") - @GetMapping(value = "/list") - public Result> queryList() { - List list = otaBaCxLsjlService.queryList(); + * 分页列表查询 + * + * @param otaBaCxLsjl + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "车型备案-历史记录-分页列表查询") + @ApiOperation(value = "车型备案-历史记录-分页列表查询", notes = "车型备案-历史记录-分页列表查询") + @GetMapping(value = "/page") + public Result queryPageList(OtaBaCxLsjl otaBaCxLsjl, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(otaBaCxLsjl, req.getParameterMap()); + queryWrapper.orderByDesc("create_time"); + Page page = new Page(pageNo, pageSize); + IPage pageList = otaBaCxLsjlService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @return + */ + @AutoLog(value = "车型备案-历史记录-列表查询") + @ApiOperation(value = "车型备案-历史记录-列表查询", notes = "车型备案-历史记录-列表查询") + @GetMapping(value = "/list") + public Result> queryList() { + List list = otaBaCxLsjlService.list(); return Result.OK(list); - } - - /** - * 添加 - * - * @param otaBaCxLsjl - * @return - */ - @AutoLog(value = "车型备案-历史记录-添加") - @ApiOperation(value="车型备案-历史记录-添加", notes="车型备案-历史记录-添加") - @PostMapping(value = "/add") - public Result add(@Validated @RequestBody OtaBaCxLsjl otaBaCxLsjl) { - otaBaCxLsjlService.add(otaBaCxLsjl); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param otaBaCxLsjl - * @return - */ - @AutoLog(value = "车型备案-历史记录-编辑") - @ApiOperation(value="车型备案-历史记录-编辑", notes="车型备案-历史记录-编辑") - @PutMapping(value = "/edit") - public Result edit(@Validated @RequestBody OtaBaCxLsjl otaBaCxLsjl) { - otaBaCxLsjlService.editById(otaBaCxLsjl); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "车型备案-历史记录-通过id删除") - @ApiOperation(value="车型备案-历史记录-通过id删除", notes="车型备案-历史记录-通过id删除") - @DeleteMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - otaBaCxLsjlService.deleteById(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "车型备案-历史记录-批量删除") - @ApiOperation(value="车型备案-历史记录-批量删除", notes="车型备案-历史记录-批量删除") - @DeleteMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.otaBaCxLsjlService.deleteByIds(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) { - OtaBaCxLsjl otaBaCxLsjl = otaBaCxLsjlService.queryById(id); - if(otaBaCxLsjl==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(otaBaCxLsjl); - } - - /** - * 通过otaId查询 - * - * @param otaId - * @return - */ - @AutoLog(value = "车型备案-历史记录-通过otaId查询") - @ApiOperation(value="车型备案-历史记录-通过otaId查询", notes="车型备案-历史记录-通过otaId查询") - @GetMapping(value = "/queryByOtaId") - public Result queryByOtaId(@RequestParam(name="otaId",required=true) String otaId) { - List otaBaCxLsjlList = otaBaCxLsjlService.queryByOtaId(otaId); - if(otaBaCxLsjlList==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(otaBaCxLsjlList); - } + } /** - * 导出excel - * - * @param request - * @param otaBaCxLsjl - */ + * 添加 + * + * @param otaBaCxLsjl + * @return + */ + @AutoLog(value = "车型备案-历史记录-添加") + @ApiOperation(value = "车型备案-历史记录-添加", notes = "车型备案-历史记录-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody OtaBaCxLsjl otaBaCxLsjl) { + otaBaCxLsjlService.add(otaBaCxLsjl); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param otaBaCxLsjl + * @return + */ + @AutoLog(value = "车型备案-历史记录-编辑") + @ApiOperation(value = "车型备案-历史记录-编辑", notes = "车型备案-历史记录-编辑") + @PutMapping(value = "/edit") + public Result edit(@Validated @RequestBody OtaBaCxLsjl otaBaCxLsjl) { + otaBaCxLsjlService.editById(otaBaCxLsjl); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "车型备案-历史记录-通过id删除") + @ApiOperation(value = "车型备案-历史记录-通过id删除", notes = "车型备案-历史记录-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + otaBaCxLsjlService.deleteById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "车型备案-历史记录-批量删除") + @ApiOperation(value = "车型备案-历史记录-批量删除", notes = "车型备案-历史记录-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.otaBaCxLsjlService.deleteByIds(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) { + OtaBaCxLsjl otaBaCxLsjl = otaBaCxLsjlService.queryById(id); + if (otaBaCxLsjl == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(otaBaCxLsjl); + } + + /** + * 通过otaId查询 + * + * @param otaId + * @return + */ + @AutoLog(value = "车型备案-历史记录-通过otaId查询") + @ApiOperation(value = "车型备案-历史记录-通过otaId查询", notes = "车型备案-历史记录-通过otaId查询") + @GetMapping(value = "/queryByOtaId") + public Result queryByOtaId(@RequestParam(name = "otaId", required = true) String otaId) { + List otaBaCxLsjlList = otaBaCxLsjlService.queryByOtaId(otaId); + if (otaBaCxLsjlList == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(otaBaCxLsjlList); + } + + /** + * 导出excel + * + * @param request + * @param otaBaCxLsjl + */ @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, OtaBaCxLsjl otaBaCxLsjl) { return super.exportXls(request, otaBaCxLsjl, OtaBaCxLsjl.class, "车型备案-历史记录"); } /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, OtaBaCxLsjl.class); diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaCxLsjlServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaCxLsjlServiceImpl.java index 66a7184ed..41b20f07e 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaCxLsjlServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaBaCxLsjlServiceImpl.java @@ -93,6 +93,7 @@ public class OtaBaCxLsjlServiceImpl extends ServiceImpl queryByOtaId(String otaId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(OtaBaCxLsjl::getOtaId, otaId); + queryWrapper.orderByDesc(OtaBaCxLsjl::getCreateTime); List res = this.list(queryWrapper); return res; }