package com.github.wxiaoqi.security.admin.biz;

import org.springframework.stereotype.Service;

import com.github.wxiaoqi.security.admin.entity.BaseGoodCommission;
import com.github.wxiaoqi.security.admin.mapper.BaseGoodCommissionMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * 商品拥金表
 *
 * @author zjw
 * @email 18178966185@163.com
 * @date 2019-07-11 18:34:39
 */
@Service
public class BaseGoodCommissionBiz extends BaseBiz<BaseGoodCommissionMapper,BaseGoodCommission> {



    public  Integer getExtract(Integer type,Integer goodId){
        Example example=new Example(BaseGoodCommission.class);
        example.createCriteria().andEqualTo("goodId", goodId).andEqualTo("type", type).andEqualTo("isReckon",1);
        List<BaseGoodCommission> list = mapper.selectByExample(example);
        if (list != null && list.size() != 0) {
            return list.get(0).getExtract();
        }
      return  0;
    }

}