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;

/**
 * 项目名: yhlxj2
 * 文件名: VipOrderDonPopularizeView
 * 创建者: JavaZou
 * 创建时间:2025/6/3 15:10
 */
@Getter
@Setter
@SearchBean(tables = "vip_order_don o left join goods_don g on g.id = o.goods_id",
		where = "o.status not in ('close','noPayment') :time:",
		groupBy = "o.goods_id,o.popularize_id")
public class VipOrderDonPopularizeView {
	@DbField("o.popularize_id")
	private Long popularizeId;
	/**
	 * 平台名称
	 */
	@DbField("g.title")
	private String goodsName;

	@DbField("g.id")
	private Long goodsId;

	@DbField("g.type")
	private Integer goodsDonType;

	/**
	 * 订单数
	 */
	@DbField("count(if(o.status != 'refund',1,NULL))")
	private Integer orderCount;

	/**
	 * 订单金额
	 */
	@DbField("IFNULL(sum(o.money),0)")
	private BigDecimal orderMoney;

	/**
	 * 退款数
	 */
	@DbField("count(if(o.status = 'refund',1,NULL))")
	private Integer refundCount;

	/**
	 * 退款金额
	 */
	@DbField("IFNULL(sum(o.refund_money),0)")
	private BigDecimal refundMoney;
}
