夏文涛 2 年 前
コミット
74529638db

+ 13 - 0
src/main/java/com/template/controller/DriverStockController.java

@@ -28,6 +28,7 @@ import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Calendar;
 import java.util.List;
 import java.util.List;
+import java.util.stream.Collectors;
 
 
 @Controller
 @Controller
 public class DriverStockController implements DriverStockControllerAPI {
 public class DriverStockController implements DriverStockControllerAPI {
@@ -43,7 +44,19 @@ public class DriverStockController implements DriverStockControllerAPI {
     @PassToken
     @PassToken
     @DESRespondSecret(validated = false)
     @DESRespondSecret(validated = false)
     public CommonResult getClassTj() {
     public CommonResult getClassTj() {
+
         List<Tj> list = driverStockService.getClassTj();
         List<Tj> list = driverStockService.getClassTj();
+        Integer num = 0;
+        for (Tj teacherData:list) {
+            if (teacherData.getName().contains("老师")) {
+                num = num + teacherData.getNum();
+            }
+        }
+        Tj teacher = new Tj();
+        teacher.setName("教师");
+        teacher.setNum(num);
+        list = list.stream().filter(e -> !e.name.contains("老师")).collect(Collectors.toList());
+        list.add(teacher);
         return CommonResult.ok(list);
         return CommonResult.ok(list);
     }
     }
 
 

+ 8 - 5
src/main/resources/mapper/template/DriverStockMapper.xml

@@ -29,8 +29,10 @@
 
 
     <!--年级统计-->
     <!--年级统计-->
     <select id="getClassTj" resultMap="Tj">
     <select id="getClassTj" resultMap="Tj">
-        select `name`, COUNT(*) as num from ( select IFNULL(b.`name`,'未知') `name` from `smart_user` a
-                left join `smart_grade` b on a.`grade`=b.id ) c group by `name`
+        select `name`, COUNT(*) as num from ( select CONCAT(IFNULL(b.`name`,''),i.`name` ) `name` from `smart_user` a
+left join smart_identity i on i.deleted = 0 and i.id = a.identity_id
+left join `smart_grade` b on b.deleted = 0 and a.`grade`=b.id
+where a.deleted =0 and a.is_cancel = 0) c group by `name`
     </select>
     </select>
 
 
     <!--访客统计-->
     <!--访客统计-->
@@ -97,9 +99,10 @@
 
 
     <!--用户汇总学生-->
     <!--用户汇总学生-->
     <select id="getUserPage" resultMap="userPage">
     <select id="getUserPage" resultMap="userPage">
-        select a.id,a.sex_id as sexId,a.head_image as headImage,  a.name,a.`card_no`,b.`name`  as depart_ment from `smart_user` a
-             left join `smart_department` b on a.`department_id`=b.id
-             where a.`deleted`=0 and a.identity_id=#{identityId}
+        select a.id,a.sex_id as sexId,a.head_image as headImage, a.name,a.`card_no`,b.`name` as depart_ment from
+        `smart_user` a
+        left join `smart_department` b on a.`department_id`=b.id
+        where a.`deleted`=0 and a.identity_id=#{identityId}
         <if test="key != null and key != ''">
         <if test="key != null and key != ''">
             and (a.name like '%' #{key} '%' or a.card_no like '%' #{key} '%')
             and (a.name like '%' #{key} '%' or a.card_no like '%' #{key} '%')
         </if>
         </if>