package com.cyksj.model.excel;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cyksj.model.entity.GroupsTrips;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/*
 *项目名: yhlxj
 *文件名: ExcelGroupRelationData
 *创建者: JavaZou
 *创建时间:2023/9/12 18:01
 */
@Getter
@Setter
@SearchBean(tables = "groups_trips gt left join goods_don_sku sku on gt.sku_id = sku.id " +
		"left join goods_don g on g.id = sku.goods_id " +
		"left join account a on a.id = gt.account_id ")
public class ExcelGroupRelationData {

	@DbField("gt.id")
	@ExcelIgnore
	private Long groupId;

	/**
	 * 商品skuId
	 */
	@DbField("gt.sku_id")
	@ExcelIgnore
	private Long skuId;

	/**
	 * 账号id
	 */
	@DbField("gt.account_id")
	@ExcelIgnore
	private Long accountId;

	/**
	 * 账号
	 */
	@DbField("a.account")
	@ExcelProperty("账号")
	private String account;

	/**
	 * 密码
	 */
	@DbField("a.password")
	@ExcelProperty("密码")
	private String password;

	/**
	 * 商品id
	 */
	@DbField("g.id")
	@ExcelIgnore
	private Long goodsId;

	/**
	 * 标题
	 */
	@DbField("g.title")
	@ExcelProperty("平台")
	private String title;

	/**
	 * 商品规格
	 */
	@DbField("sku.spec_val")
	@ExcelProperty("规格")
	private String specVal;

	/**
	 * 车位数量
	 */
	@DbField("gt.num")
	@ExcelProperty("车位数量")
	private Integer num;

	/**
	 * 可用车位数
	 */
	@DbField("gt.available_num")
	@ExcelProperty("剩余车位")
	private Integer availableNum;

	/**
	 * 状态
	 */
	@DbField("gt.status")
	@ExcelIgnore
	private GroupsTrips.Status status;

	/**
	 * 状态
	 */
	@DbIgnore
	@ExcelProperty("状态")
	private String cnStatus;

	@DbField("a.expiry_time")
	@ExcelProperty("过期时间")
	private Date expiryTime;

	/**
	 * 创建时间
	 */
	@DbField("gt.created_time")
	@ExcelProperty("创建时间")
	private Date createdTime;

	/**
	 * 更新时间
	 */
	@DbField("gt.update_time")
	@ExcelIgnore
	private Date updateTime;

	public String getCnStatus() {
		return status.getDesc();
	}
}
