zoukankan      html  css  js  c++  java
  • Hibernate-JPA注解开发

    @Query使用Pageable 进行分页查询排序

      Pageable:Pageable pageable = new PageRequest(pageNo-1,pageSize,sort);

      Sort:Sort.Order order = new Sort.Order(Sort.Direction.DESC,"createdTime");Sort sort = new Sort(order);

      @Query(value = "SELECT * from PrpLorderTaskInfo t where t.assistorCode = :userCode and ( t.registNo " +
          "like %:registNo% or t.licenseNo like %:registNo% ) -- #pageable ",// -- #pageable 固定格式引入pageable
        countQuery = "SELECT COUNT(1) FROM PrpLorderTaskInfo t where t.assistorCode = :userCode and ( t.registNo " +
          "like %:registNo% or t.licenseNo like %:registNo%)" ,nativeQuery=true)
      Page<PrpLorderTaskInfo> findByUserCodeRegistNo(@Param("registNo") String registNo,@Param("userCode") String userCode, Pageable pageable);

    @Query查询条目

      @Query(value = "SELECT COUNT(t.id) FROM PrpLorderTaskInfo t where t.assistorCode = :userCode and t.receiveTime >= to_date(:date,'YYYY/MM/DD')")
      int countByAssistorCodeMonth(@Param("userCode")String userCode,@Param("date") String date);

  • 相关阅读:
    搭建本地源
    shell中tar加密打包
    mysql出现ERROR 1819 (HY000)的解决方法
    mysql 创建用户及授权(2)
    mysql 创建用户及授权(1)
    Redis 工具 redis-port 使用
    mysql中 drop、truncate和delete的区别
    dlerror和dlclose用法
    dlsym用法
    dlopen用法
  • 原文地址:https://www.cnblogs.com/god-monk/p/9358607.html
Copyright © 2011-2022 走看看