Hi_Amos
坚持每天都在进步!!
	String sql="select * from sys_invitation where to_phone = '13000000000' order by create_time desc ;";
		Session currentSession = this.getCurrentSession();
		List<SysInvitation> list = currentSession.createSQLQuery(sql).addEntity(SysInvitation.class).list();
		for(SysInvitation syslist:list){
			String invitation_code2 = syslist.getInvitation_code();
			System.out.println("invitation_code2:"+invitation_code2);
		}
		Object uniqueResult = this.getCurrentSession().createCriteria(SysInvitation.class).add(Restrictions.eq("to_phone", account)).add                Order(Order.desc("create_time")).setMaxResults(1).uniqueResult();
		if(uniqueResult==null){
			return "";
		}else {
			SysInvitation invitation = (SysInvitation) uniqueResult;
			return invitation.getInvitation_code();
		}

  

posted on 2013-11-11 16:47  Hi_Amos  阅读(589)  评论(0编辑  收藏  举报