修正根据文章id查找username问题
This commit is contained in:
@@ -103,7 +103,7 @@ public class articleDao {
|
|||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
String sql = "SELECT * FROM `article` WHERE articleId = ? AND isValid = 1;";
|
String sql = "SELECT * FROM `article` WHERE articleId = ? AND isValid = 1;";
|
||||||
String sql1 = "UPDATE article SET readCount = readCount+1 where articleId = ?";
|
String sql1 = "UPDATE article SET readCount = readCount+1 where articleId = ?";
|
||||||
articleEntity entity = null;
|
com.hellogithub.entity.articleEntity entity=null;
|
||||||
try{
|
try{
|
||||||
conn = JdbcUtils.getConnection();
|
conn = JdbcUtils.getConnection();
|
||||||
preparedStatement.setInt(1, id);
|
preparedStatement.setInt(1, id);
|
||||||
@@ -122,19 +122,15 @@ public class articleDao {
|
|||||||
int readcount = rs.getInt(6);
|
int readcount = rs.getInt(6);
|
||||||
String articleTitle = rs.getString(7);
|
String articleTitle = rs.getString(7);
|
||||||
String articleIco = rs.getString(8);
|
String articleIco = rs.getString(8);
|
||||||
entity.setArticleId(articleid);
|
entity = new articleEntity(
|
||||||
entity.setUserId(userid);
|
articleid,userid,articlecontent,datetime,isvalid,readcount,articleTitle,articleIco
|
||||||
entity.setArticleContent(articlecontent);
|
);
|
||||||
entity.setPublishTime(datetime);
|
preparedStatement1.close();
|
||||||
entity.setIsValid(isvalid);
|
JdbcUtils.closeConnection(rs, preparedStatement, conn);
|
||||||
entity.setReadCount(readcount);
|
|
||||||
entity.setArticleTitle(articleTitle);
|
|
||||||
entity.setArticleIco(articleIco);
|
|
||||||
}
|
}
|
||||||
return entity;
|
} catch (SQLException e) {
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
Reference in New Issue
Block a user