List<Integer> types = new ArrayList<>(); types.add("条件1"); types.add("条件2"); Criteria eatCriteria = Criteria.where("_change_type").in(types).and("_downstream_user_id").is(userId); Sort.Order orders = new…
------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 本篇博客讲述如何在SpringBoot中整合PageHelper,如何实现带多个条件,以及PageInfo中的属性的中文解释(翻译) 一,jar包 <!-- 分页插件 --> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-sta…
排序查询 语法:order by 子句 order by 排序字段1 排序方式1 , 排序字段2 排序方式2... 排序方式: ASC:升序,默认的. DESC:降序. 注意: 如果有多个排序条件,则当前边的条件值一样时,才会判断第二条件. 聚合函数 将一列数据作为一个整体,进行纵向的计算. count:计算个数 一般选择非空的列:主键 select count(id) from 表名 max:计算最大值 min:计算最小值 sum:计算和 avg:计算平均值 注意:聚合函数的计算,排除null…
https://yq.aliyun.com/articles/619586 本篇博客讲述如何在SpringBoot中整合PageHelper,如何实现带多个条件,以及PageInfo中的属性的中文解释(翻译) 一,jar包 <!-- 分页插件 --> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter<…
html层 <div> <a class="num"><b th:text="'共 '+ ${result.resultMap['pages']}+ ' 页'"></b></a> <a class="num" th:if="${result.resultMap['hasPreviousPage']} == true" th:href="@{'/repo…
目录 1.使用时间格式化方法 2.进行时间补偿(默认当前时区是东八区,即8x3600x1000=28800000) mongodb的默认时间是格林尼治时间,如果是要按照日期进行分组需要注意!!!. 解决方案: 1.使用时间格式化方法 Aggregation.project().and("createTime").dateAsFormattedString("%Y-%m-%d").as("time"), Aggregation.group(&quo…
一.使用QueryByExampleExecutor 1. 继承MongoRepository public interface StudentRepository extends MongoRepository<Student, String> { } 2. 代码实现 使用ExampleMatcher匹配器-----只支持字符串的模糊查询,其他类型是完全匹配 Example封装实体类和匹配器 使用QueryByExampleExecutor接口中的findAll方法 public Page&…
这是已经被废弃的接口 Sort sort = new Sort(Sort.Direction.DESC,"bean类中字段"); //创建时间降序排序 Pageable pageable = new PageRequest(pageNumber,pageSize,sort); 上面的用法在最新的SpringBoot中已经不再支持了,下面是一个简单的分页查询demo 持久层配置 public interface OrderDao extends JpaRepository<Orde…
spring-boot 集合mybatis 的github分页查询 一.依赖包 <!-- mysql 数据库驱动. --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- spring-boot mybatis依赖: 请不要使用1..0版本,因为还不支持拦截器插…
1.pom相关依赖引入 <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</grou…