kongdeqiang
2023-06-08 3fba1d84220268d871c3c28e0e25f6eab3526f46
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
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.boying.mapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.boying.entity.Ticket;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.jpa.repository.Query;
 
import java.util.Date;
 
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName TicketMapper.java
 * @Description TODO
 * @createTime 2022年11月20日 10:25:00
 */
@Mapper
public interface TicketMapper extends BaseMapper<Ticket> {
 
    @Query(value = "select sum(money) from Ticket where createTime>:startTime and createTime<:endTime")
    Double sumByPrice(Date startTime, Date endTime);
 
    @Query(value = "select count(id) from Ticket where payStatus=1")
    long count4();
 
    @Query(value = "select count(id) from Ticket")
    long count5();
 
//    @Query(value = "select count(id) from Ticket where type=1 and createTime>:startTime and createTime<:endTime")
//    long count6(Date startTime, Date endTime);
//
//    @Query(value = "select count(id) from Ticket where type=1 and status=1 and createTime>:startTime and createTime<:endTime")
//    long count7(Date startTime, Date endTime);
//
//    @Query(value = "select count(id) from Ticket where type=0 and createTime>:startTime and createTime<:endTime")
//    long count8(Date startTime, Date endTime);
 
    @Query(value = "select sum(money) from Ticket where createTime>:startTime and createTime<:endTime and type=0")
    Double sumByPrice2(Date startTime, Date endTime);
}