Search in sources :

Example 1 with ExcelUtil

use of com.ruoyi.common.utils.poi.ExcelUtil in project hocassian-media-matrix by hokaso.

the class SysUserController method importData.

@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
    ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
    List<SysUser> userList = util.importExcel(file.getInputStream());
    LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
    String operName = loginUser.getUsername();
    String message = userService.importUser(userList, updateSupport, operName);
    return AjaxResult.success(message);
}
Also used : ExcelUtil(com.ruoyi.common.utils.poi.ExcelUtil) SysUser(com.ruoyi.common.core.domain.entity.SysUser) LoginUser(com.ruoyi.common.core.domain.model.LoginUser) PostMapping(org.springframework.web.bind.annotation.PostMapping) Log(com.ruoyi.common.annotation.Log) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

Log (com.ruoyi.common.annotation.Log)1 SysUser (com.ruoyi.common.core.domain.entity.SysUser)1 LoginUser (com.ruoyi.common.core.domain.model.LoginUser)1 ExcelUtil (com.ruoyi.common.utils.poi.ExcelUtil)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1