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
 * 文件名: CpsOrderView
 * 创建者: JavaZou
 * 创建时间:2024/3/21 14:55
 */
@Getter
@Setter
@SearchBean(tables = "(select o.id,o.goods_id,o.money,o.is_dp,o.ori_money,o.created_time from order_don o inner join (select user_id from user_distribute_shared where :sharedId:) us on us.user_id = o.user_id where o.is_fixed_distribute is true and o.status not in ('close','noPayment') :time:) od left join goods_don g on g.id = od.goods_id" +
		" inner join distribute_waiting_send_points dp on dp.order_id = od.id",
		groupBy = "od.goods_id,g.title,date_format(od.created_time,'%Y-%m-%d')")
public class CpsOrderView {

	@DbField("od.goods_id")
	private Long goodsId;

	@DbField("g.title")
	private String title;

	@DbField("cast(sum(if(od.is_dp and od.ori_money != 0,od.ori_money,od.money))/100 as decimal(10,2))")
	private BigDecimal distributeOrderMoney;

	@DbField("count(od.id)")
	private Integer orders;

	/**
	 * 日期
	 */
	@DbField("date_format(od.created_time,'%Y-%m-%d')")
	private String date;
}
