Browse Source

删除多余的方法。

zzy.zhiyuan.foxmail 8 years ago
parent
commit
73f64a34b2

+ 0 - 61
src/main/java/com/ekexiu/portal/dao/AssessDao.java

@ -1,9 +1,7 @@
1 1
package com.ekexiu.portal.dao;
2 2

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

8 6
import org.jfw.apt.orm.annotation.dao.DAO;
9 7
import org.jfw.apt.orm.annotation.dao.method.From;
@ -175,65 +173,6 @@ public abstract class AssessDao {
175 173
        }
176 174
    }
177 175
	
178
	public List<Assess> queryAll(Connection con, String assessId, String resourceId, String professorId) throws SQLException {
179
		StringBuilder sql = new StringBuilder();
180
		boolean hasAssessId = null != assessId;
181
		boolean hasResourceId = null != resourceId;
182
		boolean hasProfessorId = null != professorId;
183
		sql.append(" SELECT ASSESS_ID,STAR_LEVEL,ASSESS.DESCP,ASSESS.OPERATION_ID,ASSESS.RESOURCE_ID,ASSESS.PROFESSOR_ID,RESOURCE_NAME,PROFESSOR.NAME FROM ASSESS INNER JOIN RESOURCE ON ASSESS.RESOURCE_ID = RESOURCE.RESOURCE_ID INNER JOIN PROFESSOR ON ASSESS.PROFESSOR_ID = PROFESSOR.ID ");
184
		if(hasAssessId){
185
			sql.append(" WHERE ASSESS_ID = ? ");
186
		}
187
		if(hasResourceId){
188
			sql.append(" WHERE ASSESS.RESOURCE_ID = ? ");
189
		}
190
		if(hasProfessorId){
191
			sql.append(" WHERE ASSESS.PROFESSOR_ID = ? ");
192
		}
193
		int _m_1 = 1;
194
        PreparedStatement ps = con.prepareStatement(sql.toString());
195
        try{
196
        	if(hasAssessId){
197
        		ps.setString(_m_1++, assessId);
198
        	}
199
        	if(hasResourceId){
200
        		ps.setString(_m_1++, resourceId);
201
        	}
202
        	if(hasProfessorId){
203
        		ps.setString(_m_1++, professorId);
204
        	}
205
            java.sql.ResultSet rs = ps.executeQuery();
206
            try{
207
                java.util.List<com.ekexiu.portal.po.Assess> _result = new java.util.ArrayList<com.ekexiu.portal.po.Assess>();
208
                while(rs.next()){
209
                    com.ekexiu.portal.po.Assess _obj =  new com.ekexiu.portal.po.Assess();
210
                    _obj.setAssessId(rs.getString(1));
211
                    _obj.setStarLevel(rs.getInt(2));
212
                    java.lang.String _m_2 = rs.getString(3);
213
                    if(rs.wasNull()){
214
                        _m_2 = null;
215
                    }
216
                    _obj.setDescp(_m_2);
217
                    _obj.setOperationId(rs.getString(4));
218
                    Resource resource = new Resource();
219
                    resource.setResourceId(rs.getString(5));
220
                    Professor professor = new Professor();
221
                    professor.setId(rs.getString(6));
222
                    resource.setResourceName(rs.getString(7));
223
                    _obj.setResource(resource);
224
                    professor.setName(rs.getString(8));
225
                    _obj.setProfessor(professor);
226
                    _result.add(_obj);
227
                }
228
                return _result;
229
            }finally{
230
                try{rs.close();}catch(Exception _m_3){}
231
            }
232
        }finally{
233
            try{ps.close();}catch(Exception _m_4){}
234
        }
235
	}
236
	
237 176
	@DeleteWith
238 177
	@From(Assess.class)
239 178
	public abstract int delete(Connection con, String assessId) throws SQLException;

+ 10 - 10
src/main/java/com/ekexiu/portal/service/AssessService.java

@ -61,22 +61,22 @@ public class AssessService {
61 61
	
62 62
	@Get
63 63
	@Path("/qapro")
64
	public List<Assess> queryPro(@JdbcConn Connection con, String operationId) throws SQLException {
65
		return this.queryPro(con, operationId);
64
	public List<Assess> queryPro(@JdbcConn Connection con, String professorId) throws SQLException {
65
		return this.queryPro(con, professorId);
66 66
	}
67 67
	
68 68
	@Get
69 69
	@Path("/qa")
70
	public List<Assess> queryAll(@JdbcConn Connection con, @Nullable String assessId, @Nullable String resourceId, @Nullable String professorId) throws SQLException {
71
		if(assessId != null) {
72
			resourceId = null;
73
			professorId = null;
70
	public List<Assess> queryAll(@JdbcConn Connection con, @Nullable String operationId, @Nullable String resourceId, @Nullable String professorId) throws SQLException {
71
		if(operationId != null) {
72
			return this.queryOper(con, operationId);
73
		} else if(resourceId != null) {
74
			return this.queryRes(con, resourceId);
75
		} else if(professorId != null) {
76
			return this.queryPro(con, professorId);
74 77
		} else {
75
			if(resourceId != null) {
76
				professorId = null;
77
			}
78
			return null;
78 79
		}
79
		return this.assessDao.queryAll(con, assessId, resourceId, professorId);
80 80
	}
81 81
	
82 82
	@Delete