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.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;

/*
 *项目名: netflix
 *文件名: ExcelRealGoodsOrderData
 *创建者: JavaZou
 *创建时间:2023/3/8 12:01
 */
@Getter
@Setter
@SearchBean(tables = "order_don o left join goods_don_sku sku on o.sku_id = sku.id " +
		"left join goods_don g on g.id = sku.goods_id " +
		"left join user u on o.user_id = u.id " +
		"left join groups_relation gr on gr.id = o.relation_id " +
		"left join channel_popularize cp on o.popularize_id = cp.id " +
		"left join channel c on c.id = cp.channel_id " +
		"left join order_don_transport odt on odt.order_id = o.id")
public class ExcelRealGoodsOrderData {

	@DbField("c.id")
	@ExcelIgnore
	private Long channelId;

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

	@DbField("gr.groups_id")
	@ExcelIgnore
	private Long groupsId;

	@DbField("gr.account")
	@ExcelIgnore
	private String account;

	@DbField("g.type")
	@ExcelIgnore
	private Integer goodsDonType;

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

	@DbField("o.order_no")
	@ExcelIgnore
	private String orderNo;

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

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

	@DbField("u.id")
	@ExcelIgnore
	private Long userId;

	@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("o.status")
	@ExcelIgnore
	private OrderDon.Status status;

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

	@DbField("o.order_type")
	@ExcelIgnore
	private Integer orderType;

	@DbField("o.num")
	@ExcelIgnore
	private Integer num;

	@DbField("o.created_time")
	@ExcelIgnore
	private Date createdTime;

	@DbField("o.ex_code")
	@ExcelIgnore
	private String exCode;

	/**
	 * 收货人
	 */
	@ExcelProperty("*收件人姓名")
	@DbField("odt.receiver")
	private String receiver;

	/**
	 * 手机号
	 */
	@ExcelProperty("*收件人电话")
	@DbField("odt.phone")
	private String phone;

	/**
	 * 省份
	 */
	@ExcelProperty("*收件人地址")
	@DbField("concat(odt.province,odt.city,odt.district,odt.address)")
	private String address;

	@ExcelProperty("公司名称")
	private String company;

	@ExcelProperty("物品名称")
	private String realGoodName;

	@ExcelProperty("重量（kg）")
	private BigDecimal weight;

	@ExcelProperty("付款方式")
	private String payType;

	@ExcelProperty("月结卡号")
	private String monthCardNo;

	@ExcelProperty("代收卡号")
	private String toMoneyCardNumber;

	@ExcelProperty("代收金额")
	private String toMoney;

	@ExcelProperty("备注")
	private String remark;
}
