zoukankan      html  css  js  c++  java
  • springboot + jpa

    https://blog.csdn.net/mdw5521/article/details/79088806

    https://blog.csdn.net/liu280790081/article/details/73647916

    例子

    public void aaa() {
        //1. @Query
        List<LogisticsFinanceDayOrder> list1 = logisticsFinanceDayOrderDao.ccc();
        LogisticsFinanceDayOrder list2 = logisticsFinanceDayOrderDao.ccc2("5");
        List<String> list3 = logisticsFinanceDayOrderDao.ccc3("18日");
        //2. 排序查询
        Sort sort=new Sort(Sort.Direction.DESC,"id");
        List<LogisticsFinanceDayOrder> list = logisticsFinanceDayOrderDao.findAll(sort);
        System.out.println("ccc");
        //3. 分页排序查询
        PageRequest pageRequest = PageRequest.of(0,4,sort);
        Page<LogisticsFinanceDayOrder> page = logisticsFinanceDayOrderDao.findAll(pageRequest);
        System.out.println("ccc");
        //4. 实体匹配查询
        LogisticsFinanceDayOrder logisticsFinanceDayOrder = new LogisticsFinanceDayOrder();
        //logisticsFinanceDayOrder.setId("5");
        logisticsFinanceDayOrder.setDescription("18日");
        ExampleMatcher exampleMatcher = ExampleMatcher.matching().withMatcher("description", ExampleMatcher.GenericPropertyMatchers.startsWith());
        Example example = Example.of(logisticsFinanceDayOrder,exampleMatcher);
        List<LogisticsFinanceDayOrder> l = logisticsFinanceDayOrderDao.findAll(example);
    }
    @Repository
    public interface LogisticsFinanceDayOrderDao extends BaseDao<LogisticsFinanceDayOrder>, LogisticsFinanceDayOrderDaoCustom {
        @Query("from LogisticsFinanceDayOrder")
        public List<LogisticsFinanceDayOrder> ccc();
    
        @Query("from LogisticsFinanceDayOrder where id = ?1")
        public LogisticsFinanceDayOrder ccc2(String id);
    
        @Query("select orderNo from LogisticsFinanceDayOrder where description like CONCAT(:description,'%')")
        public List<String> ccc3(@Param("description") String description);
    }
  • 相关阅读:
    编程基础——c 选择结构程序设计个人总结实例
    编程基础C——常量,变量,运算符个人总结
    编程基础C——格式化输入函数scanf的应用
    编程基础C——基本数据类型个人总结:
    django-base
    django-mvc
    OSI七层与TCP/IP五层网络架构详解
    tcp/ip三次握手及四次挥手
    网页浏览过程
    http协议
  • 原文地址:https://www.cnblogs.com/yifanSJ/p/9815638.html
Copyright © 2011-2022 走看看