Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Y
yn-health-science
Project
Project
Details
Activity
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
徐俊
yn-health-science
Commits
6857289b
Commit
6857289b
authored
Feb 18, 2025
by
徐俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xujun
parent
401dd323
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
0 deletions
+41
-0
ComDownloadDAO.java
...src/main/java/com/yiboshi/science/dao/ComDownloadDAO.java
+3
-0
ComDownloadController.java
...va/com/yiboshi/science/rest/v1/ComDownloadController.java
+8
-0
ComDownloadService.java
.../java/com/yiboshi/science/service/ComDownloadService.java
+10
-0
ComDownloadServiceImpl.java
.../yiboshi/science/service/impl/ComDownloadServiceImpl.java
+15
-0
ComDownloadDAO.xml
science-admin/src/main/resources/mapper/ComDownloadDAO.xml
+5
-0
No files found.
science-admin/src/main/java/com/yiboshi/science/dao/ComDownloadDAO.java
View file @
6857289b
...
...
@@ -18,4 +18,6 @@ import org.apache.ibatis.annotations.Param;
public
interface
ComDownloadDAO
extends
BaseMapper
<
ComDownload
>,
BaseDAO
<
ComDownloadQueryVO
,
ComDownloadDTO
,
ComDownload
>
{
Page
<
ComDownloadDTO
>
getAllListByPage
(
Page
<
ComDownloadQueryVO
>
page
,
@Param
(
"ew"
)
Wrapper
<
ComDownloadQueryVO
>
queryWrapper
);
ComDownload
getDownloadByFileName
(
String
fileName
);
}
\ No newline at end of file
science-admin/src/main/java/com/yiboshi/science/rest/v1/ComDownloadController.java
View file @
6857289b
...
...
@@ -51,6 +51,14 @@ public class ComDownloadController extends BaseController<ComDownloadService, Co
return
ResponseDataModel
.
ok
(
ComDownloadService
.
asyncUpload
(
file
));
}
@ApiOperation
(
value
=
"文件上传"
,
httpMethod
=
"POST"
,
notes
=
"文件上传"
)
@PostMapping
(
"/asyncApplyBookUpload"
)
// @Logs(value = CommonEnum.logType.fileUpload)
public
ResponseDataModel
<
ComDownload
>
asyncApplyBookUpload
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
return
ResponseDataModel
.
ok
(
ComDownloadService
.
asyncApplyBookUpload
(
file
));
}
@ApiOperation
(
value
=
"删除文件"
,
httpMethod
=
"DELETE"
,
notes
=
"删除文件"
)
@DeleteMapping
(
value
=
"delete/{id}"
)
@Logs
(
value
=
CommonEnum
.
logType
.
fileDelete
)
...
...
science-admin/src/main/java/com/yiboshi/science/service/ComDownloadService.java
View file @
6857289b
...
...
@@ -21,6 +21,13 @@ public interface ComDownloadService extends BaseService<ComDownloadQueryVO, ComD
* @param
*/
ComDownload
asyncUpload
(
MultipartFile
file
);
/**
* 文件上传
* @param file
* @return
*/
ComDownload
asyncApplyBookUpload
(
MultipartFile
file
);
/**
* 删除文件
*
...
...
@@ -46,4 +53,6 @@ public interface ComDownloadService extends BaseService<ComDownloadQueryVO, ComD
String
getFilePath
(
String
basePath
);
String
getPhysicalPath
(
String
filePath
);
ComDownload
getDownloadByFileName
(
String
fileName
);
}
\ No newline at end of file
science-admin/src/main/java/com/yiboshi/science/service/impl/ComDownloadServiceImpl.java
View file @
6857289b
...
...
@@ -147,6 +147,21 @@ public class ComDownloadServiceImpl extends BaseServiceImpl<ComDownloadDAO, ComD
throw
new
BusinessException
(
"文件上传失败!"
);
}
public
ComDownload
asyncApplyBookUpload
(
MultipartFile
file
)
{
ComDownload
entity
=
this
.
asyncUpload
(
file
);
ComDownload
applyBookFile
=
this
.
getDownloadByFileName
(
file
.
getOriginalFilename
().
replace
(
".pdf"
,
".doc"
));
if
(
null
!=
applyBookFile
)
{
applyBookFile
.
setConvertUrl
(
entity
.
getDownloadUrl
());
this
.
update
(
applyBookFile
);
}
return
applyBookFile
;
}
public
ComDownload
getDownloadByFileName
(
String
fileName
)
{
return
comDownloadDAO
.
getDownloadByFileName
(
fileName
);
}
public
String
delete
(
String
id
)
{
ComDownload
comDownload
=
this
.
getById
(
id
);
if
(
null
!=
comDownload
){
...
...
science-admin/src/main/resources/mapper/ComDownloadDAO.xml
View file @
6857289b
...
...
@@ -16,4 +16,8 @@
</where>
ORDER BY c.created desc
</select>
<select
id=
"getDownloadByFileName"
parameterType=
"java.lang.String"
resultType=
"com.yiboshi.science.entity.ComDownload"
>
select * from com_download where download_url like concat('%', #{fileName}, '%')
</select>
</mapper>
\ No newline at end of file
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