package com.cyksj.model.views;

import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;

/*
 *项目名: netflix
 *文件名: BusinessTakeMoneyHeadView
 *创建者: JavaZou
 *创建时间:2023/3/27 14:02
 */
@Getter
@Setter
@SearchBean(tables = "user_distribute_business_order_don_record ubr",
		where = ":time:"
		, groupBy = "ubr.business_id")
public class BusinessTakeMoneyHeadView {
	@DbField("ubr.business_id")
	private Long businessId;

	@DbField("count(if(ubr.order_type = 1 and ubr.status = 'success',1,NULL))")
	private Integer numOfFirstOrder;

	@DbField("cast(sum(if(ubr.order_type = 1 and ubr.status = 'success',ubr.take_money,0))/100 as decimal(10,2))")
	private BigDecimal moneyOfFirstOrder;

	@DbField("count(if(ubr.order_type = 2 and ubr.status = 'success',1,NULL))")
	private Integer numOfRenewOrder;

	@DbField("cast(sum(if(ubr.order_type = 2 and ubr.status = 'success',ubr.take_money,0))/100 as decimal(10,2))")
	private BigDecimal moneyOfRenewOrder;

	@DbField("cast(sum(if(ubr.status = 'success', ubr.take_money,0))/100 as decimal(10,2))")
	private BigDecimal takeMoney;

	@DbField("cast(sum(if(ubr.status = 'refund', ubr.take_money,0))/100 as decimal(10,2))")
	private BigDecimal refundMoney;
}
