| | |
| | | * @return 结果
|
| | | * @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);
|
| | | }
|
| | |
| | | * @return 结果
|
| | | * @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.setCharacterEncoding("utf-8");
|
| | | this.init(list, sheetName, title, Type.EXPORT);
|
| | | exportExcel(response.getOutputStream());
|
| | | exportExcel(response);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param sheetName 工作表的名称
|
| | | * @return 结果
|
| | | */
|
| | | public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException
|
| | | public void importTemplateExcel(HttpServletResponse response, String sheetName)
|
| | | {
|
| | | importTemplateExcel(response, sheetName, StringUtils.EMPTY);
|
| | | }
|
| | |
| | | * @param title 标题
|
| | | * @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.setCharacterEncoding("utf-8");
|
| | | this.init(null, sheetName, title, Type.IMPORT);
|
| | | exportExcel(response.getOutputStream());
|
| | | exportExcel(response);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | *
|
| | | * @return 结果
|
| | | */
|
| | | public void exportExcel(OutputStream out)
|
| | | public void exportExcel(HttpServletResponse response)
|
| | | {
|
| | | try
|
| | | {
|
| | | writeSheet();
|
| | | wb.write(out);
|
| | | wb.write(response.getOutputStream());
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | finally
|
| | | {
|
| | | IOUtils.closeQuietly(wb);
|
| | | IOUtils.closeQuietly(out);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.quartz.SchedulerException;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | |
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
| | | @Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysJob sysJob)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysJob sysJob)
|
| | | {
|
| | | List<SysJob> list = jobService.selectJobList(sysJob);
|
| | | ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
| | | return util.exportExcel(list, "定时任务");
|
| | | util.exportExcel(response, list, "定时任务");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | 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.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.project.monitor.domain.SysJobLog;
|
| | | import com.ruoyi.project.monitor.service.ISysJobLogService;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysJobLog;
|
| | | import com.ruoyi.project.monitor.service.ISysJobLogService;
|
| | |
|
| | | /**
|
| | | * 调度日志操作处理
|
| | |
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
| | | @Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysJobLog sysJobLog)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysJobLog sysJobLog)
|
| | | {
|
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
| | | ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
| | | return util.exportExcel(list, "调度日志");
|
| | | util.exportExcel(response, list, "调度日志");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | 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.utils.poi.ExcelUtil;
|
| | |
| | |
|
| | | @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')")
|
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | 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.utils.poi.ExcelUtil;
|
| | |
| | |
|
| | | @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)
|
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | 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;
|
| | |
| | |
|
| | | @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, "参数数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | 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;
|
| | |
| | |
|
| | | @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, "字典数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | 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;
|
| | |
| | |
|
| | | @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, "字典类型");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @GetMapping("/list")
|
| | | public AjaxResult list(SysMenu menu)
|
| | | {
|
| | | Long userId = getUserId();
|
| | | List<SysMenu> menus = menuService.selectMenuList(menu, userId);
|
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
| | | return AjaxResult.success(menus);
|
| | | }
|
| | |
|
| | |
| | | @GetMapping("/treeselect")
|
| | | public AjaxResult treeselect(SysMenu menu)
|
| | | {
|
| | | Long userId = getUserId();
|
| | | List<SysMenu> menus = menuService.selectMenuList(menu, userId);
|
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
| | | return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
| | | }
|
| | |
|
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | 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;
|
| | |
| | |
|
| | | @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, "岗位数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | {
|
| | | return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getEmail())
|
| | | if (StringUtils.isNotEmpty(user.getEmail())
|
| | | && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
| | | {
|
| | | return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | 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;
|
| | |
| | |
|
| | | @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, "角色数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | 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;
|
| | |
| | |
|
| | | @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)
|
| | |
| | | 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, "用户数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package ${packageName}.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | |
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
|
| | | @Log(title = "${functionName}", businessType = BusinessType.EXPORT)
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(${ClassName} ${className})
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, ${ClassName} ${className})
|
| | | {
|
| | | List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
|
| | | ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
|
| | | return util.exportExcel(list, "${functionName}数据");
|
| | | util.exportExcel(response, list, "${functionName}数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | plain
|
| | | icon="el-icon-download"
|
| | | size="mini"
|
| | | :loading="exportLoading"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['${moduleName}:${businessName}:export']"
|
| | | >导出</el-button>
|
| | |
| | | </template>
|
| | |
|
| | | <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 {
|
| | | name: "${BusinessName}",
|
| | |
| | | return {
|
| | | // 遮罩层
|
| | | loading: true,
|
| | | // 导出遮罩层
|
| | | exportLoading: false,
|
| | | // 选中数组
|
| | | ids: [],
|
| | | #if($table.sub)
|
| | |
| | | #end
|
| | | /** 导出按钮操作 */
|
| | | handleExport() {
|
| | | const queryParams = this.queryParams;
|
| | | this.#[[$modal]]#.confirm('是否确认导出所有${functionName}数据项?').then(() => {
|
| | | this.exportLoading = true;
|
| | | return export${BusinessName}(queryParams);
|
| | | }).then(response => {
|
| | | this.#[[$download]]#.name(response.msg);
|
| | | this.exportLoading = false;
|
| | | }).catch(() => {});
|
| | | this.download('${moduleName}/${businessName}/export', {
|
| | | ...this.queryParams
|
| | | }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
| | | }
|
| | | }
|
| | | };
|