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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.seer.teach.common.enums.teacher.TeachTextDefaultEnum;
import com.seer.teach.teacher.module.entity.TeachTextsEntity;
import com.seer.teach.teacher.module.mapper.TeachTextsMapper;
import com.seer.teach.teacher.service.TeachTextsService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Wang
 * @since 2025-12-02 19:56:20
 */
@Service
public class TeachTextsServiceImpl extends ServiceImpl<TeachTextsMapper, TeachTextsEntity> implements TeachTextsService {

    @Override
    public TeachTextsEntity getDefaultTextByGoalId(Integer id) {
        return this.lambdaQuery()
                .eq(TeachTextsEntity::getGoalId, id)
                .eq(TeachTextsEntity::getIsDefault, TeachTextDefaultEnum.IS_DEFAULT.getCode())
                .one();
    }

    @Override
    public TeachTextsEntity getDefaultTextByGoalIdAndMethodId(Integer goalId, Integer methodId) {
        return this.lambdaQuery()
                .eq(TeachTextsEntity::getGoalId, goalId)
                .eq(TeachTextsEntity::getMethodId, methodId)
                .one();
    }
}
