接口getAllInstallBots添加返回参数:单个bot下所有repoOwners

This commit is contained in:
wanjia 2023-03-30 13:07:45 +08:00
parent a6ec2fef28
commit 40836ee219
2 changed files with 17 additions and 1 deletions

View File

@ -1196,6 +1196,21 @@ public class UserService extends AbstractUserBot implements IUserService {
List<InstallBot> installBots = installMapper.selectList(Wrappers.<InstallBot>lambdaQuery() List<InstallBot> installBots = installMapper.selectList(Wrappers.<InstallBot>lambdaQuery()
.eq(InstallBot::getInstallerId,userId)); .eq(InstallBot::getInstallerId,userId));
Map<Integer, StringJoiner> botAndAllRepoOwnerMap = new HashMap<>();
for(InstallBot installBot : installBots) {
StringJoiner s = new StringJoiner(",");
if(botAndAllRepoOwnerMap.containsKey(installBot.getBotId())){
s = botAndAllRepoOwnerMap.get(installBot.getBotId());
}
if (installBot.getRepoOwner() == null || (s.length() > 0 && s.toString().contains(installBot.getRepoOwner()))){
continue;
}
botAndAllRepoOwnerMap.put(installBot.getBotId(), s.add(installBot.getRepoOwner()));
}
List<InstallBotInfo> installBotInfos = new ArrayList<>(); List<InstallBotInfo> installBotInfos = new ArrayList<>();
installBots.forEach(installBot -> { installBots.forEach(installBot -> {
Integer botId = installBot.getBotId(); Integer botId = installBot.getBotId();
@ -1208,6 +1223,7 @@ public class UserService extends AbstractUserBot implements IUserService {
installBotInfo.setLimitVO(limitVO); installBotInfo.setLimitVO(limitVO);
BeanUtils.copyProperties(bot,installBotInfo); BeanUtils.copyProperties(bot,installBotInfo);
BeanUtils.copyProperties(installBot,installBotInfo); BeanUtils.copyProperties(installBot,installBotInfo);
installBotInfo.setRepoOwners(String.valueOf(botAndAllRepoOwnerMap.get(installBotInfo.getBotId())));
installBotInfos.add(installBotInfo); installBotInfos.add(installBotInfo);
}); });

View File

@ -32,5 +32,5 @@ public class InstallBotInfo {
LimitVO limitVO; LimitVO limitVO;
String repoOwner; String repoOwners;
} }