-----------------基类-------------------------------
/**
* @className:com.jubangit.ebusiness.database.BasicEntityInterface
* @description:TODO
* @author:admin
*/
package com.jubangit.smartbusiness.database;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
/**
* 所有表都需要的字段,包含aguid,pguid,status,pxxh,remark
*
* @author admin
*/
@MappedSuperclass
public class BasicEntity {
public static final String ID = "aguid";
public static final String PID = "pguid";
public static final String STATUS = "status";
public static final String SERIAL_NUMBER = "pxxh";
public static final String REMARK = "remark";
public static final String TIME_UPDATE = "lastupdate";
public static final int NORMAL_FLAG = 0;
public static final int CANCEL_FLAG = 65536;
@Id
private UUID id;
@Column(name = PID)
private String pid;
@Column(name = STATUS)
protected int status;
@Column(name = SERIAL_NUMBER)
private long serialNum;
@Column(name = REMARK)
private String remark;
@Column(name = TIME_UPDATE)
protected String theLastOfUpdate;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public long getSerialNum() {
return serialNum;
}
public void setSerialNum(long serialNum) {
this.serialNum = serialNum;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
protected boolean isCanceled() {
int flag = status & CANCEL_FLAG;
return flag == CANCEL_FLAG;
}
/***
* 返回状态对应的值
*
* @author:admin
* @date:2013-8-13 下午3:00:41
*/
public String getStatusLabel() {
return "";
}
/**
* 返回在通用查询列表中显示的名称
*
* @author:admin
* @date:2013-8-13 下午3:25:20
*/
public String getLabel() {
return "";
}
/**
* 最后更新的标识
*
* @param lastUpdate
*/
public void setLastOfUpdate(String lastUpdate) {
this.theLastOfUpdate = lastUpdate;
}
public String getLastOfUpdate() {
return this.theLastOfUpdate;
}
}
------------------------子类-------------------------------------
/**
* @className:com.jubangit.ebusiness.database.entity.Areas
* @description:TODO
* @author:admin
*/
package com.jubangit.smartbusiness.database.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import com.jubangit.smartbusiness.database.BasicEntity;
/**
* 地区资料
*
* @author admin
*/
@Entity(name=Areas.TABLE_NAME)
public class Areas extends BasicEntity {
public final static String TABLE_NAME = "pubarea";
public final static String NAME = "aname";
public final static String LEVEL = "lvl";
@Column(name = NAME)
private String name;
@Column(name = LEVEL)
private String level;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public Areas() {
super();
}
@Override
public String getLabel() {
return name;
}
}