基于J2EE Struts框架的課程設(shè)計(jì)實(shí)訓(xùn)項(xiàng)目——BBS論壇系統(tǒng)——構(gòu)建系統(tǒng)持久層中各個(gè)實(shí)體PO類(lèi)第1部分
《基于J2EE Struts框架的課程設(shè)計(jì)實(shí)訓(xùn)項(xiàng)目——BBS論壇系統(tǒng)——構(gòu)建系統(tǒng)持久層中各個(gè)實(shí)體PO類(lèi)第1部分》由會(huì)員分享,可在線(xiàn)閱讀,更多相關(guān)《基于J2EE Struts框架的課程設(shè)計(jì)實(shí)訓(xùn)項(xiàng)目——BBS論壇系統(tǒng)——構(gòu)建系統(tǒng)持久層中各個(gè)實(shí)體PO類(lèi)第1部分(31頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。
1、楊教授大學(xué)堂 精心創(chuàng)作的優(yōu)秀程序員 職業(yè)提升必讀系列資料基于J2EE Struts框架的課程設(shè)計(jì)實(shí)訓(xùn)項(xiàng)目BBS論壇系統(tǒng)構(gòu)建系統(tǒng)持久層中各個(gè)實(shí)體PO類(lèi)(第1/2部分)1.1.1 構(gòu)造出本W(wǎng)eb項(xiàng)目中的DAO層的各個(gè)實(shí)體PO類(lèi)組件1、本項(xiàng)目中的各個(gè)PO的類(lèi)圖2、在數(shù)據(jù)訪(fǎng)問(wèn)層中添加各個(gè)PO類(lèi)建立UserInfoBasePO實(shí)體類(lèi)(1)UserInfoBasePO基類(lèi),包名稱(chēng)為com.px1987.webbbs.dao,并實(shí)現(xiàn)java.io.Serializable接口(2)添加下面的各個(gè)成員屬性private String id;private String userName;private Str
2、ing 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;private String userComeFrom;private String userResume;(
3、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 String userName;private String userPassWord;private int userType;private String aliaoName;private Stri
4、ng passWordAsk;private String userImage;private String registerTime;private String passWordAnswer;private String userMail;private int userSex;private String userBirthDay;private String userComeFrom;private String userResume;public UserInfoBasePO() public String getAliaoName() return aliaoName;public
5、 void setAliaoName(String aliaoName) this.aliaoName = aliaoName;public String getId() return id;public void setId(String id) this.id = id;public String getPassWordAnswer() return passWordAnswer;public void setPassWordAnswer(String passWordAnswer) this.passWordAnswer = passWordAnswer;public String ge
6、tPassWordAsk() return passWordAsk;public void setPassWordAsk(String passWordAsk) this.passWordAsk = passWordAsk;public String getRegisterTime() return registerTime;public void setRegisterTime(String registerTime) this.registerTime = registerTime;public String getUserBirthDay() return userBirthDay;pu
7、blic void setUserBirthDay(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 setUserImage(String userImag
8、e) 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) this.userName = userName;public String getUserPassWord() return userPassWor
9、d;public void setUserPassWord(String userPassWord) this.userPassWord = userPassWord;public String getUserResume() return userResume;public void setUserResume(String userResume) this.userResume = userResume;public int getUserSex() return userSex;public void setUserSex(int userSex) this.userSex = user
10、Sex;public int getUserType() return userType;public void setUserType(int userType) this.userType = userType;Overridepublic int hashCode() final int PRIME = 31;int result = 1;result = PRIME * result + (aliaoName = null) ? 0 : aliaoName.hashCode();result = PRIME * result + (id = null) ? 0 : id.hashCod
11、e();result = PRIME * result + (passWordAnswer = null) ? 0 : passWordAnswer.hashCode();result = PRIME * result + (passWordAsk = null) ? 0 : passWordAsk.hashCode();result = PRIME * result + (registerTime = null) ? 0 : registerTime.hashCode();result = PRIME * result + (userBirthDay = null) ? 0 : userBi
12、rthDay.hashCode();result = PRIME * result + (userComeFrom = 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.has
13、hCode();result = PRIME * result + (userPassWord = null) ? 0 : userPassWord.hashCode();result = PRIME * result + (userResume = null) ? 0 : userResume.hashCode();result = PRIME * result + userSex;result = PRIME * result + userType;return result;Overridepublic boolean equals(Object obj) if (this = obj)
14、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)return false;if (id = null) if (other.id != null)return fa
15、lse; else if (!id.equals(other.id)return false;if (passWordAnswer = null) if (other.passWordAnswer != null)return false; else if (!passWordAnswer.equals(other.passWordAnswer)return false;if (passWordAsk = null) if (other.passWordAsk != null)return false; else if (!passWordAsk.equals(other.passWordAs
16、k)return false;if (registerTime = null) if (other.registerTime != null)return false; else if (!registerTime.equals(other.registerTime)return false;if (userBirthDay = null) if (other.userBirthDay != null)return false; else if (!userBirthDay.equals(other.userBirthDay)return false;if (userComeFrom = nu
17、ll) if (other.userComeFrom != null)return false; else if (!userComeFrom.equals(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
18、 (!userMail.equals(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(other.userPassWord)return false;if (u
19、serResume = 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;return true;3、在數(shù)據(jù)訪(fǎng)問(wèn)層中添加各個(gè)PO類(lèi)建立UserInfoPO實(shí)體類(lèi)(1)UserInfoPO類(lèi),包名稱(chēng)為com.px1987.webbbs.dao并繼承于com.px19
20、87.webbbs.dao.UserInfoBasePO基類(lèi)(2)添加下面的各個(gè)成員屬性private Map contactMethod = new HashMap();private String userSign;private int emailVisible;private int acceptAdvise;(3)并為這些成員屬性提供get/set方法(4)最后產(chǎn)生出下面的代碼package com.px1987.webbbs.dao;import java.util.ArrayList;import java.util.HashMap;import java.util.HashSe
21、t;import java.util.Map;import java.util.Set;public class UserInfoPO extends UserInfoBasePO private Map contactMethod = new HashMap();private String userSign;private int emailVisible;private int acceptAdvise;public UserInfoPO() public int getAcceptAdvise() return acceptAdvise;public void setAcceptAdv
22、ise(int acceptAdvise) this.acceptAdvise = acceptAdvise;public Map getContactMethod() return contactMethod;public void setContactMethod(Map contactMethod) this.contactMethod = contactMethod;public int getEmailVisible() return emailVisible;public void setEmailVisible(int emailVisible) this.emailVisibl
23、e = emailVisible;public String getUserSign() return userSign;public void setUserSign(String userSign) this.userSign = userSign;public void addOneContactMethod(String oneContactMethodKey,String oneContactMethodValue) /該方法為“幫助方法”contactMethod.put(oneContactMethodKey,oneContactMethodValue);public Strin
24、g getOneContactMethod(String oneContactMethodKey) /該方法為“幫助方法”return (String)contactMethod.get(oneContactMethodKey);/在“一”端(UserInfo)的PO類(lèi)中增加一個(gè)“多”端(BBSInfo)的集合對(duì)象的屬性private Set bbsInfos = new HashSet();public Set getBbsInfos()return bbsInfos;public void setBbsInfos(Set bbsInfos) this.bbsInfos = bbsInfos
25、;public ArrayList getBBSInfoSByUser() /利用該方法可以獲得該用戶(hù)所發(fā)表的BBS信息ArrayList allBBSInfosByOneUser=null;allBBSInfosByOneUser=new ArrayList();java.util.Iterator allBBSInfoItemIterator = getBbsInfos().iterator();while(allBBSInfoItemIterator.hasNext()BBSInfoPO oneBBSInfo=(BBSInfoPO)allBBSInfoItemIterator.next(
26、);allBBSInfosByOneUser.add(oneBBSInfo);return allBBSInfosByOneUser;Overridepublic int hashCode() final int PRIME = 31;int result = super.hashCode();result = PRIME * result + acceptAdvise;result = PRIME * result + (bbsInfos = null) ? 0 : bbsInfos.hashCode();result = PRIME * result + (contactMethod =
27、null) ? 0 : contactMethod.hashCode();result = PRIME * result + emailVisible;result = PRIME * result + (userSign = null) ? 0 : userSign.hashCode();return result;Overridepublic boolean equals(Object obj) if (this = obj)return true;if (!super.equals(obj)return false;if (getClass() != obj.getClass()retu
28、rn false;final UserInfoPO other = (UserInfoPO) obj;if (acceptAdvise != other.acceptAdvise)return false;if (bbsInfos = 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 (
29、!contactMethod.equals(other.contactMethod)return false;if (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ù)訪(fǎng)問(wèn)層中添加各個(gè)PO類(lèi)建立AdminUserInfoPO實(shí)體類(lèi)(1)AdminUserInfoPO類(lèi),包名稱(chēng)為com.p
30、x1987.webbbs.dao并且也繼承于com.px1987.webbbs.dao.UserInfoBasePO類(lèi)(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 extends UserInfoBasePO private St
31、ring 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;public String getStudyHistory() return studyHistory;public void setStudy
32、History(String studyHistory) this.studyHistory = studyHistory;public String getStudySchool() return studySchool;public void setStudySchool(String studySchool) this.studySchool = studySchool;public String getWorkUnit() return workUnit;public void setWorkUnit(String workUnit) this.workUnit = workUnit;
33、Overridepublic int hashCode() final int PRIME = 31;int result = super.hashCode();result = PRIME * result + (idCardNo = null) ? 0 : idCardNo.hashCode();result = PRIME * result + (studyHistory = null) ? 0 : studyHistory.hashCode();result = PRIME * result + (studySchool = null) ? 0 : studySchool.hashCo
34、de();result = PRIME * result + (workUnit = null) ? 0 : workUnit.hashCode();return result;Overridepublic 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 (idCard
35、No = null) if (other.idCardNo != null)return 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 != null)return f
36、alse; 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ù)訪(fǎng)問(wèn)層中添加各個(gè)PO類(lèi)建立BBSInfoPO實(shí)體類(lèi)(1)BBSInfoPO類(lèi),包名稱(chēng)為com.px1987.webbbs.dao,并實(shí)現(xiàn)java.io.Serializable接口(2)添加下面的成員屬
37、性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; private String lastUpdateTime; private int bbsIconID; private int bbsTypeID; private int bbs
38、TitleID; private String userID; private Integer id;(3)并為這些成員屬性提供get/set方法(4)最后產(chǎn)生出下面的代碼package com.px1987.webbbs.dao;import java.sql.*;import java.util.*;public class BBSInfoPO implements java.io.Serializableprivate String author;private String title;private int replay;private int hits;private String
39、 sendInfoTime;private String content;/private Clob content;private int mailto;private String abstractText;private String lastUpdateTime;private int bbsIconID;private int bbsTypeID;private int bbsTitleID;private String userID;private int bbsID;public BBSInfoPO()public String getAbstractText() return
40、abstractText;public void setAbstractText(String abstractText) this.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 = bbsIcon
41、ID;public 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() return content;public void setContent(String
42、 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(String lastUpdateTime) this.lastUpdateTime = lastUpdateTime;public int getMailto() return mailto;publ
43、ic void setMailto(int mailto) this.mailto = mailto;public int getReplay() return replay;public void setReplay(int replay) this.replay = replay;public String getSendInfoTime() return sendInfoTime;public void setSendInfoTime(String sendInfoTime) this.sendInfoTime = sendInfoTime;public String getTitle(
44、) return title;public void setTitle(String title) this.title = title;public String getUserID() return userID;public void setUserID(String userID) this.userID = userID;private Set bbsReplyInfos = new HashSet();public Set getBbsReplyInfos()return bbsReplyInfos;public void setBbsReplyInfos(Set bbsReply
45、Infos)this.bbsReplyInfos = bbsReplyInfos;public ArrayList getBbsReplyInfosByBBS() /利用該方法可以獲得該分類(lèi)下的所有BBS信息ArrayList allBbsReplyInfosByOneBBS=null;allBbsReplyInfosByOneBBS=new ArrayList();java.util.Iterator allBBSReplyInfoItemIterator = getBbsReplyInfos().iterator();while(allBBSReplyInfoItemIterator.ha
46、sNext()BBSReplyInfoPO oneBBSReplyInfo=(BBSReplyInfoPO)allBBSReplyInfoItemIterator.next();allBbsReplyInfosByOneBBS.add(oneBBSReplyInfo);return allBbsReplyInfosByOneBBS;public int getBbsID() return bbsID;public void setBbsID(int bbsID) this.bbsID = bbsID;Overridepublic int hashCode() final int PRIME =
47、 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;result = PRIME * result + (bbsReplyInfos = null) ? 0 : bbsReplyInfos.
48、hashCode();result = PRIME * result + bbsTitleID;result = PRIME * result + bbsTypeID;result = PRIME * result + (content = null) ? 0 : content.hashCode();result = PRIME * result + hits;result = PRIME * result + (lastUpdateTime = null) ? 0 : lastUpdateTime.hashCode();result = PRIME * result + mailto;re
49、sult = PRIME * result + replay;result = PRIME * result + (sendInfoTime = null) ? 0 : sendInfoTime.hashCode();result = PRIME * result + (title = null) ? 0 : title.hashCode();result = PRIME * result + (userID = null) ? 0 : userID.hashCode();return result;Overridepublic boolean equals(Object obj) if (t
50、his = obj)return true;if (obj = null)return false;if (getClass() != obj.getClass()return false;final BBSInfoPO other = (BBSInfoPO) obj;if (abstractText = null) if (other.abstractText != null)return false; else if (!abstractText.equals(other.abstractText)return false;if (author = null) if (other.auth
51、or != null)return false; else if (!author.equals(other.author)return 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 (b
52、bsTitleID != 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 = null) if (other.lastUpdateTime != null)ret
53、urn 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 != 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頁(yè)
- 溫馨提示:
1: 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 道路運(yùn)輸組織 客運(yùn)設(shè)施現(xiàn)代化PPT課件
- 應(yīng)用程序的結(jié)構(gòu)工程師課件
- 正弦穩(wěn)態(tài)分析
- 汽車(chē)照明與信號(hào)系統(tǒng)1
- 攝像頭的工作原理PPT課件
- 高中英語(yǔ)課程標(biāo)準(zhǔn)簡(jiǎn)介
- 目標(biāo)管理實(shí)務(wù)布衣公子作品版teliss課件
- 高中英語(yǔ)新課程通識(shí)培訓(xùn)校本研修
- (河南專(zhuān)版)九年級(jí)化學(xué)上冊(cè) 第五單元 化學(xué)方程式 課題1 第2課時(shí) 化學(xué)方程式(增分課練)習(xí)題課件 (新版)新人教版
- XXXX年淥口三級(jí)聯(lián)儲(chǔ)推介會(huì)講稿
- 131平方根(教育精品)
- 一年級(jí)《漢語(yǔ)拼音復(fù)習(xí)三》課件(教育精品)
- 為品牌戰(zhàn)略奠定基礎(chǔ)
- 化妝整體服務(wù)方案課件
- 同分異構(gòu)體的書(shū)寫(xiě)課件