|
@@ -8,17 +8,24 @@ package org.eco.vip.nexus.core.controller.config;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
import jakarta.validation.Valid;
|
|
|
import jakarta.validation.constraints.NotEmpty;
|
|
|
import org.eco.vip.core.pojo.CommonResult;
|
|
|
import org.eco.vip.core.pojo.PageResult;
|
|
|
+import org.eco.vip.excel.core.ExcelResult;
|
|
|
+import org.eco.vip.excel.utils.ExcelUtils;
|
|
|
+import org.eco.vip.nexus.core.domain.config.excel.ConfigImport;
|
|
|
import org.eco.vip.nexus.core.domain.config.pojo.ConfigBO;
|
|
|
import org.eco.vip.nexus.core.domain.config.pojo.ConfigVO;
|
|
|
import org.eco.vip.nexus.core.service.config.IConfigService;
|
|
|
import org.eco.vip.security.annotation.PermissionsResource;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static org.eco.vip.core.pojo.CommonResult.fail;
|
|
@@ -72,7 +79,7 @@ public class ConfigController {
|
|
|
}
|
|
|
|
|
|
@DeleteMapping("/delete")
|
|
|
- @SaCheckPermission("system:config:delete")
|
|
|
+ @SaCheckPermission(value = "system:config:delete")
|
|
|
public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空") List<String> ids) {
|
|
|
boolean result = configService.delete(ids);
|
|
|
if (!result) {
|
|
@@ -80,4 +87,24 @@ public class ConfigController {
|
|
|
}
|
|
|
return success();
|
|
|
}
|
|
|
+
|
|
|
+ @SaCheckPermission("system:config:import")
|
|
|
+ @PostMapping("/template")
|
|
|
+ public void downTemplate(HttpServletResponse response) {
|
|
|
+ ExcelUtils.exportExcel(new ArrayList<>(), "参数配置模板", ConfigImport.class, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ @SaCheckPermission("system:config:import")
|
|
|
+ @PostMapping("/import")
|
|
|
+ public CommonResult<Valid> importData(MultipartFile file, boolean isCover) throws IOException {
|
|
|
+ ExcelResult<ConfigImport> result = ExcelUtils.importExcel(file.getInputStream(), ConfigImport.class, true);
|
|
|
+ return success(result.getAnalysis());
|
|
|
+ }
|
|
|
+
|
|
|
+ @SaCheckPermission(value = "system:config:export")
|
|
|
+ @PostMapping("/export")
|
|
|
+ public void export(HttpServletResponse response, ConfigBO configBO) {
|
|
|
+ List<ConfigVO> list = configService.selectList(configBO);
|
|
|
+ ExcelUtils.exportExcel(list, "参数配置", ConfigVO.class, response);
|
|
|
+ }
|
|
|
}
|