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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.seer.teach.teacher.module.entity.TeachGoalsEntity;
import com.seer.teach.teacher.module.mapper.TeachGoalsMapper;
import com.seer.teach.teacher.service.TeachGoalsService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Wang
 * @since 2025-12-02 18:17:59
 */
@Service
public class TeachGoalsServiceImpl extends ServiceImpl<TeachGoalsMapper, TeachGoalsEntity> implements TeachGoalsService {

    @Override
    public TeachGoalsEntity getFirstGoalByKnowId(Integer knowId) {
        return this.lambdaQuery()
                .eq(TeachGoalsEntity::getKnowId, knowId)
                .orderByAsc(TeachGoalsEntity::getSort)
                .last("limit 1")
                .one();
    }

    @Override
    public TeachGoalsEntity getGoalByKnowIdAndSortId(Integer knowId, Integer sort) {
        return this.lambdaQuery()
                .eq(TeachGoalsEntity::getKnowId, knowId)
                .eq(TeachGoalsEntity::getSort, sort)
                .one();
    }

}
