|
@ -1,18 +1,22 @@
|
1
|
1
|
package com.ekexiu.portal.dao;
|
2
|
2
|
|
3
|
3
|
import java.sql.Connection;
|
|
4
|
import java.sql.PreparedStatement;
|
|
5
|
import java.sql.ResultSet;
|
4
|
6
|
import java.sql.SQLException;
|
|
7
|
import java.util.ArrayList;
|
|
8
|
import java.util.List;
|
5
|
9
|
|
6
|
10
|
import org.jfw.apt.orm.annotation.dao.DAO;
|
7
|
11
|
import org.jfw.apt.orm.annotation.dao.method.From;
|
8
|
12
|
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
|
9
|
|
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
|
10
|
13
|
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
|
11
|
14
|
import org.jfw.apt.orm.annotation.dao.param.Set;
|
12
|
15
|
import org.jfw.util.exception.JfwBaseException;
|
13
|
16
|
|
14
|
17
|
import com.ekexiu.portal.po.Operation;
|
15
|
18
|
import com.ekexiu.portal.po.PayHistory;
|
|
19
|
import com.ekexiu.portal.po.Professor;
|
16
|
20
|
|
17
|
21
|
@DAO
|
18
|
22
|
public abstract class PayHistoryDao {
|
|
@ -23,23 +27,56 @@ public abstract class PayHistoryDao {
|
23
|
27
|
@From(PayHistory.class)
|
24
|
28
|
public abstract int update(Connection con, String payHistoryId, @Set int payStatus) throws SQLException;
|
25
|
29
|
|
26
|
|
@SelectOne
|
27
|
|
public abstract PayHistory query(Connection con, String payHistoryId) throws SQLException, JfwBaseException;
|
28
|
|
|
29
|
|
// @SelectList
|
30
|
|
// public abstract List<PayHistory> queryOper(Connection con, String operationId) throws SQLException;
|
|
30
|
public PayHistory query(Connection con,String payHistoryId) throws SQLException, JfwBaseException{
|
|
31
|
int _m_1 = 1;
|
|
32
|
String sql = "SELECT PAY_HISTORY_ID,OPERATION_ID,PAID_MONEY,RETURN_MONEY,REMARK,ISONLINE,PAY_TYPE,PAY_STATUS,PAY_HISTORY.PROFESSOR_ID,PAY_HISTORY.CREATE_TIME,PROFESSOR.NAME FROM PAY_HISTORY LEFT JOIN PROFESSOR ON PAY_HISTORY.PROFESSOR_ID = PROFESSOR.ID WHERE PAY_HISTORY_ID = ?";
|
|
33
|
PreparedStatement ps = con.prepareStatement(sql);
|
|
34
|
try{
|
|
35
|
ps.setString(_m_1++,payHistoryId);
|
|
36
|
ResultSet rs = ps.executeQuery();
|
|
37
|
try{
|
|
38
|
if(rs.next()){
|
|
39
|
PayHistory _result = new PayHistory();
|
|
40
|
_result.setPayHistoryId(rs.getString(1));
|
|
41
|
_result.setOperationId(rs.getString(2));
|
|
42
|
_result.setPaidMoney(rs.getBigDecimal(3));
|
|
43
|
_result.setReturnMoney(rs.getBigDecimal(4));
|
|
44
|
String _m_2 = rs.getString(5);
|
|
45
|
if(rs.wasNull()){
|
|
46
|
_m_2 = null;
|
|
47
|
}
|
|
48
|
_result.setRemark(_m_2);
|
|
49
|
_result.setIsonline(rs.getInt(6));
|
|
50
|
_result.setPayType(rs.getInt(7));
|
|
51
|
_result.setPayStatus(rs.getInt(8));
|
|
52
|
Professor professor = new Professor();
|
|
53
|
professor.setId(rs.getString(9));
|
|
54
|
_result.setCreateTime(rs.getString(10));
|
|
55
|
professor.setName(rs.getString(11));
|
|
56
|
_result.setProfessor(professor);
|
|
57
|
return _result;
|
|
58
|
}else{
|
|
59
|
throw new JfwBaseException(201);
|
|
60
|
}
|
|
61
|
}finally{
|
|
62
|
try{rs.close();}catch(Exception _m_3){}
|
|
63
|
}
|
|
64
|
}finally{
|
|
65
|
try{ps.close();}catch(Exception _m_4){}
|
|
66
|
}
|
|
67
|
}
|
31
|
68
|
|
32
|
|
public java.util.List<com.ekexiu.portal.po.PayHistory> queryDetail(java.sql.Connection con,java.lang.String operationId) throws java.sql.SQLException{
|
|
69
|
public List<PayHistory> queryDetail(Connection con,String operationId) throws SQLException{
|
33
|
70
|
int _m_1 = 1;
|
34
|
|
String sql = "SELECT PAY_HISTORY_ID,PAY_HISTORY.OPERATION_ID,PAID_MONEY,RETURN_MONEY,REMARK,ISONLINE,PAY_TYPE,PAY_HISTORY.CREATE_TIME,OPERATION.DEAL_PRICE,OPERATION.CREATE_TIME FROM PAY_HISTORY LEFT JOIN OPERATION ON PAY_HISTORY.OPERATION_ID = OPERATION.OPERATION_ID WHERE PAY_HISTORY.OPERATION_ID = ?";
|
35
|
|
java.sql.PreparedStatement ps = con.prepareStatement(sql);
|
|
71
|
String sql = "SELECT PAY_HISTORY_ID,PAY_HISTORY.OPERATION_ID,PAID_MONEY,RETURN_MONEY,REMARK,ISONLINE,PAY_TYPE,PAY_HISTORY.CREATE_TIME,OPERATION.DEAL_PRICE,OPERATION.CREATE_TIME,PAY_HISTORY.PROFESSOR_ID,PROFESSOR.NAME FROM PAY_HISTORY LEFT JOIN OPERATION ON PAY_HISTORY.OPERATION_ID = OPERATION.OPERATION_ID LEFT JOIN PROFESSOR ON PAY_HISTORY.PROFESSOR_ID = PROFESSOR.ID WHERE PAY_HISTORY.OPERATION_ID = ?";
|
|
72
|
PreparedStatement ps = con.prepareStatement(sql);
|
36
|
73
|
try{
|
37
|
74
|
ps.setString(_m_1++,operationId);
|
38
|
|
java.sql.ResultSet rs = ps.executeQuery();
|
|
75
|
ResultSet rs = ps.executeQuery();
|
39
|
76
|
try{
|
40
|
|
java.util.List<com.ekexiu.portal.po.PayHistory> _result = new java.util.ArrayList<com.ekexiu.portal.po.PayHistory>();
|
|
77
|
List<PayHistory> _result = new ArrayList<PayHistory>();
|
41
|
78
|
while(rs.next()){
|
42
|
|
com.ekexiu.portal.po.PayHistory _obj = new com.ekexiu.portal.po.PayHistory();
|
|
79
|
PayHistory _obj = new PayHistory();
|
43
|
80
|
_obj.setPayHistoryId(rs.getString(1));
|
44
|
81
|
Operation operation = new Operation();
|
45
|
82
|
operation.setOperationId(rs.getString(2));
|
|
@ -56,6 +93,10 @@ public abstract class PayHistoryDao {
|
56
|
93
|
operation.setDealPrice(rs.getBigDecimal(9));
|
57
|
94
|
operation.setCreateTime(rs.getString(10));
|
58
|
95
|
_obj.setOperation(operation);
|
|
96
|
Professor professor = new Professor();
|
|
97
|
professor.setId(rs.getString(11));
|
|
98
|
professor.setName(rs.getString(12));
|
|
99
|
_obj.setProfessor(professor);
|
59
|
100
|
_result.add(_obj);
|
60
|
101
|
}
|
61
|
102
|
return _result;
|