贡献值(修正sql)
This commit is contained in:
@@ -201,23 +201,18 @@ public class UserDao {
|
|||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
PreparedStatement preparedStatement = null;
|
PreparedStatement preparedStatement = null;
|
||||||
ResultSet rs = 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;
|
int Value = 0;
|
||||||
try{
|
try{
|
||||||
conn = JdbcUtils.getConnection();
|
conn = JdbcUtils.getConnection();
|
||||||
preparedStatement = conn.prepareStatement(sql);
|
preparedStatement = conn.prepareStatement(sql);
|
||||||
preparedStatement.setString(1, name);
|
preparedStatement.setString(1, name);
|
||||||
rs = preparedStatement.executeQuery();
|
rs = preparedStatement.executeQuery();
|
||||||
if(rs.next()){
|
|
||||||
while(rs.next()){
|
while(rs.next()){
|
||||||
int projectNum = rs.getInt(6);
|
Value = rs.getInt(8);
|
||||||
Value = Value+projectNum;
|
}return Value;
|
||||||
Value++;
|
|
||||||
}
|
|
||||||
return Value;
|
|
||||||
}else{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}finally {
|
}finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user