feiyu02
2025-09-19 7cbe1610b87da19ed8a146a09b1117f92d9d3d98
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,12 +14,14 @@
@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)
        })
@@ -30,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
//        }
    }
}