Search in sources :

Example 11 with JeecgEntityExcelView

use of org.jeecgframework.poi.excel.view.JeecgEntityExcelView in project kms by mahonelau.

the class SysAnnouncementController method exportXls.

/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysAnnouncement sysAnnouncement, HttpServletRequest request) {
    // Step.1 组装查询条件
    LambdaQueryWrapper<SysAnnouncement> queryWrapper = new LambdaQueryWrapper<SysAnnouncement>(sysAnnouncement);
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    queryWrapper.eq(SysAnnouncement::getDelFlag, CommonConstant.DEL_FLAG_0);
    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;
}
Also used : ExportParams(org.jeecgframework.poi.excel.entity.ExportParams) SysAnnouncement(org.jeecg.modules.system.entity.SysAnnouncement) JeecgEntityExcelView(org.jeecgframework.poi.excel.view.JeecgEntityExcelView) ModelAndView(org.springframework.web.servlet.ModelAndView) LoginUser(org.jeecg.common.system.vo.LoginUser) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Example 12 with JeecgEntityExcelView

use of org.jeecgframework.poi.excel.view.JeecgEntityExcelView in project kms by mahonelau.

the class SysRoleController method exportXls.

/**
 * 导出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;
}
Also used : ExportParams(org.jeecgframework.poi.excel.entity.ExportParams) JeecgEntityExcelView(org.jeecgframework.poi.excel.view.JeecgEntityExcelView) SysRole(org.jeecg.modules.system.entity.SysRole) ModelAndView(org.springframework.web.servlet.ModelAndView) LoginUser(org.jeecg.common.system.vo.LoginUser) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 13 with JeecgEntityExcelView

use of org.jeecgframework.poi.excel.view.JeecgEntityExcelView in project kms by mahonelau.

the class SysUserAgentController method exportXls.

/**
 * 导出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;
}
Also used : ExportParams(org.jeecgframework.poi.excel.entity.ExportParams) JeecgEntityExcelView(org.jeecgframework.poi.excel.view.JeecgEntityExcelView) ModelAndView(org.springframework.web.servlet.ModelAndView) SysUserAgent(org.jeecg.modules.system.entity.SysUserAgent) LoginUser(org.jeecg.common.system.vo.LoginUser) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 14 with JeecgEntityExcelView

use of org.jeecgframework.poi.excel.view.JeecgEntityExcelView in project kms by mahonelau.

the class SysUserController method exportXls.

/**
 * 导出excel
 *
 * @param request
 * @param sysUser
 */
@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;
}
Also used : ExportParams(org.jeecgframework.poi.excel.entity.ExportParams) JeecgEntityExcelView(org.jeecgframework.poi.excel.view.JeecgEntityExcelView) ModelAndView(org.springframework.web.servlet.ModelAndView) LoginUser(org.jeecg.common.system.vo.LoginUser)

Example 15 with JeecgEntityExcelView

use of org.jeecgframework.poi.excel.view.JeecgEntityExcelView in project kykms by mahonelau.

the class SysDictController method exportXls.

/**
 * 导出excel
 *
 * @param request
 */
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysDict sysDict, HttpServletRequest request) {
    // Step.1 组装查询条件
    QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap());
    // Step.2 AutoPoi 导出Excel
    ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
    List<SysDictPage> pageList = new ArrayList<SysDictPage>();
    List<SysDict> sysDictList = sysDictService.list(queryWrapper);
    for (SysDict dictMain : sysDictList) {
        SysDictPage vo = new SysDictPage();
        BeanUtils.copyProperties(dictMain, vo);
        // 查询机票
        List<SysDictItem> sysDictItemList = sysDictItemService.selectItemsByMainId(dictMain.getId());
        vo.setSysDictItemList(sysDictItemList);
        pageList.add(vo);
    }
    // 导出文件名称
    mv.addObject(NormalExcelConstants.FILE_NAME, "数据字典");
    // 注解对象Class
    mv.addObject(NormalExcelConstants.CLASS, SysDictPage.class);
    // 自定义表格参数
    LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("数据字典列表", "导出人:" + user.getRealname(), "数据字典"));
    // 导出数据列表
    mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
    return mv;
}
Also used : ExportParams(org.jeecgframework.poi.excel.entity.ExportParams) SysDictPage(org.jeecg.modules.system.vo.SysDictPage) JeecgEntityExcelView(org.jeecgframework.poi.excel.view.JeecgEntityExcelView) SysDict(org.jeecg.modules.system.entity.SysDict) ModelAndView(org.springframework.web.servlet.ModelAndView) SysDictItem(org.jeecg.modules.system.entity.SysDictItem) LoginUser(org.jeecg.common.system.vo.LoginUser)

Aggregations

ExportParams (org.jeecgframework.poi.excel.entity.ExportParams)33 JeecgEntityExcelView (org.jeecgframework.poi.excel.view.JeecgEntityExcelView)33 ModelAndView (org.springframework.web.servlet.ModelAndView)33 LoginUser (org.jeecg.common.system.vo.LoginUser)28 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)6 IPage (com.baomidou.mybatisplus.core.metadata.IPage)6 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)6 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 JSON (com.alibaba.fastjson.JSON)3 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)3 IOException (java.io.IOException)3 java.util (java.util)3 Collectors (java.util.stream.Collectors)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 HttpServletResponse (javax.servlet.http.HttpServletResponse)3 Slf4j (lombok.extern.slf4j.Slf4j)3 StringUtils (org.apache.commons.lang.StringUtils)3 SecurityUtils (org.apache.shiro.SecurityUtils)3 Result (org.jeecg.common.api.vo.Result)3