package com.wzj.soopin.member.domain.bo;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wzj.soopin.member.domain.po.AccountBill;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.dromara.common.core.domain.BaseBO;

import java.math.BigDecimal;

/**
 *  账单
 *
 * @author zcc
 */
@Schema(description="账单 ")
@Data
public class AccountBillBO extends BaseBO<AccountBill> {

    private Long id;

    @Schema(description = "账户id")
    private Long accountId;
    @Schema(description ="余额")
    private BigDecimal moneyBalance;


    @Schema(description ="变动前余额")
    private BigDecimal beforeBalance;

    @Schema(description ="变动后余额")
    private BigDecimal afterBalance;


    @Schema(description ="变动金额")
    private BigDecimal changeAmount;

    @Schema(description ="变动类型")
    private Integer changeType;

    @Schema(description ="变动描述")
    private String changeDesc;

    @Schema(description ="来源")
    private Integer source;

    @Override
    public LambdaQueryWrapper<AccountBill> toWrapper() {
        return super.toWrapper()
            .eq(getChangeType()  != null, AccountBill::getChangeType,changeType)
            .eq(getAccountId()  != null, AccountBill::getAccountId,accountId)
            .eq(getSource()  != null, AccountBill::getSource,source);
    }

}
