Skip to content

Commit

Permalink
fix: 导入的后台模板不准确的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lltx authored Aug 8, 2024
1 parent 9ccda9f commit fddf728
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
10 changes: 7 additions & 3 deletions multiple/主子Contoller.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import ${package}.common.log.annotation.SysLog;
#if($opensource)
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
#else
import ${package}.common.excel.annotation.ResponseExcel;
import ${package}.common.excel.annotation.RequestExcel;
#end
import ${package}.${moduleName}.entity.${ClassName}Entity;
import ${package}.${moduleName}.entity.${ChildClassName}Entity;
Expand All @@ -29,6 +31,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import java.util.List;
Expand Down Expand Up @@ -192,7 +195,8 @@ public R removeChild(@RequestBody ${pk.attrType}[] ids) {
@HasPermission("${moduleName}_${functionName}_export")
#else
@PreAuthorize("@pms.hasPermission('${moduleName}_${functionName}_export')" )
#end public List<${ClassName}Entity> export(${ClassName}Entity ${className},${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));
}

Expand All @@ -208,7 +212,7 @@ public R removeChild(@RequestBody ${pk.attrType}[] ids) {
#else
@PreAuthorize("@pms.hasPermission('${moduleName}_${functionName}_export')" )
#end
public R import(@RequestExcel List<DemoEntity> ${className}List, BindingResult bindingResult) {
return R.ok( ${className}Service.saveBatch(${className}List));
public R import(@RequestExcel List<${ClassName}Entity> ${className}List, BindingResult bindingResult) {
return R.ok(${className}Service.saveBatch(${className}List));
}
}
7 changes: 5 additions & 2 deletions single/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import ${package}.common.log.annotation.SysLog;
#if($opensource)
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
#else
import ${package}.common.excel.annotation.ResponseExcel;
import ${package}.common.excel.annotation.RequestExcel;
#end
import ${package}.${moduleName}.entity.${ClassName}Entity;
import ${package}.${moduleName}.service.${ClassName}Service;
Expand All @@ -30,6 +32,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import java.util.List;
Expand Down Expand Up @@ -194,7 +197,7 @@ public R removeById(@RequestBody ${pk.attrType}[] ids) {
#else
@PreAuthorize("@pms.hasPermission('${moduleName}_${functionName}_export')" )
#end
public R import(@RequestExcel List<DemoEntity> ${className}List, BindingResult bindingResult) {
return R.ok( ${className}Service.saveBatch(${className}List));
public R import(@RequestExcel List<${ClassName}Entity> ${className}List, BindingResult bindingResult) {
return R.ok(${className}Service.saveBatch(${className}List));
}
}
4 changes: 2 additions & 2 deletions single/表格.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@
<!-- 编辑、新增 -->
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />

<!-- 导入excel -->
<!-- 导入excel (需要在 upms-biz/resources/file 下维护模板) -->
<upload-excel
ref="excelUploadRef"
title="导入"
url="/${moduleName}/${functionName}/import"
temp-url="/${moduleName}/${functionName}/export.xlsx?$pk.attrName=-1"
temp-url="/admin/sys-file/local/file/模板.xlsx"
@refreshDataList="getDataList"
/>
</div>
Expand Down

0 comments on commit fddf728

Please sign in to comment.