|
@ -11,15 +11,12 @@ import java.util.List;
|
11
|
11
|
|
12
|
12
|
import org.jfw.apt.annotation.Nullable;
|
13
|
13
|
import org.jfw.apt.orm.annotation.dao.DAO;
|
14
|
|
import org.jfw.apt.orm.annotation.dao.method.From;
|
15
|
14
|
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
|
16
|
15
|
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
|
17
|
|
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
|
18
|
|
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
|
19
|
|
import org.jfw.apt.orm.annotation.dao.param.Set;
|
20
|
16
|
import org.jfw.util.PageQueryResult;
|
21
|
17
|
|
22
|
18
|
import com.ekexiu.portal.po.Consult;
|
|
19
|
import com.ekexiu.portal.po.Professor;
|
23
|
20
|
import com.ekexiu.portal.pojo.EditProfessor;
|
24
|
21
|
|
25
|
22
|
@DAO
|
|
@ -27,12 +24,18 @@ public abstract class ConsultDao {
|
27
|
24
|
@Insert
|
28
|
25
|
public abstract int insert(Connection con, Consult consult) throws SQLException;
|
29
|
26
|
|
30
|
|
@Update
|
31
|
|
public abstract int update(Connection con, Consult consult) throws SQLException;
|
32
|
|
|
33
|
|
@UpdateWith
|
34
|
|
@From(Consult.class)
|
35
|
|
public abstract int updateFinishTime(Connection con, String consultId, @Set String finishTime) throws SQLException;
|
|
27
|
public int updateFinishTime(Connection con,String consultId,int consultStatus) throws SQLException{
|
|
28
|
int _m_2 = 1;
|
|
29
|
String sql ="UPDATE CONSULT SET FINISH_TIME= TO_CHAR(NOW(),'YYYYMMDDHH24MISS'),CONSULT_STATUS= ? WHERE CONSULT_ID = ?";
|
|
30
|
PreparedStatement ps = con.prepareStatement(sql);
|
|
31
|
try{
|
|
32
|
ps.setInt(_m_2++, consultStatus);
|
|
33
|
ps.setString(_m_2++,consultId);
|
|
34
|
return ps.executeUpdate();
|
|
35
|
}finally{
|
|
36
|
try{ps.close();}catch(Exception _m_3){}
|
|
37
|
}
|
|
38
|
}
|
36
|
39
|
|
37
|
40
|
public int updateRevoveryTime(Connection con,String consultId) throws SQLException{
|
38
|
41
|
int _m_1 = 1;
|
|
@ -46,16 +49,185 @@ public abstract class ConsultDao {
|
46
|
49
|
}
|
47
|
50
|
}
|
48
|
51
|
|
|
52
|
public int updateAssess(Connection con, String consultId, int assessStatus, int assessStar, String assessContant) throws SQLException{
|
|
53
|
int _m_2 = 1;
|
|
54
|
boolean _m_3 = null == assessContant;
|
|
55
|
String sql ="UPDATE CONSULT SET ASSESS_TIME= TO_CHAR(NOW(),'YYYYMMDDHH24MISS'),ASSESS_CONTANT= ?,ASSESS_STAR= ?,ASSESS_STATUS= ? WHERE CONSULT_ID = ?";
|
|
56
|
PreparedStatement ps = con.prepareStatement(sql);
|
|
57
|
try{
|
|
58
|
if(_m_3){
|
|
59
|
ps.setNull(_m_2++,12);
|
|
60
|
}else{
|
|
61
|
ps.setString(_m_2++,assessContant);
|
|
62
|
}
|
|
63
|
ps.setInt(_m_2++,assessStar);
|
|
64
|
ps.setInt(_m_2++, assessStatus);
|
|
65
|
ps.setString(_m_2++,consultId);
|
|
66
|
return ps.executeUpdate();
|
|
67
|
}finally{
|
|
68
|
try{ps.close();}catch(Exception _m_4){}
|
|
69
|
}
|
|
70
|
}
|
|
71
|
|
|
72
|
public int updateThanks(Connection con,String consultId,int thanksStatus,BigDecimal thanksMoney) throws SQLException{
|
|
73
|
int _m_2 = 1;
|
|
74
|
boolean _m_3 = null == thanksMoney;
|
|
75
|
String sql ="UPDATE CONSULT SET THANKS_TIME= TO_CHAR(NOW(),'YYYYMMDDHH24MISS'),THANKS_MONEY= ?,THANKS_STATUS= ? WHERE CONSULT_ID = ?";
|
|
76
|
PreparedStatement ps = con.prepareStatement(sql);
|
|
77
|
try{
|
|
78
|
if(_m_3){
|
|
79
|
ps.setNull(_m_2++,3);
|
|
80
|
}else{
|
|
81
|
ps.setBigDecimal(_m_2++,thanksMoney);
|
|
82
|
}
|
|
83
|
ps.setInt(_m_2++,thanksStatus);
|
|
84
|
ps.setString(_m_2++,consultId);
|
|
85
|
return ps.executeUpdate();
|
|
86
|
}finally{
|
|
87
|
try{ps.close();}catch(Exception _m_4){}
|
|
88
|
}
|
|
89
|
}
|
|
90
|
|
49
|
91
|
@SelectOne
|
50
|
92
|
@Nullable
|
51
|
93
|
public abstract Consult query(Connection con, String consultId) throws SQLException;
|
52
|
94
|
|
53
|
|
public PageQueryResult<Consult> queryPagePro(Connection con, String professorId, int consultStatus, int timeType, int sortType, int pageSize, int pageNo) throws SQLException{
|
|
95
|
public Consult queryPro(Connection con,String consultId) throws SQLException{
|
|
96
|
int _m_1 = 1;
|
|
97
|
String sql = "SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,PROFESSOR_ID,CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.CREATE_TIME,PROFESSOR.NAME FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.CONSULTANT_ID = PROFESSOR.ID WHERE CONSULT_ID = ?";
|
|
98
|
PreparedStatement ps = con.prepareStatement(sql);
|
|
99
|
try{
|
|
100
|
ps.setString(_m_1++,consultId);
|
|
101
|
ResultSet rs = ps.executeQuery();
|
|
102
|
try{
|
|
103
|
if(rs.next()){
|
|
104
|
Consult _result = new Consult();
|
|
105
|
_result.setConsultId(rs.getString(1));
|
|
106
|
_result.setConsultType(rs.getString(2));
|
|
107
|
_result.setConsultTitle(rs.getString(3));
|
|
108
|
_result.setConsultContant(rs.getString(4));
|
|
109
|
_result.setProfessorId(rs.getString(5));
|
|
110
|
Professor professor = new Professor();
|
|
111
|
professor.setId(rs.getString(6));
|
|
112
|
_result.setConsultStatus(rs.getInt(7));
|
|
113
|
String _m_2 = rs.getString(8);
|
|
114
|
if(rs.wasNull()){
|
|
115
|
_m_2 = null;
|
|
116
|
}
|
|
117
|
_result.setFinishTime(_m_2);
|
|
118
|
_result.setAssessStatus(rs.getInt(9));
|
|
119
|
_result.setAssessStar(rs.getInt(10));
|
|
120
|
String _m_3 = rs.getString(11);
|
|
121
|
if(rs.wasNull()){
|
|
122
|
_m_3 = null;
|
|
123
|
}
|
|
124
|
_result.setAssessContant(_m_3);
|
|
125
|
String _m_4 = rs.getString(12);
|
|
126
|
if(rs.wasNull()){
|
|
127
|
_m_4 = null;
|
|
128
|
}
|
|
129
|
_result.setAssessTime(_m_4);
|
|
130
|
_result.setThanksStatus(rs.getInt(13));
|
|
131
|
BigDecimal _m_5 = rs.getBigDecimal(14);
|
|
132
|
if(rs.wasNull()){
|
|
133
|
_m_5 = null;
|
|
134
|
}
|
|
135
|
_result.setThanksMoney(_m_5);
|
|
136
|
String _m_6 = rs.getString(15);
|
|
137
|
if(rs.wasNull()){
|
|
138
|
_m_6 = null;
|
|
139
|
}
|
|
140
|
_result.setThanksTime(_m_6);
|
|
141
|
_result.setRevoveryTime(rs.getString(16));
|
|
142
|
_result.setCreateTime(rs.getString(17));
|
|
143
|
professor.setName(rs.getString(18));
|
|
144
|
_result.setProfessor(professor);
|
|
145
|
return _result;
|
|
146
|
}else{
|
|
147
|
return null;
|
|
148
|
}
|
|
149
|
}finally{
|
|
150
|
try{rs.close();}catch(Exception _m_7){}
|
|
151
|
}
|
|
152
|
}finally{
|
|
153
|
try{ps.close();}catch(Exception _m_8){}
|
|
154
|
}
|
|
155
|
}
|
|
156
|
|
|
157
|
public Consult queryCon(Connection con,String consultId) throws SQLException{
|
|
158
|
int _m_1 = 1;
|
|
159
|
String sql = "SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,PROFESSOR_ID,CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.CREATE_TIME,PROFESSOR.NAME FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.PROFESSOR_ID = PROFESSOR.ID WHERE CONSULT_ID = ?";
|
|
160
|
PreparedStatement ps = con.prepareStatement(sql);
|
|
161
|
try{
|
|
162
|
ps.setString(_m_1++,consultId);
|
|
163
|
ResultSet rs = ps.executeQuery();
|
|
164
|
try{
|
|
165
|
if(rs.next()){
|
|
166
|
Consult _result = new Consult();
|
|
167
|
_result.setConsultId(rs.getString(1));
|
|
168
|
_result.setConsultType(rs.getString(2));
|
|
169
|
_result.setConsultTitle(rs.getString(3));
|
|
170
|
_result.setConsultContant(rs.getString(4));
|
|
171
|
Professor professor = new Professor();
|
|
172
|
professor.setId(rs.getString(5));
|
|
173
|
_result.setConsultantId(rs.getString(6));
|
|
174
|
_result.setConsultStatus(rs.getInt(7));
|
|
175
|
String _m_2 = rs.getString(8);
|
|
176
|
if(rs.wasNull()){
|
|
177
|
_m_2 = null;
|
|
178
|
}
|
|
179
|
_result.setFinishTime(_m_2);
|
|
180
|
_result.setAssessStatus(rs.getInt(9));
|
|
181
|
_result.setAssessStar(rs.getInt(10));
|
|
182
|
String _m_3 = rs.getString(11);
|
|
183
|
if(rs.wasNull()){
|
|
184
|
_m_3 = null;
|
|
185
|
}
|
|
186
|
_result.setAssessContant(_m_3);
|
|
187
|
String _m_4 = rs.getString(12);
|
|
188
|
if(rs.wasNull()){
|
|
189
|
_m_4 = null;
|
|
190
|
}
|
|
191
|
_result.setAssessTime(_m_4);
|
|
192
|
_result.setThanksStatus(rs.getInt(13));
|
|
193
|
BigDecimal _m_5 = rs.getBigDecimal(14);
|
|
194
|
if(rs.wasNull()){
|
|
195
|
_m_5 = null;
|
|
196
|
}
|
|
197
|
_result.setThanksMoney(_m_5);
|
|
198
|
String _m_6 = rs.getString(15);
|
|
199
|
if(rs.wasNull()){
|
|
200
|
_m_6 = null;
|
|
201
|
}
|
|
202
|
_result.setThanksTime(_m_6);
|
|
203
|
_result.setRevoveryTime(rs.getString(16));
|
|
204
|
_result.setCreateTime(rs.getString(17));
|
|
205
|
professor.setName(rs.getString(18));
|
|
206
|
_result.setProfessor(professor);
|
|
207
|
return _result;
|
|
208
|
}else{
|
|
209
|
return null;
|
|
210
|
}
|
|
211
|
}finally{
|
|
212
|
try{rs.close();}catch(Exception _m_7){}
|
|
213
|
}
|
|
214
|
}finally{
|
|
215
|
try{ps.close();}catch(Exception _m_8){}
|
|
216
|
}
|
|
217
|
}
|
|
218
|
|
|
219
|
public PageQueryResult<Consult> queryPagePro(Connection con, String professorId, int status, int timeType, int sortType, int pageSize, int pageNo) throws SQLException{
|
54
|
220
|
PageQueryResult<Consult> queryResult = new PageQueryResult<Consult>();
|
55
|
221
|
StringBuilder sql = new StringBuilder();
|
56
|
222
|
sql.append(" WHERE CONSULT.PROFESSOR_ID = ? ");
|
57
|
|
if(0 != consultStatus) {
|
58
|
|
sql.append(" AND CONSULT_STATUS = ? ");
|
|
223
|
if(1 == status) {
|
|
224
|
sql.append(" AND CONSULT_STATUS = 0 ");
|
|
225
|
}else if(2 == status) {
|
|
226
|
sql.append(" AND CONSULT_STATUS = 1 AND THANKS_STATUS = 0 ");
|
|
227
|
}else if(3 == status) {
|
|
228
|
sql.append(" AND CONSULT_STATUS = 1 AND ASSESS_STATUS = 0 ");
|
|
229
|
}else if(4 == status) {
|
|
230
|
sql.append(" AND CONSULT_STATUS = 1 ");
|
59
|
231
|
}
|
60
|
232
|
StringBuilder whereSql = sql;
|
61
|
233
|
sql = new StringBuilder();
|
|
@ -68,9 +240,6 @@ public abstract class ConsultDao {
|
68
|
240
|
int totalSize = 0;
|
69
|
241
|
try {
|
70
|
242
|
ps.setString(paramIndex++, professorId);
|
71
|
|
if(0 != consultStatus){
|
72
|
|
ps.setInt(paramIndex++, consultStatus);
|
73
|
|
}
|
74
|
243
|
queryResult.setPageSize(pageSize);
|
75
|
244
|
ResultSet resultSet = ps.executeQuery();
|
76
|
245
|
try {
|
|
@ -156,9 +325,6 @@ public abstract class ConsultDao {
|
156
|
325
|
ps = con.prepareStatement(sql.toString());
|
157
|
326
|
try {
|
158
|
327
|
ps.setString(paramIndex++, professorId);
|
159
|
|
if(0 != consultStatus){
|
160
|
|
ps.setInt(paramIndex++, consultStatus);
|
161
|
|
}
|
162
|
328
|
ResultSet rs = ps.executeQuery();
|
163
|
329
|
try {
|
164
|
330
|
List<Consult> _m_11 = new ArrayList<Consult>();
|
|
@ -248,12 +414,18 @@ public abstract class ConsultDao {
|
248
|
414
|
}
|
249
|
415
|
}
|
250
|
416
|
|
251
|
|
public PageQueryResult<Consult> queryPageCon(Connection con, String consultantId, int consultStatus, int timeType, int sortType, int pageSize, int pageNo) throws SQLException{
|
|
417
|
public PageQueryResult<Consult> queryPageCon(Connection con, String consultantId, int status, int timeType, int sortType, int pageSize, int pageNo) throws SQLException{
|
252
|
418
|
PageQueryResult<Consult> queryResult = new PageQueryResult<Consult>();
|
253
|
419
|
StringBuilder sql = new StringBuilder();
|
254
|
420
|
sql.append(" WHERE CONSULT.CONSULTANT_ID = ? ");
|
255
|
|
if(0 != consultStatus) {
|
256
|
|
sql.append(" AND CONSULT_STATUS = ? ");
|
|
421
|
if(1 == status) {
|
|
422
|
sql.append(" AND CONSULT_STATUS = 0 ");
|
|
423
|
}else if(2 == status) {
|
|
424
|
sql.append(" AND CONSULT_STATUS = 1 AND THANKS_STATUS = 0 ");
|
|
425
|
}else if(3 == status) {
|
|
426
|
sql.append(" AND CONSULT_STATUS = 1 AND ASSESS_STATUS = 0 ");
|
|
427
|
}else if(4 == status) {
|
|
428
|
sql.append(" AND CONSULT_STATUS = 1 ");
|
257
|
429
|
}
|
258
|
430
|
StringBuilder whereSql = sql;
|
259
|
431
|
sql = new StringBuilder();
|
|
@ -266,10 +438,6 @@ public abstract class ConsultDao {
|
266
|
438
|
int totalSize = 0;
|
267
|
439
|
try {
|
268
|
440
|
ps.setString(paramIndex++, consultantId);
|
269
|
|
if(0 != consultStatus){
|
270
|
|
ps.setInt(paramIndex++, consultStatus);
|
271
|
|
}
|
272
|
|
queryResult.setPageSize(pageSize);
|
273
|
441
|
ResultSet resultSet = ps.executeQuery();
|
274
|
442
|
try {
|
275
|
443
|
resultSet.next();
|
|
@ -354,9 +522,6 @@ public abstract class ConsultDao {
|
354
|
522
|
ps = con.prepareStatement(sql.toString());
|
355
|
523
|
try {
|
356
|
524
|
ps.setString(paramIndex++, consultantId);
|
357
|
|
if(0 != consultStatus){
|
358
|
|
ps.setInt(paramIndex++, consultStatus);
|
359
|
|
}
|
360
|
525
|
ResultSet rs = ps.executeQuery();
|
361
|
526
|
try {
|
362
|
527
|
List<Consult> _m_11 = new ArrayList<Consult>();
|