|
|
@@ -481,22 +481,29 @@ public class SysUserController extends BaseController {
|
|
|
@RequiresPermissions("system:user:export")
|
|
|
@PostMapping("/export")
|
|
|
public void export(SysUser user, HttpServletResponse response) {
|
|
|
- List<UserExport> list = userService.down(user);
|
|
|
- if (ObjectUtil.isEmpty(list)) {
|
|
|
- throw new RuntimeException("导出数据为空!");
|
|
|
- }
|
|
|
- AtomicInteger xh= new AtomicInteger();
|
|
|
- xh.getAndIncrement();
|
|
|
- list.forEach(e->{
|
|
|
- if (e.getIsManager()==null) {
|
|
|
- e.setIsManager("N");
|
|
|
+ List<UserExport> list=null;
|
|
|
+ //如果导出模板
|
|
|
+ if(user.getTemplate()){
|
|
|
+ list = new ArrayList<>();
|
|
|
+ }else{
|
|
|
+ list= userService.down(user);
|
|
|
+ if (ObjectUtil.isEmpty(list)) {
|
|
|
+ throw new RuntimeException("导出数据为空!");
|
|
|
}
|
|
|
- e.setXh(String.valueOf(xh.getAndIncrement()));
|
|
|
- });
|
|
|
+ AtomicInteger xh= new AtomicInteger();
|
|
|
+ xh.getAndIncrement();
|
|
|
+ list.forEach(e->{
|
|
|
+ if (e.getIsManager()==null) {
|
|
|
+ e.setIsManager("N");
|
|
|
+ }
|
|
|
+ e.setXh(String.valueOf(xh.getAndIncrement()));
|
|
|
+ });
|
|
|
|
|
|
- if(list.size()>10000){
|
|
|
- throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
|
|
|
+ if(list.size()>10000){
|
|
|
+ throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
try {
|
|
|
// 设置响应头
|
|
|
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("用户数据", "utf-8"));
|