kongdeqiang
2022-09-19 a9862e81851bbe037edc6bb1c7f562c1e55c0d7f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.boying.dao;
 
import com.boying.common.BaseDao;
import com.boying.entity.OrderRecord;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
 
import java.util.Date;
import java.util.List;
 
@Repository("orderRecordDao")
public interface OrderRecordDao extends BaseDao<OrderRecord, Long>{
 
    @Query(value = "select count(id) from OrderRecord where createTime>:yearFirst and createTime<:yearLast")
    long countByYear(Date yearFirst, Date yearLast);
 
    @Query(value = "select sum(money) from OrderRecord where createTime>:yearFirst and createTime<:yearLast")
    Double sumByYear(Date yearFirst, Date yearLast);
 
    @Query(value = "select a from OrderRecord a where a.createTime>:yearFirst and a.createTime<:yearLast order by a.id desc")
    List<OrderRecord> findAll2(Date yearFirst, Date yearLast);
}