Sfoglia il codice sorgente

我的工作台查询几项合作正在进行。

zzy.zhiyuan.foxmail 8 anni fa
parent
commit
85c7cfd866

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

@ -64,6 +64,24 @@ public abstract class OperationDao {
64 64
	@From(Operation.class)
65 65
	public abstract int updatePayMethod(Connection con, String operationId, @Set String payMethod) throws SQLException;
66 66
	
67
	/**
68
	 * 查询有多少资源合作正在进行
69
	 * @param con
70
	 * @param professorId 登陆者ID
71
	 * @return 返回正在合作的资源申请数量
72
	 * @throws SQLException
73
	 */
74
	public int queryOnGoingOper(Connection con, @Nullable String professorId) throws SQLException {
75
		String sql = " SELECT COUNT(1) FROM OPERATION O WHERE (OPERATION_STATUS IN (1,2,3,7)) AND (O.RESOURCE_ID IN (SELECT R.RESOURCE_ID FROM RESOURCE R WHERE R.PROFESSOR_ID = ?) OR O.DEMAND_ID = ?) ";
76
		PreparedStatement ps = con.prepareStatement(sql);
77
		ps.setString(1, professorId);
78
		ps.setString(2, professorId);
79
		ResultSet rs = ps.executeQuery();
80
		rs.next();
81
		int count = rs.getInt(1);
82
		return count;
83
	}
84
	
67 85
	public Operation query(Connection con,String operationId) throws SQLException{
68 86
        int _m_1 = 1;
69 87
        String sql = "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,P1.NAME,RESOURCE_NAME,RESOURCE.PROFESSOR_ID,P2.NAME,APPLYSQUARE FROM OPERATION INNER JOIN PROFESSOR P1 ON DEMAND_ID = P1.ID INNER JOIN RESOURCE ON OPERATION.RESOURCE_ID = RESOURCE.RESOURCE_ID INNER JOIN PROFESSOR P2 ON RESOURCE.PROFESSOR_ID = P2.ID WHERE OPERATION_ID = ?";

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

@ -49,6 +49,12 @@ public class OperationService {
49 49
		this.operationDao.update(con, operation);
50 50
	}
51 51
	
52
	@Get
53
	@Path("/qaOnGoingOper")
54
	public int queryOnGoingOper(@JdbcConn Connection con, @Nullable String professorId) throws SQLException {
55
		return this.operationDao.queryOnGoingOper(con, professorId);
56
	}
57
	
52 58
	@Get
53 59
	@Path("/{operationId}")
54 60
	public Operation query(@JdbcConn Connection con, @PathVar String operationId) throws SQLException{