修正根据文章id查找username问题
This commit is contained in:
@@ -103,14 +103,17 @@ public class articleDao {
|
||||
PreparedStatement preparedStatement1 = null;
|
||||
ResultSet rs = null;
|
||||
String sql = "SELECT * FROM `article` WHERE articleId = ? AND isValid = 1;";
|
||||
String sql1 = "UPDATE article SET readCount = readCount+1 where articleId = ?";
|
||||
com.hellogithub.entity.articleEntity entity=null;
|
||||
String sql1 = "UPDATE article SET readCount = readCount+1 WHERE articleId = ?";
|
||||
articleEntity entity = null;
|
||||
try{
|
||||
conn = JdbcUtils.getConnection();
|
||||
conn1 = JdbcUtils.getConnection();
|
||||
preparedStatement.setInt(1, id);
|
||||
preparedStatement = conn.prepareStatement(sql);
|
||||
|
||||
preparedStatement1.setInt(1, id);
|
||||
preparedStatement1 = conn1.prepareStatement(sql1);
|
||||
|
||||
rs = preparedStatement.executeQuery();
|
||||
preparedStatement1.executeQuery(sql1);
|
||||
|
||||
@@ -126,9 +129,9 @@ public class articleDao {
|
||||
entity = new articleEntity(
|
||||
articleid,userid,articlecontent,datetime,isvalid,readcount,articleTitle,articleIco
|
||||
);
|
||||
JdbcUtils.closeConnection(preparedStatement1, conn1);
|
||||
JdbcUtils.closeConnection(rs, preparedStatement, conn);
|
||||
}
|
||||
JdbcUtils.closeConnection(preparedStatement1, conn1);
|
||||
JdbcUtils.closeConnection(rs, preparedStatement, conn);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Reference in New Issue
Block a user