优化导出数据操作
This commit is contained in:
		| @@ -1,11 +1,13 @@ | ||||
| package com.ruoyi.web.controller.monitor; | ||||
|  | ||||
| import java.util.List; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| 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.RestController; | ||||
| import com.ruoyi.common.annotation.Log; | ||||
| @@ -40,12 +42,12 @@ public class SysLogininforController extends BaseController | ||||
|  | ||||
|     @Log(title = "登录日志", businessType = BusinessType.EXPORT) | ||||
|     @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysLogininfor logininfor) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, SysLogininfor logininfor) | ||||
|     { | ||||
|         List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); | ||||
|         ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); | ||||
|         return util.exportExcel(list, "登录日志"); | ||||
|         util.exportExcel(response, list, "登录日志"); | ||||
|     } | ||||
|  | ||||
|     @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") | ||||
|   | ||||
| @@ -1,11 +1,13 @@ | ||||
| package com.ruoyi.web.controller.monitor; | ||||
|  | ||||
| import java.util.List; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| 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.RestController; | ||||
| import com.ruoyi.common.annotation.Log; | ||||
| @@ -40,12 +42,12 @@ public class SysOperlogController extends BaseController | ||||
|  | ||||
|     @Log(title = "操作日志", businessType = BusinessType.EXPORT) | ||||
|     @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysOperLog operLog) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, SysOperLog operLog) | ||||
|     { | ||||
|         List<SysOperLog> list = operLogService.selectOperLogList(operLog); | ||||
|         ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); | ||||
|         return util.exportExcel(list, "操作日志"); | ||||
|         util.exportExcel(response, list, "操作日志"); | ||||
|     } | ||||
|  | ||||
|     @Log(title = "操作日志", businessType = BusinessType.DELETE) | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package com.ruoyi.web.controller.system; | ||||
|  | ||||
| import java.util.List; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| @@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import com.ruoyi.common.annotation.Log; | ||||
| import com.ruoyi.common.annotation.RepeatSubmit; | ||||
| import com.ruoyi.common.constant.UserConstants; | ||||
| import com.ruoyi.common.core.controller.BaseController; | ||||
| import com.ruoyi.common.core.domain.AjaxResult; | ||||
| @@ -49,12 +49,12 @@ public class SysConfigController extends BaseController | ||||
|  | ||||
|     @Log(title = "参数管理", businessType = BusinessType.EXPORT) | ||||
|     @PreAuthorize("@ss.hasPermi('system:config:export')") | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysConfig config) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, SysConfig config) | ||||
|     { | ||||
|         List<SysConfig> list = configService.selectConfigList(config); | ||||
|         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 | ||||
|     @PreAuthorize("@ss.hasPermi('system:config:add')") | ||||
|     @Log(title = "参数管理", businessType = BusinessType.INSERT) | ||||
|     @PostMapping | ||||
|     @RepeatSubmit | ||||
|     public AjaxResult add(@Validated @RequestBody SysConfig config) | ||||
|     { | ||||
|         if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| @@ -50,12 +51,12 @@ public class SysDictDataController extends BaseController | ||||
|  | ||||
|     @Log(title = "字典数据", businessType = BusinessType.EXPORT) | ||||
|     @PreAuthorize("@ss.hasPermi('system:dict:export')") | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysDictData dictData) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, SysDictData dictData) | ||||
|     { | ||||
|         List<SysDictData> list = dictDataService.selectDictDataList(dictData); | ||||
|         ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); | ||||
|         return util.exportExcel(list, "字典数据"); | ||||
|         util.exportExcel(response, list, "字典数据"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package com.ruoyi.web.controller.system; | ||||
|  | ||||
| import java.util.List; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| @@ -45,12 +46,12 @@ public class SysDictTypeController extends BaseController | ||||
|  | ||||
|     @Log(title = "字典类型", businessType = BusinessType.EXPORT) | ||||
|     @PreAuthorize("@ss.hasPermi('system:dict:export')") | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysDictType dictType) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, SysDictType dictType) | ||||
|     { | ||||
|         List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); | ||||
|         ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); | ||||
|         return util.exportExcel(list, "字典类型"); | ||||
|         util.exportExcel(response, list, "字典类型"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package com.ruoyi.web.controller.system; | ||||
|  | ||||
| import java.util.List; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| @@ -48,12 +49,12 @@ public class SysPostController extends BaseController | ||||
|      | ||||
|     @Log(title = "岗位管理", businessType = BusinessType.EXPORT) | ||||
|     @PreAuthorize("@ss.hasPermi('system:post:export')") | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysPost post) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, SysPost post) | ||||
|     { | ||||
|         List<SysPost> list = postService.selectPostList(post); | ||||
|         ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); | ||||
|         return util.exportExcel(list, "岗位数据"); | ||||
|         util.exportExcel(response, list, "岗位数据"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package com.ruoyi.web.controller.system; | ||||
|  | ||||
| import java.util.List; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| @@ -61,12 +62,12 @@ public class SysRoleController extends BaseController | ||||
|  | ||||
|     @Log(title = "角色管理", businessType = BusinessType.EXPORT) | ||||
|     @PreAuthorize("@ss.hasPermi('system:role:export')") | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysRole role) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, SysRole role) | ||||
|     { | ||||
|         List<SysRole> list = roleService.selectRoleList(role); | ||||
|         ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); | ||||
|         return util.exportExcel(list, "角色数据"); | ||||
|         util.exportExcel(response, list, "角色数据"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system; | ||||
|  | ||||
| import java.util.List; | ||||
| import java.util.stream.Collectors; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import org.apache.commons.lang3.ArrayUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| @@ -62,12 +63,12 @@ public class SysUserController extends BaseController | ||||
|  | ||||
|     @Log(title = "用户管理", businessType = BusinessType.EXPORT) | ||||
|     @PreAuthorize("@ss.hasPermi('system:user:export')") | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysUser user) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, SysUser user) | ||||
|     { | ||||
|         List<SysUser> list = userService.selectUserList(user); | ||||
|         ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); | ||||
|         return util.exportExcel(list, "用户数据"); | ||||
|         util.exportExcel(response, list, "用户数据"); | ||||
|     } | ||||
|  | ||||
|     @Log(title = "用户管理", businessType = BusinessType.IMPORT) | ||||
| @@ -82,11 +83,11 @@ public class SysUserController extends BaseController | ||||
|         return AjaxResult.success(message); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/importTemplate") | ||||
|     public AjaxResult importTemplate() | ||||
|     @PostMapping("/importTemplate") | ||||
|     public void importTemplate(HttpServletResponse response) | ||||
|     { | ||||
|         ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); | ||||
|         return util.importTemplateExcel("用户数据"); | ||||
|         util.importTemplateExcel(response, "用户数据"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user