package com.cyksj.model.excel;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cyksj.model.entity.OrderDon;
import com.cyksj.model.entity.UpgradeOrderDon;
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.math.BigDecimal;
import java.util.Date;

/*
 *项目名: netflix
 *文件名: ExcelOrderDonData
 *创建者: JavaZou
 *创建时间:2022/12/29 10:25
 */
@Getter
@Setter
@SearchBean(tables = "upgrade_order_don o left join upgrade_package up on o.package_id = up.id " +
		"left join user u on o.user_id = u.id "
)
public class ExcelUpgradeOrderDonData {

	@DbField("o.id")
	@ExcelIgnore
	private Long id;

	@DbField("o.relation_id")
	@ExcelIgnore
	private Long relationId;

	@DbField("o.transaction_id")
	@ExcelIgnore
	private String transactionId;

	@DbField("o.order_no")
	@ExcelProperty("订单号")
	private String orderNo;

	@DbField("up.name")
	@ExcelProperty("套餐名")
	private String packageName;

	@DbField("o.money")
	@ExcelProperty("金额")
	private BigDecimal money;

	@DbField("u.id")
	@ExcelProperty("用户ID")
	private Long userId;

	@DbField("u.nickname")
	@ExcelProperty("用户名")
	private String nickname;

	@DbField("case when u.login_phone != '' then 'phone' when u.email != '' then 'email' when u.open_id != '' then 'wechat' else 'wechat' end")
	@ExcelIgnore
	private String register;

	@DbField("case when u.login_phone != '' then concat('手机号',login_phone) when u.email != '' then concat('邮箱',email) when u.open_id != '' then '微信授权' else '微信授权' end")
	@ExcelProperty("注册方式")
	private String registerStr;

	@DbField("o.status")
	@ExcelIgnore
	private UpgradeOrderDon.Status status;

	@ExcelProperty("状态")
	private String statusStr;

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

	@DbField("o.type")
	@ExcelIgnore
	private UpgradeOrderDon.Type type;

	@ExcelProperty("支付方式")
	private String typeStr;

}
