459242451@qq.com 3 лет назад
Родитель
Сommit
dc8c76285a
16 измененных файлов с 231 добавлено и 14 удалено
  1. 8 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlCommonController.java
  2. 18 7
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlPatrolmanController.java
  3. 28 0
      ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/PatromanStatic.java
  4. 27 0
      ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/XunStaticMonth.java
  5. 1 1
      ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionLocationLogMapper.java
  6. 2 0
      ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlPatrolmanMapper.java
  7. 1 1
      ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlPlanRecordMapper.java
  8. 3 0
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/IQdCommonService.java
  9. 3 0
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlPatrolmanService.java
  10. 107 2
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/QdCommonServiceImpl.java
  11. 1 1
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlInspectionLocationLogServiceImpl.java
  12. 13 0
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlPatrolmanServiceImpl.java
  13. 1 1
      ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlPlanRecordServiceImpl.java
  14. 3 0
      ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionLocationLogMapper.xml
  15. 12 0
      ruoyi-system/src/main/resources/mapper/qdtl/TlPatrolmanMapper.xml
  16. 3 0
      ruoyi-system/src/main/resources/mapper/qdtl/TlPlanRecordMapper.xml

+ 8 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlCommonController.java

@@ -17,6 +17,7 @@ import com.ruoyi.qdtl.domain.TlArea;
 import com.ruoyi.qdtl.domain.TlInspectionLocation;
 import com.ruoyi.qdtl.domain.TlInspectionLocationLog;
 import com.ruoyi.qdtl.domain.UserCheckPoint;
+import com.ruoyi.qdtl.service.IQdCommonService;
 import com.ruoyi.qdtl.service.ITlAreaService;
 import com.ruoyi.qdtl.service.ITlInspectionLocationLogService;
 import com.ruoyi.qdtl.service.ITlInspectionLocationService;
@@ -62,6 +63,7 @@ public class TlCommonController extends BaseController {
     private final ITlInspectionLocationLogService tlInspectionLocationLogService;
     private final ITlMonitorService tlMonitorService;
     private final ITlPlanRecordService planRecordService;
+    private final IQdCommonService qdCommonService;
 
 
     /**
@@ -170,7 +172,7 @@ public class TlCommonController extends BaseController {
         DateTime startDate = DateUtil.offsetDay(endDate, -6);
         List<JSONObject> locationLogDaysList = tlInspectionLocationLogService.queryDistanceByDateRange(DateUtil.formatDate(startDate), DateUtil.formatDate(endDate));
         map.put("locationLogDaysList", locationLogDaysList);
-        
+
         return AjaxResult.success(map);
     }
 
@@ -209,4 +211,9 @@ public class TlCommonController extends BaseController {
         return AjaxResult.success(data);
     }
 
+    @GetMapping("/monthStatic")
+    public AjaxResult monthStatic(@RequestParam(required = false) Long areaId, @RequestParam String startDate, @RequestParam String endDate) {
+        return AjaxResult.success(qdCommonService.monthStatic(areaId, startDate, endDate));
+    }
+
 }

+ 18 - 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/qdtl/TlPatrolmanController.java

@@ -10,13 +10,13 @@ import com.ruoyi.qdtl.domain.TlPatrolman;
 import com.ruoyi.qdtl.service.ITlPatrolmanService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletResponse;
@@ -46,6 +46,16 @@ public class TlPatrolmanController extends BaseController {
     }
 
     /**
+     * 获取所有的巡检人员
+     *
+     * @return
+     */
+    @GetMapping("/xunlist")
+    public AjaxResult getXunList(TlPatrolman tlPatrolman) {
+        return AjaxResult.success(tlPatrolmanService.selectTlPatrolmanList(tlPatrolman));
+    }
+
+    /**
      * 导出巡检员列表
      */
     @PreAuthorize("@ss.hasPermi('qdtl:patrolman:export')")
@@ -87,12 +97,13 @@ public class TlPatrolmanController extends BaseController {
     }
 
     /**
-     * 删除巡检员
+     * 人员报表
+     *
+     * @param cards
+     * @return
      */
-    @PreAuthorize("@ss.hasPermi('qdtl:patrolman:remove')")
-    @Log(title = "巡检员", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(tlPatrolmanService.deleteTlPatrolmanByIds(ids));
+    @GetMapping(value = "/getPatrolmanStatic")
+    public AjaxResult getPatrolmanStatic(@RequestParam String cards) {
+        return AjaxResult.success(tlPatrolmanService.getPatrolmanStatic(cards));
     }
 }

+ 28 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/PatromanStatic.java

@@ -0,0 +1,28 @@
+package com.ruoyi.qdtl.domain;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2022/6/19
+ * @Version V1.0
+ */
+@Data
+public class PatromanStatic {
+    private String name;
+    private String card;
+    private String areaName;
+    private Integer planCount;
+    private Integer unPlanCount;
+    private List<PlanDetail> planDetailList;
+
+    @Data
+    public static class PlanDetail {
+        private String countDate;
+        private Integer planCount;
+        private Integer unPlanCount;
+    }
+}

+ 27 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/XunStaticMonth.java

@@ -0,0 +1,27 @@
+package com.ruoyi.qdtl.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2022/6/19
+ * @Version V1.0
+ */
+@Data
+public class XunStaticMonth {
+    // 日期
+    private String staticDate;
+    // 巡更点数量
+    private Long xunTotal;
+    // 计划巡更点总数
+    private Integer planLocationTotal;
+    // 实际巡更数
+    private Long actualXunTotal;
+    // 漏巡数
+    private Long UnXunTotal;
+    // 漏巡率
+    private BigDecimal UnXunPercent;
+}

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionLocationLogMapper.java

@@ -72,5 +72,5 @@ public interface TlInspectionLocationLogMapper {
 
     List<TlInspectionLocationLog> selectListByDate(@Param("date") String date);
 
-    List<TlInspectionLocationLog> queryDistanceByDateRange(@Param("startDate") String startDate, @Param("endDate") String endDate);
+    List<TlInspectionLocationLog> queryDistanceByDateRange(@Param("areaName") String areaName, @Param("startDate") String startDate, @Param("endDate") String endDate);
 }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlPatrolmanMapper.java

@@ -65,4 +65,6 @@ public interface TlPatrolmanMapper {
     TlPatrolman queryByThirdId(@Param("thirdId") String thirdId);
 
     void deletePatrolmanByVersion(@Param("version") int version);
+
+    List<TlPatrolman> selectPatrolmanList(@Param("list") List<String> cards);
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlPlanRecordMapper.java

@@ -66,5 +66,5 @@ public interface TlPlanRecordMapper {
 
     List<TlPlanRecord> selectTlPlanRecordListByDate(@Param("date") String date);
 
-    List<TlPlanRecord> selectTlPlanRecordListByDatePeriod(@Param("startDate") String startDate, @Param("endDate") String endDate);
+    List<TlPlanRecord> selectTlPlanRecordListByDatePeriod(@Param("areaId") Long areaId, @Param("startDate") String startDate, @Param("endDate") String endDate);
 }

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/IQdCommonService.java

@@ -5,6 +5,7 @@ import com.ruoyi.qdtl.domain.TlElectricDevice;
 import com.ruoyi.qdtl.domain.TlElectricDeviceLocation;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: TODO
@@ -33,4 +34,6 @@ public interface IQdCommonService {
     List<TlElectricDevice> getElectricCarsDeviceList();
 
     List<TlElectricDeviceLocation> getElectricCarsDeviceLocationList();
+
+    Map<String, Object> monthStatic(Long areaId, String startDate, String endDate);
 }

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/ITlPatrolmanService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.qdtl.service;
 
+import com.ruoyi.qdtl.domain.PatromanStatic;
 import com.ruoyi.qdtl.domain.TlPatrolman;
 
 import java.util.List;
@@ -64,4 +65,6 @@ public interface ITlPatrolmanService {
     TlPatrolman queryByThirdId(String thirdId);
 
     void deletePatrolmanByVersion(int version);
+
+    List<PatromanStatic> getPatrolmanStatic(String cards);
 }

+ 107 - 2
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/QdCommonServiceImpl.java

@@ -1,7 +1,11 @@
 package com.ruoyi.qdtl.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateField;
+import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpRequest;
@@ -11,11 +15,17 @@ import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.ServiceException;
-import com.ruoyi.qdtl.domain.TlElectricDevice;
-import com.ruoyi.qdtl.domain.TlElectricDeviceLocation;
+import com.ruoyi.qdtl.domain.*;
+import com.ruoyi.qdtl.mapper.TlInspectionLocationLogMapper;
+import com.ruoyi.qdtl.mapper.TlInspectionPlanMapper;
+import com.ruoyi.qdtl.mapper.TlPlanRecordMapper;
 import com.ruoyi.qdtl.service.IQdCommonService;
+import com.ruoyi.qdtl.service.ITlAreaService;
 import com.ruoyi.qdtl.service.ITlInspectionDeviceService;
+import com.ruoyi.qdtl.service.ITlInspectionLineLocationService;
+import com.ruoyi.qdtl.service.ITlInspectionLineService;
 import com.ruoyi.qdtl.service.ITlInspectionLocationService;
+import com.ruoyi.qdtl.service.ITlInspectionPlanService;
 import com.ruoyi.qdtl.service.ITlPatrolmanService;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
@@ -23,10 +33,14 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 /**
  * @Description: TODO
@@ -61,6 +75,20 @@ public class QdCommonServiceImpl implements IQdCommonService {
     private ITlInspectionDeviceService tlInspectionDeviceService;
     @Autowired
     private ITlPatrolmanService tlPatrolmanService;
+    @Autowired
+    private ITlInspectionPlanService inspectionPlanService;
+    @Autowired
+    private ITlInspectionLineLocationService inspectionLineLocationService;
+    @Autowired
+    private ITlInspectionLineService inspectionLineService;
+    @Autowired
+    private TlInspectionPlanMapper tlInspectionPlanMapper;
+    @Autowired
+    private TlInspectionLocationLogMapper tlInspectionLocationLogMapper;
+    @Autowired
+    private TlPlanRecordMapper planRecordMapper;
+    @Autowired
+    private ITlAreaService areaService;
 
     /**
      * 获取巡检接口的token
@@ -298,5 +326,82 @@ public class QdCommonServiceImpl implements IQdCommonService {
         }
     }
 
+    @Override
+    public Map<String, Object> monthStatic(Long areaId, String startDate, String endDate) {
+        Map<String, Object> data = new HashMap<>();
+
+        // 查询所有的线路点位
+        List<TlInspectionLineLocation> lineLocations = inspectionLineLocationService.selectTlInspectionLineLocationList(new TlInspectionLineLocation());
+        Map<Long, List<TlInspectionLineLocation>> lineLocationsCollect = lineLocations.stream().collect(Collectors.groupingBy(TlInspectionLineLocation::getLineId));
+        // 查询线路数据
+        TlInspectionLine line = new TlInspectionLine();
+        line.setAreaId(areaId);
+        List<TlInspectionLine> lines = inspectionLineService.selectTlInspectionLineList(line);
+        for (TlInspectionLine tlInspectionLine : lines) {
+            tlInspectionLine.setLineLocations(lineLocationsCollect.getOrDefault(tlInspectionLine.getId(), new ArrayList<>()));
+        }
+        Map<Long, Integer> LineLocationCount = lines.stream().collect(Collectors.toMap(TlInspectionLine::getId, a -> a.getLineLocations().size()));
+        // 查询计划相关
+        List<TlInspectionPlan> list = tlInspectionPlanMapper.queryByDatePeriod(startDate, endDate);
+        List<DateTime> dateTimes = DateUtil.rangeToList(DateUtil.parseDate(startDate), DateUtil.parseDate(endDate), DateField.DAY_OF_YEAR);
+        // 查询areaId对应我爱巡后台是哪个区域
+        String areaName = "";
+        if (ObjectUtil.isNotEmpty(areaId)) {
+            TlArea tlArea = areaService.selectTlAreaById(areaId);
+            if (tlArea != null) {
+                areaName = tlArea.getAreaName();
+            }
+        }
+        // 查询巡更记录表
+        List<TlInspectionLocationLog> locationLogList = tlInspectionLocationLogMapper.queryDistanceByDateRange(areaName, startDate, endDate);
+        Map<String, Long> locationLogCollectCount = locationLogList.stream().collect(Collectors.groupingBy(a -> DateUtil.formatDate(a.getCreateTime()), Collectors.counting()));
+        // 查询计划中的数据
+        List<TlPlanRecord> planRecords = planRecordMapper.selectTlPlanRecordListByDatePeriod(areaId, startDate, endDate);
+        Map<String, Long> unPlanRecordsCollect = planRecords.stream().filter(a -> StrUtil.isBlank(a.getFence())).collect(Collectors.groupingBy(TlPlanRecord::getPlanDate, Collectors.counting()));
+        Map<String, Long> planRecordsCollect = planRecords.stream().collect(Collectors.groupingBy(TlPlanRecord::getPlanDate, Collectors.counting()));
+
+        List<XunStaticMonth> result = new ArrayList<>();
+        for (DateTime existTime : dateTimes) {
+            XunStaticMonth xunStaticMonth = new XunStaticMonth();
+            // 计划巡更点总数
+            int planLocationTotal = 0;
+            for (TlInspectionPlan inspectionPlan : list) {
+                // 每一个计划所有的日期
+                String weeks = inspectionPlan.getWeeks();
+                int week = DateUtil.dayOfWeek(existTime);
+                if (CollUtil.contains(StrUtil.split(weeks, ","), Convert.toStr(week))) {
+                    // 计划巡更点数
+                    planLocationTotal += inspectionPlan.getXunNum() * LineLocationCount.getOrDefault(inspectionPlan.getLineId(), 0);
+                }
+            }
+            xunStaticMonth.setStaticDate(DateUtil.formatDate(existTime));
+            xunStaticMonth.setPlanLocationTotal(planLocationTotal);
+            xunStaticMonth.setActualXunTotal(locationLogCollectCount.getOrDefault(DateUtil.formatDate(existTime), 0L));
+            xunStaticMonth.setUnXunTotal(unPlanRecordsCollect.getOrDefault(DateUtil.formatDate(existTime), 0L));
+            Long xun = planRecordsCollect.getOrDefault(DateUtil.formatDate(existTime), 0L);
+            xunStaticMonth.setXunTotal(xun);
+            xunStaticMonth.setUnXunPercent(xun == 0L ? new BigDecimal(0) : NumberUtil.mul(NumberUtil.div(xunStaticMonth.getUnXunTotal(), xun, 4), 100));
+            result.add(xunStaticMonth);
+        }
+        data.put("xunList", result);
+        // 本月计划巡更点总数
+        Integer planXunLocationTotal = result.stream().mapToInt(XunStaticMonth::getPlanLocationTotal).sum();
+        data.put("planXunLocationTotal", planXunLocationTotal);
+        // 本月漏巡更点总数
+        int unXunTotal = result.stream().mapToInt(a -> Convert.toInt(a.getUnXunTotal())).sum();
+        data.put("unXunTotal", unXunTotal);
+        // 本月已巡更点总数
+        int actualXunTotal = result.stream().mapToInt(a -> Convert.toInt(a.getActualXunTotal())).sum();
+        data.put("actualXunTotal", actualXunTotal);
+        // 本月未巡更点总数
+        int weiXun = result.stream().filter(a -> DateUtil.compare(new Date(), DateUtil.parseDate(a.getStaticDate())) < 0).mapToInt(XunStaticMonth::getPlanLocationTotal).sum();
+        data.put("weiXun", weiXun);
+        // 本月漏巡率
+        int xunTotal = result.stream().mapToInt(a -> Convert.toInt(a.getXunTotal())).sum();
+        double unPercent = (xunTotal == 0) ? (double) 0 : NumberUtil.mul(NumberUtil.div(unXunTotal, xunTotal, 4), 100);
+        data.put("unPercent", unPercent);
+        return data;
+    }
+
 
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlInspectionLocationLogServiceImpl.java

@@ -170,7 +170,7 @@ public class TlInspectionLocationLogServiceImpl implements ITlInspectionLocation
 
     @Override
     public List<JSONObject> queryDistanceByDateRange(String startDate, String endDate) {
-        List<TlInspectionLocationLog> locationLogList = tlInspectionLocationLogMapper.queryDistanceByDateRange(startDate, endDate);
+        List<TlInspectionLocationLog> locationLogList = tlInspectionLocationLogMapper.queryDistanceByDateRange("", startDate, endDate);
         // 解析根据日期分组
         Map<String, List<TlInspectionLocationLog>> collect = locationLogList.stream().collect(Collectors.groupingBy(a -> DateUtil.formatDate(a.getCreateTime())));
         List<JSONObject> result = new ArrayList<>();

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlPatrolmanServiceImpl.java

@@ -1,5 +1,7 @@
 package com.ruoyi.qdtl.service.impl;
 
+import cn.hutool.core.util.StrUtil;
+import com.ruoyi.qdtl.domain.PatromanStatic;
 import com.ruoyi.qdtl.domain.TlPatrolman;
 import com.ruoyi.qdtl.mapper.TlPatrolmanMapper;
 import com.ruoyi.qdtl.service.ITlPatrolmanService;
@@ -99,4 +101,15 @@ public class TlPatrolmanServiceImpl implements ITlPatrolmanService {
     public void deletePatrolmanByVersion(int version) {
         tlPatrolmanMapper.deletePatrolmanByVersion(version);
     }
+
+    @Override
+    public List<PatromanStatic> getPatrolmanStatic(String cards) {
+        List<TlPatrolman> list = tlPatrolmanMapper.selectPatrolmanList(StrUtil.split(cards, ","));
+        // 查询所有的计划
+        for (TlPatrolman tlPatrolman : list) {
+            // 查询每一个巡检员的数据
+
+        }
+        return null;
+    }
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlPlanRecordServiceImpl.java

@@ -222,7 +222,7 @@ public class TlPlanRecordServiceImpl implements ITlPlanRecordService {
      */
     @Override
     public List<AreaCheckInfoStatic> queryCheckInfo(String startDate, String endDate) {
-        List<TlPlanRecord> planRecords = tlPlanRecordMapper.selectTlPlanRecordListByDatePeriod(startDate, endDate);
+        List<TlPlanRecord> planRecords = tlPlanRecordMapper.selectTlPlanRecordListByDatePeriod(null, startDate, endDate);
         // 以各个镇分组
         Map<Long, List<TlPlanRecord>> areaCollect = planRecords.stream().filter(a -> ObjectUtil.isNotNull(a.getAreaId())).collect(Collectors.groupingBy(TlPlanRecord::getAreaId));
         List<AreaCheckInfoStatic> list = new ArrayList<>();

+ 3 - 0
ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionLocationLogMapper.xml

@@ -116,6 +116,9 @@
         where date_format(create_time,'%Y-%m-%d') &gt;= #{startDate}
         and date_format(create_time,'%Y-%m-%d') &lt;= #{endDate}
         and fence != ''
+        <if test="areaName != null and areaName != ''">
+            and area_name = #{areaName}
+        </if>
         order by create_time asc
     </select>
 

+ 12 - 0
ruoyi-system/src/main/resources/mapper/qdtl/TlPatrolmanMapper.xml

@@ -46,6 +46,18 @@
         where third_id = #{thirdId}
     </select>
 
+    <select id="selectPatrolmanList" resultType="com.ruoyi.qdtl.domain.TlPatrolman">
+        <include refid="selectTlPatrolmanVo"/>
+        <where>
+            <if test="list != null">
+                card in
+                <foreach collection="list" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
     <insert id="insertTlPatrolman" parameterType="TlPatrolman" useGeneratedKeys="true" keyProperty="id">
         insert into tl_patrolman
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 3 - 0
ruoyi-system/src/main/resources/mapper/qdtl/TlPlanRecordMapper.xml

@@ -75,6 +75,9 @@
     <select id="selectTlPlanRecordListByDatePeriod" resultMap="TlPlanRecordResult">
         <include refid="selectTlPlanRecordVo"/>
         where plan_date &lt;= #{endDate} and plan_date &gt;= #{startDate}
+        <if test="areaId != null">
+            and area_id = #{areaId}
+        </if>
         order by create_time
     </select>