package com.cyksj.model.views;

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

/**
 * 项目名: yhlxj
 * 文件名: CorpInteractiveRadarOrderDataView
 * 创建者: JavaZou
 * 创建时间:2023/10/24 11:37
 */
@Getter
@Setter
public class CorpInteractiveRadarOrderDataView {

	private CorpInteractiveRadarOrderData today;

	private CorpInteractiveRadarOrderData history;

	@Getter
	@Setter
	@SearchBean(tables = "corp_interactive_radar_user_record cr left join corp_interactive_user_order_relation cor on cor.radar_id = cr.id" +
			" left join order_don o on o.id = cor.order_id and o.status not in ('close','noPayment','refund')",
			where = ":condition:")
	public static class CorpInteractiveRadarOrderData{
		@DbField("count(distinct cr.id)")
		private Integer click;

		@DbField("count(distinct o.id)")
		private Integer payNum;

		@DbField("count(distinct cr.user_id)")
		private Integer clickUserNum;

		@DbField("count(distinct o.user_id)")
		private Integer payUserNum;

		@DbField("count(distinct if(cor.is_new = 1,o.user_id,NULL))")
		private Integer payNewUserNum;

		@DbField("count(distinct if(cor.is_new = 0,o.user_id,NULL))")
		private Integer payOldUserNum;


		@DbField("count(distinct if(o.order_type = 2,o.user_id,NULL))")
		private Integer renewUserNum;
	}
}
