|
@ -48,16 +48,52 @@ public abstract class TidingsDao {
|
48
|
48
|
return count;
|
49
|
49
|
}
|
50
|
50
|
|
51
|
|
public com.ekexiu.portal.po.Tidings query(java.sql.Connection con,java.lang.String tidingsId) throws java.sql.SQLException{
|
|
51
|
/**
|
|
52
|
* 咨询页面显示最后回复信息
|
|
53
|
* @param con
|
|
54
|
* @param consultId 咨询ID
|
|
55
|
* @param senderId 登陆者ID
|
|
56
|
* @return 返回对方最后回复的信息
|
|
57
|
* @throws SQLException
|
|
58
|
*/
|
|
59
|
public Tidings queryLastRevovery(Connection con,String consultId,String senderId) throws SQLException{
|
|
60
|
int _m_1 = 1;
|
|
61
|
String sql = "SELECT TIDINGS_ID,TIDINGS_CONTANT,SENDER_ID,CONSULT_ID,CREATE_TIME FROM TIDINGS WHERE CREATE_TIME IN (SELECT MAX(CREATE_TIME) FROM TIDINGS WHERE (CONSULT_ID = ?) AND (SENDER_ID != ?)) ";
|
|
62
|
PreparedStatement ps = con.prepareStatement(sql);
|
|
63
|
try{
|
|
64
|
ps.setString(_m_1++,consultId);
|
|
65
|
ps.setString(_m_1++,senderId);
|
|
66
|
ResultSet rs = ps.executeQuery();
|
|
67
|
try{
|
|
68
|
if(rs.next()){
|
|
69
|
Tidings _result = new Tidings();
|
|
70
|
_result.setTidingsId(rs.getString(1));
|
|
71
|
_result.setTidingsContant(rs.getString(2));
|
|
72
|
_result.setSenderId(rs.getString(3));
|
|
73
|
_result.setConsultId(rs.getString(4));
|
|
74
|
_result.setCreateTime(rs.getString(5));
|
|
75
|
return _result;
|
|
76
|
}else{
|
|
77
|
return null;
|
|
78
|
}
|
|
79
|
}finally{
|
|
80
|
try{rs.close();}catch(Exception _m_2){}
|
|
81
|
}
|
|
82
|
}finally{
|
|
83
|
try{ps.close();}catch(Exception _m_3){}
|
|
84
|
}
|
|
85
|
}
|
|
86
|
|
|
87
|
public Tidings query(Connection con,String tidingsId) throws SQLException{
|
52
|
88
|
int _m_1 = 1;
|
53
|
89
|
String sql = "SELECT TIDINGS_ID,TIDINGS_CONTANT,SENDER_ID,CONSULT_ID,TIDINGS.CREATE_TIME,PROFESSOR.NAME FROM TIDINGS LEFT JOIN PROFESSOR ON SENDER_ID = PROFESSOR.ID WHERE TIDINGS_ID = ?";
|
54
|
|
java.sql.PreparedStatement ps = con.prepareStatement(sql);
|
|
90
|
PreparedStatement ps = con.prepareStatement(sql);
|
55
|
91
|
try{
|
56
|
92
|
ps.setString(_m_1++,tidingsId);
|
57
|
|
java.sql.ResultSet rs = ps.executeQuery();
|
|
93
|
ResultSet rs = ps.executeQuery();
|
58
|
94
|
try{
|
59
|
95
|
if(rs.next()){
|
60
|
|
com.ekexiu.portal.po.Tidings _result = new com.ekexiu.portal.po.Tidings();
|
|
96
|
Tidings _result = new Tidings();
|
61
|
97
|
_result.setTidingsId(rs.getString(1));
|
62
|
98
|
_result.setTidingsContant(rs.getString(2));
|
63
|
99
|
Professor professor = new Professor();
|
|
@ -78,17 +114,17 @@ public abstract class TidingsDao {
|
78
|
114
|
}
|
79
|
115
|
}
|
80
|
116
|
|
81
|
|
public java.util.List<com.ekexiu.portal.po.Tidings> queryCon(java.sql.Connection con,java.lang.String consultId) throws java.sql.SQLException{
|
|
117
|
public java.util.List<Tidings> queryCon(Connection con,String consultId) throws SQLException{
|
82
|
118
|
int _m_1 = 1;
|
83
|
119
|
String sql = "SELECT TIDINGS_ID,TIDINGS_CONTANT,SENDER_ID,TIDINGS.CONSULT_ID,TIDINGS.CREATE_TIME,PROFESSOR.NAME FROM TIDINGS LEFT JOIN PROFESSOR ON SENDER_ID = PROFESSOR.ID WHERE TIDINGS.CONSULT_ID = ? ORDER BY TIDINGS.CREATE_TIME";
|
84
|
|
java.sql.PreparedStatement ps = con.prepareStatement(sql);
|
|
120
|
PreparedStatement ps = con.prepareStatement(sql);
|
85
|
121
|
try{
|
86
|
122
|
ps.setString(_m_1++,consultId);
|
87
|
|
java.sql.ResultSet rs = ps.executeQuery();
|
|
123
|
ResultSet rs = ps.executeQuery();
|
88
|
124
|
try{
|
89
|
|
java.util.List<com.ekexiu.portal.po.Tidings> _result = new java.util.ArrayList<com.ekexiu.portal.po.Tidings>();
|
|
125
|
java.util.List<Tidings> _result = new java.util.ArrayList<Tidings>();
|
90
|
126
|
while(rs.next()){
|
91
|
|
com.ekexiu.portal.po.Tidings _obj = new com.ekexiu.portal.po.Tidings();
|
|
127
|
Tidings _obj = new Tidings();
|
92
|
128
|
_obj.setTidingsId(rs.getString(1));
|
93
|
129
|
_obj.setTidingsContant(rs.getString(2));
|
94
|
130
|
Professor professor = new Professor();
|