package com.cyksj.model.views;

import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;

/**
 * 项目名: yhlxj
 * 文件名: UserDistributeUnbindOrderMoneyView
 * 创建者: JavaZou
 * 创建时间:2023/12/20 17:23
 */
@Getter
@Setter
@SearchBean(tables = "user_distribute_shared_relate_unbind unb inner join order_don o on o.user_id = unb.user_id and o.created_time > unb.update_time" +
		" inner join user_distribute_shared us on us.user_id = unb.user_id" +
		" inner join user_distribute ud on ud.user_id = us.shared_id and ud.deleted = 1",
		where = "o.status not in ('close','noPayment','refund') and o.is_distribute = 0 :time:")
public class UserDistributeUnbindOrderMoneyView {


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


	@DbField("cast(sum(o.money * (select rate from user_plat_distribute_rate ur where ur.goods_id = o.goods_id and ur.distribute_id = ud.id limit 1))/10000 as decimal(10,2))")
	private BigDecimal takerMoney;
}
