package org.jeecg.modules.system.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * <p>
 * 部门表
 * <p>
 * 
 * @Author Steve
 * @Since  2019-01-22
 */
@Data
@TableName("sys_depart")
public class SysDepart implements Serializable {
    private static final long serialVersionUID = 1L;
    
	/**ID*/
	@TableId(type = IdType.ASSIGN_ID)
	private String id;
	/**父机构ID*/
	private String parentId;
	/**父机构名称*/
	private String parentName;
	/**机构/部门名称*/
	@Excel(name="机构/部门名称",width=15)
	private String departName;

	/**机构/部门名称*/
	@Excel(name="机构/部门编码",width=15)
	private String departCode;
	/**英文名*/
	@Excel(name="英文名",width=15)
	private String departNameEn;
	/**缩写*/
	private String departNameAbbr;
	/**排序*/
	@Excel(name="排序",width=15)
	private Integer departOrder;
	/**描述*/
	@Excel(name="描述",width=15)
	private String description;
	/**机构类别 1公司，2组织机构，2岗位*/
	@Excel(name="机构类别",width=15,dicCode="org_category")
	private String orgCategory;
	/**机构类型*/
	private String orgType;
	/**机构编码*/
	@Excel(name="机构编码",width=15)
	private String orgCode;
	/**手机号*/
	@Excel(name="手机号",width=15)
	private String mobile;
	/**传真*/
	@Excel(name="传真",width=15)
	private String fax;
	/**地址*/
	@Excel(name="地址",width=15)
	private String address;
	/**备注*/
	@Excel(name="备注",width=15)
	private String memo;
	/**状态（1启用，0不启用）*/
	@Dict(dicCode = "depart_status")
	private String status;
	/**删除状态（0，正常，1已删除）*/
	@Dict(dicCode = "del_flag")
	@TableLogic
	private String delFlag;
	/**创建人*/
	private String createBy;

	/**创建日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date createTime;
	/**更新人*/
	private String updateBy;
	/**更新日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date updateTime;
	/**机构/部门简称*/
	@Excel(name = "机构/部门简称", width = 15)
	@ApiModelProperty(value = "机构/部门简称")
	private String departSimpleName;
	/**邮政编码*/
	@Excel(name = "邮政编码", width = 15)
	@ApiModelProperty(value = "邮政编码")
	private String zipCode;
	/**部门所属类别*/
	@Excel(name = "部门所属类别", width = 15)
	@ApiModelProperty(value = "部门所属类别")
	private String deptCategory;
	/**部门级别*/
	@Excel(name = "部门级别", width = 15)
	@ApiModelProperty(value = "部门级别")
	private String deptLevel;
	/**部门性质*/
	@Excel(name = "部门性质", width = 15)
	@ApiModelProperty(value = "部门性质")
	private String deptNatrue;
	/**部门类型*/
	@Excel(name = "部门类型", width = 15)
	@ApiModelProperty(value = "部门类型")
	@Dict(dicCode = "dept_type")
	private String deptType;
	/**负责人*/
	@Excel(name = "负责人", width = 15)
	@ApiModelProperty(value = "负责人")
	private String changeName;
	/**联系人*/
	@Excel(name = "联系人", width = 15)
	@ApiModelProperty(value = "联系人")
	private String contactName;
	/**部门行业*/
	@Excel(name = "部门行业", width = 15)
	@ApiModelProperty(value = "部门行业")
	private String deptTrade;
	/**统一社会信用代码*/
	@Excel(name = "统一社会信用代码", width = 15)
	@ApiModelProperty(value = "统一社会信用代码")
	private String socialCreditCode;
	/**是否法人单位*/
	@Excel(name = "是否法人单位", width = 15)
	@ApiModelProperty(value = "是否法人单位")
	@Dict(dicCode = "yn")
	private String isLegalDept;
	/**部门行使层级*/
	@Excel(name = "部门行使层级", width = 15)
	@ApiModelProperty(value = "部门行使层级")
	private String performLevel;
	/**区划编码*/
	@Excel(name = "区划编码", width = 15)
	@ApiModelProperty(value = "区划编码")
	private String areaCode;
	/**区划id*/
	@Excel(name = "区划id", width = 15)
	@ApiModelProperty(value = "区划id")
	private String areaId;
	/**区划名称*/
	@Excel(name = "区划名称", width = 15)
	@ApiModelProperty(value = "区划名称")
	private String areaName;
	/**部门所在层级(1国家，2省，3市，4县，5乡镇，6村)*/
	@Excel(name = "部门所在层级(1国家，2省，3市，4县，5乡镇，6村)", width = 15)
	@ApiModelProperty(value = "部门所在层级(1国家，2省，3市，4县，5乡镇，6村)")
	private String areaLevel;
	/**大部门名称*/
	@Excel(name = "大部门名称", width = 15)
	@ApiModelProperty(value = "大部门名称")
	private String bigDepartName;
	/**大部门编码*/
	@Excel(name = "大部门编码", width = 15)
	@ApiModelProperty(value = "大部门编码")
	private String bigDepartCode;
	/**大部门id*/
	@Excel(name = "大部门id", width = 15)
	@ApiModelProperty(value = "大部门id")
	private String bigDepartId;
	/**部门族谱id逗号拼接*/
	@Excel(name = "部门族谱id逗号拼接", width = 15)
	@ApiModelProperty(value = "部门族谱id逗号拼接")
	private String departPath;
	/**部门树层级*/
	@Excel(name = "部门树层级", width = 15)
	@ApiModelProperty(value = "部门树层级")
	private String treeLevel;
	/**是否叶子节点*/
	@Excel(name = "是否叶子节点", width = 15)
	@ApiModelProperty(value = "是否叶子节点")
	private String isLeaf;
	/**是否垂管*/
	@ApiModelProperty(value = "是否垂管")
	private Integer manubrium;

	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	@TableField(exist = false)
	private List<SysDepart> children;
	/**
	 * 重写equals方法
	 */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
			return true;
		}
        if (o == null || getClass() != o.getClass()) {
			return false;
		}
        if (!super.equals(o)) {
			return false;
		}
        SysDepart depart = (SysDepart) o;
        return Objects.equals(id, depart.id) &&
                Objects.equals(parentId, depart.parentId) &&
                Objects.equals(departName, depart.departName) &&
                Objects.equals(departNameEn, depart.departNameEn) &&
                Objects.equals(departNameAbbr, depart.departNameAbbr) &&
                Objects.equals(departOrder, depart.departOrder) &&
                Objects.equals(description, depart.description) &&
                Objects.equals(orgCategory, depart.orgCategory) &&
                Objects.equals(orgType, depart.orgType) &&
                Objects.equals(orgCode, depart.orgCode) &&
                Objects.equals(mobile, depart.mobile) &&
                Objects.equals(fax, depart.fax) &&
                Objects.equals(address, depart.address) &&
                Objects.equals(memo, depart.memo) &&
                Objects.equals(status, depart.status) &&
                Objects.equals(delFlag, depart.delFlag) &&
                Objects.equals(createBy, depart.createBy) &&
                Objects.equals(createTime, depart.createTime) &&
                Objects.equals(updateBy, depart.updateBy) &&
                Objects.equals(updateTime, depart.updateTime);
    }

    /**
     * 重写hashCode方法
     */
    @Override
    public int hashCode() {

        return Objects.hash(super.hashCode(), id, parentId, departName, 
        		departNameEn, departNameAbbr, departOrder, description,orgCategory, 
        		orgType, orgCode, mobile, fax, address, memo, status, 
        		delFlag, createBy, createTime, updateBy, updateTime);
    }
}
