Quellcode durchsuchen

添加行为分析

liu vor 2 Jahren
Ursprung
Commit
a9aec27732

+ 6 - 6
.idea/workspace.xml

@@ -4,8 +4,8 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-<<<<<<< HEAD
-    <list default="true" id="be7aa737-81a4-4fa1-848a-b64feaec2f6c" name="Default Changelist" comment="">
+
+    <list default="true" id="be7aa737-81a4-4fa1-848a-b64feaec2f6c" name="Default Changelist" comment=""></list>
       <change beforePath="$PROJECT_DIR$/src/main/java/com/template/common/utils/TimeExchange.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/common/utils/TimeExchange.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/template/controller/SmartVisitorController.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/target/mybatis_plus-0.0.1-SNAPSHOT.jar.original" beforeDir="false" />
@@ -19,7 +19,7 @@
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
     <option name="LAST_RESOLUTION" value="IGNORE" />
   </component>
-<<<<<<< HEAD
+
   <component name="DefaultGradleProjectSettings">
     <option name="testRunner" value="GRADLE" />
     <option name="delegatedBuild" value="true" />
@@ -294,8 +294,8 @@
       <pane id="PackagesPane" />
     </panes>
   </component>
-<<<<<<< HEAD
-  <component name="PropertiesComponent">
+
+  <component name="PropertiesComponent"></component>
     <property name="RequestMappingsPanelOrder0" value="0" />
     <property name="RequestMappingsPanelOrder1" value="1" />
     <property name="RequestMappingsPanelWidth0" value="75" />
@@ -353,7 +353,7 @@
       <option name="number" value="Default" />
       <option name="presentableId" value="Default" />
       <updated>1706770138891</updated>
-<<<<<<< HEAD
+
       <workItem from="1706770142017" duration="13022000" />
 =======
       <workItem from="1706770142017" duration="4313000" />

+ 3 - 2
src/main/java/com/template/controller/SmartWarningController.java

@@ -19,6 +19,7 @@ import com.template.model.pojo.SmartUser;
 import com.template.model.pojo.SmartWarning;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.BehaviourListVo;
 import com.template.model.vo.DepartmentTreeVo;
 import com.template.model.vo.UserVo;
 import com.template.services.SmartDepartmentService;
@@ -357,9 +358,9 @@ public class SmartWarningController implements SmartWarningControllerAPI {
 
     @Override
     public CommonResult behaviourList() {
+        List<BehaviourListVo> behaviourList=smartWarningService.behaviourList();
 
-
-        return null;
+        return CommonResult.ok(behaviourList);
     }
 
 

+ 4 - 0
src/main/java/com/template/mapper/SmartWarningMapper.java

@@ -2,6 +2,7 @@ package com.template.mapper;
 
 import com.template.model.pojo.SmartWarning;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.vo.BehaviourListVo;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -20,4 +21,7 @@ public interface SmartWarningMapper extends BaseMapper<SmartWarning> {
     List<String> warningType();
 
 
+    List<BehaviourListVo> behaviourList();
+
+
 }

+ 13 - 0
src/main/java/com/template/model/vo/BehaviourListVo.java

@@ -0,0 +1,13 @@
+package com.template.model.vo;
+
+import lombok.Data;
+
+@Data
+public class BehaviourListVo {
+    private String typeName; //预警名称
+
+    private Integer typeCount; //预警次数
+
+    private Integer totalCount;// 总次数
+
+}

+ 2 - 0
src/main/java/com/template/services/SmartWarningService.java

@@ -5,6 +5,7 @@ import com.template.model.pojo.SmartWarning;
 import com.template.model.pojo.SmartWarning;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.BehaviourListVo;
 
 import java.util.List;
 
@@ -32,5 +33,6 @@ public interface SmartWarningService extends IService<SmartWarning> {
     PageUtils<SmartWarning> pageWarning(int currentPage, int pageCount, String type, String dateTime);
 
 
+    List<BehaviourListVo> behaviourList();
 
 }

+ 5 - 1
src/main/java/com/template/services/impl/SmartWarningServiceImpl.java

@@ -12,6 +12,7 @@ import com.template.model.pojo.SmartWarning;
 import com.template.model.pojo.SmartWarning;
 import com.template.mapper.SmartWarningMapper;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.BehaviourListVo;
 import com.template.services.SmartWarningService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -95,7 +96,10 @@ public class SmartWarningServiceImpl extends ServiceImpl<SmartWarningMapper, Sma
         return new PageUtils<>(result);
     }
 
-
+    @Override
+    public List<BehaviourListVo> behaviourList() {
+        return smartWarningMapper.behaviourList();
+    }
 
 
 }

+ 10 - 0
src/main/resources/mapper/template/SmartWarningMapper.xml

@@ -5,4 +5,14 @@
     <select id="warningType" resultType="java.lang.String">
         SELECT type FROM `smart_warning` GROUP BY type
     </select>
+    <select id="behaviourList" resultType="com.template.model.vo.BehaviourListVo">
+        SELECT
+            sw.type as typeName,
+            COUNT( sw.type ) AS typeCount,
+            ( SELECT COUNT( 0 ) FROM smart_warning sw2 ) AS totalCount
+        FROM
+            `smart_warning` sw
+        GROUP BY
+            sw.type
+    </select>
 </mapper>

+ 10 - 0
target/classes/mapper/template/SmartWarningMapper.xml

@@ -5,4 +5,14 @@
     <select id="warningType" resultType="java.lang.String">
         SELECT type FROM `smart_warning` GROUP BY type
     </select>
+    <select id="behaviourList" resultType="com.template.model.vo.BehaviourListVo">
+        SELECT
+            sw.type as typeName,
+            COUNT( sw.type ) AS typeCount,
+            ( SELECT COUNT( 0 ) FROM smart_warning sw2 ) AS totalCount
+        FROM
+            `smart_warning` sw
+        GROUP BY
+            sw.type
+    </select>
 </mapper>