基于J2EE Struts框架的课程设计实训项目——BBS论坛系统——构建系统持久层中各个实体PO类第1部分

上传人:仙*** 文档编号:34531069 上传时间:2021-10-21 格式:DOC 页数:31 大小:486.02KB
返回 下载 相关 举报
基于J2EE Struts框架的课程设计实训项目——BBS论坛系统——构建系统持久层中各个实体PO类第1部分_第1页
第1页 / 共31页
基于J2EE Struts框架的课程设计实训项目——BBS论坛系统——构建系统持久层中各个实体PO类第1部分_第2页
第2页 / 共31页
基于J2EE Struts框架的课程设计实训项目——BBS论坛系统——构建系统持久层中各个实体PO类第1部分_第3页
第3页 / 共31页
点击查看更多>>
资源描述
杨教授大学堂 精心创作的优秀程序员 职业提升必读系列资料基于J2EE Struts框架的课程设计实训项目BBS论坛系统构建系统持久层中各个实体PO类(第1/2部分)1.1.1 构造出本Web项目中的DAO层的各个实体PO类组件1、本项目中的各个PO的类图2、在数据访问层中添加各个PO类建立UserInfoBasePO实体类(1)UserInfoBasePO基类,包名称为com.px1987.webbbs.dao,并实现java.io.Serializable接口(2)添加下面的各个成员属性private String id;private 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 userBirthDay;private String userComeFrom;private String userResume;(3)并为这些成员属性提供get/set方法(4)最后产生出下面的代码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 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;public UserInfoBasePO() public String getAliaoName() return aliaoName;public 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 getPassWordAsk() 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;public 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 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) 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) 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;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.hashCode();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 : userBirthDay.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.hashCode();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)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 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 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.registerTime)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.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 (!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 (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;return true;3、在数据访问层中添加各个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)并为这些成员属性提供get/set方法(4)最后产生出下面的代码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 String 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 contactMethod;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 userSign;public void setUserSign(String userSign) this.userSign = userSign;public void addOneContactMethod(String oneContactMethodKey,String oneContactMethodValue) /该方法为“帮助方法”contactMethod.put(oneContactMethodKey,oneContactMethodValue);public String getOneContactMethod(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) this.bbsInfos = bbsInfos;public ArrayList getBBSInfoSByUser() /利用该方法可以获得该用户所发表的BBS信息ArrayList allBBSInfosByOneUser=null;allBBSInfosByOneUser=new ArrayList();java.util.Iterator allBBSInfoItemIterator = getBbsInfos().iterator();while(allBBSInfoItemIterator.hasNext()BBSInfoPO oneBBSInfo=(BBSInfoPO)allBBSInfoItemIterator.next();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 = 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()return 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 (!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、在数据访问层中添加各个PO类建立AdminUserInfoPO实体类(1)AdminUserInfoPO类,包名称为com.px1987.webbbs.dao并且也继承于com.px1987.webbbs.dao.UserInfoBasePO类(2)添加下面的成员属性private String workUnit;private String studyHistory;private String studySchool;private String idCardNo;(3)并这些成员属性提供get/set方法(4)最后产生出下面的代码package com.px1987.webbbs.dao;public class AdminUserInfoPO extends 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;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 = studySchool;public String getWorkUnit() return workUnit;public void setWorkUnit(String workUnit) this.workUnit = workUnit;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.hashCode();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 (idCardNo = 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 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、在数据访问层中添加各个PO类建立BBSInfoPO实体类(1)BBSInfoPO类,包名称为com.px1987.webbbs.dao,并实现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 String abstractText; private String lastUpdateTime; private int bbsIconID; private int bbsTypeID; private int bbsTitleID; private String userID; private Integer id;(3)并为这些成员属性提供get/set方法(4)最后产生出下面的代码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 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 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 = bbsIconID;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 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;public 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() 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 bbsReplyInfos)this.bbsReplyInfos = bbsReplyInfos;public ArrayList getBbsReplyInfosByBBS() /利用该方法可以获得该分类下的所有BBS信息ArrayList allBbsReplyInfosByOneBBS=null;allBbsReplyInfosByOneBBS=new ArrayList();java.util.Iterator allBBSReplyInfoItemIterator = getBbsReplyInfos().iterator();while(allBBSReplyInfoItemIterator.hasNext()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 = 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.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;result = 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 (this = 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.author != 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 (bbsTitleID != 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)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 != 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;杨教授大学堂,版权所有,盗版必究。 31/31页
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 工作计划


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!