package com.bohuikeji.delivery.backstage.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.bohuikeji.frame.module.admin.annotation.TableKeyField;
import com.bohuikeji.frame.module.admin.annotation.TableQueryField;
import com.bohuikeji.frame.module.admin.constant.RegEx;
import com.bohuikeji.frame.module.admin.entity.TFranchiseeInformation;
import com.bohuikeji.frame.module.admin.entity.vo.AddressVo;
import com.bohuikeji.frame.module.admin.entity.web.block.FileBlock;
import com.bohuikeji.frame.module.admin.enums.ColumnTypeEnum;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.time.LocalDate;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import com.bohuikeji.frame.module.admin.annotation.TableShowField;
import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import com.bohuikeji.frame.module.admin.entity.web.block.DateBlock;
import com.bohuikeji.frame.module.admin.entity.web.block.SelectBlock;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Qualifier;

/**
 * <p>
 * 门店信息表
 * </p>
 *
 * @author 10552
 * @since 2019-08-22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="TStoreInformation对象", description="门店信息表")
@TableName("t_store_information")
public class TStoreInformation extends EntityBase<TStoreInformation> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "store_id", type = IdType.AUTO)
    @TableShowField(value = "ID",id = true)
    @TableNewField(show = false)
    private Integer storeId;

    @ApiModelProperty(value = "门店名称")
    @TableField("store_name")
    @TableQueryField
    @TableShowField(value = "门店名称")
    @TableNewField(block = SelectBlock.class)
    private String storeName;

    @ApiModelProperty(value = "门店牌匾名称")
    @TableField("store_plaque_name")
    @TableShowField(value = "门店牌匾名称",show = false)
    @TableNewField
    @TableQueryField
    private String storePlaqueName;

    @ApiModelProperty(value = "门店地址")
    @TableField("store_address")
    @TableShowField(value = "门店地址")
    @TableNewField
    private AddressVo storeAddress;

    @ApiModelProperty(value = "门店面积")
    @TableField("store_area")
    @TableShowField("门店面积")
    @TableNewField
    private Double storeArea;

    @ApiModelProperty(value = "门店图片")
    @TableField("store_picture")
    @TableShowField(value = "门店图片",type = ColumnTypeEnum.IMAGE)
    @TableNewField(block = FileBlock.class)
    private String storePicture;

    @ApiModelProperty(value = "门店成立时间")
    @TableField("store_create_time")
    @TableShowField("门店成立时间")
    @TableQueryField(block = DateBlock.class,sort = 0)
    @TableNewField(block = DateBlock.class)
    private LocalDate storeCreateTime;

    @ApiModelProperty(value = "工作人员数量")
    @TableField("store_people_number")
    @TableShowField("工作人员数量")
    @TableNewField()
    private Integer storePeopleNumber;

    @ApiModelProperty(value = "门店负责人")
    @TableField("store_person_charge")
    @TableShowField(value = "门店负责人")
    @TableNewField()
    private String storePersonCharge;

    @ApiModelProperty(value = "负责人电话")
    @TableField("store_person_phone")
    @TableShowField(value = "负责人电话",show = false)
    @TableNewField(limit = RegEx.INTEGER)
    private String storePersonPhone;

    @ApiModelProperty(value = "门店电话")
    @TableField("store_phone")
    @TableShowField("门店电话")
    @TableNewField(limit = RegEx.INTEGER)
    private String storePhone;

    @ApiModelProperty(value = "负责人的身份证号")
    @TableField("store_person_card")
    @TableShowField(value = "负责人的身份证号",show = false)
    @TableNewField
    private String storePersonCard;

    @ApiModelProperty(value = "负责人证件照片")
    @TableField("store_person_card_url")
    @TableShowField(value = "负责人证件照片",type = ColumnTypeEnum.IMAGE)
    @TableNewField(block = FileBlock.class,required = false)
    private String storePersonCardUrl;

    @ApiModelProperty(value = "门店状态")
    @TableField("store_status")
    @TableShowField("门店状态")
    @TableNewField(block = SelectBlock.class,options = {"营业中","暂停营业"})
    @TableQueryField
    private String storeStatus;

    @ApiModelProperty(value = "所属加盟商id")
    @TableField("fran_id")
    @TableShowField("所属加盟商")
    @TableNewField(block = SelectBlock.class)
    @TableQueryField
    @TableKeyField(table = "t_franchisee_information",keyShowFields = {"fran_name"},key = TFranchiseeInformation.class)
    private Integer franId;

    /*@ApiModelProperty(value = "所属加盟商")
    @TableField(exist = false)
    @TableShowField("所属加盟商")
    @TableNewField(show = false)
    private String franName;

    public void setFranId(Integer franId) {
        this.franId = franId;
        this.franName = (String) sql().selectObj("select fran_name from t_franchisee_information where fran_id={0}",franId);
    }*/
}
