package com.cf.imes.module.manage.dal.mysql.query;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.manage.controller.admin.pack.vo.OrderPartsRespVO;
import com.cf.imes.module.manage.controller.admin.plate.vo.plate.PlatePageReqVO;
import com.cf.imes.module.manage.controller.admin.query.vo.pack.PackageDetailsRespVO;
import com.cf.imes.module.manage.dal.dataobject.plate.PlateDO;
import com.cf.imes.module.manage.dal.dataobject.query.OrderPartsNDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface OrderPartsMapper extends BaseMapperX<OrderPartsNDO> {


    IPage<PackageDetailsRespVO> selectParts(@Param("page") IPage page, @Param("packageId")  Long packageId, @Param("organId")  Long organId);


    IPage<OrderPartsRespVO> selectPartsList(@Param("page") IPage page, @Param("orderId") Long orderId , @Param("organId")  Long organId);



    List<OrderPartsRespVO> selectOrderParts(@Param("orderNo")Long orderNo,@Param("packageNo") Long packageNo);


    void deleteOrderParts(@Param("packageId") Long packageId);


    default OrderPartsNDO selectOneParts(String otherPartsName,Long organId) {
        return selectOne(new LambdaQueryWrapperX<OrderPartsNDO>()
                .eq(OrderPartsNDO::getOrganId,organId)
                .eqIfPresent(OrderPartsNDO::getName,otherPartsName));

    }

    void updateParts(@Param("partsId") Long partsId);

}
