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
23
24
25
26
27
28
package com.boying.dao;
 
import com.boying.common.BaseDao;
import com.boying.entity.OutPark;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
 
import java.util.Date;
import java.util.List;
 
@Repository("outParkDao")
public interface OutParkDao extends BaseDao<OutPark, Long>{
 
    @Query(value = "select count(id) from OutPark where createTime>:startTime and createTime<:endTime and status=1")
    long count1(Date startTime, Date endTime);
 
    @Query(value = "select count(id) from OutPark where createTime>:startTime and createTime<:endTime")
    long count2(Date startTime, Date endTime);
 
    @Query(value = "select sum(price) from OutPark where createTime>:startTime and createTime<:endTime")
    Double sumByPrice(Date startTime, Date endTime);
 
    @Query(value = "from OutPark where barrierId=:bId and status=1 and status2=0 and id = (select max(id) from OutPark)")
    OutPark count4(Long bId);
 
    @Query(value = "from OutPark where barrierId=:id and carNo=:carNo and id = (select max(id) from OutPark)")
    OutPark findByCarNoAndBarrierId(String carNo, Long id);
}