diff --git a/hchyun-ui/src/api/system/download.js b/hchyun-ui/src/api/system/download.js
deleted file mode 100644
index 91e19ba..0000000
--- a/hchyun-ui/src/api/system/download.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import axios from "axios";
-import {getToken} from "@/utils/auth";
-
-export function downloadFile(fileId) {
- return axios({
- method: 'get',
- url: process.env.VUE_APP_BASE_API + '/system/file/download/' + fileId,
- headers: {
- token: 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
- }
- })
-}
diff --git a/hchyun-ui/src/components/ImageUpload/index.vue b/hchyun-ui/src/components/ImageUpload/index.vue
index c887a54..aca076d 100644
--- a/hchyun-ui/src/components/ImageUpload/index.vue
+++ b/hchyun-ui/src/components/ImageUpload/index.vue
@@ -61,7 +61,7 @@ export default {
},
handleUploadSuccess(res) {
this.$emit("input", res.url);
- this.$emit("changeAddress",res.fileName);
+ this.$emit("change",res.fileName,res.url);
this.loading.close();
},
handleBeforeUpload() {
diff --git a/hchyun-ui/src/router/index.js b/hchyun-ui/src/router/index.js
index 9f9a668..86fac08 100644
--- a/hchyun-ui/src/router/index.js
+++ b/hchyun-ui/src/router/index.js
@@ -133,15 +133,15 @@ export const constantRoutes = [
]
},
{
- path: '/test',
+ path: '/download',
component: Layout,
hidden: true,
children: [
{
path: '/',
- component: (resolve) => require(['@/views/test/sqltest'], resolve),
- name: 'sqltest',
- meta: { title: 'sql语法高亮测试' }
+ component: (resolve) => require(['@/views/test/downloadtest'], resolve),
+ name: 'download',
+ meta: { title: '下载组件测试' }
}
]
},
diff --git a/hchyun-ui/src/utils/fileUtils.js b/hchyun-ui/src/utils/fileUtils.js
new file mode 100644
index 0000000..89af810
--- /dev/null
+++ b/hchyun-ui/src/utils/fileUtils.js
@@ -0,0 +1,34 @@
+import axios from "axios";
+import {getToken} from "@/utils/auth";
+import {Message} from "element-ui";
+
+export function downloadFile(fileId) {
+ return axios({
+ method: 'get',
+ url: process.env.VUE_APP_BASE_API + '/system/file/download/' + fileId,
+ headers: {
+ token: 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
+ }
+ })
+}
+
+export function uploadFile(data) {
+ return axios({
+ url: process.env.VUE_APP_BASE_API + '/system/file',
+ method: 'post',
+ data: data,
+ headers: {
+ Authorization: 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
+ }
+ }).then(res => {
+ if (res.data.code === 200) {
+ return res.data
+ } else {
+ Message({
+ message: res.data.msg,
+ type: 'error'
+ })
+ return false
+ }
+ })
+}
diff --git a/hchyun-ui/src/views/login.vue b/hchyun-ui/src/views/login.vue
index 19b9332..09d2540 100644
--- a/hchyun-ui/src/views/login.vue
+++ b/hchyun-ui/src/views/login.vue
@@ -158,7 +158,7 @@ export default {
.title {
margin: 0px auto 30px auto;
text-align: center;
- color: #707070;
+ color: white;
}
.login-form {
@@ -168,6 +168,8 @@ export default {
padding: 25px 25px 5px 25px;
.el-input {
height: 38px;
+ background-color: white;
+ border-radius: 6px;
input {
height: 38px;
}
diff --git a/hchyun-ui/src/views/system/file/index.vue b/hchyun-ui/src/views/system/file/index.vue
index 0b9643e..d2eddf3 100644
--- a/hchyun-ui/src/views/system/file/index.vue
+++ b/hchyun-ui/src/views/system/file/index.vue
@@ -181,7 +181,7 @@
-
+
-
+
-
+
-
+
@@ -229,7 +229,7 @@
+
+
diff --git a/hchyun-ui/src/views/test/downloadtest.vue b/hchyun-ui/src/views/test/downloadtest.vue
new file mode 100644
index 0000000..8a6b367
--- /dev/null
+++ b/hchyun-ui/src/views/test/downloadtest.vue
@@ -0,0 +1,39 @@
+
+
+ F:{{ value }}
+
+ 确 定
+
+
+
+
+
+
diff --git a/hchyun-ui/src/views/test/sqltest.vue b/hchyun-ui/src/views/test/sqltest.vue
deleted file mode 100644
index e77748f..0000000
--- a/hchyun-ui/src/views/test/sqltest.vue
+++ /dev/null
@@ -1,241 +0,0 @@
-
-
-
-
代码编辑,高亮补全
-
代码版本,差异对比
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/FileController.java b/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/FileController.java
index e7cfc4c..1139077 100644
--- a/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/FileController.java
+++ b/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/FileController.java
@@ -76,12 +76,12 @@ public class FileController extends HcyBaseController {
}
@GetMapping("/folder")
- public AjaxResult getFolder(){
+ public AjaxResult getFolder() {
try {
ServerResult> serverResult = fileService.selectFileFolder();
- if (serverResult.isStart()){
+ if (serverResult.isStart()) {
return AjaxResult.success(serverResult.getData());
- }else {
+ } else {
return AjaxResult.error(serverResult.getMsg());
}
} catch (RuntimeException e) {
@@ -138,21 +138,25 @@ public class FileController extends HcyBaseController {
@PostMapping
public AjaxResult add(@RequestBody SysFile sysFile) {
try {
- if (sysFile.getFileAddr() == null||sysFile.getFileAddr().equals("")){
+ if (sysFile.getFileAddr() == null || sysFile.getFileAddr().equals("")) {
return AjaxResult.error("上传文件不能为空!");
}
- Map modeMap = new HashMap<>();
- ServerResult serverResult = fileService.insertFile(sysFile);
- if (serverResult.isStart()) {
- if (sysFile.getIsPublic().equals("1")) {
- String fileUrl = FtpUtils.getResources() + sysFile.getFileAddr().substring(FtpUtils.getPubfiles().length()) + "/" + sysFile.getMapping();
- modeMap.put("url", fileUrl);
+ if (sysFile.getIsPublic().equals("1") || sysFile.getIsPublic().equals("2")) {
+ Map modeMap = new HashMap<>();
+ ServerResult serverResult = fileService.insertFile(sysFile);
+ if (serverResult.isStart()) {
+ if (sysFile.getIsPublic().equals("1")) {
+ String fileUrl = FtpUtils.getResources() + sysFile.getFileAddr().substring(FtpUtils.getPubfiles().length()) + "/" + sysFile.getMapping();
+ modeMap.put("url", fileUrl);
+ }
+ String fileUri = sysFile.getFileAddr() + "/" + sysFile.getMapping();
+ modeMap.put("uri", fileUri);
+ return AjaxResult.success(modeMap);
+ } else {
+ return AjaxResult.error(serverResult.getMsg());
}
- String filrUri = sysFile.getFileAddr() + "/" + sysFile.getMapping();
- modeMap.put("uri", filrUri);
- return AjaxResult.success(modeMap);
- } else {
- return AjaxResult.error(serverResult.getMsg());
+ }else {
+ return AjaxResult.error("isPublic为空或者状态有误!");
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
@@ -208,7 +212,7 @@ public class FileController extends HcyBaseController {
public AjaxResult download(@PathVariable Long fileId, HttpServletRequest request, HttpServletResponse response) {
try {
LoginUser user = tokenService.getFileUser(request);
- ServerResult serverResult = fileService.downloadFile(fileId,user);
+ ServerResult serverResult = fileService.downloadFile(fileId, user);
if (serverResult.isStart()) {
return AjaxResult.success(serverResult.getData().getFileName());
} else {
@@ -219,8 +223,9 @@ public class FileController extends HcyBaseController {
return AjaxResult.error(ReturnConstants.SYS_ERROR);
}
}
+
@GetMapping("/download/api")
- public AjaxResult api(){
+ public AjaxResult api() {
return AjaxResult.success("8085");
}
}
diff --git a/hchyun/hchyun-generator/pom.xml b/hchyun/hchyun-generator/pom.xml
index 7e9b1ba..e68874e 100644
--- a/hchyun/hchyun-generator/pom.xml
+++ b/hchyun/hchyun-generator/pom.xml
@@ -16,7 +16,6 @@
-
org.apache.velocity
diff --git a/hchyun/hchyun-generator/src/main/resources/generator.yml b/hchyun/hchyun-generator/src/main/resources/generator.yml
index 7e57e2c..97c45d4 100644
--- a/hchyun/hchyun-generator/src/main/resources/generator.yml
+++ b/hchyun/hchyun-generator/src/main/resources/generator.yml
@@ -1,5 +1,5 @@
# 代码生成
-gen:
+gen:
# 作者
author: hchyun
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
diff --git a/hchyun/hchyun-generator/src/main/resources/mapper/generator/InterTableMapper.xml b/hchyun/hchyun-generator/src/main/resources/mapper/generator/InterTableMapper.xml
index f8d457b..e4d0656 100644
--- a/hchyun/hchyun-generator/src/main/resources/mapper/generator/InterTableMapper.xml
+++ b/hchyun/hchyun-generator/src/main/resources/mapper/generator/InterTableMapper.xml
@@ -74,12 +74,12 @@
- select id, m_id, c_id, it_name, it_describe, is_permission, requrl, method, is_generate, type, create_time, create_by from sys_inter_table
+ select id, m_id, c_id, it_name, it_describe, is_permission, requrl, method, is_generate, type, create_time, create_by from gen_inter_table
@@ -87,7 +87,7 @@
@@ -113,20 +113,20 @@
- insert into sys_inter_table (m_id, c_id, it_name, it_describe, is_permission, requrl, method, is_generate, type, create_by) VALUES
+ insert into gen_inter_table (m_id, c_id, it_name, it_describe, is_permission, requrl, method, is_generate, type, create_by) VALUES
(#{item.mId},#{item.cId},#{item.itName},#{item.itDescribe},#{item.isPermission},#{item.requrl},#{item.method},#{item.isGenerate},#{item.type},#{item.createBy})
- delete from sys_inter_table where c_id = #{cId} and type = 2
+ delete from gen_inter_table where c_id = #{cId} and type = 2
- delete from sys_inter_table where c_id = #{cId} and type = 1
+ delete from gen_inter_table where c_id = #{cId} and type = 1
- insert into sys_inter_table
+ insert into gen_inter_table
m_id,
c_id,
@@ -154,7 +154,7 @@
- update sys_inter_table
+ update gen_inter_table
m_id = #{mId},
c_id = #{cId},
@@ -171,11 +171,11 @@
- delete from sys_inter_table where id = #{id}
+ delete from gen_inter_table where id = #{id}
- delete from sys_inter_table where id in
+ delete from gen_inter_table where id in
#{id}
diff --git a/hchyun/hchyun-system/src/main/java/com/hchyun/system/service/impl/FileServiceImpl.java b/hchyun/hchyun-system/src/main/java/com/hchyun/system/service/impl/FileServiceImpl.java
index 6fc2dd9..733f70c 100644
--- a/hchyun/hchyun-system/src/main/java/com/hchyun/system/service/impl/FileServiceImpl.java
+++ b/hchyun/hchyun-system/src/main/java/com/hchyun/system/service/impl/FileServiceImpl.java
@@ -96,14 +96,17 @@ public class FileServiceImpl implements FileService {
if (sysFile == null) {
return new ServerResult<>(false, "文件上传失败!");
}
- if (sysFile.getpId() != null || sysFile.getpId() > 0) {
- SysFile folder = fileDao.selectFileById(sysFile.getpId());
- sysFile.setInherit(folder.getRoleIds());
+ if (sysFile.getpId() != null) {
+ if (sysFile.getpId() > 0) {
+ SysFile folder = fileDao.selectFileById(sysFile.getpId());
+ sysFile.setInherit(folder.getRoleIds());
+ }
}
sysFile.setCreateBy(SecurityUtils.getUserId());
try {
sysFile = FtpUtils.uploadFtp(sysFile);
} catch (RuntimeException e) {
+ logger.error(e.getMessage());
return new ServerResult<>(false, "文件处理出错,请重新上传文件!");
}
Integer renewal = fileDao.insertFile(sysFile);
diff --git a/hchyun/pom.xml b/hchyun/pom.xml
index 786e9d6..aadf5eb 100644
--- a/hchyun/pom.xml
+++ b/hchyun/pom.xml
@@ -172,6 +172,7 @@
hchyun-generator
${hchyun.version}
+
com.hchyun