package com.cyksj.model.views;

import com.cyksj.model.entity.DistributeWaitingSendPoints;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;

/**
 * CC普通推广邀请明细视图
 */
@Getter
@Setter
@SearchBean(tables = " user_distribute_shared uds INNER JOIN user u ON u.id = uds.user_id" +
		" LEFT JOIN distribute_waiting_send_points dwsp ON dwsp.user_id = uds.user_id",
		where = "uds.remark = 'cc'",
		groupBy = "uds.shared_id,uds.user_id,u.nickname,u.headimgurl,uds.created_time")
public class CcPromotionInvitationDetailView {
	/**
	 * 分销用户id
	 */
	@DbField("uds.shared_id")
	@JsonIgnore
	private Long sharedId;

	/**
	 * 被邀请用户ID
	 */
	@DbField("uds.user_id")
	@JsonIgnore
	private Long userId;

	/**
	 * 用户昵称
	 */
	@DbField("u.nickname")
	private String nickname;

	/**
	 * 用户头像
	 */
	@DbField("u.headimgurl")
	private String headimgurl;

	/**
	 * 提成状态
	 */
	@DbIgnore
	private DistributeWaitingSendPoints.Status status;

	/**
	 * 首单订单ID
	 */
	@DbIgnore
	private Long firstOrderId;

	/**
	 * 规格
	 */
	@DbIgnore
	private String specVal;

	/**
	 * 订单金额
	 */
	@DbIgnore
	private BigDecimal orderMoney;

	/**
	 * 返现提成
	 */
	@DbIgnore
	private BigDecimal reMoney = BigDecimal.ZERO;

	/**
	 * 邀请时间
	 */
	@DbField("ifnull(max(dwsp.update_time),uds.created_time)")
	private Date updateTime;
}