浏览代码

--add queryPublish();

zzy.zhiyuan.foxmail 8 年之前
父节点
当前提交
b9aaa5ad93

+ 19 - 0
src/main/java/com/ekexiu/portal/dao/DemandDao.java

34
	@Nullable
34
	@Nullable
35
	public abstract Demand queryOne(Connection con,String demandId)throws SQLException;
35
	public abstract Demand queryOne(Connection con,String demandId)throws SQLException;
36
	
36
	
37
	public int queryCountByStatus(Connection con,String demander,String demandStatus)throws SQLException{
38
		String sql = " SELECT COUNT(1) FROM DEMAND WHERE DEMANDER = ? AND DEMAND_STATUS = ? ";
39
		PreparedStatement ps = con.prepareStatement(sql);
40
		int index = 1;
41
		try {
42
			ps.setString(index++, demander);
43
			ps.setString(index++, demandStatus);
44
			ResultSet rs = ps.executeQuery();
45
			try {
46
				rs.next();
47
				return rs.getInt(1);
48
			} finally {
49
				try{rs.close();}catch(Exception e1){}
50
			}
51
		} finally {
52
            try{ps.close();}catch(Exception e2){}
53
        }
54
	}
55
	
37
	@SelectList
56
	@SelectList
38
	@OrderBy("ORDER BY CREATE_TIME DESC")
57
	@OrderBy("ORDER BY CREATE_TIME DESC")
39
	public abstract List<Demand> queryByDemander(Connection con,String demander)throws SQLException;
58
	public abstract List<Demand> queryByDemander(Connection con,String demander)throws SQLException;

+ 13 - 0
src/main/java/com/ekexiu/portal/service/DemandService.java

101
		return demand;
101
		return demand;
102
	}
102
	}
103
	
103
	
104
	/**
105
	 * 查询发布中的需求总数
106
	 * @param con
107
	 * @param demander 发布者ID
108
	 * @return 返回状态发布中的需求总数
109
	 * @throws SQLException
110
	 */
111
	@Get
112
	@Path("/queryPublish")
113
	public int queryPublish(@JdbcConn Connection con,String demander)throws SQLException{
114
		return this.demandDao.queryCountByStatus(con, demander, "1");
115
	}
116
	
104
	@Get
117
	@Get
105
	@Path("/byDemander")
118
	@Path("/byDemander")
106
	public List<Demand> queryByDemander(@JdbcConn Connection con,String demander)throws SQLException{
119
	public List<Demand> queryByDemander(@JdbcConn Connection con,String demander)throws SQLException{