SaaS网站可以做seo嘛,网页制作工具按其制作方式分为什么,个人网站欣赏的网站,合肥建设集团信息网站导致这个问题的原因很多#xff0c;这里记录一下我碰到的问题和解决方法。
网上有说时 pageNo要从0开始#xff0c;我的不是这个问题。 在使用springboot jpa时#xff0c;发现使用 t.ip like %?5% 语句#xff0c;如果数据库记录的ip is null时#xff0c;将查询不到该…导致这个问题的原因很多这里记录一下我碰到的问题和解决方法。
网上有说时 pageNo要从0开始我的不是这个问题。 在使用springboot jpa时发现使用 t.ip like %?5% 语句如果数据库记录的ip is null时将查询不到该数据。更换为t.ip like concat(‘%’, ?5, ‘%’) )后可以解决此问题。
Query(value select t from SignAuditRequireLogEntity t where 1 1 and ( ?1 null or ?1 or t.proposalNo ?1 ) and ( ?2 null or ?2 or t.proposalStatus like %?2% ) and ( ?3 null or ?3 or t.userNo like %?3% ) and ( ?4 null or ?4 or t.userName like %?4% ) and ( ?5 null or ?5 or t.ip like concat(%, ?5, %) ) order by t.createDate desc )PageSignAuditRequireLogEntity findByPage(String proposalNo, String proposalStatus, String userNo, String userName, String ip, Pageable pageable);ps以后在JPA中使用like要用 like concat(‘%’, ?5, ‘%’) )方式
例子1
数据如下 java代码
Query(value select t from SignAuditRequireLogEntity t where 1 1 and ( ?1 null or ?1 or t.proposalNo ?1 ) and ( ?2 null or ?2 or t.proposalStatus like %?2% ) and ( ?3 null or ?3 or t.userNo like %?3% ) and ( ?4 null or ?4 or t.userName like %?4% ) and ( ?5 null or ?5 or t.ip like concat(%, ?5, %) ) order by t.createDate desc )PageSignAuditRequireLogEntity findByPage(String proposalNo, String proposalStatus, String userNo, String userName, String ip, Pageable pageable);效果如下
例子2
我们把例子1中的proposal_status字段改为空字符串。 数据如下 java代码
Query(value select t from SignAuditRequireLogEntity t where 1 1 and ( ?1 null or ?1 or t.proposalNo ?1 ) and ( ?2 null or ?2 or t.proposalStatus like %?2% ) and ( ?3 null or ?3 or t.userNo like %?3% ) and ( ?4 null or ?4 or t.userName like %?4% ) and ( ?5 null or ?5 or t.ip like concat(%, ?5, %) ) order by t.createDate desc )PageSignAuditRequireLogEntity findByPage(String proposalNo, String proposalStatus, String userNo, String userName, String ip, Pageable pageable);效果如下我们就能查到数据了