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.MpAgentActivityParticipantEntity;
import com.seer.teach.mp.mapper.MpAgentActivityParticipantMapper;
import com.seer.teach.mp.service.IMpAgentActivityLogService;
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 代理商活动参与记录表 服务实现类
 * </p>
 *
 * @author Lingma
 * @since 2025-12-29
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class MpAgentActivityParticipantServiceImpl extends ServiceImpl<MpAgentActivityParticipantMapper, MpAgentActivityParticipantEntity> implements IMpAgentActivityParticipantService {

    private final IMpAgentActivityLogService agentActivityLogService;

    @Override
    public MpAgentActivityParticipantEntity getParticipantsByActivityAndAgent(Integer activityId, Integer agentId) {
        LambdaQueryWrapper<MpAgentActivityParticipantEntity> queryWrapper = 
            new LambdaQueryWrapper<MpAgentActivityParticipantEntity>()
                .eq(MpAgentActivityParticipantEntity::getActivityId, activityId)
                .eq(MpAgentActivityParticipantEntity::getAgentId, agentId);
                
        return super.getOne(queryWrapper);
    }

    @Override
    public List<MpAgentActivityParticipantEntity> getListByAgentId(Integer agentId) {
        return super.list(new LambdaQueryWrapper<MpAgentActivityParticipantEntity>()
                .eq(MpAgentActivityParticipantEntity::getAgentId, agentId));
    }

    @Override
    public List<MpAgentActivityParticipantEntity> getOneByActivityId(Integer activityId) {
        return super.list(new LambdaQueryWrapper<MpAgentActivityParticipantEntity>().eq(MpAgentActivityParticipantEntity::getActivityId, activityId));
    }
}