package cn.iocoder.yudao.module.mes.dal.mysql.saleorder;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.saleorder.SaleOrderItemsDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 销售订单项 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface SaleOrderItemsMapper2 extends BaseMapperX<SaleOrderItemsDO> {

    default PageResult<SaleOrderItemsDO> selectPage(PageParam reqVO, Long orderId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SaleOrderItemsDO>()
                .eq(SaleOrderItemsDO::getOrderId, orderId)
                .orderByDesc(SaleOrderItemsDO::getId));
    }

    default int deleteByOrderId(Long orderId) {
        return delete(SaleOrderItemsDO::getOrderId, orderId);
    }

}