package cn.flightfeather.supervision.domain.ds2.repository
|
|
import cn.flightfeather.supervision.domain.ds1.entity.Scense
|
import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper
|
import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper
|
import cn.flightfeather.supervision.domain.ds2.entity.UserMap
|
import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
|
import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
|
import org.springframework.stereotype.Repository
|
import tk.mybatis.mapper.entity.Example
|
|
@Repository
|
class UserMapRep(
|
private val userMapMapper: UserMapMapper,
|
private val scenseMapper: ScenseMapper,
|
private val userinfoMapper: UserinfoMapper
|
) {
|
|
/**
|
* 从飞羽监管系统中查找基本信息
|
* @param userinfoTZ 飞羽环境中的用户信息
|
* @return
|
*/
|
fun findFromSupervision(userinfoTZ: UserinfoTZ?): Scense? {
|
val userMap = UserMap().apply {
|
tzUserId = userinfoTZ?.guid
|
}
|
// 找到两个系统用户的对应关系
|
val uMap = userMapMapper.selectOne(userMap)
|
if (uMap == null) {
|
println("${userinfoTZ?.guid}, ${userinfoTZ?.realname}")
|
return null
|
}
|
// 找到飞羽监管中的用户信息
|
val userInfoSp = userinfoMapper.selectByPrimaryKey(uMap.svUserId)
|
// 找到飞羽监管中的场景信息
|
return scenseMapper.selectByPrimaryKey(userInfoSp.dGuid)
|
}
|
|
/**
|
* 通过飞羽监管用户id查询飞羽环境用户id
|
*/
|
fun findBySVUserId(idList: List<String?>): List<UserMap?> {
|
return userMapMapper.selectByExample(Example(UserMap::class.java).apply {
|
createCriteria().andIn("svUserId", idList)
|
})
|
}
|
}
|