package com.cyksj.model.views;

import com.cyksj.model.entity.OrderDon;
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;

/*
 *项目名: netflix
 *文件名: DistributePopularizeOrdersView
 *创建者: JavaZou
 *创建时间:2022/11/15 14:28
 */
@Getter
@Setter
@SearchBean(tables = "distribute_waiting_send_points dw left join order_don od on od.id = dw.order_id and dw.is_vip = false" +
		" left join vip_order_don vod on vod.id = dw.order_id and dw.is_vip = true" +
		" left join user u on u.id = od.user_id ")
public class DistributePopularizeOrdersView {
	@DbField("ifnull(od.id,dw.order_id)")
	private Long orderId;

	@DbField("ifnull(od.goods_id,vod.goods_id)")
	@JsonIgnore
	private Long goodsId;

	@DbField("od.sku_id")
	@JsonIgnore
	private Long skuId;

	@DbField("if(od.id is null,vod.money,if(od.is_dp and od.ori_money != 0,od.ori_money,od.money))")
	private BigDecimal money;

	@DbField("dw.shared_id")
	@JsonIgnore
	private Long sharedId;

	@DbField("u.nickname")
	private String nickname;

	@DbField("dw.points")
	private BigDecimal points;

	@DbField("dw.extra_rebate")
	private BigDecimal extraRebate;

	/**
	 * 原本积分奖励
	 */
	@DbField("dw.ori_points")
	private BigDecimal oriPoints;

	@DbIgnore
	private BigDecimal waitGetMoney;

	@DbIgnore
	private BigDecimal oriGetMoney;

	@DbField("dw.send_status")
	private String sendStatus;

	@DbIgnore
	private String goodsTitle;

	@DbField("ifnull(od.status,vod.status)")
	private OrderDon.Status orderStatus;

	@DbField("if(od.id is null,vod.pay_title,od.pay_title)")
	private String specVal;

	@DbField("ifnull(od.created_time,vod.created_time)")
	private Date createdTime;
}
