package cn.pluss.platform.mapper;

import cn.pluss.platform.dto.jft.JftReceiptOrderDTO;
import cn.pluss.platform.entity.JftReceiptOrder;
import cn.pluss.platform.vo.JftReceiptOrderVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 收款单订单详情 Mapper 接口
 * </p>
 *
 * @author crystal
 * @since 2022-06-16
 */
public interface JftReceiptOrderMapper extends BaseMapper<JftReceiptOrder> {

    /**
     * 根据收款单id盒状态查询收款单详情
     * @param rid
     * @return
     */
    @Select("SELECT * FROM tb_pluss_jft_receipt_order WHERE rid = #{rid} and `status` = #{status} order by id desc")
    List<JftReceiptOrder> listByReceiptId(@Param("rid") Long rid, @Param("status") String status);

    @Select("SELECT * FROM tb_pluss_jft_receipt_order WHERE orderNumber = #{orderNumber} limit 1")
    JftReceiptOrder getOrderByNo(String orderNumber);

    @Select("SELECT * FROM tb_pluss_jft_receipt_order WHERE mercOrderNo = #{mercOrderNo} limit 1")
    JftReceiptOrder getMercOrderByNo(String mercOrderNo);

    /**
     * 分页查询
     * @param page
     * @param entity
     * @return
     */
    Page<JftReceiptOrderVO> pageData(@Param("page") Page<JftReceiptOrderVO> page, @Param("entity") JftReceiptOrderDTO entity);
}
