package com.hzs.sale.wares.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.domain.sale.wares.BdWaresMemberLimit;
import com.hzs.sale.wares.mapper.BdWaresMemberLimitMapper;
import com.hzs.sale.wares.service.IBdWaresMemberLimitService;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * 会员商品限购 服务实现类
 */
@Service
public class BdWaresMemberLimitServiceImpl extends ServiceImpl<BdWaresMemberLimitMapper, BdWaresMemberLimit> implements IBdWaresMemberLimitService {

    @Override
    public int updateWaresMemberLimitBatch(List<BdWaresMemberLimit> waresMemberLimitList) {
        return baseMapper.updateWaresMemberLimitBatch(waresMemberLimitList);
    }

    @Override
    public List<BdWaresMemberLimit> listMemberWaresLimit(Long pkMember, Collection<Integer> pkWaresList) {
        return this.list(Wrappers.<BdWaresMemberLimit>lambdaQuery()
                .eq(BdWaresMemberLimit::getPkMember, pkMember)
                .in(BdWaresMemberLimit::getPkWares, pkWaresList)
                .orderByAsc(BdWaresMemberLimit::getPkWares)
        );
    }

}
