package com.cyksj.model.views;

import com.cyksj.model.entity.GoodsDon;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.List;

/**
 * 项目名: yhlxj2
 * 文件名: YhShopGoodsFrontCategoryView
 * 创建者: JavaZou
 * 创建时间:2023/10/12 14:44
 */
@Getter
@Setter
@SearchBean(tables = "(select ys.goods_id,min(ys.price) as price from yh_shop_goods_sku ys left join goods_don_sku sku on sku.id = ys.sku_id where sku.status is true and ys.status is true and ys.deleted is true :yhsId: group by ys.goods_id) yg" +
		" inner join goods_don g on g.id = yg.goods_id" +
		" left join goods_don_category_relate gcr on gcr.goods_id = g.id",
		where = "g.deleted is true and g.status is true and g.is_distribute is true :condition:",
		orderBy = "gcr.sorted asc, g.id")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class YhShopGoodsFrontCategoryView {
	@DbField("g.id")
	private Long id;

	/**
	 * 商品名称
	 */
	@DbField("g.title")
	private String title;

	/**
	 * 标签
	 */
	@DbField("g.tags")
	private String tags;

	/**
	 * 缩略图
	 */
	@DbField("g.logo")
	private String logo;

	/**
	 * 背景图
	 */
	@DbField("g.img")
	private String img;

	/**
	 * 类型
	 */
	@DbField("g.type")
	private Integer type;

	/**
	 * 分类
	 * 1、AI  2、流媒体
	 */
	@DbField("gcr.category")
	private Long category;

	@DbField("g.second_type")
	private Integer secondType;

	@DbField("g.special_type")
	private GoodsDon.SpecialType specialType;

	/**
	 * 店铺最低规格价格
	 */
	@DbIgnore
	private Long skuId;

	/**
	 * 店铺最低规格价格
	 */
	@DbIgnore
	private BigDecimal price;

	/**
	 * 最低规格月份
	 */
	@DbField("g.min_months")
	private Integer months;

	/**
	 * 最低规格天数
	 */
	@DbField("g.min_days")
	private Integer days;

	/**
	 * 已售
	 */
	@DbField("g.virtual_sold")
	private Integer sold;

	@DbIgnore
	private BigDecimal specificPrice;

	@DbIgnore
	private Long specificSkuId;

	@DbField("g.pay_desc")
	private String payDesc;

	/**
	 * 是否是特定价格平台
	 */
	@DbField("g.is_sp")
	private Boolean isSp;

	/**
	 * 购买通知信息
	 */
	@DbIgnore
	private String notifyMsg;

	@DbIgnore
	private List<YhShopGoodsSkuFrontView> skuList;

	@DbIgnore
	private GoodsDonSpecFrontView specs;

	@DbIgnore
	private OrderCommentFrontView comments;
}
