package com.base.plan.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.base.plan.model.entity.AlgSchemeStep;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface AlgSchemeStepMapper extends BaseMapper<AlgSchemeStep> {
    @Select("select * from alg_scheme_step order by created_date desc")
    List<AlgSchemeStep> listAll();

    default List<AlgSchemeStep> listNotConfirmAll(){
       return this.selectList(new QueryWrapper<AlgSchemeStep>().eq("is_confirm", 2).orderByDesc("created_date"));
    }

    default void confirmScheme(List<String> ids){
        this.update(null,new UpdateWrapper<AlgSchemeStep>().set("is_confirm",1).in("id",ids));
    }

}