package com.cyksj.model.excel;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/*
 *项目名: netflix
 *文件名: ExcelExchangeCodeData
 *创建者: JavaZou
 *创建时间:2022/11/7 16:44
 */
@Getter
@Setter
@SearchBean(tables = "exchange_code ec left join user u on u.id = ec.user_id" +
		" left join goods_don gd on ec.goods_id = gd.id" +
		" left join goods_don_sku gdk on gdk.id = ec.sku_id")
public class ExcelExchangeCodeData {

	/**
	 * 生成日期
	 */
	@ExcelProperty("生成日期")
	@DbField("ec.created_time")
	private Date createdTime;

	@ExcelProperty("兑换码")
	@DbField("ec.code")
	private String code;

	@ExcelIgnore
	@DbField("ec.goods_id")
	private Long goodsId;

	/**
	 * 平台名称
	 */
	@ExcelProperty("平台")
	@DbField("gd.title")
	private String title;

	/**
	 * 规格名称,金额
	 */
	@ExcelProperty("规格名称")
	@DbField("concat(gdk.spec_val,'',cast(gdk.price/100 as decimal(10,2)))")
	private String specVal;

	/**
	 * 使用状态str
	 */
	@ExcelProperty("使用状态")
	@DbField("if(ec.use_status,'已使用','未使用')")
	@TableField(exist = false)
	private String useStatusStr;

	/**
	 * 使用状态
	 */
	@DbField("ec.use_status")
	@ExcelIgnore
	private Boolean useStatus;

	/**
	 * 使用时间
	 */
	@ExcelProperty("使用时间")
	@DbField("ec.use_time")
	private Date useTime;

	/**
	 * 使用用户
	 */
	@ExcelProperty("使用用户")
	@DbField("u.nickname")
	private String nickName;

	/**
	 * 用户id
	 */
	@ExcelProperty("用户id")
	@DbField("u.id")
	private Long userId;
}
