wjli
2023-05-11 a067fdbf6b1374a1402096c722257575916eab99
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java
@@ -43,19 +43,28 @@
    List<Car> getCarInfo2(@Param(Constants.WRAPPER) QueryWrapper<Car> wrapper);
    @Select("select \n" +
            "sum(case when create_time <= '${year}-01' then 1 else 0 end) as january,\n" +
            "sum(case when create_time <= '${year}-02' then 1 else 0 end) as february,\n" +
            "sum(case when create_time <= '${year}-03' then 1 else 0 end) as march,\n" +
            "sum(case when create_time <= '${year}-04' then 1 else 0 end) as april,\n" +
            "sum(case when create_time <= '${year}-05' then 1 else 0 end) as may,\n" +
            "sum(case when create_time <= '${year}-06' then 1 else 0 end) as june,\n" +
            "sum(case when create_time <= '${year}-07' then 1 else 0 end) as july,\n" +
            "sum(case when create_time <= '${year}-08' then 1 else 0 end) as august,\n" +
            "sum(case when create_time <= '${year}-09' then 1 else 0 end) as september,\n" +
            "sum(case when create_time <= '${year}-10' then 1 else 0 end) as october,\n" +
            "sum(case when create_time <= '${year}-11' then 1 else 0 end) as november,\n" +
            "sum(case when create_time <= '${year}-12' 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);
}
    @Select("SELECT\n" +
            "\t( MAX( amount ) - MIN( amount ) ) AS amount,\n" +
            "\tSUM( money ) AS money,\n" +
            "\t( MAX( mileage ) - MIN( mileage ) ) AS mileage, \n" +
            "\tSUM(amount) AS allAmount,SUM(money) AS allMoney,(MAX(mileage)) AS allMileage \n"+
            "FROM\n" +
            "\t t_add_oil a\n" +
            "\t WHERE a.car_id = #{carId}")
    Car getCarInfoByCarId(@Param("carId")String carId);
}