package com.cyksj.model.views;

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

/*
 *项目名: netflix
 *文件名: UserDistributeView
 *创建者: JavaZou
 *创建时间:2022/11/15 16:27
 */
@Getter
@Setter
@SearchBean(tables = "goods_don gd left join user_plat_distribute_rate up on gd.id = up.goods_id :dis_id:" +
		" left join business_distribute_default_rate_config bdc on bdc.goods_id = gd.id",
		where = "gd.deleted is true and gd.status is true and gd.is_distribute is true")
public class UserDistributeView {
	@DbField("up.id")
	private Long id;

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

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

	@DbField("ifnull(up.rate,bdc.rate)")
	private Integer rate;

	@DbField("gd.type")
	private Integer type;

	/**
	 * 默认选择一个分类
	 */
	@DbField("select gc.name from goods_don_category_relate gcr inner join goods_don_category gc on gc.id = gcr.category where gcr.goods_id = gd.id order by gc.id limit 1")
	private String categoryName;

	@DbField("ifnull(up.second_rate,bdc.second_rate)")
	private Integer secondRate;
}
