bug
zhangzeli
2022-01-25 e31d4d2d3cecab2fb56508c0f5b82d821719e7bb
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
package cn.exrick.xboot.your.mapper;
 
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.exrick.xboot.your.entity.Customer;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
 
/**
 * 商户表数据处理层
 * @author zhangzeli
 */
public interface CustomerMapper extends BaseMapper<Customer> {
 
    @Select("select count(id) from t_customer")
    int count();
 
    @Select("select \n" +
            "sum(case when create_time < '${year}-02' then 1 else 0 end) as january,\n" +
            "sum(case when create_time < '${year}-03' then 1 else 0 end) as february,\n" +
            "sum(case when create_time < '${year}-04' then 1 else 0 end) as march,\n" +
            "sum(case when create_time < '${year}-05' then 1 else 0 end) as april,\n" +
            "sum(case when create_time < '${year}-06' then 1 else 0 end) as may,\n" +
            "sum(case when create_time < '${year}-07' then 1 else 0 end) as june,\n" +
            "sum(case when create_time < '${year}-08' then 1 else 0 end) as july,\n" +
            "sum(case when create_time < '${year}-09' then 1 else 0 end) as august,\n" +
            "sum(case when create_time < '${year}-10' then 1 else 0 end) as september,\n" +
            "sum(case when create_time < '${year}-11' then 1 else 0 end) as october,\n" +
            "sum(case when create_time < '${year}-12' then 1 else 0 end) as november,\n" +
            "sum(case when create_time < '${year}-13' then 1 else 0 end) as december\n" +
            "from t_customer")
    Month getCustomerCount(@Param("year")Integer year);
 
    @Select("select sum(login_num) from t_customer")
    int sumLogin();
}