597db52ee761295b36b9585955bcbf75db968209.svn-base 2.47 KB
/**
 * Copyright © 2015-2018 ODM All rights reserved.
 */
package com.thinkgem.jeesite.modules.reg.entity.base;

import com.fasterxml.jackson.annotation.JsonBackReference;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.TreeEntity;

/**
 * 要素代码与名称描述表Entity
 * @author xuyg
 * @version 2015-10-05
 */
public class RegBaseElementCode extends TreeEntity<RegBaseElementCode> {
	
	private static final long serialVersionUID = 1L;
	private RegBaseElementCode parent;		// 父级编号
	private String parentIds;		// 所有父级编号
	private String name;		// 代码
	private Integer sort;		// 排序
	private String elementCode;		// 要素代码
	private String elementName;		// 要素名称
	private String elementType;		// 要素类型
	
	public RegBaseElementCode() {
		super();
	}

	public RegBaseElementCode(String id){
		super(id);
	}

	@JsonBackReference
	@NotNull(message="父级编号不能为空")
	public RegBaseElementCode getParent() {
		return parent;
	}

	public void setParent(RegBaseElementCode parent) {
		this.parent = parent;
	}
	
	@Length(min=1, max=2000, message="所有父级编号长度必须介于 1 和 2000 之间")
	public String getParentIds() {
		return parentIds;
	}

	public void setParentIds(String parentIds) {
		this.parentIds = parentIds;
	}
	
	@Length(min=1, max=10, message="代码长度必须介于 1 和 10 之间")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@NotNull(message="排序不能为空")
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
	
	@Length(min=1, max=10, message="要素代码长度必须介于 1 和 10 之间")
	public String getElementCode() {
		return elementCode;
	}

	public void setElementCode(String elementCode) {
		this.elementCode = elementCode;
	}
	
	@Length(min=1, max=50, message="要素名称长度必须介于 1 和 50 之间")
	public String getElementName() {
		return elementName;
	}

	public void setElementName(String elementName) {
		this.elementName = elementName;
	}
	
	@Length(min=0, max=50, message="要素类型长度必须介于 0 和 50 之间")
	public String getElementType() {
		return elementType;
	}

	public void setElementType(String elementType) {
		this.elementType = elementType;
	}
	
	public String getParentId() {
		return parent != null && parent.getId() != null ? parent.getId() : "0";
	}
}