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;

/**
 * 项目名: yhlxj
 * 文件名: CorpActiveCodeGoodsOrderView
 * 创建者: JavaZou
 * 创建时间:2023/10/10 13:45
 */
@Getter
@Setter
@SearchBean(tables = "corp_user cu inner join order_don o on cu.user_id = o.user_id and cu.user_id != 0 and o.status not in ('close','noPayment') :acId: :time:" +
		" left join goods_don g on g.id = o.goods_id" +
		" left join goods_don_sku sku on sku.id = o.sku_id" +
		" left join user u on u.id = o.user_id",
		groupBy = "g.id,g.title")
public class CorpActiveCodeGoodsOrderView {
	/**
	 * 平台名称
	 */
	@DbField("g.title")
	private String goodsName;

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

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

	/**
	 * 订单数
	 */
	@DbField("count(o.id)")
	private Integer orderCount;

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

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

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