日期:2014-05-19 浏览次数:20742 次
select b.*,e.uid,e.ip,e.place,e.ctime,count(distinct e.uid) from edm.edm_open_56 e left join (select u.id,u.email from e_toemail u ) b on e.uid = b.id
public List<EmailOpenReturnInfoVO> findOpenInfo(Long taskId) { List<EmailOpenReturnInfoVO> emailOpenReturnInfoVOs = new ArrayList<EmailOpenReturnInfoVO>(); String sql = "select b.*,e.uid,e.ip,e.place,e.ctime,count(distinct e.uid) from edm.edm_open_56 e left join (select u.id,u.email from e_toemail u ) b on e.uid = b.id"; PreparedStatement ps = null; ResultSet rs = null; EmailOpenReturnInfoVO vo = null; Session session = null; try { session = this.sessionFactory.openSession(); ps = SessionFactoryUtils.getDataSource(session.getSessionFactory()).getConnection().prepareStatement(sql); rs = ps.executeQuery(); while (rs.next()) { vo = new EmailOpenReturnInfoVO(); vo.setEmial(rs.getString("email")); vo.setIp(rs.getString("ip")); vo.setPlace(rs.getString("place")); vo.setTime(new Date(rs.getInt("ctime")*1000L)); emailOpenReturnInfoVOs.add(vo); } } catch (SQLException e) { e.printStackTrace(); } finally { if(null != session) session.close(); } return emailOpenReturnInfoVOs; }