From 4e837c1e8c6f8a7252fb95776a1530ab737bb684 Mon Sep 17 00:00:00 2001 From: wang-hao-jie <1550036656@qq.com> Date: 星期一, 06 六月 2022 15:32:42 +0800 Subject: [PATCH] 最新版本 --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java index 935ceaf..0f88580 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java @@ -1,6 +1,5 @@ package cn.exrick.xboot.your.mapper; -import cn.exrick.xboot.your.entity.Area; -import cn.exrick.xboot.your.vo.CarVo; +import cn.exrick.xboot.your.vo.Month; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; @@ -27,7 +26,7 @@ IPage<Car> page2(Page initMpPage, @Param(Constants.WRAPPER) QueryWrapper<Car> wrapper); @Select("SELECT c.*,u.nickname,a.`name` AS area_name FROM t_car c LEFT JOIN t_user AS u ON c.user_id=u.id LEFT JOIN t_area AS a ON a.user_id=u.id") - List<Car> getAll2(); + IPage<Car> getAll2(Page initMpPage); @Select("SELECT\n" + "\tc.*,(SUM(amount)) AS allAmount,SUM(money) AS allMoney,(MAX(mileage)) AS allMileage\n" + @@ -43,4 +42,20 @@ "LEFT JOIN t_add_oil a ON c.id = a.car_id ${ew.customSqlSegment}") List<Car> getCarInfo2(@Param(Constants.WRAPPER) QueryWrapper<Car> wrapper); + @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_car") + Month getCarCount(@Param("year")Integer year); + } \ No newline at end of file -- Gitblit v1.9.1