|
| 1 | +/*--------------------------------------------------------------------------------------------- |
| 2 | + * Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved. |
| 3 | + * This file is a part of the ModelEngine Project. |
| 4 | + * Licensed under the MIT License. See License.txt in the project root for license information. |
| 5 | + *--------------------------------------------------------------------------------------------*/ |
| 6 | + |
| 7 | +package modelengine.fit.jober.aipp.repository.impl; |
| 8 | + |
| 9 | +import modelengine.fit.jober.aipp.entity.ChatAndInstanceMap; |
| 10 | +import modelengine.fit.jober.aipp.entity.ChatInfo; |
| 11 | +import modelengine.fit.jober.aipp.mapper.AippChatMapper; |
| 12 | +import modelengine.fit.jober.aipp.repository.AippChatRepository; |
| 13 | +import modelengine.fitframework.annotation.Component; |
| 14 | +import modelengine.fitframework.transaction.Transactional; |
| 15 | +import modelengine.fitframework.util.CollectionUtils; |
| 16 | + |
| 17 | +import java.util.ArrayList; |
| 18 | +import java.util.List; |
| 19 | + |
| 20 | +/** |
| 21 | + * {@link AippChatRepository}对应实现类。 |
| 22 | + * |
| 23 | + * @author 杨祥宇 |
| 24 | + * @since 2025-04-09 |
| 25 | + */ |
| 26 | +@Component |
| 27 | +public class AippChatRepositoryImpl implements AippChatRepository { |
| 28 | + private final AippChatMapper aippChatMapper; |
| 29 | + |
| 30 | + public AippChatRepositoryImpl(AippChatMapper aippChatMapper) {this.aippChatMapper = aippChatMapper;} |
| 31 | + |
| 32 | + @Override |
| 33 | + public List<String> getExpiredChatIds(int expiredDays, int limit) { |
| 34 | + return aippChatMapper.getExpiredChatIds(expiredDays, limit); |
| 35 | + } |
| 36 | + |
| 37 | + @Override |
| 38 | + @Transactional |
| 39 | + public void forceDeleteChat(List<String> chatIds) { |
| 40 | + if (CollectionUtils.isEmpty(chatIds)) { |
| 41 | + return; |
| 42 | + } |
| 43 | + aippChatMapper.forceDeleteChat(chatIds); |
| 44 | + aippChatMapper.deleteWideRelationshipByChatIds(chatIds); |
| 45 | + } |
| 46 | + |
| 47 | + @Override |
| 48 | + public List<ChatInfo> selectByChatIds(List<String> chatIds) { |
| 49 | + if (CollectionUtils.isEmpty(chatIds)) { |
| 50 | + return new ArrayList<>(); |
| 51 | + } |
| 52 | + return aippChatMapper.selectByChatIds(chatIds); |
| 53 | + } |
| 54 | + |
| 55 | + @Override |
| 56 | + public List<ChatAndInstanceMap> selectTaskInstanceRelationsByChatIds(List<String> chatIds) { |
| 57 | + if (CollectionUtils.isEmpty(chatIds)) { |
| 58 | + return new ArrayList<>(); |
| 59 | + } |
| 60 | + return aippChatMapper.selectTaskInstanceRelationsByChatIds(chatIds); |
| 61 | + } |
| 62 | +} |
0 commit comments