JPA like 模糊查询 语法格式

	public List getAllInstitution(final Application app){
		String zdGljg = null;
		Sysuser user = (Sysuser) app.getUser();
		String userGljg = user.getGljg();
		if("00".equals(userGljg.substring(4, 6))){//市级机构权限
			zdGljg = userGljg.substring(0, 4) + "%";
		}else if("00".equals(userGljg.substring(6, 8))){//区县级机构权限
			zdGljg =  userGljg.substring(0, 6) + "%";
		}else{//乡镇级机构权限
			zdGljg = userGljg + "%";
		}
		Query query = entityManager.createQuery("select s from InstitutionInfo s where s.gljg like :zdGlbh ");
		query.setParameter("zdGlbh", zdGljg);
		List adg =query.getResultList();	
		return adg;
	}

你可能感兴趣的:(JPA like 模糊查询 语法格式)