From a2cc89fdd214c1a350d1f5b06447c155c47a5c25 Mon Sep 17 00:00:00 2001 From: whywhyo <1511349576@qq.com> Date: 星期一, 08 五月 2023 17:52:00 +0800 Subject: [PATCH] 888 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java | 41 ++++++++++++++++++----------------------- 1 files changed, 18 insertions(+), 23 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java index 485e78d..264df42 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java @@ -39,10 +39,10 @@ private ZfEventService zfEventService; @GetMapping("/all") - public AjaxResult listAll(ZfEvent zfEvent){ + public AjaxResult listAll(ZfEvent zfEvent) { Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); - return zfEventService.selectEventList(zfEvent, pageNum, pageSize); + return zfEventService.selectDataList(zfEvent, pageNum, pageSize); } @@ -52,12 +52,16 @@ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, ZfEvent zfEvent) - { + public void export(HttpServletResponse response, ZfEvent zfEvent) { List<ZfEvent> list = zfEventService.selectByCondition(zfEvent); - log.info("瀵煎嚭璁板綍涓�:{}",list); + log.info("瀵煎嚭璁板綍涓�:{}", list); ExcelUtil<ZfEvent> util = new ExcelUtil<>(ZfEvent.class); util.exportExcel(response, list, "瀹跺涵澶т簨浠惰褰曟暟鎹�"); + + } + + public static void main(String[] args) { + System.out.println(); } /** @@ -65,16 +69,9 @@ */ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT) @PostMapping("/importData") - public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception - { - ExcelUtil<ZfEvent> util = new ExcelUtil<>(ZfEvent.class); - List<ZfEvent> eventList = util.importExcel(file.getInputStream()); - log.info("瀹跺涵澶т簨浠跺垪琛ㄤ负锛歿}",eventList); + public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception { - if (zfEventService.saveBatch(eventList)) { - return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛"); - } - return AjaxResult.error("瀵煎叆鏁版嵁澶辫触"); + return zfEventService.importExcel(file); } @@ -83,20 +80,19 @@ */ // @PreAuthorize("@ss.hasPermi('system:property:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return success(zfEventService.getById(id)); } // + /** * 鏂板瀹跺涵澶т簨浠惰褰� */ // @PreAuthorize("@ss.hasPermi('system:property:add')") @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody ZfEvent zfEvent) - { - return toAjax(zfEventService.save(zfEvent)); + public AjaxResult add(@RequestBody ZfEvent zfEvent) { + return zfEventService.addData2(zfEvent); } /** @@ -105,19 +101,18 @@ // @PreAuthorize("@ss.hasPermi('system:property:edit')") @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody ZfEvent zfEvent) - { + public AjaxResult edit(@RequestBody ZfEvent zfEvent) { return toAjax(zfEventService.updateById(zfEvent)); } // + /** * 鎵归噺鍒犻櫎瀹跺涵澶т簨浠惰褰� */ // @PreAuthorize("@ss.hasPermi('system:property:remove')") @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { + public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(zfEventService.removeByIds(Arrays.asList(ids))); } -- Gitblit v1.9.1