org.jeecgframework.poi.excel.def.NormalExcelConstants Java Examples

The following examples show how to use org.jeecgframework.poi.excel.def.NormalExcelConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SysUserController.java    From jeecg-boot with Apache License 2.0 8 votes vote down vote up
/**
   * 导出excel
   *
   * @param request
   * @param response
   */
  @RequestMapping(value = "/exportXls")
  public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
      // Step.1 组装查询条件
      QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
      //Step.2 AutoPoi 导出Excel
      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
      //update-begin--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据--------------------
      String selections = request.getParameter("selections");
     if(!oConvertUtils.isEmpty(selections)){
         queryWrapper.in("id",selections.split(","));
     }
      //update-end--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据----------------------
      List<SysUser> pageList = sysUserService.list(queryWrapper);

      //导出文件名称
      mv.addObject(NormalExcelConstants.FILE_NAME, "用户列表");
      mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
      ExportParams exportParams = new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息");
      exportParams.setImageBasePath(upLoadPath);
      mv.addObject(NormalExcelConstants.PARAMS, exportParams);
      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
      return mv;
  }
 
Example #2
Source File: SysUserController.java    From jeecg-cloud with Apache License 2.0 8 votes vote down vote up
/**
   * 导出excel
   *
   * @param request
   */
  @RequestMapping(value = "/exportXls")
  public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
      // Step.1 组装查询条件
      QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
      //Step.2 AutoPoi 导出Excel
      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
      //update-begin--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据--------------------
      String selections = request.getParameter("selections");
     if(!oConvertUtils.isEmpty(selections)){
         queryWrapper.in("id",selections.split(","));
     }
      //update-end--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据----------------------
      List<SysUser> pageList = sysUserService.list(queryWrapper);

      //导出文件名称
      mv.addObject(NormalExcelConstants.FILE_NAME, "用户列表");
      mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
      ExportParams exportParams = new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息");
      exportParams.setImageBasePath(upLoadPath);
      mv.addObject(NormalExcelConstants.PARAMS, exportParams);
      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
      return mv;
  }
 
Example #3
Source File: SysUserAgentController.java    From jeecg-cloud with Apache License 2.0 8 votes vote down vote up
/**
    * 导出excel
 *
 * @param sysUserAgent
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysUserAgent sysUserAgent,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysUserAgent> pageList = sysUserAgentService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "用户代理人设置列表");
    mv.addObject(NormalExcelConstants.CLASS, SysUserAgent.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 ExportParams exportParams = new ExportParams("用户代理人设置列表数据", "导出人:"+user.getRealname(), "导出信息");
 exportParams.setImageBasePath(upLoadPath);
    mv.addObject(NormalExcelConstants.PARAMS, exportParams);
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #4
Source File: SysDepartController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
  * 导出excel
  *
  * @param request
  */
 @RequestMapping(value = "/exportXls")
 public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) {
     // Step.1 组装查询条件
     QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
     //Step.2 AutoPoi 导出Excel
     ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
     List<SysDepart> pageList = sysDepartService.list(queryWrapper);
     //按字典排序
     Collections.sort(pageList, new Comparator<SysDepart>() {
         @Override
public int compare(SysDepart arg0, SysDepart arg1) {
         	return arg0.getOrgCode().compareTo(arg1.getOrgCode());
         }
     });
     //导出文件名称
     mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
     mv.addObject(NormalExcelConstants.CLASS, SysDepart.class);
     LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
     mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息"));
     mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
     return mv;
 }
 
Example #5
Source File: SysUserController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
   * 导出excel
   *
   * @param request
   * @param response
   */
  @RequestMapping(value = "/exportXls")
  public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
      // Step.1 组装查询条件
      QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
      //Step.2 AutoPoi 导出Excel
      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
      //update-begin--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据--------------------
      String selections = request.getParameter("selections");
     if(!oConvertUtils.isEmpty(selections)){
         queryWrapper.in("id",selections.split(","));
     }
      //update-end--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据----------------------
      List<SysUser> pageList = sysUserService.list(queryWrapper);

      //导出文件名称
      mv.addObject(NormalExcelConstants.FILE_NAME, "用户列表");
      mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息"));
      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
      return mv;
  }
 
Example #6
Source File: SysCategoryController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
    // Step.1 组装查询条件查询数据
    QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap());
    List<SysCategory> pageList = sysCategoryService.list(queryWrapper);
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    // 过滤选中数据
    String selections = request.getParameter("selections");
    if(oConvertUtils.isEmpty(selections)) {
  	  mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    }else {
  	  List<String> selectionList = Arrays.asList(selections.split(","));
  	  List<SysCategory> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
  	  mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
    }
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "分类字典列表");
    mv.addObject(NormalExcelConstants.CLASS, SysCategory.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息"));
    return mv;
}
 
Example #7
Source File: SysPositionController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<SysPosition> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            SysPosition sysPosition = JSON.parseObject(deString, SysPosition.class);
            queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysPosition> pageList = sysPositionService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "职务表列表");
    mv.addObject(NormalExcelConstants.CLASS, SysPosition.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #8
Source File: SysDepartController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
  * 导出excel
  *
  * @param request
  */
 @RequestMapping(value = "/exportXls")
 public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) {
     // Step.1 组装查询条件
     QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
     //Step.2 AutoPoi 导出Excel
     ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
     List<SysDepart> pageList = sysDepartService.list(queryWrapper);
     //按字典排序
     Collections.sort(pageList, new Comparator<SysDepart>() {
         @Override
public int compare(SysDepart arg0, SysDepart arg1) {
         	return arg0.getOrgCode().compareTo(arg1.getOrgCode());
         }
     });
     //导出文件名称
     mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
     mv.addObject(NormalExcelConstants.CLASS, SysDepart.class);
     LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
     mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息"));
     mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
     return mv;
 }
 
Example #9
Source File: SysUserAgentController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysUserAgent sysUserAgent,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysUserAgent> pageList = sysUserAgentService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "用户代理人设置列表");
    mv.addObject(NormalExcelConstants.CLASS, SysUserAgent.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户代理人设置列表数据", "导出人:"+user.getRealname(), "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #10
Source File: JoaDemoController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<JoaDemo> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            JoaDemo joaDemo = JSON.parseObject(deString, JoaDemo.class);
            queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<JoaDemo> pageList = joaDemoService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "流程测试列表");
    mv.addObject(NormalExcelConstants.CLASS, JoaDemo.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("流程测试列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #11
Source File: JoaDemoController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<JoaDemo> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            JoaDemo joaDemo = JSON.parseObject(deString, JoaDemo.class);
            queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<JoaDemo> pageList = joaDemoService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "流程测试列表");
    mv.addObject(NormalExcelConstants.CLASS, JoaDemo.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("流程测试列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #12
Source File: SysAnnouncementController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysAnnouncement sysAnnouncement,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysAnnouncement> queryWrapper = QueryGenerator.initQueryWrapper(sysAnnouncement, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysAnnouncement> pageList = sysAnnouncementService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "系统通告列表");
    mv.addObject(NormalExcelConstants.CLASS, SysAnnouncement.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("系统通告列表数据", "导出人:"+user.getRealname(), "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #13
Source File: SysRoleController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysRole sysRole,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysRole> pageList = sysRoleService.list(queryWrapper);
	//导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME,"角色列表");
	mv.addObject(NormalExcelConstants.CLASS,SysRole.class);
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS,new ExportParams("角色列表数据","导出人:"+user.getRealname(),"导出信息"));
	mv.addObject(NormalExcelConstants.DATA_LIST,pageList);
	return mv;
}
 
Example #14
Source File: SysAnnouncementController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysAnnouncement sysAnnouncement,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysAnnouncement> queryWrapper = QueryGenerator.initQueryWrapper(sysAnnouncement, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysAnnouncement> pageList = sysAnnouncementService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "系统通告列表");
    mv.addObject(NormalExcelConstants.CLASS, SysAnnouncement.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("系统通告列表数据", "导出人:"+user.getRealname(), "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #15
Source File: SysUserController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
   * 导出excel
   *
   * @param request
   * @param response
   */
  @RequestMapping(value = "/exportXls")
  public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
      // Step.1 组装查询条件
      QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
      //Step.2 AutoPoi 导出Excel
      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
      //update-begin--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据--------------------
      String selections = request.getParameter("selections");
     if(!oConvertUtils.isEmpty(selections)){
         queryWrapper.in("id",selections.split(","));
     }
      //update-end--Author:kangxiaolin  Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据----------------------
      List<SysUser> pageList = sysUserService.list(queryWrapper);

      //导出文件名称
      mv.addObject(NormalExcelConstants.FILE_NAME, "用户列表");
      mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息"));
      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
      return mv;
  }
 
Example #16
Source File: SysCategoryController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
    // Step.1 组装查询条件查询数据
    QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap());
    List<SysCategory> pageList = sysCategoryService.list(queryWrapper);
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    // 过滤选中数据
    String selections = request.getParameter("selections");
    if(oConvertUtils.isEmpty(selections)) {
  	  mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    }else {
  	  List<String> selectionList = Arrays.asList(selections.split(","));
  	  List<SysCategory> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
  	  mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
    }
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "分类字典列表");
    mv.addObject(NormalExcelConstants.CLASS, SysCategory.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息"));
    return mv;
}
 
Example #17
Source File: SysPositionController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<SysPosition> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            SysPosition sysPosition = JSON.parseObject(deString, SysPosition.class);
            queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysPosition> pageList = sysPositionService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "职务表列表");
    mv.addObject(NormalExcelConstants.CLASS, SysPosition.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #18
Source File: JeecgTemplateExcelView.java    From autopoi with Apache License 2.0 6 votes vote down vote up
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
	String codedFileName = "临时文件";
	Workbook workbook = ExcelExportUtil.exportExcel((TemplateExportParams) model.get(TemplateExcelConstants.PARAMS), (Class<?>) model.get(TemplateExcelConstants.CLASS), (List<?>) model.get(TemplateExcelConstants.LIST_DATA), (Map<String, Object>) model.get(TemplateExcelConstants.MAP_DATA));
	if (model.containsKey(NormalExcelConstants.FILE_NAME)) {
		codedFileName = (String) model.get(NormalExcelConstants.FILE_NAME);
	}
	if (workbook instanceof HSSFWorkbook) {
		codedFileName += HSSF;
	} else {
		codedFileName += XSSF;
	}
	if (isIE(request)) {
		codedFileName = java.net.URLEncoder.encode(codedFileName, "UTF8");
	} else {
		codedFileName = new String(codedFileName.getBytes("UTF-8"), "ISO-8859-1");
	}
	response.setHeader("content-disposition", "attachment;filename=" + codedFileName);
	ServletOutputStream out = response.getOutputStream();
	workbook.write(out);
	out.flush();
}
 
Example #19
Source File: SysUserAgentController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysUserAgent sysUserAgent,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysUserAgent> pageList = sysUserAgentService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "用户代理人设置列表");
    mv.addObject(NormalExcelConstants.CLASS, SysUserAgent.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户代理人设置列表数据", "导出人:"+user.getRealname(), "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #20
Source File: SysRoleController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * 导出excel
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysRole sysRole,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysRole> pageList = sysRoleService.list(queryWrapper);
	//导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME,"角色列表");
	mv.addObject(NormalExcelConstants.CLASS,SysRole.class);
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS,new ExportParams("角色列表数据","导出人:"+user.getRealname(),"导出信息"));
	mv.addObject(NormalExcelConstants.DATA_LIST,pageList);
	return mv;
}
 
Example #21
Source File: SysUserAgentController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param sysUserAgent
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysUserAgent sysUserAgent,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysUserAgent> queryWrapper = QueryGenerator.initQueryWrapper(sysUserAgent, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysUserAgent> pageList = sysUserAgentService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "用户代理人设置列表");
    mv.addObject(NormalExcelConstants.CLASS, SysUserAgent.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 ExportParams exportParams = new ExportParams("用户代理人设置列表数据", "导出人:"+user.getRealname(), "导出信息");
 exportParams.setImageBasePath(upLoadPath);
    mv.addObject(NormalExcelConstants.PARAMS, exportParams);
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #22
Source File: JoaDemoController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<JoaDemo> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            JoaDemo joaDemo = JSON.parseObject(deString, JoaDemo.class);
            queryWrapper = QueryGenerator.initQueryWrapper(joaDemo, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<JoaDemo> pageList = joaDemoService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "流程测试列表");
    mv.addObject(NormalExcelConstants.CLASS, JoaDemo.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("流程测试列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #23
Source File: SysDepartController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
  * 导出excel
  *
  * @param request
  */
 @RequestMapping(value = "/exportXls")
 public ModelAndView exportXls(SysDepart sysDepart,HttpServletRequest request) {
     // Step.1 组装查询条件
     QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
     //Step.2 AutoPoi 导出Excel
     ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
     List<SysDepart> pageList = sysDepartService.list(queryWrapper);
     //按字典排序
     Collections.sort(pageList, new Comparator<SysDepart>() {
         @Override
public int compare(SysDepart arg0, SysDepart arg1) {
         	return arg0.getOrgCode().compareTo(arg1.getOrgCode());
         }
     });
     //导出文件名称
     mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
     mv.addObject(NormalExcelConstants.CLASS, SysDepart.class);
     LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
     mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息"));
     mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
     return mv;
 }
 
Example #24
Source File: SysRoleController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysRole sysRole,HttpServletRequest request) {
	// Step.1 组装查询条件
	QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(sysRole, request.getParameterMap());
	//Step.2 AutoPoi 导出Excel
	ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
	List<SysRole> pageList = sysRoleService.list(queryWrapper);
	//导出文件名称
	mv.addObject(NormalExcelConstants.FILE_NAME,"角色列表");
	mv.addObject(NormalExcelConstants.CLASS,SysRole.class);
	LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
	mv.addObject(NormalExcelConstants.PARAMS,new ExportParams("角色列表数据","导出人:"+user.getRealname(),"导出信息"));
	mv.addObject(NormalExcelConstants.DATA_LIST,pageList);
	return mv;
}
 
Example #25
Source File: SysAnnouncementController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysAnnouncement sysAnnouncement,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysAnnouncement> queryWrapper = QueryGenerator.initQueryWrapper(sysAnnouncement, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysAnnouncement> pageList = sysAnnouncementService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "系统通告列表");
    mv.addObject(NormalExcelConstants.CLASS, SysAnnouncement.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("系统通告列表数据", "导出人:"+user.getRealname(), "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #26
Source File: SysCategoryController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
    // Step.1 组装查询条件查询数据
    QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap());
    List<SysCategory> pageList = sysCategoryService.list(queryWrapper);
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    // 过滤选中数据
    String selections = request.getParameter("selections");
    if(oConvertUtils.isEmpty(selections)) {
  	  mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    }else {
  	  List<String> selectionList = Arrays.asList(selections.split(","));
  	  List<SysCategory> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
  	  mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
    }
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "分类字典列表");
    mv.addObject(NormalExcelConstants.CLASS, SysCategory.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息"));
    return mv;
}
 
Example #27
Source File: SysPositionController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<SysPosition> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            SysPosition sysPosition = JSON.parseObject(deString, SysPosition.class);
            queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysPosition> pageList = sysPositionService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "职务表列表");
    mv.addObject(NormalExcelConstants.CLASS, SysPosition.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #28
Source File: SysPositionController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 * @param response
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
    // Step.1 组装查询条件
    QueryWrapper<SysPosition> queryWrapper = null;
    try {
        String paramsStr = request.getParameter("paramsStr");
        if (oConvertUtils.isNotEmpty(paramsStr)) {
            String deString = URLDecoder.decode(paramsStr, "UTF-8");
            SysPosition sysPosition = JSON.parseObject(deString, SysPosition.class);
            queryWrapper = QueryGenerator.initQueryWrapper(sysPosition, request.getParameterMap());
        }
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysPosition> pageList = sysPositionService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "职务表列表");
    mv.addObject(NormalExcelConstants.CLASS, SysPosition.class);
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("职务表列表数据", "导出人:Jeecg", "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
 
Example #29
Source File: SysCategoryController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
    * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SysCategory sysCategory) {
    // Step.1 组装查询条件查询数据
    QueryWrapper<SysCategory> queryWrapper = QueryGenerator.initQueryWrapper(sysCategory, request.getParameterMap());
    List<SysCategory> pageList = sysCategoryService.list(queryWrapper);
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    // 过滤选中数据
    String selections = request.getParameter("selections");
    if(oConvertUtils.isEmpty(selections)) {
  	  mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    }else {
  	  List<String> selectionList = Arrays.asList(selections.split(","));
  	  List<SysCategory> exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
  	  mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
    }
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "分类字典列表");
    mv.addObject(NormalExcelConstants.CLASS, SysCategory.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("分类字典列表数据", "导出人:"+user.getRealname(), "导出信息"));
    return mv;
}
 
Example #30
Source File: SysAnnouncementController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysAnnouncement sysAnnouncement,HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysAnnouncement> queryWrapper = QueryGenerator.initQueryWrapper(sysAnnouncement, request.getParameterMap());
    //Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysAnnouncement> pageList = sysAnnouncementService.list(queryWrapper);
    //导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "系统通告列表");
    mv.addObject(NormalExcelConstants.CLASS, SysAnnouncement.class);
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("系统通告列表数据", "导出人:"+user.getRealname(), "导出信息"));
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}