package com.xxfc.platform.activity.biz;

import com.xxfc.platform.activity.constant.CouponUsed;
import com.xxfc.platform.activity.entity.Coupon;
import org.springframework.stereotype.Service;
import com.xxfc.platform.activity.mapper.CouponMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * 优惠券表
 *
 * @author libin
 * @email 18178966185@163.com
 * @date 2019-06-21 14:34:49
 */
@Service
public class CouponBiz extends BaseBiz<CouponMapper, Coupon> {


    //获取优惠卷
    public  Coupon getCouponByUsed(Integer used){
        Example example=new Example(Coupon.class);
        example.createCriteria().andEqualTo("used",used )
                .andEqualTo("status",1).andEqualTo("isDel",0);
         List<Coupon> list=selectByExample(example);
         if (list.size()>0){
            return list.get(0);
         }
        return null;
    }
}