資源簡介
在實際mis項目中增刪改查必不可少,針對"改"的操作,重要的項目中都要有變更歷史記錄.本實例提供了一個實體屬性變更歷史記錄工具類,只要寫很少的代碼就能實現強大的變更歷史記錄功能.本工具類的主要優點是1.工具類對實體對象沒有依賴性,任何對象都能記錄歷史.2.只要編寫很少的代碼就能實現需求.
3.所有屬性都記錄變更歷史太多,有些屬性我不想記錄變更歷史.
4.實體屬性變化前后的值需要把編碼轉成有意義的文字.例如:實體類中性別用 0,1表示,而希望變更歷史中記錄前后變化的值是"男","女".
5.傳入實體對象自動識別實體Id,而不需要手工傳入.
6.實體的屬性名不好記,想加一個好記別名,這樣便于
代碼片段和文件信息
package?com.tgb.lk.history;
import?java.util.Date;
public?class?History?{
private?int?id;
private?String?entity;?//?實體類名標記是哪個實體類
private?String?entityId;?//?實體對象的Id
private?String?property;?//?實體的屬性名標記實體的哪個屬性發生修改
private?String?oldValue;?//?原屬性值
private?String?newValue;?//?新屬性值
private?String?user;?//?修改人
private?Date?modifyDate;?//?修改時間
private?String?desc;?//?描述
public?int?getId()?{
return?id;
}
public?void?setId(int?id)?{
this.id?=?id;
}
public?String?getEntityId()?{
return?entityId;
}
public?void?setEntityId(String?entityId)?{
this.entityId?=?entityId;
}
public?String?getEntity()?{
return?entity;
}
public?void?setEntity(String?entity)?{
this.entity?=?entity;
}
public?String?getProperty()?{
return?pro
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????301??2012-10-20?12:17??HistoryDemo\.classpath
?????文件????????387??2012-10-20?13:47??HistoryDemo\.project
?????文件????????629??2012-09-24?16:56??HistoryDemo\.settings\org.eclipse.jdt.core.prefs
?????文件???????2712??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history\History.class
?????文件???????1136??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history\HistoryTest.class
?????文件???????3017??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history\HistoryUtil.class
?????文件???????1448??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history\Student.class
?????文件???????2930??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history2\History.class
?????文件????????435??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history2\HistoryAlias.class
?????文件????????390??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history2\HistoryId.class
?????文件????????404??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history2\HistoryNotRecord.class
?????文件???????1001??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history2\HistoryTest.class
?????文件???????4646??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history2\HistoryUtil.class
?????文件???????1670??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history2\Person.class
?????文件???????1908??2012-10-20?12:54??HistoryDemo\src\com\tgb\lk\history\History.java
?????文件????????642??2012-10-20?12:49??HistoryDemo\src\com\tgb\lk\history\HistoryTest.java
?????文件???????2106??2012-10-20?12:46??HistoryDemo\src\com\tgb\lk\history\HistoryUtil.java
?????文件????????731??2012-10-16?17:58??HistoryDemo\src\com\tgb\lk\history\Student.java
?????文件???????2092??2012-10-20?13:35??HistoryDemo\src\com\tgb\lk\history2\History.java
?????文件????????319??2012-10-20?12:46??HistoryDemo\src\com\tgb\lk\history2\HistoryAlias.java
?????文件????????284??2012-10-20?12:46??HistoryDemo\src\com\tgb\lk\history2\HistoryId.java
?????文件????????291??2012-10-20?12:46??HistoryDemo\src\com\tgb\lk\history2\HistoryNotRecord.java
?????文件????????536??2012-10-20?12:49??HistoryDemo\src\com\tgb\lk\history2\HistoryTest.java
?????文件???????3556??2012-10-20?13:01??HistoryDemo\src\com\tgb\lk\history2\HistoryUtil.java
?????文件????????840??2012-10-20?12:46??HistoryDemo\src\com\tgb\lk\history2\Person.java
?????目錄??????????0??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history
?????目錄??????????0??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk\history2
?????目錄??????????0??2012-10-20?12:20??HistoryDemo\src\com\tgb\lk\history
?????目錄??????????0??2012-10-20?12:21??HistoryDemo\src\com\tgb\lk\history2
?????目錄??????????0??2012-10-20?13:47??HistoryDemo\bin\com\tgb\lk
............此處省略12個文件信息
- 上一篇:本科畢業論文--局域網組建完整開題報告PPT等
- 下一篇:UCINET中文操作教程
評論
共有 條評論