/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package cn.ysk.cashier.pojo.shop;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-02-08
**/
@Entity
@Data
@TableName("tb_merchant_account")
@Table(name="tb_merchant_account")
public class TbMerchantAccount implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "自增id")
    @TableId(type = IdType.AUTO)
    private Integer id;

    @Column(name = "`account`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "登陆帐号")
    private String account;

    @Column(name = "`password`")
    @ApiModelProperty(value = "登陆密码")
    private String password;

    @Column(name = "`merchant_id`")
    @ApiModelProperty(value = "商家Id")
    private String merchantId;

    @Column(name = "`shop_id`")
    @ApiModelProperty(value = "门店Id")
    private String shopId;

    @Column(name = "`shop_snap`")
    @ApiModelProperty(value = "shopSnap")
    private String shopSnap;

    @Column(name = "`is_admin`")
    @ApiModelProperty(value = "是否管理员")
    private Integer isAdmin;

    @Column(name = "`is_mercantile`")
    @ApiModelProperty(value = "是否商户：1商户帐号0-店铺帐号")
    private Integer isMercantile;

    @Column(name = "`name`")
    @ApiModelProperty(value = "姓名")
    private String name;

    @Column(name = "`sex`")
    @ApiModelProperty(value = "性别:0女 1 男")
    private Integer sex;

    @Column(name = "`email`")
    @ApiModelProperty(value = "邮箱")
    private String email;

    @Column(name = "`head_img`")
    @ApiModelProperty(value = "头像")
    private String headImg;

    @Column(name = "`telephone`")
    @ApiModelProperty(value = "联系电话")
    private String telephone;

    @Column(name = "`status`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "状态")
    private Integer status;

    @Column(name = "`sort`")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @Column(name = "`role_id`")
    @ApiModelProperty(value = "roleId")
    private Integer roleId;

    @Column(name = "`last_login_at`")
    @ApiModelProperty(value = "最后登陆时间")
    private Integer lastLoginAt;

    @Column(name = "`mp_open_id`")
    @ApiModelProperty(value = "公众号openId")
    private String mpOpenId;

    @Column(name = "`msg_able`")
    @ApiModelProperty(value = "是否接收消息通知")
    private Integer msgAble;

    @Column(name = "`created_at`")
    @ApiModelProperty(value = "createdAt")
    private Long createdAt;

    @Column(name = "`updated_at`")
    @ApiModelProperty(value = "updatedAt")
    private Long updatedAt;

    @Column(name = "`pwd`")
    @ApiModelProperty(value = "操作密码")
    private String pwd;

    public void copy(TbMerchantAccount source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
