riku
2019-09-16 6f6c35f0e0881d2bbf32ad62f6c59f0ab1504854
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.flightfeather.obd.repository.impl
 
import com.flightfeather.obd.domain.entity.ObdUser
import com.flightfeather.obd.domain.mapper.ObdUserMapper
import com.flightfeather.obd.lightshare.bean.ObdUserVo
import com.flightfeather.obd.repository.ObdUserRepository
import org.springframework.beans.BeanUtils
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
 
/**
 * @author riku
 * Date: 2019/9/6
 */
@Repository
class ObdUserDaoImpl(val obdUserMapper: ObdUserMapper): ObdUserRepository {
 
    override fun getUserInfo(userId: String): ObdUserVo? {
        val example = Example(ObdUser::class.java).apply {
            createCriteria().andEqualTo("obdUserId", userId)
        }
 
        val result = obdUserMapper.selectByExample(example)
 
        if (result.isNotEmpty()) {
            val vo = ObdUserVo()
            BeanUtils.copyProperties(result[0], vo)
            return vo
        }
 
        return null
    }
 
}