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


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.patching.vo.PatchingDetailReqVO;
import com.cf.imes.module.manage.controller.admin.patching.vo.PatchingDetailRespVO;
import com.cf.imes.module.manage.controller.admin.patching.vo.PatchingPlatePageReqVO;
import com.cf.imes.module.manage.controller.admin.process.vo.OrderPlateReqVO;
import com.cf.imes.module.manage.controller.admin.process.vo.PlateDetails;
import com.cf.imes.module.manage.dal.dataobject.plate.OrderPlateDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface OrderPlateMapper extends BaseMapperX<OrderPlateDO> {



    List<PatchingDetailRespVO> selectPlateDetail(PatchingPlatePageReqVO pageReqVO);



    PatchingDetailRespVO selectPlate(@Param("plateId") Long plateId);



    default List<OrderPlateDO> selectPlateList(PatchingDetailReqVO reqVO) {
        return selectList( new LambdaQueryWrapperX<OrderPlateDO>()
                .and(wrapper -> {
                    for (Long plateId : reqVO.getPlateIdList()) {
                        wrapper.or().eq(OrderPlateDO::getId, plateId);
                    }
                })
                .orderByDesc(OrderPlateDO::getId));
    }


    List<PatchingDetailRespVO> selectOtherPlateList(@Param("plateIdList") List<Long> plateIdList);

    List<PlateDetails> selectListByOrderId( @Param("orderId") Long orderId, @Param("organId") Long organId);

}
