Pārlūkot izejas kodu

新增资源多条件模糊查询,订单多条件查询(按订单时间、订单成交金额、资源名称、需求者姓名查询)。

zzy.zhiyuan.foxmail 8 gadi atpakaļ
vecāks
revīzija
d3f79d3504

+ 187 - 0
src/main/java/com/ekexiu/portal/dao/OperationDao.java

@ -15,6 +15,8 @@ import org.jfw.apt.orm.annotation.dao.method.operator.Update;
15 15
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
16 16

17 17
import com.ekexiu.portal.po.Operation;
18
import com.ekexiu.portal.po.Professor;
19
import com.ekexiu.portal.po.Resource;
18 20

19 21
@DAO
20 22
public abstract class OperationDao {
@ -61,4 +63,189 @@ public abstract class OperationDao {
61 63
	@From(Operation.class)
62 64
	public abstract int deleteProRes(Connection con, String demandId, String resourceId) throws SQLException;
63 65
	
66
	public org.jfw.util.PageQueryResult<com.ekexiu.portal.po.Operation> queryPage(java.sql.Connection con,java.lang.String professorName,java.lang.String resourceName,java.lang.String firstTime,java.lang.String lastTime,java.math.BigDecimal lowPrice,java.math.BigDecimal highPrice,int pageSize,int pageNo) throws java.sql.SQLException{
67
        int _m_1 = 0;
68
        org.jfw.util.PageQueryResult<com.ekexiu.portal.po.Operation> _result = new org.jfw.util.PageQueryResult<com.ekexiu.portal.po.Operation>();
69
        int _m_3 = 1;
70
        boolean _m1 = null == professorName;
71
        boolean _m2 = null == resourceName;
72
        boolean _m3 = null == firstTime;
73
        boolean _m4 = null == lastTime;
74
        boolean _m5 = null == lowPrice;
75
        boolean _m6 = null == highPrice;
76
        StringBuilder sql = new StringBuilder();
77
        boolean _m_5 = true;
78
        if(!_m1){
79
            _m_5 =  false;
80
            sql.append(" WHERE DEMAND_ID (SELECT PROFESSOR.PROFESSOR.ID FROM PROFESSOR WHERE PROFESSOR.NAME LIKE ?)");
81
        }
82
        if(!_m2){
83
            if(_m_5){
84
                _m_5 =  false;
85
                sql.append(" WHERE OPERATION.RESOURCE_ID IN (SELECT RESOURCE.RESOURCE_ID FROM RESOURCE WHERE RESOURCE_NAME LIKE ?)");
86
            }else{
87
                sql.append(" OR OPERATION.RESOURCE_ID IN (SELECT RESOURCE.RESOURCE_ID FROM RESOURCE WHERE RESOURCE_NAME LIKE ?)");
88
            }
89
        }
90
        if(!_m3){
91
            if(_m_5){
92
                _m_5 =  false;
93
                sql.append(" WHERE OPERATION.CREATE_TIME > ?");
94
            }else{
95
                sql.append(" AND OPERATION.CREATE_TIME > ?");
96
            }
97
        }
98
        if(!_m4){
99
            if(_m_5){
100
                _m_5 =  false;
101
                sql.append(" WHERE OPERATION.CREATE_TIME <= ?");
102
            }else{
103
                sql.append(" AND OPERATION.CREATE_TIME <= ?");
104
            }
105
        }
106
        if(!_m5){
107
            if(_m_5){
108
                _m_5 =  false;
109
                sql.append(" WHERE DEAL_PRICE > ?");
110
            }else{
111
                sql.append(" AND DEAL_PRICE > ?");
112
            }
113
        }
114
        if(!_m6){
115
            if(_m_5){
116
                _m_5 =  false;
117
                sql.append(" WHERE DEAL_PRICE <= ?");
118
            }else{
119
                sql.append(" AND DEAL_PRICE <= ?");
120
            }
121
        }
122
        StringBuilder _m_4 = sql;
123
        sql = new StringBuilder();
124
        sql.append("SELECT COUNT(1) FROM OPERATION");
125
        if(_m_4.length()>0){
126
            sql.append(_m_4);
127
        }
128
        java.sql.PreparedStatement ps = con.prepareStatement(sql.toString());
129
        try{
130
            if(!_m1){
131
                ps.setString(_m_3++,professorName);
132
            }
133
            if(!_m2){
134
                ps.setString(_m_3++,resourceName);
135
            }
136
            if(!_m3){
137
                ps.setString(_m_3++,firstTime);
138
            }
139
            if(!_m4){
140
                ps.setString(_m_3++,lastTime);
141
            }
142
            if(!_m5){
143
                ps.setBigDecimal(_m_3++,lowPrice);
144
            }
145
            if(!_m6){
146
                ps.setBigDecimal(_m_3++,highPrice);
147
            }
148
            _result.setPageSize(pageSize);
149
            java.sql.ResultSet _pageRs = ps.executeQuery();
150
            try{
151
                _pageRs.next();
152
                _m_1 = _pageRs.getInt(1);
153
            }finally{
154
                try{_pageRs.close();}catch(Exception _m_6){}
155
            }
156
        }finally{
157
            try{ps.close();}catch(Exception _m_7){}
158
        }
159
        _result.setTotal(_m_1);
160
        if(0== _m_1){
161
            _result.setPageNo(1);
162
            _result.setData(java.util.Collections.<com.ekexiu.portal.po.Operation>emptyList());
163
            return _result;
164
        }
165
        _m_3 = 1;
166
        boolean _m_8 = (1 == pageNo);
167
        if(_m_8){
168
            _result.setPageNo(1);
169
            sql = new StringBuilder();
170
            sql.append("SELECT REPLY_NOTES,OPERATION.CREATE_TIME,OPERATION_ID,OPERATION_STATUS,DEMAND_ID,DETAIL_DEMAND,DELIVER_TIME,OPERATION.RESOURCE_ID,DEAL_PRICE,DEAL_TIME,PAY_METHOD,PROFESSOR.NAME,RESOURCE_NAME FROM OPERATION LEFT JOIN PROFESSOR ON DEMAND_ID = PROFESSOR.ID LEFT JOIN RESOURCE ON OPERATION.RESOURCE_ID = RESOURCE.RESOURCE_ID");
171
            if(_m_4.length()>0){
172
                sql.append(_m_4);
173
            }
174
            sql.append(" ORDER BY OPERATION.CREATE_TIME");
175
            sql.append(" LIMIT ").append(pageSize);
176
        }else{
177
            int _m_9 = _m_1 / pageSize;
178
            if(_m_1 % pageSize != 0){
179
                ++_m_9;
180
            }
181
            if(pageNo > _m_9){
182
                pageNo = _m_9;
183
            }
184
            _result.setPageNo(pageNo);
185
            --pageNo;
186
            int _m_10 = (pageNo * pageSize);
187
            sql = new StringBuilder();
188
            sql.append("SELECT REPLY_NOTES,OPERATION.CREATE_TIME,OPERATION_ID,OPERATION_STATUS,DEMAND_ID,DETAIL_DEMAND,DELIVER_TIME,OPERATION.RESOURCE_ID,DEAL_PRICE,DEAL_TIME,PAY_METHOD,PROFESSOR.NAME,RESOURCE_NAME FROM OPERATION LEFT JOIN PROFESSOR ON DEMAND_ID = PROFESSOR.ID LEFT JOIN RESOURCE ON OPERATION.RESOURCE_ID = RESOURCE.RESOURCE_ID");
189
            if(_m_4.length()>0){
190
                sql.append(_m_4);
191
            }
192
            sql.append(" ORDER BY OPERATION.CREATE_TIME");
193
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
194
        }
195
        ps = con.prepareStatement(sql.toString());
196
        try{
197
            if(!_m1){
198
                ps.setString(_m_3++,professorName);
199
            }
200
            if(!_m2){
201
                ps.setString(_m_3++,resourceName);
202
            }
203
            if(!_m3){
204
                ps.setString(_m_3++,firstTime);
205
            }
206
            if(!_m4){
207
                ps.setString(_m_3++,lastTime);
208
            }
209
            if(!_m5){
210
                ps.setBigDecimal(_m_3++,lowPrice);
211
            }
212
            if(!_m6){
213
                ps.setBigDecimal(_m_3++,highPrice);
214
            }
215
            java.sql.ResultSet rs = ps.executeQuery();
216
            try{
217
                java.util.List<com.ekexiu.portal.po.Operation> _m_11 = new java.util.ArrayList<com.ekexiu.portal.po.Operation>();
218
                _result.setData(_m_11);
219
                int _m_12 = 0;
220
                while((_m_12<pageSize) && rs.next()){
221
                    ++_m_12;
222
                    com.ekexiu.portal.po.Operation _obj =  new com.ekexiu.portal.po.Operation();
223
                    _obj.setReplyNotes(rs.getString(1));
224
                    _obj.setCreateTime(rs.getString(2));
225
                    _obj.setOperationId(rs.getString(3));
226
                    _obj.setOperationStatus(rs.getInt(4));
227
                    Professor professor = new Professor();
228
                    professor.setId(rs.getString(5));
229
                    _obj.setDetailDemand(rs.getString(6));
230
                    _obj.setDeliverTime(rs.getString(7));
231
                    Resource resource = new Resource();
232
                    resource.setResourceId(rs.getString(8));
233
                    _obj.setDealPrice(rs.getBigDecimal(9));
234
                    _obj.setDealTime(rs.getString(10));
235
                    _obj.setPayMethod(rs.getString(11));
236
                    professor.setName(rs.getString(12));
237
                    _obj.setProfessor(professor);
238
                    resource.setResourceName(rs.getString(13));
239
                    _obj.setResource(resource);
240
                    _m_11.add(_obj);
241
                }
242
                return _result;
243
            }finally{
244
                try{rs.close();}catch(Exception _m_13){}
245
            }
246
        }finally{
247
            try{ps.close();}catch(Exception _m_14){}
248
        }
249
    }
250
	
64 251
}

+ 196 - 170
src/main/java/com/ekexiu/portal/dao/ResourceDao.java

@ -1,10 +1,7 @@
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;
6 4
import java.sql.SQLException;
7
import java.util.ArrayList;
8 5
import java.util.List;
9 6

10 7
import org.jfw.apt.annotation.Nullable;
@ -18,7 +15,6 @@ import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
18 15
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
19 16
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
20 17
import org.jfw.apt.orm.annotation.dao.param.Set;
21
import org.jfw.util.PageQueryResult;
22 18

23 19
import com.ekexiu.portal.po.Professor;
24 20
import com.ekexiu.portal.po.Resource;
@ -77,172 +73,202 @@ public abstract class ResourceDao {
77 73
	 * @param pageSize 
78 74
	 * @param pageNo
79 75
	 * @return
80
	 * @throws SQLException
76
	 * @throws java.sql.SQLException
81 77
	 */
82
	public PageQueryResult<Resource> queryPage(Connection con, @Nullable String key, String subject, String industry, int pageSize, int pageNo) throws SQLException {
83
		PageQueryResult<Resource> _result = new PageQueryResult<Resource>();
84
		StringBuilder sql = new StringBuilder();
85
		boolean hasKey = null != key;
86
		if (hasKey) {
87
			sql.append(
88
					" WHERE (( RESOURCE_NAME LIKE ? ) OR ( SUPPORTED_SERVICES LIKE ? ) OR ( DESCP LIKE ? ) OR ( COOPERATION_NOTES LIKE ? ))");
89
		}
90
		boolean hasSubject = null != subject;
91
		boolean hasIndustry = null != industry;
92
		if (hasSubject) {
93
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(SUBJECT LIKE ?)");
94
		}
95
		if (hasIndustry) {
96
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(INDUSTRY LIKE ?)");
97
		}
98
		StringBuilder whereSql = sql;
99
		sql = new StringBuilder();
100
		sql.append("SELECT COUNT(1) FROM RESOURCE");
101
		if (whereSql.length() > 0) {
102
			sql.append(whereSql);
103
		}
104
		PreparedStatement ps = con.prepareStatement(sql.toString());
105
		int paramIndex = 1;
106
		int totalSize = 0;
107
		try {
108
			if (hasKey) {
109
				ps.setString(paramIndex++, key);
110
				ps.setString(paramIndex++, key);
111
				ps.setString(paramIndex++, key);
112
				ps.setString(paramIndex++, key);
113
			}
114
			if (hasSubject) {
115
				ps.setString(paramIndex++, subject);
116
			}
117
			if (hasIndustry) {
118
				ps.setString(paramIndex++, industry);
119
			}
120
			_result.setPageSize(pageSize);
121
			ResultSet _pageRs = ps.executeQuery();
122
			try {
123
				_pageRs.next();
124
				totalSize = _pageRs.getInt(1);
125
			} finally {
126
				try {
127
					_pageRs.close();
128
				} catch (Exception _m_6) {
129
				}
130
			}
131
		} finally {
132
			try {
133
				ps.close();
134
			} catch (Exception _m_7) {
135
			}
136
		}
137
		_result.setTotal(totalSize);
138
		if (0 == totalSize) {
139
			_result.setPageNo(1);
140
			_result.setData(java.util.Collections.<com.ekexiu.portal.po.Resource> emptyList());
141
			return _result;
142
		}
143
		paramIndex = 1;
144
		if (1 == pageNo) {
145
			_result.setPageNo(1);
146
			sql = new StringBuilder();
147
			//左连接查询资源表和专家表,方便前台显示专家姓名
148
			sql.append(" SELECT RESOURCE_ID,RESOURCE_NAME,SUPPORTED_SERVICES,R.DESCP,PROFESSOR_ID,P.NAME,R.CREATE_TIME,R.MODIFY_TIME,HOPE_PAY_METHOD,COOPERATION_NOTES,R.SUBJECT,R.INDUSTRY FROM RESOURCE R LEFT JOIN PROFESSOR P ON PROFESSOR_ID = P.ID ");
149
			if (whereSql.length() > 0) {
150
				sql.append(whereSql);
151
			}
152
			sql.append(" ORDER BY RESOURCE_NAME ");
153
			sql.append(" LIMIT ").append(pageSize);
154
		} else {
155
			int _pageSize = totalSize / pageSize;
156
			if (totalSize % pageSize != 0) {
157
				++_pageSize;
158
			}
159
			if (pageNo > _pageSize) {
160
				pageNo = _pageSize;
161
			}
162
			_result.setPageNo(pageNo);
163
			--pageNo;
164
			int _m_10 = (pageNo * pageSize);
165
			sql = new StringBuilder();
166
			sql.append(" SELECT RESOURCE_ID,RESOURCE_NAME,SUPPORTED_SERVICES,R.DESCP,PROFESSOR_ID,P.NAME,R.CREATE_TIME,R.MODIFY_TIME,HOPE_PAY_METHOD,COOPERATION_NOTES,R.SUBJECT,R.INDUSTRY FROM RESOURCE R LEFT JOIN PROFESSOR P ON PROFESSOR_ID = P.ID ");
167
			if (whereSql.length() > 0) {
168
				sql.append(whereSql);
169
			}
170
			sql.append(" ORDER BY RESOURCE ");
171
			sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
172
		}
173
		ps = con.prepareStatement(sql.toString());
174
		try {
175
			if (hasKey) {
176
				ps.setString(paramIndex++, key);
177
				ps.setString(paramIndex++, key);
178
				ps.setString(paramIndex++, key);
179
				ps.setString(paramIndex++, key);
180
			}
181
			if (hasSubject) {
182
				ps.setString(paramIndex++, subject);
183
			}
184
			if (hasIndustry) {
185
				ps.setString(paramIndex++, industry);
186
			}
187
			ResultSet rs = ps.executeQuery();
188
			try {
189
				List<Resource> _m_11 = new ArrayList<Resource>();
190
				_result.setData(_m_11);
191
				while (rs.next()) {
192
					Resource obj = new Resource();
193
					obj.setResourceId(rs.getString(1));
194
					String _m_13 = rs.getString(2);
195
					if (rs.wasNull()) {
196
						_m_13 = null;
197
					}
198
					obj.setResourceName(_m_13);
199
					String _m_14 = rs.getString(3);
200
					if (rs.wasNull()) {
201
						_m_14 = null;
202
					}
203
					obj.setSupportedServices(_m_14);
204
					String _m_15 = rs.getString(4);
205
					if (rs.wasNull()) {
206
						_m_15 = null;
207
					}
208
					obj.setDescp(_m_15);
209
					Professor professor = new Professor();
210
					professor.setId(rs.getString(5));
211
					professor.setName(rs.getString(6));
212
					obj.setProfessor(professor);
213
					obj.setCreateTime(rs.getString(7));
214
					obj.setModifyTime(rs.getString(8));
215
					obj.setHopePayMethod(rs.getString(9));
216
					String _m_16 = rs.getString(10);
217
					if (rs.wasNull()) {
218
						_m_16 = null;
219
					}
220
					obj.setCooperationNotes(_m_16);
221
					String _m_17 = rs.getString(11);
222
					if (rs.wasNull()) {
223
						_m_17 = null;
224
					}
225
					obj.setSubject(_m_17);
226
					String _m_18 = rs.getString(12);
227
					if (rs.wasNull()) {
228
						_m_18 = null;
229
					}
230
					obj.setIndustry(_m_18);
231
					_m_11.add(obj);
232
				}
233
				return _result;
234
			} finally {
235
				try {
236
					rs.close();
237
				} catch (Exception _m_19) {
238
				}
239
			}
240
		} finally {
241
			try {
242
				ps.close();
243
			} catch (Exception _m_20) {
244
			}
245
		}
246
	}
78
	public org.jfw.util.PageQueryResult<com.ekexiu.portal.po.Resource> queryPage(java.sql.Connection con,java.lang.String key,java.lang.String subject,java.lang.String industry,int pageSize,int pageNo) throws java.sql.SQLException{
79
        int _m_1 = 0;
80
        org.jfw.util.PageQueryResult<com.ekexiu.portal.po.Resource> _result = new org.jfw.util.PageQueryResult<com.ekexiu.portal.po.Resource>();
81
        int _m_3 = 1;
82
        boolean _m_2 = null == key;
83
        boolean _m_4 = null == subject;
84
        boolean _m_5 = null == industry;
85
        StringBuilder sql = new StringBuilder();
86
        boolean _m_7 = true;
87
        if(!_m_2){
88
            _m_7 =  false;
89
            sql.append(" WHERE RESOURCE_NAME LIKE ?");
90
        }
91
        if(!_m_2){
92
            if(_m_7){
93
                _m_7 =  false;
94
                sql.append(" WHERE SUPPORTED_SERVICES LIKE ?");
95
            }else{
96
                sql.append(" OR SUPPORTED_SERVICES LIKE ?");
97
            }
98
        }
99
        if(!_m_2){
100
            if(_m_7){
101
                _m_7 =  false;
102
                sql.append(" WHERE RESOURCE.DESCP LIKE ?");
103
            }else{
104
                sql.append(" OR RESOURCE.DESCP LIKE ?");
105
            }
106
        }
107
        if(!_m_2){
108
            if(_m_7){
109
                _m_7 =  false;
110
                sql.append(" WHERE COOPERATION_NOTES LIKE ?");
111
            }else{
112
                sql.append(" OR COOPERATION_NOTES LIKE ?");
113
            }
114
        }
115
        if(!_m_4){
116
            if(_m_7){
117
                _m_7 =  false;
118
                sql.append(" WHERE RESOURCE.SUBJECT = ?");
119
            }else{
120
                sql.append(" OR RESOURCE.SUBJECT = ?");
121
            }
122
        }
123
        if(!_m_5){
124
            if(_m_7){
125
                _m_7 =  false;
126
                sql.append(" WHERE RESOURCE.INDUSTRY = ?");
127
            }else{
128
                sql.append(" OR RESOURCE.INDUSTRY = ?");
129
            }
130
        }
131
        StringBuilder _m_6 = sql;
132
        sql = new StringBuilder();
133
        sql.append("SELECT COUNT(1) FROM RESOURCE");
134
        if(_m_6.length()>0){
135
            sql.append(_m_6);
136
        }
137
        java.sql.PreparedStatement ps = con.prepareStatement(sql.toString());
138
        try{
139
            if(!_m_2){
140
                ps.setString(_m_3++,key);
141
            }
142
            if(!_m_2){
143
                ps.setString(_m_3++,key);
144
            }
145
            if(!_m_2){
146
                ps.setString(_m_3++,key);
147
            }
148
            if(!_m_2){
149
                ps.setString(_m_3++,key);
150
            }
151
            if(!_m_4){
152
                ps.setString(_m_3++,subject);
153
            }
154
            if(!_m_5){
155
                ps.setString(_m_3++,industry);
156
            }
157
            _result.setPageSize(pageSize);
158
            java.sql.ResultSet _pageRs = ps.executeQuery();
159
            try{
160
                _pageRs.next();
161
                _m_1 = _pageRs.getInt(1);
162
            }finally{
163
                try{_pageRs.close();}catch(Exception _m_8){}
164
            }
165
        }finally{
166
            try{ps.close();}catch(Exception _m_9){}
167
        }
168
        _result.setTotal(_m_1);
169
        if(0== _m_1){
170
            _result.setPageNo(1);
171
            _result.setData(java.util.Collections.<com.ekexiu.portal.po.Resource>emptyList());
172
            return _result;
173
        }
174
        _m_3 = 1;
175
        boolean _m_10 = (1 == pageNo);
176
        if(_m_10){
177
            _result.setPageNo(1);
178
            sql = new StringBuilder();
179
            sql.append("SELECT RESOURCE_ID,RESOURCE_NAME,RESOURCE.SUBJECT,RESOURCE.INDUSTRY,SUPPORTED_SERVICES,RESOURCE.DESCP,PROFESSOR_ID,ASCRIPTION,HOPE_PAY_METHOD,COOPERATION_NOTES,RESOURCE.CREATE_TIME,RESOURCE.MODIFY_TIME,PROFESSOR.NAME FROM RESOURCE LEFT JOIN PROFESSOR ON PROFESSOR_ID = PROFESSOR.ID");
180
            if(_m_6.length()>0){
181
                sql.append(_m_6);
182
            }
183
            sql.append(" ORDER BY RESOURCE_NAME");
184
            sql.append(" LIMIT ").append(pageSize);
185
        }else{
186
            int _m_11 = _m_1 / pageSize;
187
            if(_m_1 % pageSize != 0){
188
                ++_m_11;
189
            }
190
            if(pageNo > _m_11){
191
                pageNo = _m_11;
192
            }
193
            _result.setPageNo(pageNo);
194
            --pageNo;
195
            int _m_12 = (pageNo * pageSize);
196
            sql = new StringBuilder();
197
            sql.append("SELECT RESOURCE_ID,RESOURCE_NAME,RESOURCE.SUBJECT,RESOURCE.INDUSTRY,SUPPORTED_SERVICES,RESOURCE.DESCP,PROFESSOR_ID,ASCRIPTION,HOPE_PAY_METHOD,COOPERATION_NOTES,RESOURCE.CREATE_TIME,RESOURCE.MODIFY_TIME,PROFESSOR.NAME FROM RESOURCE LEFT JOIN PROFESSOR ON PROFESSOR_ID = PROFESSOR.ID");
198
            if(_m_6.length()>0){
199
                sql.append(_m_6);
200
            }
201
            sql.append(" ORDER BY RESOURCE_NAME");
202
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_12);
203
        }
204
        ps = con.prepareStatement(sql.toString());
205
        try{
206
            if(!_m_2){
207
                ps.setString(_m_3++,key);
208
            }
209
            if(!_m_2){
210
                ps.setString(_m_3++,key);
211
            }
212
            if(!_m_2){
213
                ps.setString(_m_3++,key);
214
            }
215
            if(!_m_2){
216
                ps.setString(_m_3++,key);
217
            }
218
            if(!_m_4){
219
                ps.setString(_m_3++,subject);
220
            }
221
            if(!_m_5){
222
                ps.setString(_m_3++,industry);
223
            }
224
            java.sql.ResultSet rs = ps.executeQuery();
225
            try{
226
                java.util.List<com.ekexiu.portal.po.Resource> _m_13 = new java.util.ArrayList<com.ekexiu.portal.po.Resource>();
227
                _result.setData(_m_13);
228
                int _m_14 = 0;
229
                while((_m_14<pageSize) && rs.next()){
230
                    ++_m_14;
231
                    com.ekexiu.portal.po.Resource _obj =  new com.ekexiu.portal.po.Resource();
232
                    _obj.setResourceId(rs.getString(1));
233
                    _obj.setResourceName(rs.getString(2));
234
                    java.lang.String _m_15 = rs.getString(3);
235
                    if(rs.wasNull()){
236
                        _m_15 = null;
237
                    }
238
                    _obj.setSubject(_m_15);
239
                    java.lang.String _m_16 = rs.getString(4);
240
                    if(rs.wasNull()){
241
                        _m_16 = null;
242
                    }
243
                    _obj.setIndustry(_m_16);
244
                    _obj.setSupportedServices(rs.getString(5));
245
                    java.lang.String _m_17 = rs.getString(6);
246
                    if(rs.wasNull()){
247
                        _m_17 = null;
248
                    }
249
                    _obj.setDescp(_m_17);
250
                    Professor professor = new Professor();
251
                    professor.setId(rs.getString(7));
252
                    _obj.setAscription(rs.getString(8));
253
                    _obj.setHopePayMethod(rs.getString(9));
254
                    java.lang.String _m_18 = rs.getString(10);
255
                    if(rs.wasNull()){
256
                        _m_18 = null;
257
                    }
258
                    _obj.setCooperationNotes(_m_18);
259
                    _obj.setCreateTime(rs.getString(11));
260
                    _obj.setModifyTime(rs.getString(12));
261
                    professor.setName(rs.getString(13));
262
                    _obj.setProfessor(professor);
263
                    _m_13.add(_obj);
264
                }
265
                return _result;
266
            }finally{
267
                try{rs.close();}catch(Exception _m_19){}
268
            }
269
        }finally{
270
            try{ps.close();}catch(Exception _m_20){}
271
        }
272
    }
247 273
	
248 274
}

+ 16 - 0
src/main/java/com/ekexiu/portal/service/OperationService.java

@ -1,10 +1,12 @@
1 1
package com.ekexiu.portal.service;
2 2

3
import java.math.BigDecimal;
3 4
import java.sql.Connection;
4 5
import java.sql.SQLException;
5 6
import java.util.List;
6 7

7 8
import org.jfw.apt.annotation.Autowrie;
9
import org.jfw.apt.annotation.DefaultValue;
8 10
import org.jfw.apt.annotation.Nullable;
9 11
import org.jfw.apt.web.annotation.Path;
10 12
import org.jfw.apt.web.annotation.operate.Delete;
@ -13,6 +15,7 @@ import org.jfw.apt.web.annotation.operate.Post;
13 15
import org.jfw.apt.web.annotation.operate.Put;
14 16
import org.jfw.apt.web.annotation.param.JdbcConn;
15 17
import org.jfw.apt.web.annotation.param.PathVar;
18
import org.jfw.util.PageQueryResult;
16 19
import org.jfw.util.StringUtil;
17 20

18 21
import com.ekexiu.portal.dao.OperationDao;
@ -108,4 +111,17 @@ public class OperationService {
108 111
	public void deleteProRes(@JdbcConn(true) Connection con, String demandId, String resourceId) throws SQLException {
109 112
		this.operationDao.deleteProRes(con, demandId, resourceId);
110 113
	}
114
	
115
	@Get
116
	@Path("/pq")
117
	public PageQueryResult<Operation> queryPage(@JdbcConn(false) Connection con, @Nullable String professorName, 
118
			@Nullable String resourceName, @Nullable String firstTime, @Nullable String lastTime, @Nullable BigDecimal lowPrice, 
119
			@Nullable BigDecimal highPrice, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
120
		if(professorName!=null) professorName = "%"+professorName+"%";
121
		if(resourceName!=null) resourceName = "%"+resourceName+"%";
122
		if(firstTime!=null) firstTime = firstTime+"%";
123
		if(lastTime!=null) lastTime = lastTime+"%";
124
		return this.operationDao.queryPage(con, professorName, resourceName, firstTime, lastTime, lowPrice, highPrice, pageSize, pageNo);
125
	}
126
	
111 127
}

+ 1 - 1
src/main/java/com/ekexiu/portal/service/ResourceService.java

@ -134,7 +134,7 @@ public class ResourceService {
134 134
	
135 135
	@Get
136 136
	@Path("/pq")
137
	public PageQueryResult<Resource> queryPage(@JdbcConn(true) Connection con, @Nullable String key, @Nullable String subject, @Nullable String industry, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
137
	public PageQueryResult<Resource> queryPage(@JdbcConn(false) Connection con, @Nullable String key, @Nullable String subject, @Nullable String industry, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
138 138
		if(key!=null) key="%"+key+"%";
139 139
		if(subject!=null) subject ="%"+subject+"%";
140 140
		if(industry!=null)industry="%"+industry+"%";