From b212ef0208cb094f63ea8a239a1361f8e859c839 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 08 七月 2024 17:40:39 +0800
Subject: [PATCH] 2024.7.8

---
 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt
index feb9778..b541b19 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt
@@ -1,20 +1,60 @@
 package cn.flightfeather.supervision.domain.ds1.repository
 
+import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.domain.ds1.entity.Subtask
 import cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.SubTaskSummary
 import org.springframework.stereotype.Repository
+import tk.mybatis.mapper.entity.Example
+import java.time.LocalDateTime
 
 @Repository
 class SubTaskRep(private val subtaskMapper: SubtaskMapper) {
 
+    fun update(subtask: Subtask): Int {
+        return subtaskMapper.updateByPrimaryKey(subtask)
+    }
 
-    fun find(id:String): Subtask? {
+    fun findOne(id:String): Subtask? {
         return subtaskMapper.selectByPrimaryKey(id)
     }
+
+    fun findAll(subtask: Subtask): List<Subtask?> {
+        return subtaskMapper.select(subtask)
+    }
+
     /**
      * 鏍规嵁鎬讳换鍔°�佸満鏅被鍨嬨�侀棶棰樼被鍨嬶紝鑾峰彇鍙戠幇璇ョ绫婚棶棰樼殑鍦烘櫙淇℃伅
      */
     fun findSubtasks(topTaskId: String, sceneTypeId:String, proType: String): List<Subtask?> {
         return subtaskMapper.findSubTasksByProType(topTaskId, sceneTypeId, proType)
     }
+
+    /**
+     * 鏌ユ壘姝e湪鎵ц鐨勫贰鏌ヤ换鍔�
+     */
+    fun findByStatus(status: Constant.TaskProgress): List<Subtask?> {
+        return subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
+            createCriteria().andEqualTo("status", status.text)
+        })
+    }
+
+    fun findByTime(sT: LocalDateTime, eT: LocalDateTime): List<Subtask?> {
+        return subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
+            createCriteria().andBetween("planstarttime", sT, eT)
+        })
+    }
+
+    fun findByTime(year: Int, month: Int): List<Subtask?> {
+        val sT = LocalDateTime.of(year, month, 1, 0, 0, 0)
+        val eT = sT.plusMonths(1).minusSeconds(1)
+        return findByTime(sT, eT)
+    }
+
+
+    // 宸℃煡浠诲姟闂鏁存敼璇︽儏缁熻鐩稿叧
+    fun findSummary(areaVo: AreaVo): List<SubTaskSummary> {
+        return subtaskMapper.getSummaryByArea(areaVo)
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3