一.hql默认Query是JPQL,不是SQL。执行SQL加nativeQuery=true 二.模糊查询范例: 根据gradeTypes模糊查询
@Query(“select distinct (mapping.course) from CourseAttributeMapping mapping where mapping.course.gradeTypes like CONCAT(‘%’,:gradeTypes,’%’) and mapping.deleted =0 and mapping.course.deleted =0 and mapping.detail.deleted =0 and mapping.attribute.deleted = 0 and mapping.detail.id = :detailId and mapping.course.customer.id = :customerId”)
public List
三.不等于范例: content不等于null
@Query(“select count(b.id) from BallotBatchMap b where b.content <> null and b.batch.id=:batchId and b.deleted = 0”)
Integer findContentByBatchId(@Param(“batchId”) String batchId);