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