我有一个基于 Spring Web 模型-视图-控制器 (MVC) 框架的项目。Spring Web 模型-视图-控制器 (MVC) 框架的版本是 3.2.8。
我的 DAO 中有这个方法
@Override
public List<Application> findByQuickSearch(String searchString) {
final StringBuilder queryString = new StringBuilder(" select app from Application app where upper (ticket_id) like :searchString or upper (id) like :searchString " );
queryString.append(" and app.status != " + Status.DRAFT.ordinal());
queryString.append(" order by app.submissionTime desc ");
try {
final Query query = getEntityManager().createQuery(queryString.toString());
searchString = searchString.replace("!", "!!")
.replace("%", "!%")
.replace("_", "!_")
.replace("[", "![")
.trim()
.toUpperCase();
System.out.println ("searchString -----> " + searchString);
query.setParameter ("searchString", searchString);
return query.getResultList();
} catch (RuntimeException re) {
log.error("findByCompetentBodyAndStatus failed", re);
throw re;
}
}
但我意识到查询不做 LIKE 但等于
我正在寻找的春天是"iOS/032/027"
,好的"iOS/032/027"
,但"iOS/"
不是"027"