package shop.alien.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import shop.alien.entity.store.StoreVipLog;
import shop.alien.entity.store.vo.StoreVipLogVo;

/**
 * <p>
 * 商家会员记录 Mapper 接口
 * </p>
 *
 * @author ssk
 * @since 2025-02-20
 */
public interface StoreVipLogMapper extends BaseMapper<StoreVipLog> {

    @Select("select a.*, b.trans_amount order_money, b.out_biz_no order_no, c.dict_detail vip_type_str, d.dict_detail buy_duration_str, f.store_name " +
            "from store_vip_log a " +
            "left join store_ali_pay_log b on a.ali_id=b.id " +
            "left join store_dictionary c on a.vip_type =c.dict_id and c.type_name ='vipType' " +
            "left join store_dictionary d on a.buy_duration =d.dict_id and d.type_name ='vipDuration' " +
            "left join store_info f on a.store_id = f.id ${ew.customSqlSegment}")
    IPage<StoreVipLogVo> getStoreVipLogPage(IPage<StoreVipLogVo> page, @Param(Constants.WRAPPER) QueryWrapper<StoreVipLogVo> queryWrapper);

}
