From c4d425e07d1477f721ec1d1cb91eb6caa18b21df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= <2270033969@qq.com> Date: Sun, 21 Jul 2024 11:00:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\344\270\273\345\255\220Contoller.java" | 16 ++++++++++++++++ single/Controller.java | 16 ++++++++++++++++ "single/\350\241\250\346\240\274.vue" | 18 +++++++++++++++--- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git "a/multiple/\344\270\273\345\255\220Contoller.java" "b/multiple/\344\270\273\345\255\220Contoller.java" index 99206b3..6ae531d 100644 --- "a/multiple/\344\270\273\345\255\220Contoller.java" +++ "b/multiple/\344\270\273\345\255\220Contoller.java" @@ -195,4 +195,20 @@ public R removeChild(@RequestBody ${pk.attrType}[] ids) { #end public List<${ClassName}Entity> export(${ClassName}Entity ${className},${pk.attrType}[] ids) { return ${className}Service.list(Wrappers.lambdaQuery(${className}).in(ArrayUtil.isNotEmpty(ids), ${ClassName}Entity::$str.getProperty($pk.attrName), ids)); } + + /** + * 导入excel 表 + * @param ${className}List 对象实体列表 + * @param bindingResult 错误信息列表 + * @return ok fail + */ + @PostMapping("/import") + #if($isSpringBoot3) + @HasPermission("${moduleName}_${functionName}_export") + #else + @PreAuthorize("@pms.hasPermission('${moduleName}_${functionName}_export')" ) + #end + public R import(@RequestExcel List ${className}List, BindingResult bindingResult) { + return R.ok( ${className}Service.saveBatch(${className}List)); + } } diff --git a/single/Controller.java b/single/Controller.java index bff50f8..d5e0567 100644 --- a/single/Controller.java +++ b/single/Controller.java @@ -181,4 +181,20 @@ public R removeById(@RequestBody ${pk.attrType}[] ids) { public List<${ClassName}Entity> export(${ClassName}Entity ${className},${pk.attrType}[] ids) { return ${className}Service.list(Wrappers.lambdaQuery(${className}).in(ArrayUtil.isNotEmpty(ids), ${ClassName}Entity::$str.getProperty($pk.attrName), ids)); } + + /** + * 导入excel 表 + * @param ${className}List 对象实体列表 + * @param bindingResult 错误信息列表 + * @return ok fail + */ + @PostMapping("/import") + #if($isSpringBoot3) + @HasPermission("${moduleName}_${functionName}_export") + #else + @PreAuthorize("@pms.hasPermission('${moduleName}_${functionName}_export')" ) + #end + public R import(@RequestExcel List ${className}List, BindingResult bindingResult) { + return R.ok( ${className}Service.saveBatch(${className}List)); + } } diff --git "a/single/\350\241\250\346\240\274.vue" "b/single/\350\241\250\346\240\274.vue" index 15638e0..141bada 100644 --- "a/single/\350\241\250\346\240\274.vue" +++ "b/single/\350\241\250\346\240\274.vue" @@ -42,9 +42,9 @@ #end - 查询 + 查 询 - 重置 + 重 置 @@ -55,9 +55,12 @@ v-auth="'${moduleName}_${functionName}_add'"> 新 增 + + 导 入 + - 删除 + 删 除 + + @@ -124,6 +135,7 @@ const { $dict.format($fieldDict) } = useDict($dict.quotation($fieldDict)) #end // 定义变量内容 const formDialogRef = ref() +const excelUploadRef = ref(); // 搜索变量 const queryRef = ref() const showSearch = ref(true)