| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.cache.DictCache; |
| | | import org.springblade.common.cache.ParamCache; |
| | | import org.springblade.common.cache.SysCache; |
| | |
| | | import org.springblade.modules.system.service.IUserDeptService; |
| | | import org.springblade.modules.system.service.IUserOauthService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.UserDetailVO; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springblade.modules.system.wrapper.UserWrapper; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Override |
| | | public boolean updateUserInfo(User user) { |
| | | user.setPassword(null); |
| | | return updateById(user); |
| | | boolean b = updateById(user); |
| | | return b; |
| | | } |
| | | |
| | | private boolean submitUserDept(User user) { |
| | |
| | | userDeptList.add(userDept); |
| | | }); |
| | | userDeptService.remove(Wrappers.<UserDept>update().lambda().eq(UserDept::getUserId, user.getId())); |
| | | return userDeptService.saveBatch(userDeptList); |
| | | boolean b = userDeptService.saveBatch(userDeptList); |
| | | return b; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<User> selectUserPage(IPage<User> page, User user, Long deptId, String tenantId) { |
| | | if (null == deptId && !AuthUtil.isAdministrator()){ |
| | | deptId = Long.parseLong(AuthUtil.getDeptId()); |
| | | } |
| | | List<Long> deptIdList = SysCache.getDeptChildIds(deptId); |
| | | return page.setRecords(baseMapper.selectUserPage(page, user, deptIdList, tenantId)); |
| | | } |
| | |
| | | return userVO; |
| | | } |
| | | |
| | | /** |
| | | * 按条件查询用户信息 |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<UserVO> getUserListByParam(UserVO user) { |
| | | if (!Strings.isBlank(user.getRoleName())){ |
| | | // 查询对应的角色id |
| | | String roleIds = roleService.getRoleIds("000000", user.getRoleName()); |
| | | user.setRoleId(roleIds); |
| | | } |
| | | return baseMapper.getUserListByParam(user); |
| | | } |
| | | |
| | | /** |
| | | * 通过小区Id搜索用户 |
| | | * @param districtId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<User> searchUserByDistrictId(String districtId) { |
| | | return baseMapper.searchUserByDistrictId( districtId); |
| | | } |
| | | |
| | | /** |
| | | * 根据手机号查询对应账号和手机号的用户信息 |
| | | * @param phoneNumber |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<User> getUserListByPhoneOrAccount(String phoneNumber) { |
| | | return baseMapper.getUserListByPhoneOrAccount( phoneNumber); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public UserDetailVO getUserInfo(Long userId) { |
| | | // 根据用户id 获取用户详情信息 |
| | | UserDetailVO userVO = baseMapper.getUserInfo(userId); |
| | | if (null!=userVO){ |
| | | userVO.setPassword(null); |
| | | } |
| | | // 返回 |
| | | return userVO; |
| | | } |
| | | } |