Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
dacd0830
Commit
dacd0830
authored
Apr 27, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口文档的支持
parent
cae27069
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
FileHelper.java
...src/main/java/com/yanzuoguang/util/helper/FileHelper.java
+31
-0
ExcelConsole.java
...-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
+2
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/FileHelper.java
View file @
dacd0830
...
...
@@ -16,6 +16,37 @@ import java.io.RandomAccessFile;
*/
public
class
FileHelper
{
/**
* 创建目录
*
* @param path 文件路径
* @return 读取的内容
*/
public
static
String
createDirectory
(
String
path
)
{
return
createDirectory
(
new
File
(
path
));
}
/**
* 创建目录
*
* @param file 文件路径
* @return 读取的内容
*/
public
static
String
createDirectory
(
File
file
)
{
if
(
file
.
exists
())
{
//检查此路径名的文件是否是一个目录(文件夹)
if
(
file
.
isDirectory
())
{
return
StringHelper
.
EMPTY
;
}
else
{
throw
new
CodeException
(
"文件"
+
file
.
getName
()
+
"已存在文件,不能创建目录"
);
}
}
file
.
mkdirs
();
return
file
.
getName
();
}
/**
* 获取登录标记
*
...
...
yzg-util-db/src/main/java/com/yanzuoguang/excel/ExcelConsole.java
View file @
dacd0830
...
...
@@ -3,6 +3,7 @@ package com.yanzuoguang.excel;
import
com.yanzuoguang.db.impl.DbRow
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.CheckerHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.table.TableHead
;
import
com.yanzuoguang.util.table.TableHeadHelper
;
...
...
@@ -413,6 +414,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
* @return 文件名
*/
public
String
getFileName
()
{
FileHelper
.
createDirectory
(
this
.
config
.
getServerPath
());
String
fileName
=
String
.
format
(
"%s/%s"
,
this
.
config
.
getServerPath
(),
this
.
config
.
getFileName
());
return
fileName
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment