package com.kxs.stat.biz.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kxs.stat.biz.constant.enums.TotalTypeEnum;
import com.kxs.stat.biz.mapper.KxsLkbTradeMapper;
import com.kxs.stat.api.model.KxsLkbTrade;
import com.kxs.stat.biz.service.KxsLkbTradeService;
import org.springframework.stereotype.Service;

/**
 * 来客吧交易统计总表(KxsLkbTrade)表服务实现类
 *
 * @author 系统
 * @since 2024-05-09 13:59:07
 */
@Service("kxsLkbTradeService")
public class KxsLkbTradeServiceImpl extends ServiceImpl<KxsLkbTradeMapper, KxsLkbTrade> implements KxsLkbTradeService {

    @Override
    public KxsLkbTrade getLkbTradeAmt(KxsLkbTrade param) {


        return baseMapper.selectOne(Wrappers.<KxsLkbTrade>lambdaQuery()
                .eq(KxsLkbTrade::getUserId, param.getUserId())
                .eq(KxsLkbTrade::getTotalType, TotalTypeEnum.TEAM.getType())
                .eq(param.getTradeMonth() != null, KxsLkbTrade::getTradeMonth, param.getTradeMonth())
                .eq(param.getTradeDate() != null, KxsLkbTrade::getTradeDate, param.getTradeDate()));
    }
}

