package com.xunmei.system.api.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.xunmei.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 【请填写功能名称】对象 sys_org
 *
 * @author xunmei
 * @date 2023-08-10
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_org")
@ApiModel(value = "SysOrg对象", description = "【请填写功能名称】")
public class SysOrg extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @TableId
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @ApiModelProperty(value = "地址")
    @TableField(value = "address")
    private String address;

    @ApiModelProperty(value = "code")
    @TableField(value = "code")
    private String code;

    @ApiModelProperty(value = "guid")
    @TableField(value = "guid")
    private String guid;

    @ApiModelProperty(value = "禁用")
    @TableField(value = "is_lock")
    private Integer isLock;

    @ApiModelProperty(value = "负责人")
    @TableField(value = "manager")
    private String manager;

    @ApiModelProperty(value = "负责人电话")
    @TableField(value = "manager_phone")
    private String managerPhone;

    @ApiModelProperty(value = "nh名称")
    @TableField(value = "name")
    private String name;

    @ApiModelProperty(value = "上级nh")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField(value = "parent_id")
    private Long parentId;

    @ApiModelProperty(value = "父节点GUID")
    @TableField(value = "parent_guid")
    private String parentGuid;

    @ApiModelProperty(value = "联系电话")
    @TableField(value = "phone")
    private String phone;

    @ApiModelProperty(value = "行政区域编码")
    @TableField(value = "city_code")
    private String cityCode;

    @ApiModelProperty(value = "机构类型")
    @TableField(value = "type")
    private Integer type;

    @ApiModelProperty(value = "路径")
    @TableField(value = "path")
    private String path;

    @ApiModelProperty(value = "是否删除")
    @TableField(value = "deleted")
    private Integer deleted;

    @TableField(value = "sort")
    @ApiModelProperty(value = "排序")
    private Double sort;
    @ApiModelProperty(value = "天气城市区域编码")
    @TableField(value = "weather_city_code")
    private String weatherCityCode;

    @JsonSerialize(using = ToStringSerializer.class)
    @TableField(value = "org_extend_id")
    private Long orgExtendId;
    @ApiModelProperty(value = "机构来源, 0:系统新增 1:fjnx同步")
    @TableField(value = "source")
    private Integer source;

    /**
     * 机构简称
     */
    @ApiModelProperty(value = "机构简称")
    @TableField(value = "short_name")
    private String shortName;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @TableField(value = "remark")
    private String remark;

    /**
     * 子机构
     */
    @TableField(exist = false)
    private List<SysOrg> children = new ArrayList<SysOrg>();



    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("address", getAddress())
                .append("code", getCode())
                .append("guid", getGuid())
                .append("isLock", getIsLock())
                .append("manager", getManager())
                .append("managerPhone", getManagerPhone())
                .append("name", getName())
                .append("parentId", getParentId())
                .append("phone", getPhone())
                .append("cityCode", getCityCode())
                .append("type", getType())
                .append("createTime", getCreateTime())
                .append("updateTime", getUpdateTime())
                .append("path", getPath())
                .append("parentGuid", getParentGuid())
                .append("deleted", getDeleted())
                .append("sort", getSort())
                .append("source", getSource())
                .append("createBy", getCreateBy())
                .append("updateBy", getUpdateBy())
                .toString();
    }
}
