| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public FebsResponse changeState(String id, Integer type, Integer state) { |
| | | |
| | | AiProduct entity = this.getById(id); |
| | | if(ObjectUtil.isNotNull(entity)){ |
| | | if(1 == type){ |
| | | if (1 == state){ |
| | | List<AiProductPointLink> list = aiProductPointLinkService.selectListByQuery( |
| | | Wrappers.lambdaQuery(AiProductPointLink.class) |
| | | .eq(AiProductPointLink::getProductId, id) |
| | | ); |
| | | if(CollUtil.isEmpty(list)){ |
| | | return new FebsResponse().fail().message("请配置知识点"); |
| | | } |
| | | List<AiProductRoleLink> list1 = aiProductRoleLinkService.selectListByQuery( |
| | | Wrappers.lambdaQuery(AiProductRoleLink.class) |
| | | .eq(AiProductRoleLink::getProductId, id) |
| | | ); |
| | | if(CollUtil.isEmpty(list1)){ |
| | | return new FebsResponse().fail().message("请配置AI陪练"); |
| | | } |
| | | List<AiProductQuestionLink> list2 = aiProductQuestionLinkService.selectListByQuery( |
| | | Wrappers.lambdaQuery(AiProductQuestionLink.class) |
| | | .eq(AiProductQuestionLink::getProductId, id) |
| | | ); |
| | | if(CollUtil.isEmpty(list2)){ |
| | | return new FebsResponse().fail().message("请配置AI题目"); |
| | | } |
| | | } |
| | | |
| | | aiProductMapper.update(null, |
| | | Wrappers.lambdaUpdate(AiProduct.class) |
| | | .set(AiProduct::getState, state) |