贡献值(修正sql)
This commit is contained in:
@@ -201,23 +201,18 @@ public class UserDao {
|
||||
Connection conn = null;
|
||||
PreparedStatement preparedStatement = null;
|
||||
ResultSet rs = null;
|
||||
String sql = "SELECT * FROM `user` t1,article t2 WHERE t1.userId = t2.userId AND t1.userId = ? and isValid = 1";
|
||||
String sql = "SELECT * FROM `user` WHERE userName = ? AND isValid = 1;";
|
||||
int Value = 0;
|
||||
try{
|
||||
conn = JdbcUtils.getConnection();
|
||||
preparedStatement = conn.prepareStatement(sql);
|
||||
preparedStatement.setString(1, name);
|
||||
rs = preparedStatement.executeQuery();
|
||||
if(rs.next()){
|
||||
while(rs.next()){
|
||||
int projectNum = rs.getInt(6);
|
||||
Value = Value+projectNum;
|
||||
Value++;
|
||||
}
|
||||
return Value;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(rs.next()){
|
||||
Value = rs.getInt(8);
|
||||
}return Value;
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
|
Reference in New Issue
Block a user