package com.willalp.canteen.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.willalp.common.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.HashMap;
import java.util.Map;

/**
 * 用户购物车对象 hs_user_shop_car
 *
 * @author willalp
 * @date 2022-12-15
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HsUserShopCar {
    private static final long serialVersionUID = 1L;

    /** 主键 */
    @TableId
    private String id;
    /** 用户编码 */
    @Excel(name = "用户编码")
    private String userCode;
    /** 购物车数据 */
    @Excel(name = "购物车数据")
    private String jsonData;

    /**
     * 请求参数
     */
    @TableField(exist = false)
    private Map<String, Object> params;

    public Map<String, Object> getParams() {
        if (params == null) {
            params = new HashMap<>();
        }
        return params;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userCode", getUserCode())
            .append("jsonData", getJsonData())
        .toString();
    }
}
