zoukankan      html  css  js  c++  java
  • spring data jpa 通过对象传参

    传入的对象需要用@param注解修饰,value是查询语句,countQuery是查询总数,页数语句

     @Query(nativeQuery = true, value = "select * from client " +
                "where type = 1 " +
                "and if(:#{#customer.bluury} is not null, company like CONCAT(:#{#customer.blurry},'%'),1=1) " +
                "and client.dept_id = :#{#customer.deptId} " +
                "and if(:#{#customer.principal} is not null,principal = :#{#customer.principal},1=1) " +
                "order by follow_time desc ",
                countQuery = "select count(1) from client " +
                        "where type = 1 " +
                        "and if(:#{#customer.bluury} is not null, company like CONCAT(:#{#customer.blurry},'%'),1=1) " +
                        "and client.dept_id = :#{#customer.deptId} " +
                        "and if(:#{#customer.principal} is not null,principal = :#{#customer.principal},1=1) " )
        Page<Client> findAllByDeptId(Pageable pageable,@Param("customer") CustomerQueryReq customer );
    
  • 相关阅读:
    获取网卡信息
    MVC Razor
    MVC
    Windows 消息
    sql 总结
    学生成绩表 SQL练习题
    oracle与sqlserver的十大区别
    for的冒泡排序练习题
    对于for的一些认识
    穷举
  • 原文地址:https://www.cnblogs.com/mengzhao/p/15214532.html
Copyright © 2011-2022 走看看