package shop.alien.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import shop.alien.entity.store.StoreCashOutRecord;

import java.util.List;

/**
 * 商户提现记录表 Mapper 接口
 *
 * @author ssk
 * @since 2025-02-25
 */
@Mapper
public interface StoreCashOutRecordMapper extends BaseMapper<StoreCashOutRecord> {

    @Select("select scor.*, If(su.alipay_account is not null,su.alipay_account,su.phone) settlementAccount\n" +
            "from store_cash_out_record scor\n" +
            "left join store_user su on su.store_id = scor.store_id and su.delete_flag = 0\n" +
            "${ew.customSqlSegment}")
    List<StoreCashOutRecord> selectCashoutRecordList(@Param(Constants.WRAPPER) QueryWrapper<StoreCashOutRecord> wrapper);
}
