Search in sources :

Example 1 with SysUserExportVo

use of com.ruoyi.system.domain.vo.SysUserExportVo in project RuoYi-Vue-Plus by JavaLionLi.

the class SysUserController method export.

@ApiOperation("导出用户列表")
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:user:export")
@PostMapping("/export")
public void export(SysUser user, HttpServletResponse response) {
    List<SysUser> list = userService.selectUserList(user);
    List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class);
    for (int i = 0; i < list.size(); i++) {
        SysDept dept = list.get(i).getDept();
        SysUserExportVo vo = listVo.get(i);
        if (ObjectUtil.isNotEmpty(dept)) {
            vo.setDeptName(dept.getDeptName());
            vo.setLeader(dept.getLeader());
        }
    }
    ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response);
}
Also used : SysUser(com.ruoyi.common.core.domain.entity.SysUser) SysDept(com.ruoyi.common.core.domain.entity.SysDept) SysUserExportVo(com.ruoyi.system.domain.vo.SysUserExportVo) Log(com.ruoyi.common.annotation.Log) SaCheckPermission(cn.dev33.satoken.annotation.SaCheckPermission)

Example 2 with SysUserExportVo

use of com.ruoyi.system.domain.vo.SysUserExportVo in project RuoYi-Flowable-Plus by KonBAI-Q.

the class SysUserController method export.

@ApiOperation("导出用户列表")
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:user:export")
@PostMapping("/export")
public void export(SysUser user, HttpServletResponse response) {
    List<SysUser> list = userService.selectUserList(user);
    List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class);
    for (int i = 0; i < list.size(); i++) {
        SysDept dept = list.get(i).getDept();
        SysUserExportVo vo = listVo.get(i);
        if (ObjectUtil.isNotEmpty(dept)) {
            vo.setDeptName(dept.getDeptName());
            vo.setLeader(dept.getLeader());
        }
    }
    ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response);
}
Also used : SysUser(com.ruoyi.common.core.domain.entity.SysUser) SysDept(com.ruoyi.common.core.domain.entity.SysDept) SysUserExportVo(com.ruoyi.system.domain.vo.SysUserExportVo) Log(com.ruoyi.common.annotation.Log) SaCheckPermission(cn.dev33.satoken.annotation.SaCheckPermission)

Example 3 with SysUserExportVo

use of com.ruoyi.system.domain.vo.SysUserExportVo in project RuoYi-Cloud-Plus by JavaLionLi.

the class SysUserController method export.

@ApiOperation("导出用户列表")
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:user:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysUser user) {
    List<SysUser> list = userService.selectUserList(user);
    List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class);
    for (int i = 0; i < list.size(); i++) {
        SysDept dept = list.get(i).getDept();
        SysUserExportVo vo = listVo.get(i);
        if (ObjectUtil.isNotEmpty(dept)) {
            vo.setDeptName(dept.getDeptName());
            vo.setLeader(dept.getLeader());
        }
    }
    ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response);
}
Also used : SysUser(com.ruoyi.system.api.domain.SysUser) SysDept(com.ruoyi.system.api.domain.SysDept) SysUserExportVo(com.ruoyi.system.domain.vo.SysUserExportVo) Log(com.ruoyi.common.log.annotation.Log) ApiOperation(io.swagger.annotations.ApiOperation) SaCheckPermission(cn.dev33.satoken.annotation.SaCheckPermission)

Aggregations

SaCheckPermission (cn.dev33.satoken.annotation.SaCheckPermission)3 SysUserExportVo (com.ruoyi.system.domain.vo.SysUserExportVo)3 Log (com.ruoyi.common.annotation.Log)2 SysDept (com.ruoyi.common.core.domain.entity.SysDept)2 SysUser (com.ruoyi.common.core.domain.entity.SysUser)2 Log (com.ruoyi.common.log.annotation.Log)1 SysDept (com.ruoyi.system.api.domain.SysDept)1 SysUser (com.ruoyi.system.api.domain.SysUser)1 ApiOperation (io.swagger.annotations.ApiOperation)1