数据库更新

This commit is contained in:
2023-07-05 19:32:58 +08:00
parent 1a902ca4a6
commit 283409bd14
3 changed files with 23 additions and 33 deletions

View File

@@ -7,8 +7,6 @@ import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
@@ -79,7 +77,7 @@ public class commentDao {
try {
Connection conn = JdbcUtils.getConnection();
QueryRunner runner = new QueryRunner();
String sql = "select * from comment where projectId = ? and isValid = 1 Order BY creatTime ";
String sql = "select * from comment where projectId = ? and isValid = 1 Order BY creatTime DESC;";
commentEntityList = runner.query(conn, sql,new BeanListHandler<>(commentEntity.class),id);
conn.close();
} catch (SQLException e) {

View File

@@ -242,7 +242,7 @@ public class projectDao {
try {
Connection conn = JdbcUtils.getConnection();
QueryRunner runner = new QueryRunner();
String sql = "update project set starNum = starNum + 1 where isValid = 1 and projectId= ?";
String sql = "update project set startNum = startNum + 1 where isValid = 1 and projectId= ?";
num = runner.update(conn, sql,proId);
conn.close();
} catch (SQLException e) {
@@ -257,7 +257,7 @@ public class projectDao {
try {
Connection conn = JdbcUtils.getConnection();
QueryRunner runner = new QueryRunner();
String sql = "update project set starNum = starNum - 1 where isValid = 1 and projectId= ?";
String sql = "update project set startNum = startNum - 1 where isValid = 1 and projectId= ?";
num = runner.update(conn, sql,proId);
conn.close();
} catch (SQLException e) {