JPA
跬步丶
努力成长的码农。
展开
-
JPA 动态条件查询
if(1? != ‘’) @Query(value = "select id from tbl where if(?1!='', cust_code = ?1, 1=1) " + "and if(?2!='', name LIKE CONCAT('%',?2,'%'), 1=1) and if(?3 is not null, is_delete = ?3, 1=1) ", nativeQuery = true) List<Entity> findEntit原创 2021-02-03 16:13:08 · 712 阅读 · 0 评论 -
JPA findAll分页查询连表查询
实体类TaskWorkEntity@Entity@Data@Accessors(chain = true)@Table(name = "task_work")public class TaskWorkEntity extends BaseEntity { private Long id; // EcTaskEntity 关联关系 唯一字段 private String ecTaskSerial; private String taskWorkName;原创 2021-02-02 11:22:54 · 5299 阅读 · 4 评论 -
SpringBoot2.x JPA findAll 分页查询
import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; Page<Entity> page; // 倒序排序 Sort sort =..原创 2021-02-02 09:41:45 · 2973 阅读 · 0 评论