package com.ssj.bean.sys.organization.domain;

import com.ssj.bean.common.framework.core.domain.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/** 
 * @author  ZhangCaibao 
 * @version 2017年4月14日 下午2:32:48 
 * 类说明  组织架构表
 */
@Entity
@Table(name = "sys_organization")
public class Organization extends BaseEntity {
   
	/**
	 * 
	 */
	private static final long serialVersionUID = -3917122416059361245L;
	/**
	 * 编号  gz-001
	 */
	private String code;
	/**
	 * 名称
	 */
	private String name;
	/**
	 * 父ID
	 */
	private String pId;
	/**
	 * 城市
	 */
	private String city;
	/**
	 * 地区
	 */
	private String area;
	/**
	 * 排序
	 */
	private Integer sortNo;
	/**
	 * 1 显示 2删除
	 */
	private Integer status;
	/**
	 * 创建时间
	 */
	private Date createTime;
	
	private int subCount;// 子节点数量
	
	private boolean isParent;//是否存在父节点,不持久化
	
	private Integer orgLevel;
	
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String getpId() {
		return pId;
	}
	public void setpId(String pId) {
		this.pId = pId;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	@Column(updatable = false) 
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public String getArea() {
		return area;
	}
	public void setArea(String area) {
		this.area = area;
	}
	public Integer getSortNo() {
		return sortNo;
	}
	public void setSortNo(Integer sortNo) {
		this.sortNo = sortNo;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	 @Transient
	 public boolean getIsParent() {
        if (isParent == true) {
            return true;
        } else {
            return subCount > 0;
        }
    }
    public void setIsParent(boolean isParent) {
        this.isParent = isParent;
    }
	public int getSubCount() {
		return subCount;
	}
	public void setSubCount(int subCount) {
		this.subCount = subCount;
	}
	public Integer getOrgLevel() {
		return orgLevel;
	}
	public void setOrgLevel(Integer orgLevel) {
		this.orgLevel = orgLevel;
	}
	
	
	
	
}
