基于J2EE Struts框架的課程設(shè)計實訓(xùn)項目——BBS論壇系統(tǒng)——構(gòu)建系統(tǒng)持久層中各個實體PO類第1部分

上傳人:仙*** 文檔編號:34531069 上傳時間:2021-10-21 格式:DOC 頁數(shù):31 大?。?86.02KB
收藏 版權(quán)申訴 舉報 下載
基于J2EE Struts框架的課程設(shè)計實訓(xùn)項目——BBS論壇系統(tǒng)——構(gòu)建系統(tǒng)持久層中各個實體PO類第1部分_第1頁
第1頁 / 共31頁
基于J2EE Struts框架的課程設(shè)計實訓(xùn)項目——BBS論壇系統(tǒng)——構(gòu)建系統(tǒng)持久層中各個實體PO類第1部分_第2頁
第2頁 / 共31頁
基于J2EE Struts框架的課程設(shè)計實訓(xùn)項目——BBS論壇系統(tǒng)——構(gòu)建系統(tǒng)持久層中各個實體PO類第1部分_第3頁
第3頁 / 共31頁

下載文檔到電腦,查找使用更方便

10 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《基于J2EE Struts框架的課程設(shè)計實訓(xùn)項目——BBS論壇系統(tǒng)——構(gòu)建系統(tǒng)持久層中各個實體PO類第1部分》由會員分享,可在線閱讀,更多相關(guān)《基于J2EE Struts框架的課程設(shè)計實訓(xùn)項目——BBS論壇系統(tǒng)——構(gòu)建系統(tǒng)持久層中各個實體PO類第1部分(31頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、楊教授大學(xué)堂 精心創(chuàng)作的優(yōu)秀程序員 職業(yè)提升必讀系列資料 基于J2EE Struts框架的課程設(shè)計實訓(xùn)項目——《BBS論壇系統(tǒng)》——構(gòu)建系統(tǒng)持久層中各個實體PO類(第1/2部分) 1.1.1 構(gòu)造出本W(wǎng)eb項目中的DAO層的各個實體PO類組件 1、本項目中的各個PO的類圖 2、在數(shù)據(jù)訪問層中添加各個PO類——建立UserInfoBasePO實體類 (1)UserInfoBasePO基類,包名稱為com.px1987.webbbs.dao,并實現(xiàn)java.io.Serializable接口 (2)添加下面的各個成員屬性 private String id; priva

2、te String userName; private String userPassWord; private int userType; private String aliaoName; private String passWordAsk; private String userImage; private String registerTime; private String passWordAnswer; private String userMail; private int userSex; private String userBi

3、rthDay; private String userComeFrom; private String userResume; (3)并為這些成員屬性提供get/set方法 (4)最后產(chǎn)生出下面的代碼 package com.px1987.webbbs.dao; public class UserInfoBasePO implements java.io.Serializable { private static final long serialVersionUID = 1L; private String id; private Stri

4、ng userName; private String userPassWord; private int userType; private String aliaoName; private String passWordAsk; private String userImage; private String registerTime; private String passWordAnswer; private String userMail; private int userSex; private String userBirthDay;

5、 private String userComeFrom; private String userResume; public UserInfoBasePO() { } public String getAliaoName() { return aliaoName; } public void setAliaoName(String aliaoName) { this.aliaoName = aliaoName; } public String getId() { return id; } public void setId(Strin

6、g id) { this.id = id; } public String getPassWordAnswer() { return passWordAnswer; } public void setPassWordAnswer(String passWordAnswer) { this.passWordAnswer = passWordAnswer; } public String getPassWordAsk() { return passWordAsk; } public void setPassWordAsk(String pas

7、sWordAsk) { this.passWordAsk = passWordAsk; } public String getRegisterTime() { return registerTime; } public void setRegisterTime(String registerTime) { this.registerTime = registerTime; } public String getUserBirthDay() { return userBirthDay; } public void setUserBirthD

8、ay(String userBirthDay) { this.userBirthDay = userBirthDay; } public String getUserComeFrom() { return userComeFrom; } public void setUserComeFrom(String userComeFrom) { this.userComeFrom = userComeFrom; } public String getUserImage() { return userImage; } public void set

9、UserImage(String userImage) { this.userImage = userImage; } public String getUserMail() { return userMail; } public void setUserMail(String userMail) { this.userMail = userMail; } public String getUserName() { return userName; } public void setUserName(String userName) {

10、 this.userName = userName; } public String getUserPassWord() { return userPassWord; } public void setUserPassWord(String userPassWord) { this.userPassWord = userPassWord; } public String getUserResume() { return userResume; } public void setUserResume(String userResume) {

11、 this.userResume = userResume; } public int getUserSex() { return userSex; } public void setUserSex(int userSex) { this.userSex = userSex; } public int getUserType() { return userType; } public void setUserType(int userType) { this.userType = userType; } @Override

12、 public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((aliaoName == null) ? 0 : aliaoName.hashCode()); result = PRIME * result + ((id == null) ? 0 : id.hashCode()); result = PRIME * result + ((passWordAnswer == null) ? 0 : passWordAnswer.hashCode())

13、; result = PRIME * result + ((passWordAsk == null) ? 0 : passWordAsk.hashCode()); result = PRIME * result + ((registerTime == null) ? 0 : registerTime.hashCode()); result = PRIME * result + ((userBirthDay == null) ? 0 : userBirthDay.hashCode()); result = PRIME * result + ((userComeFrom =

14、= null) ? 0 : userComeFrom.hashCode()); result = PRIME * result + ((userImage == null) ? 0 : userImage.hashCode()); result = PRIME * result + ((userMail == null) ? 0 : userMail.hashCode()); result = PRIME * result + ((userName == null) ? 0 : userName.hashCode()); result = PRIME * result

15、+ ((userPassWord == null) ? 0 : userPassWord.hashCode()); result = PRIME * result + ((userResume == null) ? 0 : userResume.hashCode()); result = PRIME * result + userSex; result = PRIME * result + userType; return result; } @Override public boolean equals(Object obj) { if (this

16、== obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final UserInfoBasePO other = (UserInfoBasePO) obj; if (aliaoName == null) { if (other.aliaoName != null) return false; } else if (!aliaoName.equals(other.aliaoName)

17、) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (passWordAnswer == null) { if (other.passWordAnswer != null) return false; } else if (!passWordAnswer.equals(other.passWordAnswer)) return

18、 false; if (passWordAsk == null) { if (other.passWordAsk != null) return false; } else if (!passWordAsk.equals(other.passWordAsk)) return false; if (registerTime == null) { if (other.registerTime != null) return false; } else if (!registerTime.equals(other.registerT

19、ime)) return false; if (userBirthDay == null) { if (other.userBirthDay != null) return false; } else if (!userBirthDay.equals(other.userBirthDay)) return false; if (userComeFrom == null) { if (other.userComeFrom != null) return false; } else if (!userComeFrom.eq

20、uals(other.userComeFrom)) return false; if (userImage == null) { if (other.userImage != null) return false; } else if (!userImage.equals(other.userImage)) return false; if (userMail == null) { if (other.userMail != null) return false; } else if (!userMail.equals

21、(other.userMail)) return false; if (userName == null) { if (other.userName != null) return false; } else if (!userName.equals(other.userName)) return false; if (userPassWord == null) { if (other.userPassWord != null) return false; } else if (!userPassWord.equals

22、(other.userPassWord)) return false; if (userResume == null) { if (other.userResume != null) return false; } else if (!userResume.equals(other.userResume)) return false; if (userSex != other.userSex) return false; if (userType != other.userType) return false; r

23、eturn true; } } 3、在數(shù)據(jù)訪問層中添加各個PO類——建立UserInfoPO實體類 (1)UserInfoPO類,包名稱為com.px1987.webbbs.dao 并繼承于com.px1987.webbbs.dao.UserInfoBasePO基類 (2)添加下面的各個成員屬性 private Map contactMethod = new HashMap(); private String userSign; private int emailVisible; private int acceptAdvise; (3)并為這些成員屬性提供g

24、et/set方法 (4)最后產(chǎn)生出下面的代碼 package com.px1987.webbbs.dao; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; public class UserInfoPO extends UserInfoBasePO { private Map contactMethod = new HashMap(); private Stri

25、ng userSign; private int emailVisible; private int acceptAdvise; public UserInfoPO() { } public int getAcceptAdvise() { return acceptAdvise; } public void setAcceptAdvise(int acceptAdvise) { this.acceptAdvise = acceptAdvise; } public Map getContactMethod() { return contact

26、Method; } public void setContactMethod(Map contactMethod) { this.contactMethod = contactMethod; } public int getEmailVisible() { return emailVisible; } public void setEmailVisible(int emailVisible) { this.emailVisible = emailVisible; } public String getUserSign() { return

27、 userSign; } public void setUserSign(String userSign) { this.userSign = userSign; } public void addOneContactMethod(String oneContactMethodKey,String oneContactMethodValue) { //該方法為“幫助方法” contactMethod.put(oneContactMethodKey,oneContactMethodValue); } public String getOneContactMe

28、thod(String oneContactMethodKey) { //該方法為“幫助方法” return (String)contactMethod.get(oneContactMethodKey); } //在“一”端(UserInfo)的PO類中增加一個“多”端(BBSInfo)的集合對象的屬性 private Set bbsInfos = new HashSet(); public Set getBbsInfos(){ return bbsInfos; } public void setBbsInfos(Set bbsInfos) {

29、 this.bbsInfos = bbsInfos; } public ArrayList getBBSInfoSByUser(){ //利用該方法可以獲得該用戶所發(fā)表的BBS信息 ArrayList allBBSInfosByOneUser=null; allBBSInfosByOneUser=new ArrayList(); java.util.Iterator allBBSInfoItemIterator = getBbsInfos().iterator(); while(allBBSInfoItemIterator.hasNext()){

30、BBSInfoPO oneBBSInfo=(BBSInfoPO)allBBSInfoItemIterator.next(); allBBSInfosByOneUser.add(oneBBSInfo); } return allBBSInfosByOneUser; } @Override public int hashCode() { final int PRIME = 31; int result = super.hashCode(); result = PRIME * result + acceptAdvise; result = PR

31、IME * result + ((bbsInfos == null) ? 0 : bbsInfos.hashCode()); result = PRIME * result + ((contactMethod == null) ? 0 : contactMethod.hashCode()); result = PRIME * result + emailVisible; result = PRIME * result + ((userSign == null) ? 0 : userSign.hashCode()); return result; } @Overr

32、ide public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; final UserInfoPO other = (UserInfoPO) obj; if (acceptAdvise != other.acceptAdvise) return false; if (bbsInfo

33、s == null) { if (other.bbsInfos != null) return false; } else if (!bbsInfos.equals(other.bbsInfos)) return false; if (contactMethod == null) { if (other.contactMethod != null) return false; } else if (!contactMethod.equals(other.contactMethod)) return false; if

34、(emailVisible != other.emailVisible) return false; if (userSign == null) { if (other.userSign != null) return false; } else if (!userSign.equals(other.userSign)) return false; return true; } } 4、在數(shù)據(jù)訪問層中添加各個PO類——建立AdminUserInfoPO實體類 (1)AdminUserInfoPO類,包名稱為com.px1987.we

35、bbbs.dao 并且也繼承于com.px1987.webbbs.dao.UserInfoBasePO類 (2)添加下面的成員屬性 private String workUnit; private String studyHistory; private String studySchool; private String idCardNo; (3)并這些成員屬性提供get/set方法 (4)最后產(chǎn)生出下面的代碼 package com.px1987.webbbs.dao; public class AdminUserInfoPO exten

36、ds UserInfoBasePO { private String workUnit; private String studyHistory; private String studySchool; private String idCardNo; public AdminUserInfoPO() { } public String getIdCardNo() { return idCardNo; } public void setIdCardNo(String idCardNo) { this.idCardNo = idCardNo

37、; } public String getStudyHistory() { return studyHistory; } public void setStudyHistory(String studyHistory) { this.studyHistory = studyHistory; } public String getStudySchool() { return studySchool; } public void setStudySchool(String studySchool) { this.studySchool = s

38、tudySchool; } public String getWorkUnit() { return workUnit; } public void setWorkUnit(String workUnit) { this.workUnit = workUnit; } @Override public int hashCode() { final int PRIME = 31; int result = super.hashCode(); result = PRIME * result + ((idCardNo == null) ? 0

39、: idCardNo.hashCode()); result = PRIME * result + ((studyHistory == null) ? 0 : studyHistory.hashCode()); result = PRIME * result + ((studySchool == null) ? 0 : studySchool.hashCode()); result = PRIME * result + ((workUnit == null) ? 0 : workUnit.hashCode()); return result; } @Overri

40、de public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; final AdminUserInfoPO other = (AdminUserInfoPO) obj; if (idCardNo == null) { if (other.idCardNo != null) re

41、turn false; } else if (!idCardNo.equals(other.idCardNo)) return false; if (studyHistory == null) { if (other.studyHistory != null) return false; } else if (!studyHistory.equals(other.studyHistory)) return false; if (studySchool == null) { if (other.studySchool != nul

42、l) return false; } else if (!studySchool.equals(other.studySchool)) return false; if (workUnit == null) { if (other.workUnit != null) return false; } else if (!workUnit.equals(other.workUnit)) return false; return true; } } 5、在數(shù)據(jù)訪問層中添加各個PO類——建立BBSInfoPO實體類 (1)B

43、BSInfoPO類,包名稱為com.px1987.webbbs.dao,并實現(xiàn)java.io.Serializable接口 (2)添加下面的成員屬性 private String author; private String title; private int replay; private int hits; private String sendInfoTime; private String content; //private Clob content; private int mailto; private

44、String abstractText; private String lastUpdateTime; private int bbsIconID; private int bbsTypeID; private int bbsTitleID; private String userID; private Integer id; (3)并為這些成員屬性提供get/set方法 (4)最后產(chǎn)生出下面的代碼 package com.px1987.webbbs.dao; import java.sql.*; import java.

45、util.*; public class BBSInfoPO implements java.io.Serializable{ private String author; private String title; private int replay; private int hits; private String sendInfoTime; private String content; //private Clob content; private int mailto; private String abstractText; pr

46、ivate String lastUpdateTime; private int bbsIconID; private int bbsTypeID; private int bbsTitleID; private String userID; private int bbsID; public BBSInfoPO(){ } public String getAbstractText() { return abstractText; } public void setAbstractText(String abstractText) { thi

47、s.abstractText = abstractText; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public int getBbsIconID() { return bbsIconID; } public void setBbsIconID(int bbsIconID) { this.bbsIconID = bbsIconID; } public

48、int getBbsTitleID() { return bbsTitleID; } public void setBbsTitleID(int bbsTitleID) { this.bbsTitleID = bbsTitleID; } public int getBbsTypeID() { return bbsTypeID; } public void setBbsTypeID(int bbsTypeID) { this.bbsTypeID = bbsTypeID; } public String getContent() { r

49、eturn content; } public void setContent(String content) { this.content = content; } public int getHits() { return hits; } public void setHits(int hits) { this.hits = hits; } public String getLastUpdateTime() { return lastUpdateTime; } public void setLastUpdateTime(Str

50、ing lastUpdateTime) { this.lastUpdateTime = lastUpdateTime; } public int getMailto() { return mailto; } public void setMailto(int mailto) { this.mailto = mailto; } public int getReplay() { return replay; } public void setReplay(int replay) { this.replay = replay; }

51、 public String getSendInfoTime() { return sendInfoTime; } public void setSendInfoTime(String sendInfoTime) { this.sendInfoTime = sendInfoTime; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getUserID()

52、 { return userID; } public void setUserID(String userID) { this.userID = userID; } private Set bbsReplyInfos = new HashSet(); public Set getBbsReplyInfos(){ return bbsReplyInfos; } public void setBbsReplyInfos(Set bbsReplyInfos){ this.bbsReplyInfos = bbsReplyInfos; } pu

53、blic ArrayList getBbsReplyInfosByBBS(){ //利用該方法可以獲得該分類下的所有BBS信息 ArrayList allBbsReplyInfosByOneBBS=null; allBbsReplyInfosByOneBBS=new ArrayList(); java.util.Iterator allBBSReplyInfoItemIterator = getBbsReplyInfos().iterator(); while(allBBSReplyInfoItemIterator.hasNext()){ BBSRep

54、lyInfoPO oneBBSReplyInfo= (BBSReplyInfoPO)allBBSReplyInfoItemIterator.next(); allBbsReplyInfosByOneBBS.add(oneBBSReplyInfo); } return allBbsReplyInfosByOneBBS; } public int getBbsID() { return bbsID; } public void setBbsID(int bbsID) { this.bbsID = bbsID; } @Override p

55、ublic int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((abstractText == null) ? 0 : abstractText.hashCode()); result = PRIME * result + ((author == null) ? 0 : author.hashCode()); result = PRIME * result + bbsID; result = PRIME * result + bbsIconID;

56、 result = PRIME * result + ((bbsReplyInfos == null) ? 0 : bbsReplyInfos.hashCode()); result = PRIME * result + bbsTitleID; result = PRIME * result + bbsTypeID; result = PRIME * result + ((content == null) ? 0 : content.hashCode()); result = PRIME * result + hits; result = PRIME * r

57、esult + ((lastUpdateTime == null) ? 0 : lastUpdateTime.hashCode()); result = PRIME * result + mailto; result = PRIME * result + replay; result = PRIME * result + ((sendInfoTime == null) ? 0 : sendInfoTime.hashCode()); result = PRIME * result + ((title == null) ? 0 : title.hashCode());

58、 result = PRIME * result + ((userID == null) ? 0 : userID.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final BBSInfoPO other =

59、(BBSInfoPO) obj; if (abstractText == null) { if (other.abstractText != null) return false; } else if (!abstractText.equals(other.abstractText)) return false; if (author == null) { if (other.author != null) return false; } else if (!author.equals(other.author)) r

60、eturn false; if (bbsID != other.bbsID) return false; if (bbsIconID != other.bbsIconID) return false; if (bbsReplyInfos == null) { if (other.bbsReplyInfos != null) return false; } else if (!bbsReplyInfos.equals(other.bbsReplyInfos)) return false; if (bbsTitleID !=

61、other.bbsTitleID) return false; if (bbsTypeID != other.bbsTypeID) return false; if (content == null) { if (other.content != null) return false; } else if (!content.equals(other.content)) return false; if (hits != other.hits) return false; if (lastUpdateTime ==

62、 null) { if (other.lastUpdateTime != null) return false; } else if (!lastUpdateTime.equals(other.lastUpdateTime)) return false; if (mailto != other.mailto) return false; if (replay != other.replay) return false; if (sendInfoTime == null) { if (other.sendInfoTime

63、!= null) return false; } else if (!sendInfoTime.equals(other.sendInfoTime)) return false; if (title == null) { if (other.title != null) return false; } else if (!title.equals(other.title)) return false; if (userID == null) { if (other.userID != null) return false; } else if (!userID.equals(other.userID)) return false; return true; } } 楊教授大學(xué)堂,版權(quán)所有,盜版必究。 31/31頁

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!