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.util.Date;

/*
 *项目名: netflix
 *文件名: GoodsDonCategoryView
 *创建者: JavaZou
 *创建时间:2023/8/18 10:36
 */
@Getter
@Setter
@SearchBean(tables = "goods_don_category gc left join goods_don_category_relate gcr on gcr.category = gc.id" +
		" left join goods_don g on g.id = gcr.goods_id and g.deleted is true",
		groupBy = "gc.id,gc.name,gc.icon,gc.sorted,gc.update_time")
public class GoodsDonCategoryView {
	@DbField("gc.id")
	private Long id;

	@DbField("gc.name")
	private String name;

	@DbField("gc.icon")
	private String icon;

	@DbField("gc.sorted")
	private Integer sorted;

	@DbField("count(g.id)")
	private Integer count;

	@DbField("select count(*) from goods_click_user_record gcur where gcur.category = gc.id")
	private Integer click;

	@DbField("select count(*) from goods_don_category_relate gcr left join order_don o on o.goods_id = gcr.goods_id where gcr.category = gc.id and o.status not in ('close','noPayment','refund')")
	private Integer orderNum;

	@DbField("gc.status")
	private Boolean status;

	@DbField("gc.update_time")
	private Date updateTime;
}
