| | |
| | | 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; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商户表数据处理层 |
| | |
| | | |
| | | @Select("select count(id) from t_customer") |
| | | int count(); |
| | | |
| | | @Select("select \n" + |
| | | "sum(case when month(create_time) < 2 && year(create_time) <= #{year} then 1 else 0 end) as january,\n" + |
| | | "sum(case when month(create_time) < 3 && year(create_time) <= #{year} then 1 else 0 end) as february,\n" + |
| | | "sum(case when month(create_time) < 4 && year(create_time) <= #{year} then 1 else 0 end) as march,\n" + |
| | | "sum(case when month(create_time) < 5 && year(create_time) <= #{year} then 1 else 0 end) as april,\n" + |
| | | "sum(case when month(create_time) < 6 && year(create_time) <= #{year} then 1 else 0 end) as may,\n" + |
| | | "sum(case when month(create_time) < 7 && year(create_time) <= #{year} then 1 else 0 end) as june,\n" + |
| | | "sum(case when month(create_time) < 8 && year(create_time) <= #{year} then 1 else 0 end) as july,\n" + |
| | | "sum(case when month(create_time) < 9 && year(create_time) <= #{year} then 1 else 0 end) as august,\n" + |
| | | "sum(case when month(create_time) < 10 && year(create_time) <= #{year} then 1 else 0 end) as september,\n" + |
| | | "sum(case when month(create_time) < 11 && year(create_time) <= #{year} then 1 else 0 end) as october,\n" + |
| | | "sum(case when month(create_time) < 12 && year(create_time) <= #{year} then 1 else 0 end) as november,\n" + |
| | | "sum(case when month(create_time) < 13 && year(create_time) <= #{year} then 1 else 0 end) as december\n" + |
| | | "from t_customer") |
| | | Month getCustomerCount(@Param("year")Integer year); |
| | | } |