package com.hotent.uc.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hotent.uc.api.constant.GroupStructEnum;
import com.hotent.uc.api.constant.GroupTypeConstant;
import com.hotent.uc.api.model.IGroup;
import com.hotent.uc.api.model.IdentityType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang.builder.ToStringBuilder;

import java.util.Map;




/**
 *
 * <pre> 
 * 描述：组织架构 实体对象
 * 构建组：eip平台-bpmx-platform
 * 作者:ray
 * 邮箱:zhangyg@jee-soft.cn
 * 日期:2016-06-28 15:13:03
 * 版权：广州宏天软件有限公司
 * </pre>
 */
@TableName("UC_ORG")
@ApiModel(description="组织架构 ")
public class Org extends UcBaseModel<Org>  implements IGroup{
	//组织类型(0:组织 1:部门 2:关联组织 3:虚拟组织)
	public static final Integer ORG_TYPE_ORG = 0;
	public static final Integer ORG_TYPE_DEP = 1;
	public static final Integer ORG_TYPE_ORG_REL = 2;
	public static final Integer ORG_TYPE_ORG_VIRTU = 3;

	//对接外部系统（0=不对接1=钉钉2=微信）
	public static final String ORG_SYN_TYPE_0 = "0";
	public static final String ORG_SYN_TYPE_1 = "1";
	public static final String ORG_SYN_TYPE_2 = "2";
    //对接方向（0=系统向外部1=外部向系统）
	public static final String ORG_SYN_DIR_0 = "0";
	public static final String ORG_SYN_DIR_1 = "1";
	/**
	 *
	 */
	private static final long serialVersionUID = 7138977532880036358L;

	/**
	 * 主键
	 */
	@TableId("ID_")
	@ApiModelProperty(name="id",notes="组织id")
	protected String id;

	/**
	 * name_
	 */
	@TableField("NAME_")
	@ApiModelProperty(name="name",notes="组织名称")
	protected String name;

	/**
	 * prent_id_
	 */
	@TableField("PARENT_ID_")
	@ApiModelProperty(name="parentId",notes="组织父节点id")
	protected String parentId;

	/**
	 * code_
	 */
	@TableField("CODE_")
	@ApiModelProperty(name="code",notes="组织编码")
	protected String code;

	/**
	 * 级别
	 */
	@TableField("GRADE_")
	@ApiModelProperty(name="grade",notes="组织级别")
	protected String grade;

	/**
	 * 维度Id
	 */
	@TableField("DEM_ID_")
	@ApiModelProperty(name="demId",notes="维度id")
	protected String demId;

	@TableField("ORDER_NO_")
	@ApiModelProperty(name="orderNo",notes="序号")
	protected Long orderNo;

	/**
	 * 上级组织名称
	 */
	@TableField(exist=false)
	@ApiModelProperty(name="parentOrgName",notes="上级组织名称")
	protected  String parentOrgName;


	@TableField("SUPERIOR_ORG_ID_")
	@ApiModelProperty(name="superiorOrgId",notes="所属组织id")
	protected String superiorOrgId;

	//所属组织名称
	@TableField(exist=false)
	@ApiModelProperty(name="superiorOrg",notes="所属组织")
	protected Org superiorOrg;

	@TableField("SUPERIOR_DEP_ID_")
	@ApiModelProperty(name="superiorDepId",notes="所属部门id")
	protected String superiorDepId;

	//所属部门名称
	@TableField(exist=false)
	@ApiModelProperty(name="superiorDep",notes="所属部门")
	protected Org superiorDep;

	/**
	 * 是否主组织。
	 */
	@TableField(exist=false)
	@ApiModelProperty(name="isMaster",notes="是否主组织")
	private int isMaster=0;

	/**
	 /**
	 * 路径
	 */
	@TableField("PATH_")
	@ApiModelProperty(name="path",notes="路径")
	protected String path;

	/**
	 * 组织路径名
	 */
	@TableField("PATH_NAME_")
	@ApiModelProperty(name="pathName",notes="组织路径名")
	protected String pathName;
	/**
	 * 是否有子节点   否0  是1  
	 */
	@TableField(exist=false)
	@ApiModelProperty(name="isIsParent",notes="是否有子节点   否0  是1")
	protected int isIsParent = 0;

	/**
	 * 组织参数
	 */
	@TableField(exist=false)
	@ApiModelProperty(name="params",notes="组织参数（获取单个组织时才会有值）")
	protected Map<String,Object> params;

	/**
	 * 维度名称
	 */
	@TableField(exist=false)
	@ApiModelProperty(name="demName",notes="所属维度")
	protected String demName;

	@TableField(exist=false)
	@ApiModelProperty(name = "demCode")
	protected String demCode;



	/**
	 * OA关联ID
	 */
	@TableField(exist=false)
	@ApiModelProperty(name="refId",notes="OA关联ID")
	protected String refId;

	/**
	 * 组织用户关联id
	 */
	@TableField(exist=false)
	@ApiModelProperty(name="orgUserId",notes="组织用户关联id")
	protected String orgUserId;


	@TableField("LIMIT_NUM_")
	@ApiModelProperty(name="limitNum",notes="组织限编用户数量(0:不受限制)")
	protected Integer limitNum=0;


	@TableField("NOW_NUM_")
	@ApiModelProperty(name="nowNum",notes="组织现编用户数量")
	protected Integer nowNum;


	@TableField("EXCEED_LIMIT_NUM_")
	@ApiModelProperty(name="exceedLimitNum",notes="是否允许超过限编(0:允许；1:不允许)")
	protected Integer exceedLimitNum=0;

	@TableField("ORG_TYPE_")
	@ApiModelProperty(name="orgType", notes="组织类型(0:组织 1:部门 2:关联组织 3:虚拟组织)")
	protected Integer orgType=0;

	/**
	 * 是否是叶子节点  true 是  false 不是  
	 */
	@TableField(exist=false)
	@ApiModelProperty(name="isLeaf",notes="是否是叶子节点  true 是  false 不是 ")
	protected boolean isLeaf = false;


	@TableField(exist = false)
	@ApiModelProperty(name = "isInherit", notes = "组织权限能否继承 0 不可用 1 可以")
	protected Integer isInherit;

	@TableField("JOIN_EXT_SYSTEM_TYPE_")
	@ApiModelProperty(name="joinExtSystemType",notes="集成的外部系统（0=无，1=钉钉2=企业微信）")
	protected String joinExtSystemType;

	@TableField("JOIN_EXT_SYSTEM_SYNDIR_")
	@ApiModelProperty(name="joinExtSystemSyndir",notes="同步方向0=向第三方系统同步 ，1=第三方系统向中台同步")
	protected String joinExtSystemSyndir;

	@TableField(exist = false)
	@ApiModelProperty(name = "extSetting", notes = "是否有外部系统配置 0=无1=有")
	protected String extSetting;

	@TableField("DATA_SCOPE")
	@ApiModelProperty(name="dataScope",notes="人员（数据）级别0：省，1：市，2：区（县）")
	private Integer dataScope;

	@ApiModelProperty(value = "所属省")
	@TableField("PROVINCE_CODE")
	private String provinceCode;

	@ApiModelProperty(value = "所属市")
	@TableField("CITY_CODE")
	private String cityCode;

	@ApiModelProperty(value = "所属区、县")
	@TableField("COUNTY_CODE")
	private String countyCode;

	public String getExtSetting() {
		return extSetting;
	}

	public void setExtSetting(String extSetting) {
		this.extSetting = extSetting;
	}

	public String getJoinExtSystemType() {
		return joinExtSystemType;
	}

	public void setJoinExtSystemType(String joinExtSystemType) {
		this.joinExtSystemType = joinExtSystemType;
	}

	public String getJoinExtSystemSyndir() {
		return joinExtSystemSyndir;
	}

	public void setJoinExtSystemSyndir(String joinExtSystemSyndir) {
		this.joinExtSystemSyndir = joinExtSystemSyndir;
	}




	public Integer getIsInherit() {
		return isInherit;
	}

	public void setIsInherit(Integer isInherit) {
		this.isInherit = isInherit;
	}

	public Integer getExceedLimitNum() {
		return exceedLimitNum;
	}

	public void setExceedLimitNum(Integer exceedLimitNum) {
		this.exceedLimitNum = exceedLimitNum;
	}

	public Integer getLimitNum() {
		return limitNum;
	}

	public void setLimitNum(Integer limitNum) {
		this.limitNum = limitNum;
	}

	public Integer getNowNum() {
		return nowNum;
	}

	public void setNowNum(Integer nowNum) {
		this.nowNum = nowNum;
	}

	public String getOrgUserId() {
		return orgUserId;
	}

	public void setOrgUserId(String orgUserId) {
		this.orgUserId = orgUserId;
	}

	public String getPathName() {
		return pathName;
	}

	public boolean isIsParent() {
		return isIsParent==1;
	}

	public void setIsParent(int isIsParent) {
		this.isIsParent = isIsParent;
	}

	public void setPathName(String pathName) {
		this.pathName = pathName;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public void setParentOrgName(String parentOrgName) {
		this.parentOrgName = parentOrgName;
	}

	/**
	 * 返回 主键
	 * @return
	 */
	public String getParentOrgName() {
		return this.parentOrgName;
	}

	public void setOrderNo(Long orderNo) {
		this.orderNo = orderNo;
	}


	public void setId(String id) {
		this.id = id;
	}

	/**
	 * 返回 主键
	 * @return
	 */
	public String getId() {
		return this.id;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 返回 name_
	 * @return
	 */
	public String getName() {
		return this.name;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	/**
	 * 返回 prent_id_
	 * @return
	 */
	public String getParentId() {
		return this.parentId;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDemId() {
		return demId;
	}

	public void setDemId(String demId) {
		this.demId = demId;
	}

	/**
	 * 返回 code_
	 * @return
	 */
	public String getCode() {
		return this.code;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}

	/**
	 * 返回 级别
	 * @return
	 */
	public String getGrade() {
		return this.grade;
	}
	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this)
				.append("id", this.id)
				.append("name", this.name)
				.append("parentId", this.parentId)
				.append("code", this.code)
				.append("grade", this.grade)
				.append("demId",this.demId)
				.append("path",this.path)
				.append("pathName",this.pathName)
				.append("isDelete",this.isDelete)
				.append("version",this.version)
				.toString();
	}

	public String getGroupId() {
		return this.id;
	}

	public String getGroupCode() {
		return this.code;
	}

	public Long getOrderNo() {

		return this.orderNo;
	}

	public String getPath() {
		return this.path;
	}

	public int getIsMaster() {
		return isMaster;
	}

	public void setIsMaster(int isMaster) {
		this.isMaster = isMaster;
	}

	public Map<String, Object> getParams() {
		return params;
	}

	public void setParams(Map<String, Object> params) {
		this.params = params;
	}

	public String getDemName() {
		return demName;
	}

	public void setDemName(String demName) {
		this.demName = demName;
	}

	public String getRefId() {
		return refId;
	}

	public void setRefId(String refId) {
		this.refId = refId;
	}

	@Override
	public String getIdentityType() {
		return IdentityType.GROUP;
	}

	@Override
	public String getGroupType() {
		return GroupTypeConstant.ORG.key();
	}

	@Override
	public GroupStructEnum getStruct() {
		return null;
	}

	public String getDemCode() {
		return demCode;
	}

	public void setDemCode(String demCode) {
		this.demCode = demCode;
	}

	public boolean isLeaf() {
		return this.isIsParent==0;
	}

	public void setLeaf(boolean isLeaf) {
		this.isLeaf = isLeaf;
	}

	public Integer getOrgType() {
		return orgType;
	}

	public void setOrgType(Integer orgType) {
		this.orgType = orgType;
	}

	public String getSuperiorOrgId() {
		return superiorOrgId;
	}

	public void setSuperiorOrgId(String superiorOrgId) {
		this.superiorOrgId = superiorOrgId;
	}

	public String getSuperiorDepId() {
		return superiorDepId;
	}

	public void setSuperiorDepId(String superiorDepId) {
		this.superiorDepId = superiorDepId;
	}

	public Org getSuperiorOrg() {
		return superiorOrg;
	}

	public void setSuperiorOrg(Org superiorOrg) {
		this.superiorOrg = superiorOrg;
	}

	public Org getSuperiorDep() {
		return superiorDep;
	}

	public void setSuperiorDep(Org superiorDep) {
		this.superiorDep = superiorDep;
	}

	public Integer getDataScope() {
		return dataScope;
	}

	public void setDataScope(Integer dataScope) {
		this.dataScope = dataScope;
	}

	public int getIsIsParent() {
		return isIsParent;
	}

	public void setIsIsParent(int isIsParent) {
		this.isIsParent = isIsParent;
	}

	public String getProvinceCode() {
		return provinceCode;
	}

	public void setProvinceCode(String provinceCode) {
		this.provinceCode = provinceCode;
	}

	public String getCityCode() {
		return cityCode;
	}

	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	}

	public String getCountyCode() {
		return countyCode;
	}

	public void setCountyCode(String countyCode) {
		this.countyCode = countyCode;
	}
}