package com.xxfc.platform.activity.biz;

import cn.hutool.core.bean.BeanUtil;
import com.xxfc.platform.activity.dto.ApLogDTO;
import com.xxfc.platform.activity.entity.ActivityPopularizeItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xxfc.platform.activity.entity.ActivityPopularizeLog;
import com.xxfc.platform.activity.mapper.ActivityPopularizeLogMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;

/**
 * 用户参与推广活动（邀请有礼）的活动记录的记录（日志）
 *
 * @author libin
 * @email 18178966185@163.com
 * @date 2019-07-05 15:23:04
 */
@Service
public class ActivityPopularizeLogBiz extends BaseBiz<ActivityPopularizeLogMapper,ActivityPopularizeLog> {

    @Autowired
    ActivityPopularizeItemBiz activityPopularizeItemBiz;

    public ApLogDTO selectOneApLogDTO(ActivityPopularizeLog entity){
        ActivityPopularizeLog apl = mapper.selectOne(entity);
        if(null != apl) {
            ApLogDTO apLogDTO = BeanUtil.toBean(apl, ApLogDTO.class);
            apLogDTO.setItem(activityPopularizeItemBiz.selectById(apLogDTO.getItemId()));
            return apLogDTO;
        }else {
            return null;
        }
    }
}