From 8a0a8adfbe53db564df7aaaf561a60be7d4d8dd0 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 26 九月 2024 17:52:24 +0800
Subject: [PATCH] 1. 新增监管系统中用户模糊搜索功能 2. 新增监测设备和用户的匹配关系搜索功能

---
 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 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 d3bc67d..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,6 +14,7 @@
 @Repository
 class UserInfoSVRep(
     private val userinfoMapper: UserinfoMapper,
+    private val sceneRep: SceneRep,
 ) {
 
     /**
@@ -31,4 +34,35 @@
             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