wang-hao-jie
2022-02-07 c9cbc0947f6fe578d1f178d73a2dd46d95bec275
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java
@@ -43,18 +43,18 @@
    List<Car> getCarInfo2(@Param(Constants.WRAPPER) QueryWrapper<Car> wrapper);
    @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" +
            "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_car")
    Month getCarCount(@Param("year")Integer year);