package org.ta.pddserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.ta.pddserver.entity.CollectMailDetailEntity;

@Mapper
public interface CollectMailDetailMapper extends BaseMapper<CollectMailDetailEntity> {
    @Select("SELECT * FROM `collect_mail_detail` WHERE `orderCode` = #{orderCode} AND `expressCode` = #{expressCode} AND `mailNo` = #{mailNo};")
    CollectMailDetailEntity selectByOrderCodeAndExpressCodeAndMailNo(String orderCode, String expressCode, String mailNo);

    @Update("UPDATE `collect_mail_detail` SET `status` = #{status} WHERE `uid` = #{uid};")
    int updateStatusByUid(int status, String uid);

    @Update("UPDATE `collect_mail_detail` SET `status` = #{action} WHERE `mailNo` = #{mailNo}")
    Boolean updateByMailNo(@Param("mailNo") String mailNo, @Param("action") String action);
}
