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.LifeDiscountCouponStoreFriend;
import shop.alien.entity.store.vo.LifeDiscountCouponStoreFriendVo;
import shop.alien.entity.store.vo.LifeDiscountCouponVo;

/**
 * <p>
 * 优惠券商户发放好友优惠券关系表	 Mapper 接口
 * </p>
 *
 * @author ssk
 * @since 2025-02-19
 */
public interface LifeDiscountCouponStoreFriendMapper extends BaseMapper<LifeDiscountCouponStoreFriend> {

    @Select("select ldc.store_id,ldc.start_date,ldc.end_date,\n" +
            "si.store_name,\n" +
            "ldc.name,ldc.get_status,\n" +
            "ldcsf.single_qty,ldcsf.coupon_id,ldcsf.release_type,ldcsf.id give_coupon_id\n" +
            "from  life_discount_coupon_store_friend ldcsf\n" +
            "left join life_discount_coupon ldc\n" +
            "on ldc.id = ldcsf.coupon_id and ldc.delete_flag = 0\n" +
            "left join store_info si\n" +
            "on si.id = ldc.store_id and si.delete_flag = 0\n" +
            "${ew.customSqlSegment}")
    IPage<LifeDiscountCouponVo> selectPage(IPage<LifeDiscountCouponStoreFriendVo> iPage, @Param(Constants.WRAPPER) QueryWrapper<LifeDiscountCouponStoreFriendVo> friendLifeDiscountCouponQueryWrapper);
}
