Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
RuoYi Vue
Commits
cedd2d1d
Commit
cedd2d1d
authored
Nov 17, 2021
by
RuoYi
Browse files
优化导出数据操作
parent
2ab96587
Changes
37
Hide whitespace changes
Inline
Side-by-side
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
View file @
cedd2d1d
package
com.ruoyi.web.controller.monitor
;
package
com.ruoyi.web.controller.monitor
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.annotation.Log
;
...
@@ -40,12 +42,12 @@ public class SysLogininforController extends BaseController
...
@@ -40,12 +42,12 @@ public class SysLogininforController extends BaseController
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"登录日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:export')"
)
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:export')"
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysLogininfor
logininfor
)
public
void
export
(
HttpServletResponse
response
,
SysLogininfor
logininfor
)
{
{
List
<
SysLogininfor
>
list
=
logininforService
.
selectLogininforList
(
logininfor
);
List
<
SysLogininfor
>
list
=
logininforService
.
selectLogininforList
(
logininfor
);
ExcelUtil
<
SysLogininfor
>
util
=
new
ExcelUtil
<
SysLogininfor
>(
SysLogininfor
.
class
);
ExcelUtil
<
SysLogininfor
>
util
=
new
ExcelUtil
<
SysLogininfor
>(
SysLogininfor
.
class
);
return
util
.
exportExcel
(
list
,
"登录日志"
);
util
.
exportExcel
(
response
,
list
,
"登录日志"
);
}
}
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:remove')"
)
@PreAuthorize
(
"@ss.hasPermi('monitor:logininfor:remove')"
)
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
View file @
cedd2d1d
package
com.ruoyi.web.controller.monitor
;
package
com.ruoyi.web.controller.monitor
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.annotation.Log
;
...
@@ -40,12 +42,12 @@ public class SysOperlogController extends BaseController
...
@@ -40,12 +42,12 @@ public class SysOperlogController extends BaseController
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:export')"
)
@PreAuthorize
(
"@ss.hasPermi('monitor:operlog:export')"
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysOperLog
operLog
)
public
void
export
(
HttpServletResponse
response
,
SysOperLog
operLog
)
{
{
List
<
SysOperLog
>
list
=
operLogService
.
selectOperLogList
(
operLog
);
List
<
SysOperLog
>
list
=
operLogService
.
selectOperLogList
(
operLog
);
ExcelUtil
<
SysOperLog
>
util
=
new
ExcelUtil
<
SysOperLog
>(
SysOperLog
.
class
);
ExcelUtil
<
SysOperLog
>
util
=
new
ExcelUtil
<
SysOperLog
>(
SysOperLog
.
class
);
return
util
.
exportExcel
(
list
,
"操作日志"
);
util
.
exportExcel
(
response
,
list
,
"操作日志"
);
}
}
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
DELETE
)
@Log
(
title
=
"操作日志"
,
businessType
=
BusinessType
.
DELETE
)
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
View file @
cedd2d1d
package
com.ruoyi.web.controller.system
;
package
com.ruoyi.web.controller.system
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.annotation.RepeatSubmit
;
import
com.ruoyi.common.constant.UserConstants
;
import
com.ruoyi.common.constant.UserConstants
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.AjaxResult
;
...
@@ -49,12 +49,12 @@ public class SysConfigController extends BaseController
...
@@ -49,12 +49,12 @@ public class SysConfigController extends BaseController
@Log
(
title
=
"参数管理"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"参数管理"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:config:export')"
)
@PreAuthorize
(
"@ss.hasPermi('system:config:export')"
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysConfig
config
)
public
void
export
(
HttpServletResponse
response
,
SysConfig
config
)
{
{
List
<
SysConfig
>
list
=
configService
.
selectConfigList
(
config
);
List
<
SysConfig
>
list
=
configService
.
selectConfigList
(
config
);
ExcelUtil
<
SysConfig
>
util
=
new
ExcelUtil
<
SysConfig
>(
SysConfig
.
class
);
ExcelUtil
<
SysConfig
>
util
=
new
ExcelUtil
<
SysConfig
>(
SysConfig
.
class
);
return
util
.
exportExcel
(
list
,
"参数数据"
);
util
.
exportExcel
(
response
,
list
,
"参数数据"
);
}
}
/**
/**
...
@@ -82,7 +82,6 @@ public class SysConfigController extends BaseController
...
@@ -82,7 +82,6 @@ public class SysConfigController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:config:add')"
)
@PreAuthorize
(
"@ss.hasPermi('system:config:add')"
)
@Log
(
title
=
"参数管理"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"参数管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
@PostMapping
@RepeatSubmit
public
AjaxResult
add
(
@Validated
@RequestBody
SysConfig
config
)
public
AjaxResult
add
(
@Validated
@RequestBody
SysConfig
config
)
{
{
if
(
UserConstants
.
NOT_UNIQUE
.
equals
(
configService
.
checkConfigKeyUnique
(
config
)))
if
(
UserConstants
.
NOT_UNIQUE
.
equals
(
configService
.
checkConfigKeyUnique
(
config
)))
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
View file @
cedd2d1d
...
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
...
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -50,12 +51,12 @@ public class SysDictDataController extends BaseController
...
@@ -50,12 +51,12 @@ public class SysDictDataController extends BaseController
@Log
(
title
=
"字典数据"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"字典数据"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:dict:export')"
)
@PreAuthorize
(
"@ss.hasPermi('system:dict:export')"
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysDictData
dictData
)
public
void
export
(
HttpServletResponse
response
,
SysDictData
dictData
)
{
{
List
<
SysDictData
>
list
=
dictDataService
.
selectDictDataList
(
dictData
);
List
<
SysDictData
>
list
=
dictDataService
.
selectDictDataList
(
dictData
);
ExcelUtil
<
SysDictData
>
util
=
new
ExcelUtil
<
SysDictData
>(
SysDictData
.
class
);
ExcelUtil
<
SysDictData
>
util
=
new
ExcelUtil
<
SysDictData
>(
SysDictData
.
class
);
return
util
.
exportExcel
(
list
,
"字典数据"
);
util
.
exportExcel
(
response
,
list
,
"字典数据"
);
}
}
/**
/**
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
View file @
cedd2d1d
package
com.ruoyi.web.controller.system
;
package
com.ruoyi.web.controller.system
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -45,12 +46,12 @@ public class SysDictTypeController extends BaseController
...
@@ -45,12 +46,12 @@ public class SysDictTypeController extends BaseController
@Log
(
title
=
"字典类型"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"字典类型"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:dict:export')"
)
@PreAuthorize
(
"@ss.hasPermi('system:dict:export')"
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysDictType
dictType
)
public
void
export
(
HttpServletResponse
response
,
SysDictType
dictType
)
{
{
List
<
SysDictType
>
list
=
dictTypeService
.
selectDictTypeList
(
dictType
);
List
<
SysDictType
>
list
=
dictTypeService
.
selectDictTypeList
(
dictType
);
ExcelUtil
<
SysDictType
>
util
=
new
ExcelUtil
<
SysDictType
>(
SysDictType
.
class
);
ExcelUtil
<
SysDictType
>
util
=
new
ExcelUtil
<
SysDictType
>(
SysDictType
.
class
);
return
util
.
exportExcel
(
list
,
"字典类型"
);
util
.
exportExcel
(
response
,
list
,
"字典类型"
);
}
}
/**
/**
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
View file @
cedd2d1d
package
com.ruoyi.web.controller.system
;
package
com.ruoyi.web.controller.system
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -48,12 +49,12 @@ public class SysPostController extends BaseController
...
@@ -48,12 +49,12 @@ public class SysPostController extends BaseController
@Log
(
title
=
"岗位管理"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"岗位管理"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:post:export')"
)
@PreAuthorize
(
"@ss.hasPermi('system:post:export')"
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysPost
post
)
public
void
export
(
HttpServletResponse
response
,
SysPost
post
)
{
{
List
<
SysPost
>
list
=
postService
.
selectPostList
(
post
);
List
<
SysPost
>
list
=
postService
.
selectPostList
(
post
);
ExcelUtil
<
SysPost
>
util
=
new
ExcelUtil
<
SysPost
>(
SysPost
.
class
);
ExcelUtil
<
SysPost
>
util
=
new
ExcelUtil
<
SysPost
>(
SysPost
.
class
);
return
util
.
exportExcel
(
list
,
"岗位数据"
);
util
.
exportExcel
(
response
,
list
,
"岗位数据"
);
}
}
/**
/**
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
View file @
cedd2d1d
package
com.ruoyi.web.controller.system
;
package
com.ruoyi.web.controller.system
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -61,12 +62,12 @@ public class SysRoleController extends BaseController
...
@@ -61,12 +62,12 @@ public class SysRoleController extends BaseController
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"角色管理"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:role:export')"
)
@PreAuthorize
(
"@ss.hasPermi('system:role:export')"
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysRole
role
)
public
void
export
(
HttpServletResponse
response
,
SysRole
role
)
{
{
List
<
SysRole
>
list
=
roleService
.
selectRoleList
(
role
);
List
<
SysRole
>
list
=
roleService
.
selectRoleList
(
role
);
ExcelUtil
<
SysRole
>
util
=
new
ExcelUtil
<
SysRole
>(
SysRole
.
class
);
ExcelUtil
<
SysRole
>
util
=
new
ExcelUtil
<
SysRole
>(
SysRole
.
class
);
return
util
.
exportExcel
(
list
,
"角色数据"
);
util
.
exportExcel
(
response
,
list
,
"角色数据"
);
}
}
/**
/**
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
View file @
cedd2d1d
...
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
...
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
@@ -62,12 +63,12 @@ public class SysUserController extends BaseController
...
@@ -62,12 +63,12 @@ public class SysUserController extends BaseController
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
EXPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:user:export')"
)
@PreAuthorize
(
"@ss.hasPermi('system:user:export')"
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysUser
user
)
public
void
export
(
HttpServletResponse
response
,
SysUser
user
)
{
{
List
<
SysUser
>
list
=
userService
.
selectUserList
(
user
);
List
<
SysUser
>
list
=
userService
.
selectUserList
(
user
);
ExcelUtil
<
SysUser
>
util
=
new
ExcelUtil
<
SysUser
>(
SysUser
.
class
);
ExcelUtil
<
SysUser
>
util
=
new
ExcelUtil
<
SysUser
>(
SysUser
.
class
);
return
util
.
exportExcel
(
list
,
"用户数据"
);
util
.
exportExcel
(
response
,
list
,
"用户数据"
);
}
}
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
IMPORT
)
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
IMPORT
)
...
@@ -82,11 +83,11 @@ public class SysUserController extends BaseController
...
@@ -82,11 +83,11 @@ public class SysUserController extends BaseController
return
AjaxResult
.
success
(
message
);
return
AjaxResult
.
success
(
message
);
}
}
@
Ge
tMapping
(
"/importTemplate"
)
@
Pos
tMapping
(
"/importTemplate"
)
public
AjaxResult
importTemplate
()
public
void
importTemplate
(
HttpServletResponse
response
)
{
{
ExcelUtil
<
SysUser
>
util
=
new
ExcelUtil
<
SysUser
>(
SysUser
.
class
);
ExcelUtil
<
SysUser
>
util
=
new
ExcelUtil
<
SysUser
>(
SysUser
.
class
);
return
util
.
importTemplateExcel
(
"用户数据"
);
util
.
importTemplateExcel
(
response
,
"用户数据"
);
}
}
/**
/**
...
...
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
View file @
cedd2d1d
...
@@ -431,7 +431,7 @@ public class ExcelUtil<T>
...
@@ -431,7 +431,7 @@ public class ExcelUtil<T>
* @return 结果
* @return 结果
* @throws IOException
* @throws IOException
*/
*/
public
void
exportExcel
(
HttpServletResponse
response
,
List
<
T
>
list
,
String
sheetName
)
throws
IOException
public
void
exportExcel
(
HttpServletResponse
response
,
List
<
T
>
list
,
String
sheetName
)
{
{
exportExcel
(
response
,
list
,
sheetName
,
StringUtils
.
EMPTY
);
exportExcel
(
response
,
list
,
sheetName
,
StringUtils
.
EMPTY
);
}
}
...
@@ -446,12 +446,12 @@ public class ExcelUtil<T>
...
@@ -446,12 +446,12 @@ public class ExcelUtil<T>
* @return 结果
* @return 结果
* @throws IOException
* @throws IOException
*/
*/
public
void
exportExcel
(
HttpServletResponse
response
,
List
<
T
>
list
,
String
sheetName
,
String
title
)
throws
IOException
public
void
exportExcel
(
HttpServletResponse
response
,
List
<
T
>
list
,
String
sheetName
,
String
title
)
{
{
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setCharacterEncoding
(
"utf-8"
);
this
.
init
(
list
,
sheetName
,
title
,
Type
.
EXPORT
);
this
.
init
(
list
,
sheetName
,
title
,
Type
.
EXPORT
);
exportExcel
(
response
.
getOutputStream
()
);
exportExcel
(
response
);
}
}
/**
/**
...
@@ -484,7 +484,7 @@ public class ExcelUtil<T>
...
@@ -484,7 +484,7 @@ public class ExcelUtil<T>
* @param sheetName 工作表的名称
* @param sheetName 工作表的名称
* @return 结果
* @return 结果
*/
*/
public
void
importTemplateExcel
(
HttpServletResponse
response
,
String
sheetName
)
throws
IOException
public
void
importTemplateExcel
(
HttpServletResponse
response
,
String
sheetName
)
{
{
importTemplateExcel
(
response
,
sheetName
,
StringUtils
.
EMPTY
);
importTemplateExcel
(
response
,
sheetName
,
StringUtils
.
EMPTY
);
}
}
...
@@ -496,12 +496,12 @@ public class ExcelUtil<T>
...
@@ -496,12 +496,12 @@ public class ExcelUtil<T>
* @param title 标题
* @param title 标题
* @return 结果
* @return 结果
*/
*/
public
void
importTemplateExcel
(
HttpServletResponse
response
,
String
sheetName
,
String
title
)
throws
IOException
public
void
importTemplateExcel
(
HttpServletResponse
response
,
String
sheetName
,
String
title
)
{
{
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setCharacterEncoding
(
"utf-8"
);
this
.
init
(
null
,
sheetName
,
title
,
Type
.
IMPORT
);
this
.
init
(
null
,
sheetName
,
title
,
Type
.
IMPORT
);
exportExcel
(
response
.
getOutputStream
()
);
exportExcel
(
response
);
}
}
/**
/**
...
@@ -509,12 +509,12 @@ public class ExcelUtil<T>
...
@@ -509,12 +509,12 @@ public class ExcelUtil<T>
*
*
* @return 结果
* @return 结果
*/
*/
public
void
exportExcel
(
OutputStream
out
)
public
void
exportExcel
(
HttpServletResponse
response
)
{
{
try
try
{
{
writeSheet
();
writeSheet
();
wb
.
write
(
out
);
wb
.
write
(
response
.
getOutputStream
()
);
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
{
...
@@ -523,7 +523,6 @@ public class ExcelUtil<T>
...
@@ -523,7 +523,6 @@ public class ExcelUtil<T>
finally
finally
{
{
IOUtils
.
closeQuietly
(
wb
);
IOUtils
.
closeQuietly
(
wb
);
IOUtils
.
closeQuietly
(
out
);
}
}
}
}
...
...
ruoyi-generator/src/main/resources/vm/java/controller.java.vm
View file @
cedd2d1d
package
${
packageName
}
.controller;
package
${
packageName
}
.controller;
import java.util.List;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.GetMapping;
...
@@ -61,12 +62,12 @@ public class ${ClassName}Controller extends BaseController
...
@@ -61,12 +62,12 @@ public class ${ClassName}Controller extends BaseController
*/
*/
@PreAuthorize("@ss.hasPermi('
${
permissionPrefix
}
:export')")
@PreAuthorize("@ss.hasPermi('
${
permissionPrefix
}
:export')")
@Log(title = "
${
functionName
}
", businessType = BusinessType.EXPORT)
@Log(title = "
${
functionName
}
", businessType = BusinessType.EXPORT)
@
Ge
tMapping("/export")
@
Pos
tMapping("/export")
public
AjaxResult export(
${
ClassName
}
${
className
}
)
public
void export(HttpServletResponse response,
${
ClassName
}
${
className
}
)
{
{
List
<
${
ClassName
}
>
list =
${
className
}
Service.select
${
ClassName
}
List(
${
className
}
);
List
<
${
ClassName
}
>
list =
${
className
}
Service.select
${
ClassName
}
List(
${
className
}
);
ExcelUtil
<
${
ClassName
}
>
util = new ExcelUtil
<
${
ClassName
}
>
(
${
ClassName
}
.class);
ExcelUtil
<
${
ClassName
}
>
util = new ExcelUtil
<
${
ClassName
}
>
(
${
ClassName
}
.class);
return
util.exportExcel(list, "
${
functionName
}
数据");
util.exportExcel(
response,
list, "
${
functionName
}
数据");
}
}
/**
/**
...
...
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
View file @
cedd2d1d
...
@@ -108,7 +108,6 @@
...
@@ -108,7 +108,6 @@
plain
plain
icon=
"el-icon-download"
icon=
"el-icon-download"
size=
"mini"
size=
"mini"
:loading=
"exportLoading"
@
click=
"handleExport"
@
click=
"handleExport"
v-hasPermi=
"['
${
moduleName
}
:
${
businessName
}
:export']"
v-hasPermi=
"['
${
moduleName
}
:
${
businessName
}
:export']"
>
导出
</el-button>
>
导出
</el-button>
...
@@ -313,7 +312,7 @@
...
@@ -313,7 +312,7 @@
</template>
</template>
<script>
<script>
import
{
list
${
BusinessName
},
get
${
BusinessName
},
del
${
BusinessName
},
add
${
BusinessName
},
update
${
BusinessName
}
,
export
${
BusinessName
}
}
from
"
@/api/
${
moduleName
}
/
${
businessName
}
"
;
import
{
list
${
BusinessName
},
get
${
BusinessName
},
del
${
BusinessName
},
add
${
BusinessName
},
update
${
BusinessName
}
}
from
"
@/api/
${
moduleName
}
/
${
businessName
}
"
;
export
default
{
export
default
{
name
:
"
${
BusinessName
}
"
,
name
:
"
${
BusinessName
}
"
,
...
@@ -324,8 +323,6 @@ export default {
...
@@ -324,8 +323,6 @@ export default {
return
{
return
{
// 遮罩层
// 遮罩层
loading
:
true
,
loading
:
true
,
// 导出遮罩层
exportLoading
:
false
,
// 选中数组
// 选中数组
ids
:
[],
ids
:
[],
#
if
($
table
.
sub
)
#
if
($
table
.
sub
)
...
@@ -562,14 +559,9 @@ export default {
...
@@ -562,14 +559,9 @@ export default {
#
end
#
end
/** 导出按钮操作 */
/** 导出按钮操作 */
handleExport
()
{
handleExport
()
{
const
queryParams
=
this
.
queryParams
;
this
.
download
(
'
${
moduleName
}
/
${
businessName
}
/export
'
,
{
this
.
#
[[$
modal
]]
#
.
confirm
(
'
是否确认导出所有
${
functionName
}
数据项?
'
).
then
(()
=>
{
...
this
.
queryParams
this
.
exportLoading
=
true
;
},
`
${
businessName
}
_
#
[[
${
new
Date().getTime()}]]
#
.xlsx`
)
return
export
${
BusinessName
}(
queryParams
);
}).
then
(
response
=>
{
this
.
#
[[$
download
]]
#
.
name
(
response
.
msg
);
this
.
exportLoading
=
false
;
}).
catch
(()
=>
{
});
}
}
}
}
};
};
...
...
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
View file @
cedd2d1d
package
com.ruoyi.quartz.controller
;
package
com.ruoyi.quartz.controller
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.quartz.SchedulerException
;
import
org.quartz.SchedulerException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
@@ -54,12 +55,12 @@ public class SysJobController extends BaseController
...
@@ -54,12 +55,12 @@ public class SysJobController extends BaseController
*/
*/
@PreAuthorize
(
"@ss.hasPermi('monitor:job:export')"
)
@PreAuthorize
(
"@ss.hasPermi('monitor:job:export')"
)
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
EXPORT
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysJob
sysJob
)
public
void
export
(
HttpServletResponse
response
,
SysJob
sysJob
)
{
{
List
<
SysJob
>
list
=
jobService
.
selectJobList
(
sysJob
);
List
<
SysJob
>
list
=
jobService
.
selectJobList
(
sysJob
);
ExcelUtil
<
SysJob
>
util
=
new
ExcelUtil
<
SysJob
>(
SysJob
.
class
);
ExcelUtil
<
SysJob
>
util
=
new
ExcelUtil
<
SysJob
>(
SysJob
.
class
);
return
util
.
exportExcel
(
list
,
"定时任务"
);
util
.
exportExcel
(
response
,
list
,
"定时任务"
);
}
}
/**
/**
...
...
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java
View file @
cedd2d1d
package
com.ruoyi.quartz.controller
;
package
com.ruoyi.quartz.controller
;
import
java.util.List
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.annotation.Log
;
...
@@ -46,12 +48,12 @@ public class SysJobLogController extends BaseController
...
@@ -46,12 +48,12 @@ public class SysJobLogController extends BaseController
*/
*/
@PreAuthorize
(
"@ss.hasPermi('monitor:job:export')"
)
@PreAuthorize
(
"@ss.hasPermi('monitor:job:export')"
)
@Log
(
title
=
"任务调度日志"
,
businessType
=
BusinessType
.
EXPORT
)
@Log
(
title
=
"任务调度日志"
,
businessType
=
BusinessType
.
EXPORT
)
@
Ge
tMapping
(
"/export"
)
@
Pos
tMapping
(
"/export"
)
public
AjaxResult
export
(
SysJobLog
sysJobLog
)
public
void
export
(
HttpServletResponse
response
,
SysJobLog
sysJobLog
)
{
{
List
<
SysJobLog
>
list
=
jobLogService
.
selectJobLogList
(
sysJobLog
);
List
<
SysJobLog
>
list
=
jobLogService
.
selectJobLogList
(
sysJobLog
);
ExcelUtil
<
SysJobLog
>
util
=
new
ExcelUtil
<
SysJobLog
>(
SysJobLog
.
class
);
ExcelUtil
<
SysJobLog
>
util
=
new
ExcelUtil
<
SysJobLog
>(
SysJobLog
.
class
);
return
util
.
exportExcel
(
list
,
"调度日志"
);
util
.
exportExcel
(
response
,
list
,
"调度日志"
);
}
}
/**
/**
...
...
ruoyi-ui/src/api/monitor/job.js
View file @
cedd2d1d
...
@@ -43,15 +43,6 @@ export function delJob(jobId) {
...
@@ -43,15 +43,6 @@ export function delJob(jobId) {
})
})
}
}
// 导出定时任务调度
export
function
exportJob
(
query
)
{
return
request
({
url
:
'
/monitor/job/export
'
,
method
:
'
get
'
,
params
:
query
})
}
// 任务状态修改
// 任务状态修改
export
function
changeJobStatus
(
jobId
,
status
)
{
export
function
changeJobStatus
(
jobId
,
status
)
{
const
data
=
{
const
data
=
{
...
...
ruoyi-ui/src/api/monitor/jobLog.js
View file @
cedd2d1d
...
@@ -24,12 +24,3 @@ export function cleanJobLog() {
...
@@ -24,12 +24,3 @@ export function cleanJobLog() {
method
:
'
delete
'
method
:
'
delete
'
})
})
}
}
// 导出调度日志
export
function
exportJobLog
(
query
)
{
return
request
({
url
:
'
/monitor/jobLog/export
'
,
method
:
'
get
'
,
params
:
query
})
}
\ No newline at end of file
ruoyi-ui/src/api/monitor/logininfor.js
View file @
cedd2d1d
...
@@ -24,12 +24,3 @@ export function cleanLogininfor() {
...
@@ -24,12 +24,3 @@ export function cleanLogininfor() {
method
:
'
delete
'
method
:
'
delete
'
})
})
}
}
// 导出登录日志
export
function
exportLogininfor
(
query
)
{
return
request
({
url
:
'
/monitor/logininfor/export
'
,
method
:
'
get
'
,
params
:
query
})
}
\ No newline at end of file
ruoyi-ui/src/api/monitor/operlog.js
View file @
cedd2d1d
...
@@ -24,12 +24,3 @@ export function cleanOperlog() {
...
@@ -24,12 +24,3 @@ export function cleanOperlog() {
method
:
'
delete
'
method
:
'
delete
'
})
})
}
}
// 导出操作日志
export
function
exportOperlog
(
query
)
{
return
request
({
url
:
'
/monitor/operlog/export
'
,
method
:
'
get
'
,
params
:
query
})
}
\ No newline at end of file
ruoyi-ui/src/api/system/config.js
View file @
cedd2d1d
...
@@ -58,12 +58,3 @@ export function refreshCache() {
...
@@ -58,12 +58,3 @@ export function refreshCache() {
method
:
'
delete
'
method
:
'
delete
'
})
})
}
}
// 导出参数
export
function
exportConfig
(
query
)
{
return
request
({
url
:
'
/system/config/export
'
,
method
:
'
get
'
,
params
:
query
})
}
\ No newline at end of file
ruoyi-ui/src/api/system/dict/data.js
View file @
cedd2d1d
...
@@ -50,12 +50,3 @@ export function delData(dictCode) {
...
@@ -50,12 +50,3 @@ export function delData(dictCode) {
method
:
'
delete
'
method
:
'
delete
'
})
})
}
}
// 导出字典数据
export
function
exportData
(
query
)
{
return
request
({
url
:
'
/system/dict/data/export
'
,
method
:
'
get
'
,
params
:
query
})
}
\ No newline at end of file
ruoyi-ui/src/api/system/dict/type.js
View file @
cedd2d1d
...
@@ -51,15 +51,6 @@ export function refreshCache() {
...
@@ -51,15 +51,6 @@ export function refreshCache() {
})
})
}
}
// 导出字典类型
export
function
exportType
(
query
)
{
return
request
({
url
:
'
/system/dict/type/export
'
,
method
:
'
get
'
,
params
:
query
})
}
// 获取字典选择框列表
// 获取字典选择框列表
export
function
optionselect
()
{
export
function
optionselect
()
{
return
request
({
return
request
({
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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