Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
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
fangxinjiang
yifu-mvp
Commits
42c8c96e
Commit
42c8c96e
authored
Nov 03, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限配置页面
parent
fa77967d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
24 deletions
+112
-24
EmployeeProjectExportParamVO.java
...lus/v1/yifu/archives/vo/EmployeeProjectExportParamVO.java
+18
-0
TEmployeeProjectMapper.java
.../plus/v1/yifu/archives/mapper/TEmployeeProjectMapper.java
+4
-0
TEmployeeInfoServiceImpl.java
.../yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
+1
-1
TEmployeeProjectServiceImpl.java
...fu/archives/service/impl/TEmployeeProjectServiceImpl.java
+54
-23
TEmployeeProjectMapper.xml
...-biz/src/main/resources/mapper/TEmployeeProjectMapper.xml
+35
-0
No files found.
yifu-archives/yifu-archives-api/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/vo/EmployeeProjectExportParamVO.java
View file @
42c8c96e
...
...
@@ -23,6 +23,7 @@ import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
javax.validation.constraints.Past
;
...
...
@@ -484,4 +485,21 @@ public class EmployeeProjectExportParamVO extends BaseEntity {
private
String
[]
empNatureArray
;
private
List
<
String
>
idList
;
/**
* @Author fxj
* 查询数据起
**/
private
int
limitStart
;
/**
* @Author fxj
* 查询数据止
**/
private
int
limitEnd
;
/**
* 导出IDS
*/
@Schema
(
description
=
"导出IDS"
)
private
String
ids
;
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/mapper/TEmployeeProjectMapper.java
View file @
42c8c96e
...
...
@@ -59,4 +59,8 @@ public interface TEmployeeProjectMapper extends BaseMapper<TEmployeeProject> {
* @return
*/
List
<
EmployeeProjectExportVO
>
getTEmployeeProjectExportPage
(
@Param
(
"tEmployeeProject"
)
EmployeeProjectExportParamVO
tEmployeeProject
);
// getTEmployeeProjectExportPage 改造
List
<
EmployeeProjectExportVO
>
noPageDiy
(
@Param
(
"tEmployeeProject"
)
EmployeeProjectExportParamVO
searchVo
);
int
noPageCountDiy
(
@Param
(
"tEmployeeProject"
)
EmployeeProjectExportParamVO
searchVo
);
}
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeInfoServiceImpl.java
View file @
42c8c96e
...
...
@@ -2033,7 +2033,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
}
else
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"
不良记录
"
+
index
).
build
();
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"
人员档案批量导出
"
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
}
if
(
Common
.
isNotNull
(
list
)){
...
...
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeProjectServiceImpl.java
View file @
42c8c96e
...
...
@@ -19,10 +19,12 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.read.listener.ReadListener
;
import
com.alibaba.excel.read.metadata.holder.ReadRowHolder
;
import
com.alibaba.excel.util.ListUtils
;
import
com.alibaba.excel.write.metadata.WriteSheet
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
...
@@ -62,6 +64,7 @@ import javax.servlet.ServletOutputStream;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.lang.reflect.Field
;
import
java.net.URLEncoder
;
import
java.time.LocalDateTime
;
import
java.util.*
;
...
...
@@ -1173,38 +1176,58 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
* @Date 10:55 2022/6/23
**/
@Override
public
void
listExportProject
(
HttpServletResponse
response
,
EmployeeProjectExportParamVO
projectDTO
,
String
idstr
,
List
<
String
>
exportFields
)
{
public
void
listExportProject
(
HttpServletResponse
response
,
EmployeeProjectExportParamVO
searchVo
,
String
idstr
,
List
<
String
>
exportFields
)
{
searchVo
.
setIdList
(
Common
.
getList
(
idstr
));
String
fileName
=
"项目档案批量导出"
+
DateUtil
.
getThisTime
()
+
CommonConstants
.
XLSX
;
// 根据用户传入确定要导出的字段
Set
<
String
>
includeColumnFiledNames
=
new
HashSet
<>(
exportFields
);
//获取要导出的列表
List
<
EmployeeProjectExportVO
>
list
;
//获取记录
list
=
gettEmpProInfoExportVos
(
idstr
,
projectDTO
);
//获取要导出的列表 gettEmpProInfoExportVos
List
<
EmployeeProjectExportVO
>
list
=
new
ArrayList
<>();
long
count
=
noPageCountDiy
(
searchVo
);
ServletOutputStream
out
=
null
;
if
(
list
==
null
||
list
.
isEmpty
())
{
list
=
new
ArrayList
<>();
}
try
{
out
=
response
.
getOutputStream
();
ExcelUtil
<
EmployeeProjectExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeProjectExportVO
.
class
);
for
(
EmployeeProjectExportVO
vo
:
list
)
{
util
.
convertEntity
(
vo
,
null
,
null
,
null
);
}
response
.
setContentType
(
CommonConstants
.
MULTIPART_FORM_DATA
);
response
.
setCharacterEncoding
(
CommonConstants
.
UTF8
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
CommonConstants
.
UTF8
));
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
CommonConstants
.
CONTENT_DISPOSITION
,
CommonConstants
.
ATTACHMENT_FILENAME
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel
.
write
(
out
,
EmployeeProjectExportVO
.
class
).
includeColumnFiledNames
(
includeColumnFiledNames
).
sheet
(
"项目档案"
)
.
doWrite
(
list
);
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
out
,
EmployeeProjectExportVO
.
class
).
includeColumnFieldNames
(
includeColumnFiledNames
).
build
();
int
index
=
0
;
if
(
count
>
CommonConstants
.
ZERO_INT
){
Field
[]
allFields
=
EmployeeProjectExportVO
.
class
.
getDeclaredFields
();
for
(
int
i
=
0
;
i
<=
count
;
)
{
// 获取实际记录
searchVo
.
setLimitStart
(
i
);
searchVo
.
setLimitEnd
(
CommonConstants
.
EXCEL_EXPORT_LIMIT
);
list
=
noPageDiy
(
searchVo
);
if
(
Common
.
isNotNull
(
list
)){
ExcelUtil
<
EmployeeProjectExportVO
>
util
=
new
ExcelUtil
<>(
EmployeeProjectExportVO
.
class
);
for
(
EmployeeProjectExportVO
vo:
list
){
util
.
convertEntityAsso
(
vo
,
null
,
null
,
null
,
allFields
);
}
}
if
(
Common
.
isNotNull
(
list
)){
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"项目档案批量导出"
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
index
++;
}
i
=
i
+
CommonConstants
.
EXCEL_EXPORT_LIMIT
;
if
(
Common
.
isNotNull
(
list
)){
list
.
clear
();
}
}
}
else
{
WriteSheet
writeSheet
=
EasyExcel
.
writerSheet
(
"项目档案批量导出"
+
index
).
build
();
excelWriter
.
write
(
list
,
writeSheet
);
}
if
(
Common
.
isNotNull
(
list
)){
list
.
clear
();
}
out
.
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
finally
{
excelWriter
.
finish
();
}
catch
(
Exception
e
){
log
.
error
(
"执行异常"
,
e
);
}
finally
{
try
{
if
(
null
!=
out
)
{
out
.
close
();
...
...
@@ -1215,6 +1238,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
}
private
List
<
EmployeeProjectExportVO
>
noPageDiy
(
EmployeeProjectExportParamVO
searchVo
)
{
return
baseMapper
.
noPageDiy
(
searchVo
);
}
private
int
noPageCountDiy
(
EmployeeProjectExportParamVO
searchVo
)
{
return
baseMapper
.
noPageCountDiy
(
searchVo
);
}
/**
* @param employeeInfo
* @Description: 新增项目档案
...
...
yifu-archives/yifu-archives-biz/src/main/resources/mapper/TEmployeeProjectMapper.xml
View file @
42c8c96e
...
...
@@ -802,4 +802,39 @@
</where>
order by a.CREATE_TIME desc
</select>
<!--tEmployeeInfo导出查询改造 fxj 2022-11-03-->
<select
id=
"noPageDiy"
resultMap=
"tEmployeeProjectExportMap"
>
SELECT
<include
refid=
"Base_Export_List"
/>
FROM t_employee_project a
left join t_employee_info b on a.EMP_ID = b.id
<where>
a.DELETE_FLAG = '0'
<include
refid=
"exportTEmployeeProject_where"
/>
<if
test=
"tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''"
>
${tEmployeeProject.authSql}
</if>
</where>
order by a.CREATE_TIME desc
<if
test=
"tEmployeeProject != null"
>
<if
test=
"tEmployeeProject.limitStart != null"
>
limit #{tEmployeeProject.limitStart},#{tEmployeeProject.limitEnd}
</if>
</if>
</select>
<!--tEmployeeInfo导出查询count改造 fxj 2022-11-03-->
<select
id=
"noPageCountDiy"
resultType=
"java.lang.Integer"
>
SELECT
count(1)
FROM t_employee_project a
left join t_employee_info b on a.EMP_ID = b.id
<where>
a.DELETE_FLAG = '0'
<include
refid=
"exportTEmployeeProject_where"
/>
<if
test=
"tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''"
>
${tEmployeeProject.authSql}
</if>
</where>
</select>
</mapper>
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