修改绑定门店查询

master
wjt 12 months ago
parent b7135f8b72
commit d8026f75f7

@ -29,17 +29,18 @@ public class StoreUserServiceImpl extends ExtendServiceImpl<StoreUserMapper, Sto
private final SysUserService sysUserService;
private final BusinessProperties businessProperties;
@Override
public List<SysUserNameRoleDTO> listByRoleCode() {
List<SysUserNameRoleDTO> sysUserNameRoleS = sysUserService.listByRoleCodeAndUserId(businessProperties.getStoreCode(), SecurityUtils.getCurrentUserId());
List<SysUserNameRoleDTO> list = new ArrayList<>();
if (sysUserNameRoleS != null) {
//已经绑定的业务员
List<StoreUserEntity> storeUserEntities = baseMapper.selectList(new LambdaQueryWrapper<StoreUserEntity>().eq(StoreUserEntity::getCreateBy, SecurityUtils.getCurrentUserId()));
list = sysUserNameRoleS.stream().filter(item -> !storeUserEntities.stream().map(StoreUserEntity::getUserId).collect(Collectors.toList()).contains(item.getUserId())).collect(Collectors.toList());
}
return list;
//todo 可以1对多,不去重
// List<SysUserNameRoleDTO> list = new ArrayList<>();
// if (sysUserNameRoleS != null) {
// //已经绑定的业务员
// List<StoreUserEntity> storeUserEntities = baseMapper.selectList(new LambdaQueryWrapper<StoreUserEntity>().eq(StoreUserEntity::getCreateBy, SecurityUtils.getCurrentUserId()));
// list = sysUserNameRoleS.stream().filter(item -> !storeUserEntities.stream().map(StoreUserEntity::getUserId).collect(Collectors.toList()).contains(item.getUserId())).collect(Collectors.toList());
// }
return sysUserService.listByRoleCodeAndUserId(businessProperties.getStoreCode(), SecurityUtils.getCurrentUserId());
}
@Override
@ -55,7 +56,7 @@ public class StoreUserServiceImpl extends ExtendServiceImpl<StoreUserMapper, Sto
List<StoreUserEntity> storeUserEntities = baseMapper.selectList
(Wrappers.<StoreUserEntity>lambdaQuery().eq(StoreUserEntity::getStoreId, storeId)
.orderByDesc(StoreUserEntity::getId));
if (CollUtil.isNotEmpty(storeUserEntities)){
if (CollUtil.isNotEmpty(storeUserEntities)) {
return storeUserEntities.get(0).getUserId();
}
return 0L;

Loading…
Cancel
Save