| | |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.smartor.mapper.SysUserDeptMapper; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | |
| | | @Autowired |
| | | private SysUserDeptMapper sysUserDeptMapper; |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysUser user) { |
| | | startPage(); |
| | |
| | | } |
| | | |
| | | @Log(title = "用户管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:export')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysUser user) { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | |
| | | } |
| | | |
| | | @Log(title = "用户管理", businessType = BusinessType.IMPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user: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); |
| | |
| | | /** |
| | | * 根据用户编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping("/getInfo/{userId}") |
| | | public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { |
| | | userService.checkUserDataScope(userId); |
| | |
| | | ajax.put("postIds", postService.selectPostListByUserId(userId)); |
| | | ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
| | | } |
| | | List<SysUserDept> sysUserDeptKSs = null; |
| | | List<SysUserDept> sysUserDeptBQs = null; |
| | | SysUserDept sysUserDept = new SysUserDept(); |
| | | sysUserDept.setUserId(userId); |
| | | sysUserDept.setDeptType("1"); |
| | | sysUserDeptKSs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept); |
| | | ajax.put("belongDepts",sysUserDeptKSs); |
| | | |
| | | sysUserDept.setDeptType("2"); |
| | | sysUserDeptBQs = sysUserDeptMapper.selectSysUserDeptList(sysUserDept); |
| | | ajax.put("belongWards",sysUserDeptBQs); |
| | | |
| | | return ajax; |
| | | } |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:add')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:add')") |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) { |
| | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:remove')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:remove')") |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @GetMapping("/remove/{userIds}") |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:resetPwd')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) { |
| | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysUser user) { |
| | |
| | | /** |
| | | * 根据用户编号获取授权角色 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping("/authRole/{userId}") |
| | | public AjaxResult authRole(@PathVariable("userId") Long userId) { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | |
| | | /** |
| | | * 用户授权角色 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.GRANT) |
| | | @PostMapping("/authRole") |
| | | public AjaxResult insertAuthRole(Long userId, Long[] roleIds) { |
| | |
| | | /** |
| | | * 获取部门树列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | //@PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/deptTree") |
| | | public AjaxResult deptTree(SysDept dept) { |
| | | return success(deptService.selectDeptTreeList(dept)); |