package com.jwipc.shopping.model.query;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.enums.SqlLike;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlUtils;
import com.jwipc.query.BasePageQuery;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 *     在线商城订单查询 实体类
 * </p>
 *
 * @author qmx
 * @version 1.0
 * @since 2021/8/13
 */
@Data
public class OnlineMallCartQuery extends BasePageQuery {
    private String sort;
    private String order;
    /**
     * 创建时间(起)
     */
    private String startCreateDate;

    /**
     * 至
     */
    private String endCreateDate;
    /**
     * 订单号
     */
    private String thirdOrder;

    /**
     * 订单cp_shopping_cart表id
     */
    private Long cartId;

    private Long userId;

    private String oaId;


    private Long id;
    private Integer deliveryStatus;
    private String deliveryStatusText;
    private String skuName;
    private BigDecimal unitCost;
    private String unit;
    private BigDecimal qty;
    private BigDecimal requireNum;
    private BigDecimal receiptNum;
    private LocalDateTime receivedTime;
    private String prCode;
    private String storeNameInfo;
    private String purchaseOrderNumber;
    private String packageId;
    private String invoiceNumber;

    private Integer invoiceState;
    private Integer invoiceType;
    private String content;
    private String centerCode;
    private String centerName;
    private String factoryCode;
    private String factoryName;
    private String purchaseOrg;
    private String pgoName;
    private String purchaseGroup;
    private String pgName;
    private Integer status;
    private String callbackDesc;
    private String provinceName;
    private String cityName;
    private String countyName;
    private String provinceCode;
    private String cityCode;
    private String countyCode;
    private String address;
    private String receivingUser;
    private String receivingTel;
    private String invoiceTitle;
    private String invoiceNo;
    private String openingBank;
    private String bankAccount;
    private String bankTel;
    private String bankAddress;
    private String orderId;
    private String storeCode;
    private String storeName;
    private Integer srmStatus;
    private Long createUserId;
    private String invoiceTel;
    private String invoiceAddress;

    private Integer oaStatus;
    private String remark;
    private String srmOrderCode;
    private String createUserName;
    private LocalDateTime createTime;
    private BigDecimal returnQuatity;
    private Integer receiptStatus;
    private String receiptStatusText;
    private String provinceCityCounty;

    public String getThirdOrderLike() {
        return StringUtils.isEmpty(this.thirdOrder) ? StrUtil.EMPTY : SqlUtils.concatLike(this.thirdOrder, SqlLike.DEFAULT);
    }


    public String getSort(){
        if(StringUtils.isNotEmpty(this.sort)){
            return StrUtil.toUnderlineCase(this.sort);
        }
        return "";
    }
}
