From 6fdacca914ef38e6cc91292ef07c5af32bd92991 Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期二, 03 十二月 2024 11:12:40 +0800
Subject: [PATCH] 1. BgTask增加onStatusChange参数,通过外界传递如何发送状态改变的消息 2. BackgroundTaskCtrl.kt 创建了BgTask对象并传递了onStatusChange参数 3. WebSocketMessageUtil 类名修改为 WebSocketMessageDecoder 4. SendWebSocketMessageUtil 类名修改为 WebSocketSendMessageUtil

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

diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
index a3ea0a8..a2fac40 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
@@ -1,8 +1,10 @@
 package cn.flightfeather.supervision.domain.ds1.repository
 
+import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.domain.ds1.entity.Scense
 import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
 import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
 import org.springframework.stereotype.Repository
 import tk.mybatis.mapper.entity.Example
 
@@ -12,20 +14,55 @@
 @Repository
 class UserInfoSVRep(
     private val userinfoMapper: UserinfoMapper,
+    private val sceneRep: SceneRep,
 ) {
 
     /**
-     * 鏌ユ壘鍦烘櫙
+     * 鏌ユ壘鐢ㄦ埛
      */
     fun findUser(sceneIdList: List<String?>): List<Userinfo?> {
+        if (sceneIdList.isEmpty()) return emptyList()
         return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
             createCriteria().andIn("dGuid", sceneIdList)
         })
     }
 
-    fun findUser(sceneId: String): List<Userinfo?> {
-        return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
-            createCriteria().andEqualTo("dGuid", sceneId)
-        })
+    fun findUser(sceneId: String?): Userinfo? {
+        return try {
+            userinfoMapper.selectOne(Userinfo().apply { dGuid = sceneId })
+        } catch (e: Exception) {
+            null
+        }
+    }
+
+    /**
+     * 妯$硦鎼滅储鐢ㄦ埛
+     * @param areaVo 鏌ヨ鍖哄煙鑼冨洿
+     * @param keyword 鎼滅储鍏抽敭瀛楋紝鍖归厤璐︽埛[Userinfo.acountname]鍜屾樀绉癧Userinfo.realname]
+     * @param userType 鐢ㄦ埛绫诲瀷锛岄粯璁や紒涓歔Constant.UserType.ENTERPRISE]
+     */
+    fun searchUser(
+        areaVo: AreaVo, keyword: String,
+        userType: Constant.UserType = Constant.UserType.ENTERPRISE,
+    ): List<Userinfo?> {
+        return userinfoMapper.searchUser(areaVo, keyword, userType.value)
+//        val userList = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
+//            createCriteria().orLike("realname", "%${keyword}%")
+//                .orLike("acountname", "%${keyword}%")
+//        })
+//        val sceneList = sceneRep.findSceneList(Scense().apply {
+//            provincecode = areaVo.provincecode
+//            citycode = areaVo.citycode
+//            districtcode = areaVo.districtcode
+//            towncode = areaVo.towncode
+//            typeid = areaVo.scensetypeid?.toByteOrNull()
+//            extension1 = if (areaVo.online == true) "1" else "0"
+//        })
+//        return userList.filter { u ->
+//            val scene = sceneList.find { s ->
+//                return@find s?.guid == u.dGuid
+//            }
+//            return@filter scene != null
+//        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3