package com.sqx.modules.member.query;

import cn.hutool.core.util.StrUtil;
import com.sqx.common.query.PageQuery;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 会员推广码查询参数
 * @author codingliang
 * @date 2025-11-12
 */
@Data
@ApiModel(description = "会员推广码查询参数")
public class VipPromoCodeQuery extends PageQuery {

    @ApiModelProperty(value = "会员用户名")
    private String userName;

    @ApiModelProperty(value = "推广码")
    private String promoCode;

    @ApiModelProperty(value = "推广人手机号码")
    private String phone;

    public String buildQueryConditionString() {
        StringBuilder sb = new StringBuilder();

        // 会员用户名
        if (StrUtil.isNotBlank(userName)) {
            sb.append("会员用户名:").append(userName).append(", ");
        }

        // 推广码
        if (StrUtil.isNotBlank(promoCode)) {
            sb.append("推广码:").append(promoCode).append(", ");
        }

        // 推广人手机号码
        if (StrUtil.isNotBlank(phone)) {
            sb.append("推广人手机号码:").append(phone).append(", ");
        }

        sb.append("页码:").append(getPage()).append(", ");
        sb.append("每页条数:").append(getLimit());

        return sb.toString();
    }
}
