From 0674dea7dd0e75199c0c200e6a41070c25677082 Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期二, 19 十一月 2024 14:58:16 +0800 Subject: [PATCH] 问题整改的审核撤回 --- 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