package com.pj.tb_purchaser_address;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * Model: tb_purchaser_address -- 收购商个人地址管理表
 *
 * @author qzy
 */
@Data
@Accessors(chain = true)
@TableName(TbPurchaserAddress.TABLE_NAME)
@EqualsAndHashCode(callSuper = false)
public class TbPurchaserAddress extends Model<TbPurchaserAddress> implements Serializable {

    // ---------- 模块常量 ----------
    /**
     * 序列化版本id
     */
    private static final long serialVersionUID = 1L;
    /**
     * 此模块对应的表名
     */
    public static final String TABLE_NAME = "tb_purchaser_address";
    /**
     * 此模块对应的权限码
     */
    public static final String PERMISSION_CODE = "tb-purchaser-address";
    public static final String PERMISSION_CODE_ADD = "tb-purchaser-address-add";
    public static final String PERMISSION_CODE_EDIT = "tb-purchaser-address-edit";
    public static final String PERMISSION_CODE_DEL = "tb-purchaser-address-del";


    // ---------- 表中字段 ----------
    /**
     * 收购商地址表主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 该地址拥有者主键
     */
    private Long userId;

    /**
     * 收件人姓名
     */
    @NotBlank(message = "收件人不能为空")
    private String name;

    /**
     * 收件人电话
     */
    @Pattern(regexp = "^1[0-9]{10}$", message = "手机号不合法")
    private String phone;

    /**
     * 省
     */
    private String province;

    /**
     * 市
     */
    private String city;

    /**
     * 区
     */
    @NotBlank(message = "省市区不能为空")
    private String area;

    /**
     * 详细地址
     */
    @NotBlank(message = "详细地址不能为空")
    private String street;


}
