📄 mresume.java
字号:
conn.close();
}catch(Exception ex)
{
}
}
}
//删除简历
public boolean deleteResume( HttpSession mySession, String resumeId )
{
//获得数据库连接
Connection conn = this.getDBConnection( mySession );
if ( conn == null )
{
return false;
}
Statement stmt = null;
ResultSet rs = null;
try
{
stmt = conn.createStatement();
//尝试修改数据库
String sUpdateSQL = "delete from resume where resume_id='" + resumeId + "'";
stmt.executeUpdate( sUpdateSQL );
return true;
}
catch(Exception e)
{
e.printStackTrace();
mySession.setAttribute("errMsg","抛弃简历的时候出现错误,请联系技术人员!");
return false;
}
finally
{
try
{
rs.close();
stmt.close();
conn.close();
}catch(Exception ex)
{
}
}
}
//得到所有过期简历一览
public boolean getAllExpireResume( HttpSession mySession )
{
//设置用户信息
Hashtable myValues = (Hashtable)mySession.getAttribute(CommonConst.VIEWID_EXPIRE_LIST);
//获得数据库连接
Connection conn = this.getDBConnection( mySession );
if ( conn == null )
{
return false;
}
Statement stmt = null;
ResultSet rs = null;
try
{
//得到当前系统时间
String sDate = (new SimpleDateFormat("yyyy/MM/dd")).format(new Date(System.currentTimeMillis()));
stmt = conn.createStatement();
//执行SQL语句
String sQuery = "select * from resume where expire_time<>'' and expire_time<'" + sDate + "' order by resume_id desc";
rs = stmt.executeQuery( sQuery );
Vector processResumes = new Vector();
//循环取得所有过期的简历
while ( rs.next() )
{
ResumeContent resumeObj = new ResumeContent();
resumeObj.setResumeId( rs.getString("resume_id") );
resumeObj.setRealname( rs.getString("realname") );
resumeObj.setSex( rs.getString("sex") );
resumeObj.setBornDate( rs.getString("born_date") );
resumeObj.setMaxEducation( rs.getString("max_education") );
resumeObj.setMajor( rs.getString("major") );
resumeObj.setEmail( rs.getString("email") );
resumeObj.setContactPhone( rs.getString("contact_phone") );
resumeObj.setMobile( rs.getString("mobile") );
resumeObj.setCurrentJobType( rs.getString("current_job_type") );
resumeObj.setExpectJobType( rs.getString("expect_job_type") );
resumeObj.setCurrentPosition( rs.getString("current_position") );
resumeObj.setExpectPosition( rs.getString("expect_position") );
resumeObj.setCurrentCity( rs.getString("current_city") );
resumeObj.setExpectCity( rs.getString("expect_city") );
resumeObj.setExpectSalary( rs.getString("expect_salary") );
resumeObj.setResumeContent( rs.getString("resume_content") );
resumeObj.setExpireTime( rs.getString("expire_time") );
resumeObj.setAddTime( rs.getString("add_time") );
processResumes.add( resumeObj );
}
//放入页面值域
myValues.put( "resumes", processResumes );
//计算总页数
int countPerPage = ((Integer)mySession.getAttribute( "countPerPage" )).intValue();
int totalResumes = processResumes.size();
int totalPage = 0;
if ( totalResumes % countPerPage == 0 )
{
totalPage = totalResumes/countPerPage;
}
else
{
totalPage = totalResumes/countPerPage + 1;
}
int curPage = 0;
//放入当前页码
myValues.put( "curPage", new Integer(curPage) );
//放入总页码
myValues.put( "totalPage", new Integer(totalPage) );
return true;
}
catch(Exception e)
{
e.printStackTrace();
mySession.setAttribute("errMsg","在数据库中查找过期简历的时候出现错误,请联系技术人员!");
return false;
}
finally
{
try
{
rs.close();
stmt.close();
conn.close();
}catch(Exception ex)
{
}
}
}
//根据检索条件获得对应的简历
public boolean searchResume( HttpSession mySession,
String sResumeId1,
String sResumeId2,
String sRealname,
String sSex,
String sMaxEducation,
String sMajor,
String sCurrentJobType,
String sCurrentCity )
{
//设置用户信息
Hashtable myValues = (Hashtable)mySession.getAttribute(CommonConst.VIEWID_VIEW_LIST);
//获得数据库连接
Connection conn = this.getDBConnection( mySession );
if ( conn == null )
{
return false;
}
Statement stmt = null;
ResultSet rs = null;
try
{
stmt = conn.createStatement();
//组合SQL语句
StringBuffer sQuery = new StringBuffer();
sQuery.append( "select * from resume where 1=1 ");
if ( sResumeId1 != null && !sResumeId1.equals("") )
{
sQuery.append( "and resume_id>='" + sResumeId1 + "' ");
}
if ( sResumeId2 != null && !sResumeId2.equals("") )
{
sQuery.append( "and resume_id<='" + sResumeId2 + "' ");
}
if ( sRealname != null && !sRealname.equals("") )
{
sQuery.append( "and realname like '%" + sRealname + "%' ");
}
if ( sSex != null && !sSex.equals("") )
{
sQuery.append( "and sex='" + sSex + "' ");
}
if ( sMaxEducation != null && !sMaxEducation.equals("") )
{
sQuery.append( "and max_education like '%" + sMaxEducation + "%' ");
}
if ( sMajor != null && !sMajor.equals("") )
{
sQuery.append( "and major like '%" + sMajor + "%' ");
}
if ( sCurrentJobType != null && !sCurrentJobType.equals("") )
{
sQuery.append( "and current_job_type like '%" + sCurrentJobType + "%' ");
}
if ( sCurrentCity != null && !sCurrentCity.equals("") )
{
sQuery.append( "and current_city like '%" + sCurrentCity + "%' ");
}
sQuery.append("order by resume_id desc");
//执行SQL语句
rs = stmt.executeQuery( sQuery.toString() );
Vector processResumes = new Vector();
//循环取得所有检索到的简历
while ( rs.next() )
{
ResumeContent resumeObj = new ResumeContent();
resumeObj.setResumeId( rs.getString("resume_id") );
resumeObj.setRealname( rs.getString("realname") );
resumeObj.setSex( rs.getString("sex") );
resumeObj.setBornDate( rs.getString("born_date") );
resumeObj.setMaxEducation( rs.getString("max_education") );
resumeObj.setMajor( rs.getString("major") );
resumeObj.setEmail( rs.getString("email") );
resumeObj.setContactPhone( rs.getString("contact_phone") );
resumeObj.setMobile( rs.getString("mobile") );
resumeObj.setCurrentJobType( rs.getString("current_job_type") );
resumeObj.setExpectJobType( rs.getString("expect_job_type") );
resumeObj.setCurrentPosition( rs.getString("current_position") );
resumeObj.setExpectPosition( rs.getString("expect_position") );
resumeObj.setCurrentCity( rs.getString("current_city") );
resumeObj.setExpectCity( rs.getString("expect_city") );
resumeObj.setExpectSalary( rs.getString("expect_salary") );
resumeObj.setResumeContent( rs.getString("resume_content") );
resumeObj.setExpireTime( rs.getString("expire_time") );
processResumes.add( resumeObj );
}
//如果一条也没有查找出来
if ( processResumes.size() == 0 )
{
mySession.setAttribute("errMsg","共查找到0条记录,请重新指定查询条件。");
return false;
}
//放入页面值域
myValues.put( "resumes", processResumes );
//计算总页数
int countPerPage = ((Integer)mySession.getAttribute( "countPerPage" )).intValue();
int totalResumes = processResumes.size();
int totalPage = 0;
if ( totalResumes % countPerPage == 0 )
{
totalPage = totalResumes/countPerPage;
}
else
{
totalPage = totalResumes/countPerPage + 1;
}
int curPage = 0;
//放入当前页码
myValues.put( "curPage", new Integer(curPage) );
//放入总页码
myValues.put( "totalPage", new Integer(totalPage) );
return true;
}
catch(Exception e)
{
e.printStackTrace();
mySession.setAttribute("errMsg","在数据库中查找简历的时候出现错误,请联系技术人员!");
return false;
}
finally
{
try
{
rs.close();
stmt.close();
conn.close();
}catch(Exception ex)
{
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -