All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.invms.x.entities.basis.BaseCodedEntity Maven / Gradle / Ivy

The newest version!
package com.invms.x.entities.basis;

import javax.persistence.Column;
import javax.persistence.Lob;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import com.invms.x.entities.ICodedEntity;
import com.invms.x.filters.FieldFilter;
import com.invms.x.repositories.EntityRepository;
import com.invms.x.utils.ComUtils;
import com.invms.x.utils.XUtils;

@FieldFilter(markOnly = true)
@MappedSuperclass
public abstract class BaseCodedEntity extends BaseMarkedEntity implements ICodedEntity {
	@Transient
	protected String text;

	@FieldFilter(classNeed = "ICodedEntity", code = "{entityCode}_code", name = "{entityName}代码", uniqued = true, required = true, dataType = FieldFilter.DATA_TYPE_STRING, queryEnable = true, queryVisible = true, listEnable = true, listVisible = true, sortEnable = true, detailEnable = true, insertEnable = true, updateEnable = true, inputEnable = true, outputEnable = true, sortIndex = 2, parentCode = "{entityCode}")
	@Column(name = "c_code", length = 64)
	protected String code;

	@FieldFilter(classNeed = "ICodedEntity", code = "{entityCode}_name", name = "{entityName}名称", dataType = FieldFilter.DATA_TYPE_STRING, queryEnable = true, queryVisible = true, listEnable = true, listVisible = true, sortEnable = true, detailEnable = true, insertEnable = true, updateEnable = true, inputEnable = true, outputEnable = true, sortIndex = 3, parentCode = "{entityCode}")
	@Column(name = "c_name", length = 128)
	protected String name;

	@FieldFilter(classNeed = "ICodedEntity", code = "{entityCode}_category", name = "{entityName}类别", dataType = FieldFilter.DATA_TYPE_STRING, queryEnable = true, listEnable = true, sortEnable = true, detailEnable = true, insertEnable = true, updateEnable = true, inputEnable = true, outputEnable = true, optionValueMethod = "getCategoryValues", sortIndex = 4, parentCode = "{entityCode}")
	@Column(name = "c_category", length = 32)
	protected String category;

	@FieldFilter(classNeed = "ICodedEntity", code = "{entityCode}_remark", name = "{entityName}备注", dataType = FieldFilter.DATA_TYPE_MULTISTRING, queryEnable = true, listEnable = true, sortEnable = true, detailEnable = true, insertEnable = true, updateEnable = true, inputEnable = true, outputEnable = true, sortIndex = 93, parentCode = "{entityCode}")
	@Lob
	@Column(name = "c_remark", length = 1024)
	protected String remark;

	@Override
	public String getText() {
		return ComUtils.getNotEmpty(text, name, code);
	}

	@Override
	public void setText(String text) {
		this.text = text;
	}

	@Override
	public String getCode() {
		return code;
	}

	@Override
	public void setCode(String code) throws Exception {
		if (verifyEnable) {
			EntityRepository entityRepository = XUtils.getBean(EntityRepository.class);
			entityRepository.verifyFieldValue(this, "code", getCode(), code, null);
		}
		this.code = code;
	}

	@Override
	public String getName() {
		return name;
	}

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

	@Override
	public String getCategory() {
		return category;
	}

	@Override
	public void setCategory(String category) {
		this.category = category;
	}

	@Override
	public String getRemark() {
		return remark;
	}

	@Override
	public void setRemark(String remark) {
		this.remark = remark;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy