feiyu02
2025-06-09 c17e9978745cfe6c983f3aff75c9182fffef32fd
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt
@@ -14,6 +14,8 @@
import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep
import cn.flightfeather.supervision.lightshare.service.UserinfoService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.DataHead
import com.github.pagehelper.PageHelper
import org.springframework.beans.BeanUtils
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
@@ -45,9 +47,12 @@
        }
    }
    override fun findByType(typeId: Byte): List<Userinfo> {
    override fun findByType(typeId: Byte, enable: Boolean?): List<Userinfo> {
        val result = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
            createCriteria().andEqualTo("usertypeid", typeId)
                .apply {
                    enable?.let { andEqualTo("isenable", it) }
                }
        })
        return result
@@ -68,6 +73,14 @@
    }
    override fun delete(id: String): Int = userinfoMapper.deleteByPrimaryKey(id)
    override fun search(areaVo: AreaVo, keyword: String, userType: Int?, page: Int?, perPage: Int?)
            : Pair<DataHead, List<Userinfo?>> {
        val p = PageHelper.startPage<Userinfo>(page ?: 1, perPage ?: 30)
        val result = userInfoSVRep.searchUser(areaVo, keyword.trim(), Constant.UserType.fromValue(userType))
        result.forEach { it?.password = null }
        return DataHead(p.pageNum, p.pages, p.total) to result
    }
    override fun createAccount(sceneId: String): Userinfo {
        findByScene(sceneId)?.let { return it }
@@ -116,7 +129,7 @@
        scence.let {
            // 判断该场景是否已有对应账户
            val user = userInfoSVRep.findUser(it.guid)
            if (user != null) return Userinfo()
            if (user != null) return user
            val sceneName = it.name ?: return Userinfo()
            val uName = getUName(sceneName)