package com.gxwebsoft.shop.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * 机构
 *
 * @author LX
 * @since 2025-04-14 00:35:34
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class UnionSubOrderItem implements Serializable {
    //子商户号
    public String mid;
    //子商户分账金额
    public int totalAmount;

    String toJson() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (this.mid != null) {
            sb.append("\"mid\":\"" + this.mid + "\",");
        }
        if (this.totalAmount != 0) {
            sb.append("\"totalAmount\":\"" + this.totalAmount + "\",");
        }
        if (sb.charAt(sb.length() - 1) == ',')
            sb.deleteCharAt(sb.length() - 1);
        sb.append("}");
        return sb.toString();
    }

    public String toString() {
        return this.toJson();
    }
}
