package com.sqx.modules.datacentre.query;

import com.sqx.common.query.PageQuery;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

import javax.validation.constraints.Pattern;

@Data
public class ShopCenterQuery extends DataCenterQuery {

    @ApiModelProperty(value = "商铺主营类型id")
    @Pattern(regexp = "^[0-9]*$", message = "商铺类型只能为数字")
    private String shopType;

    @ApiModelProperty(value = "商铺主营类型名称")
    private String shopTypeName;

    @ApiModelProperty(value = "登录人id")
    private String userId;

    public String toStrMessage() {
        StringBuilder stringBuilder=new StringBuilder();
        stringBuilder
                .append(StringUtils.hasText(getStartTime())?"开始时间："+getStartTime()+";":"")
                .append(StringUtils.hasText(getEndTime())?"结束时间："+getEndTime()+";":"")
                .append(StringUtils.hasText(shopType)?"商铺类型编号："+shopType+";":"")
                .append(StringUtils.hasText(getDate())?"日期："+getDate()+";":"")
                .append(StringUtils.hasText(getDateType())?"查询类型："+getDateType()+";":"");
        return stringBuilder.toString();
    }

    public String toStrCode() {
        return
                ","+(getStartTime()==null?"":getStartTime())
                +","+(getEndTime()==null?"":getEndTime())
                +","+(shopType==null?"":shopType)
                +","+(getDate()==null?"":getDate())
                +","+(getDateType()==null?"":getDateType())
                +",";
    }
}
