package com.cyksj.model.views;

import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

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

/*
 *项目名: yhlxj
 *文件名: YhShopUserDistributeOrdersDetailView
 *创建者: JavaZou
 *创建时间:2023/9/20 11:11
 */
@Getter
@Setter
@SearchBean(tables = "(select o.id,o.user_id,o.goods_id,o.sku_id,o.money,o.refund_money,o.coupon_money,o.created_time from order_don o where :yhs_id: and o.status not in ('close','noPayment') :time:) od" +
		" left join goods_don g on g.id = od.goods_id" +
		" inner join yh_shop_distribute_waiting_send_points dp on dp.order_id = od.id")
public class YhShopUserDistributeOrdersDetailView {
	@DbField("select nickname from user where id = od.user_id limit 1")
	private String nickname;

	@JsonIgnore
	@DbField("g.id")
	private Long goodsId;

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

	@DbField("select spec_val from goods_don_sku where id = od.sku_id limit 1")
	private String specVal;

	@DbField("cast(od.money/100 as decimal(10,2))")
	private BigDecimal money;

//	@DbField("od.coupon_money")
//	private BigDecimal couponMoney;

	@DbField("TRUNCATE(dp.money/100,2)")
	private BigDecimal reMoney = BigDecimal.ZERO;

	@DbField("if(send_status = 'success',TRUNCATE(dp.refund_money/100,2),0)")
	private BigDecimal rdMoney;

	@DbField("dp.send_status")
	private String sendStatus;

	@DbField("od.created_time")
	private Date createdTime;
}
