package org.ta.pddserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.ta.pdd.entity.CollectFreightFeeDetailEntity;

@Mapper
public interface CollectFreightFeeDetailMapper extends BaseMapper<CollectFreightFeeDetailEntity> {
    @Select("SELECT * FROM `collect_freight_fee_detail` WHERE `payOrderId` = #{payOrderId} ORDER BY `uid` DESC LIMIT 1;")
    CollectFreightFeeDetailEntity findByPayOrderId(@Param("payOrderId") String payOrderId);

    @Select("SELECT * FROM `collect_freight_fee_detail` WHERE `orderCode` = #{orderCode} ORDER BY `uid` DESC LIMIT 1;")
    CollectFreightFeeDetailEntity findByOrderCode(@Param("orderCode") String orderCode);

    @Delete("DELETE FROM `collect_freight_fee_detail` WHERE `orderCode` = #{orderCode};")
    Integer deleteByOrderCode(@Param("orderCode") String orderCode);
}
