package com.seer.teach.mp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.seer.teach.mp.entity.MpParentAgentActivityRelationEntity;
import com.seer.teach.mp.mapper.MpParentAgentActivityRelationMapper;
import com.seer.teach.mp.service.IMpParentAgentActivityRelationService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * 家长参与代理商活动关系表 服务实现类
 * </p>
 *
 * @author Lingma
 * @since 2025-12-30
 */
@Service
@AllArgsConstructor
public class MpParentAgentActivityRelationServiceImpl extends ServiceImpl<MpParentAgentActivityRelationMapper, MpParentAgentActivityRelationEntity> implements IMpParentAgentActivityRelationService {

    @Override
    public MpParentAgentActivityRelationEntity getByAgentIdAndActivityIdAndParentId(Integer agentId, Integer activityId, Integer parentId) {
        LambdaQueryWrapper<MpParentAgentActivityRelationEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MpParentAgentActivityRelationEntity::getActivityId, activityId)
                .eq(MpParentAgentActivityRelationEntity::getAgentId, agentId)
                .eq(MpParentAgentActivityRelationEntity::getParentId, parentId);
        return getOne(queryWrapper);
    }

    @Override
    public MpParentAgentActivityRelationEntity getByAgentIdAndActivityIdAndParentId(Integer activityId, Integer parentId) {
        LambdaQueryWrapper<MpParentAgentActivityRelationEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MpParentAgentActivityRelationEntity::getActivityId, activityId)
                   .eq(MpParentAgentActivityRelationEntity::getParentId, parentId);
        return getOne(queryWrapper);
    }
}