package jnpf.cultivate.event.base.examidentify;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jnpf.cultivate.mapper.FtbCultivatePositionMapper;
import jnpf.model.cultivate.po.position.FtbCultivatePosition;

import javax.annotation.Resource;

/**
 * 岗位、任务基础抽象类
 *
 * @author wangchunxiang
 * @date 2024/07/29
 */
public abstract class PositionTaskTriggerAbstract extends ExamIdentifyTriggerAbstract {

    @Resource
    protected FtbCultivatePositionMapper cultivatePositionMapper;

    /**
     * 岗位考试合格后才能进行鉴定
     *
     * @param postId 岗位id
     * @return 0否1是
     */
    protected Integer doJobQualificationTrigger(String postId) {
        LambdaQueryWrapper<FtbCultivatePosition> positionLambdaQueryWrapper = Wrappers.lambdaQuery();
        positionLambdaQueryWrapper.select(FtbCultivatePosition::getQualified);
        positionLambdaQueryWrapper.eq(FtbCultivatePosition::getEnabledMark, 0);
        positionLambdaQueryWrapper.eq(FtbCultivatePosition::getPostId, postId);
        return cultivatePositionMapper.selectOne(positionLambdaQueryWrapper).getQualified();
    }


}
