package com.cyksj.model.views;

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;

/**
 * 项目名: yhlxj2
 * 文件名: OrderDonUserRefundDetailView
 * 创建者: JavaZou
 * 创建时间:2024/7/2 10:05
 */
@Getter
@Setter
@SearchBean(tables = "order_don",
		where = "status not in ('close','noPayment') :uid:")
public class OrderDonUserRefundDetailView {
	@DbField("count(1)")
	private Integer orders;

	@DbField("count(if(status = 'refund',1,NULL))")
	private Integer refundOrders;


	@Getter
	@Setter
	@SearchBean(tables = "order_don o left join goods_don g on g.id = o.goods_id" +
			" left join goods_don_sku sku on sku.id = o.sku_id")
	public static class OrderDonDetailView {
		@DbField("o.user_id")
		private Long userId;

		@DbField("o.goods_id")
		private Long goodsId;

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

		@DbField("sku.spec_val")
		private String specVal;

		@DbField("o.sku_id")
		private Long skuId;

		@DbField("ifnull(o.pay_time,o.created_time)")
		private Date payTime;

		@DbField("o.status")
		private OrderDon.Status status;

		@DbField("o.money")
		private BigDecimal money;
	}
}
