package com.dsk.common.core.domain.model;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.AssertFalse;
import javax.validation.constraints.NotNull;

/**
 * 企业详情供应商信息列表
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class EnterpriseSupplierPageBody extends BasePage {

    //企业Id
    @NotNull(message = "企业id不能为空")
    private Integer companyId;
    
    //是否企业首页用，首页用到缓存
    private Boolean isIndex = true;
    
    //查询关键词（供应商名）
    private String key;
    
    //排序字段
    private String orderColumn;


    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("com.dsk.common.core.domain.model.EnterpriseSupplierPageBody{");
        sb.append("companyId=").append(companyId);
        sb.append(", isIndex=").append(isIndex);
        sb.append(", key='").append(key).append('\'');
        sb.append(", orderColumn='").append(orderColumn).append('\'');
        sb.append(", pageIndex=").append(getPageIndex());
        sb.append(", pageSize=").append(getPageSize());
        sb.append('}');
        return sb.toString();
    }

    @AssertFalse(message = "企业不存在")
    public boolean isVaildCid() {
        return 0 == companyId;
    }
}
