package com.cyksj.mapper.stock;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cyksj.model.entity.GoodsDonStockRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author chan
 * @date 2022/12/6 4:13 PM
 */
public interface GoodsDonStockRecordMapper extends BaseMapper<GoodsDonStockRecord> {

	@Select("select * from goods_don_stock_record where stock_id = #{stockId} and type = #{type} and available < num and is_undo is ${isUndo} order by stock_id limit 1")
	GoodsDonStockRecord selectUndoRecord(@Param("stockId") Long stockId, @Param("isUndo") Boolean isUndo, @Param("type") String type);
}
