From 8e93f63d7eab5c4f5d193763cbb2e81ea5476923 Mon Sep 17 00:00:00 2001 From: whywhyo <1511349576@qq.com> Date: 星期日, 16 七月 2023 21:03:59 +0800 Subject: [PATCH] 559 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 14 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java index c76275d..1c14108 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorController.java @@ -9,6 +9,7 @@ import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ZfDoctor; +import com.ruoyi.domain.excel.ZfCollectionExcelBean; import com.ruoyi.service.ZfDoctorService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; @@ -17,6 +18,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; +import java.util.Collections; import java.util.List; import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM; @@ -44,21 +46,43 @@ return zfDoctorService.selectDoctorList(zfDoctor, pageNum, pageSize); } + /** + * 鑾峰彇瀵煎叆妯℃澘 + */ + @PostMapping("/model") + public void getExportModel(HttpServletResponse response){ + List<ZfDoctor> list = Collections.singletonList(new ZfDoctor()); + ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class); + util.exportExcel(response,list,"瀹跺涵灏忓尰鐢熷鍏ユā鏉�"); + } + +// /** +// * 瀵煎嚭瀹跺涵灏忓尰鐢熻褰曞垪琛� +// */ +//// @PreAuthorize("@ss.hasPermi('system:property:export')") +// @Log(title = "瀹跺涵灏忓尰鐢熻褰�", businessType = BusinessType.EXPORT) +// @PostMapping("/export") +// public void export(HttpServletResponse response, ZfDoctor zfDoctor) +// { +// List<ZfDoctor> list = zfDoctorService.selectByCondition(zfDoctor); +// log.info("瀵煎嚭璁板綍涓�:{}",list); +// ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class); +// util.exportExcel(response, list, "瀹跺涵灏忓尰鐢熻褰曟暟鎹�"); +// } /** * 瀵煎嚭瀹跺涵灏忓尰鐢熻褰曞垪琛� */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "瀹跺涵灏忓尰鐢熻褰�", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, ZfDoctor zfDoctor) + @PostMapping("/export/{ids}") + public void export(HttpServletResponse response, @PathVariable Long[] ids) { - List<ZfDoctor> list = zfDoctorService.selectByCondition(zfDoctor); + List<ZfDoctor> list = zfDoctorService.selectByIds(ids); log.info("瀵煎嚭璁板綍涓�:{}",list); ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class); util.exportExcel(response, list, "瀹跺涵灏忓尰鐢熻褰曟暟鎹�"); } - /** * 瀵煎叆瀹跺涵灏忓尰鐢熻褰曞垪琛� */ @@ -66,14 +90,16 @@ @PostMapping("/importData") public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception { - ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class); - List<ZfDoctor> eventList = util.importExcel(file.getInputStream()); - log.info("瀹跺涵灏忓尰鐢熷垪琛ㄤ负锛歿}",eventList); +// ExcelUtil<ZfDoctor> util = new ExcelUtil<>(ZfDoctor.class); +// List<ZfDoctor> eventList = util.importExcel(file.getInputStream()); +// log.info("瀹跺涵灏忓尰鐢熷垪琛ㄤ负锛歿}",eventList); +// +// if (zfDoctorService.saveBatch(eventList)) { +// return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛"); +// } +// return AjaxResult.error("瀵煎叆鏁版嵁澶辫触"); - if (zfDoctorService.saveBatch(eventList)) { - return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛"); - } - return AjaxResult.error("瀵煎叆鏁版嵁澶辫触"); + return zfDoctorService.importExcel(file); } /** @@ -94,7 +120,7 @@ @PostMapping public AjaxResult add(@RequestBody ZfDoctor zfDoctor) { - return toAjax(zfDoctorService.save(zfDoctor)); + return zfDoctorService.addData(zfDoctor); } /** @@ -105,7 +131,7 @@ @PutMapping public AjaxResult edit(@RequestBody ZfDoctor zfDoctor) { - return toAjax(zfDoctorService.updateById(zfDoctor)); + return zfDoctorService.updateData(zfDoctor); } // /** @@ -116,7 +142,7 @@ @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(zfDoctorService.removeByIds(Arrays.asList(ids))); + return zfDoctorService.deleteData(ids); } } -- Gitblit v1.9.1