| | |
| | | package cn.flightfeather.supervision.domain.ds2.repository |
| | | |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ |
| | | import cn.flightfeather.supervision.domain.ds2.mapper.UserinfoTZMapper |
| | | import org.springframework.stereotype.Repository |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.util.* |
| | | |
| | | @Repository |
| | | class UserInfoTZRep(private val userinfoTZMapper: UserinfoTZMapper) { |
| | |
| | | */ |
| | | fun findEnterpriseUser(district: String?, sceneType: Constant.SceneType): List<UserinfoTZ?> { |
| | | val type = Constant.SceneType.typeMap(sceneType.value.toByte()) |
| | | return findEnterpriseUser(district, type?.toInt()) |
| | | } |
| | | |
| | | /** |
| | | * 查找在线的正式企业用户 |
| | | * @param sceneTypeTZ 飞羽环境系统中的场景类型 |
| | | */ |
| | | fun findEnterpriseUser(district: String?, sceneTypeTZ: Int?): List<UserinfoTZ?> { |
| | | return userinfoTZMapper.selectByExample(Example(UserinfoTZ::class.java).apply { |
| | | createCriteria().andEqualTo("extension2", type) |
| | | createCriteria().andEqualTo("extension2", sceneTypeTZ) |
| | | .andEqualTo("extension1", district) |
| | | .andEqualTo("usertypeid", Constant.UserType.ENTERPRISE.value) |
| | | .andEqualTo("isenable", true) |
| | | and(createCriteria().orIsNull("workno").orNotEqualTo("workno", "test")) |
| | | }) |
| | | } |
| | | |
| | | fun findOne(userinfoTZ: UserinfoTZ): UserinfoTZ? { |
| | | return userinfoTZMapper.selectOne(userinfoTZ) |
| | | } |
| | | |
| | | fun insert(userinfoTZ: UserinfoTZ): Int { |
| | | if (userinfoTZ.guid == null) userinfoTZ.guid = UUIDGenerator.generate16ShortUUID() |
| | | if (userinfoTZ.headIconUrl == null) userinfoTZ.headIconUrl = "" |
| | | userinfoTZ.uiCreateTime = Date() |
| | | return userinfoTZMapper.insert(userinfoTZ) |
| | | } |
| | | |
| | | } |