package com.cf.imes.module.executor.dal.mysql.pack;

import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.dal.dataobject.pack.OrderPrepackagedDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface OrderPrepackagedMapper extends BaseMapperX<OrderPrepackagedDO> {

    default int deletePacked(Long orderId, Long organId) {
        return delete(new LambdaQueryWrapperX<OrderPrepackagedDO>()
                .eq(OrderPrepackagedDO::getOrganId, organId)
                .eqIfPresent(OrderPrepackagedDO::getOrderId, orderId));
    }

    default OrderPrepackagedDO selectOrder(Long orderId, Long organId) {
        return selectOne(new LambdaQueryWrapperX<OrderPrepackagedDO>()
                .eq(OrderPrepackagedDO::getOrganId, organId)
                .eqIfPresent(OrderPrepackagedDO::getOrderId, orderId));
    }
    
}
