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
 * 文件名: DistributePlatOrderDonBrokenLineView
 * 创建者: JavaZou
 * 创建时间:2023/11/17 18:05
 */
@Getter
@Setter
@SearchBean(tables = "(select order_id,is_vip from distribute_waiting_send_points dp :sid:) dp left join order_don od on od.id = dp.order_id and dp.is_vip = false" +
		" left join vip_order_don vod on vod.id = dp.order_id and dp.is_vip = true" +
		" left join goods_don g on g.id = ifnull(od.goods_id,vod.goods_id)",
		where = "ifnull(od.status,vod.status) not in ('noPayment','close','refund')",
		groupBy = "g.id,g.title,:date:")
public class DistributePlatOrderDonBrokenLineView {
	@DbField("g.id")
	private Long goodsId;

	/**
	 * 平台名称
	 */
	@DbField("g.title")
	private String goodsTitle;

	/**
	 * 当前日期订单金额
	 */
	@DbField("cast(sum(ifnull(od.money,vod.money))/100 as decimal(10,2))")
	private BigDecimal money;

	/**
	 * 日期
	 */
	@DbField(":date:")
	private String date;
}
