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;

/**
 * @author chan
 * @date 2022/12/13 2:54 PM
 */
@Getter
@Setter
@SearchBean(tables = "order_don o " +
        " left join goods_don g on g.id = o.goods_id " +
        " left join order_don o1 on o1.`status` != 'close' and o.id = o1.id " +
        " left join order_don o2 on o2.`status` = 'refund' and o.id = o2.id "
        ,where = "1 = 1 :time: "
        ,groupBy = "o.goods_id,o.popularize_id"
)
public class ChannelPopularizeDetailView {

    @DbField("o.popularize_id")
    private Long popularizeId;
    /**
     * 平台名称
     */
    @DbField("g.title")
    private String goodsName;

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

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

    /**
     * 订单数
     */
    @DbField("count(o1.id)")
    private Integer orderCount;

    /**
     * 订单金额
     */
    @DbField("IFNULL(sum(o1.money),0)")
    private BigDecimal orderMoney;

    /**
     * 退款数
     */
    @DbField("count(o2.id)")
    private Integer refundCount;

    /**
     * 退款金额
     */
    @DbField("IFNULL(sum(o2.money),0)")
    private BigDecimal refundMoney;


}
