diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java index a163ee9..ccfcaad 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java @@ -1,5 +1,7 @@ package org.jeecg.modules.demo.depfile.controller; +import java.io.File; +import java.net.URL; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -97,6 +99,10 @@ public class DepfileController extends JeecgController depfile.setUserid(user.getId()); String depiid = depadminlxService.getdepid(user.getId()); depfile.setDepid(depiid); + String extension = getFileExtensionFromUrl(depfile.getUpfile()); + System.out.println(depfile.getUpfile()); + System.out.println(depfile.getUpfile()); + depfile.setFilehz(extension); depfileService.save(depfile); return Result.OK("添加成功!"); } @@ -111,6 +117,10 @@ public class DepfileController extends JeecgController @ApiOperation(value="单位技术研究资质情况-编辑", notes="单位技术研究资质情况-编辑") @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) public Result edit(@RequestBody Depfile depfile) { + String extension = getFileExtensionFromUrl(depfile.getUpfile()); + depfile.setFilehz(extension); + System.out.println(depfile.getUpfile()); + System.out.println(depfile.getUpfile()); depfileService.updateById(depfile); return Result.OK("编辑成功!"); } @@ -181,6 +191,14 @@ public class DepfileController extends JeecgController @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, Depfile.class); - } -} + + } + public static String getFileExtensionFromUrl(String fileUrl) { + + File file = new File(fileUrl); + String fileName = file.getName(); + String extension = fileName.substring(fileName.lastIndexOf(".") + 1); + return extension; + } + } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java index 542eada..a2334ad 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java @@ -85,4 +85,14 @@ public class Depfile implements Serializable { @Excel(name = "用户id", width = 15) @ApiModelProperty(value = "用户id") private java.lang.String userid; + + /**文件后缀*/ + @Excel(name = "文件后缀", width = 15) + @ApiModelProperty(value = "文件后缀") + private java.lang.String filehz; + /**文件类型*/ + @Excel(name = "文件类型", width = 15, dicCode = "filetext") + @Dict(dicCode = "filetext") + @ApiModelProperty(value = "文件类型") + private java.lang.String filelx; } diff --git a/jeecgboot-vue3/src/views/depfile/Depfile.data.ts b/jeecgboot-vue3/src/views/depfile/Depfile.data.ts index 70e98ce..5e30b38 100644 --- a/jeecgboot-vue3/src/views/depfile/Depfile.data.ts +++ b/jeecgboot-vue3/src/views/depfile/Depfile.data.ts @@ -30,6 +30,16 @@ export const columns: BasicColumn[] = [ align: "center", dataIndex: 'upfile', }, + { + title: '文件后缀', + align: "center", + dataIndex: 'filehz' + }, + { + title: '文件类型', + align: "center", + dataIndex: 'filelx_dictText' + }, ]; // 高级查询数据 diff --git a/jeecgboot-vue3/src/views/depfile/components/DepfileForm.vue b/jeecgboot-vue3/src/views/depfile/components/DepfileForm.vue index d785682..eb42378 100644 --- a/jeecgboot-vue3/src/views/depfile/components/DepfileForm.vue +++ b/jeecgboot-vue3/src/views/depfile/components/DepfileForm.vue @@ -29,6 +29,12 @@ + + + + + + @@ -37,6 +43,7 @@