package com.cyksj.model.views;

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

/**
 * 项目名: yhlxj2
 * 文件名: CategoryGoodsCascadeView
 * 创建者: JavaZou
 * 创建时间:2025/3/14 14:37
 */
@Getter
@Setter
@SearchBean(tables = "goods_don g inner join goods_don_category_relate gcr on gcr.goods_id = g.id" +
		" inner join goods_don_category gc on gc.id = gcr.category",
		where = "g.status is true",
		orderBy = "gc.id,g.id")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CategoryGoodsCascadeView {
	@DbField("gc.id")
	private Long category;

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

	@DbIgnore
	private String label;

	@DbIgnore
	private String value;

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

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

	@DbIgnore
	private List<ChildGoods> children;

	@Getter
	@Setter
	@JsonInclude(JsonInclude.Include.NON_NULL)
	public static class ChildGoods {
		private Long goodsId;

		private String title;

		private String label;

		private Long value;
	}
}
