feiyu02
2024-08-15 196bb14112448857a885e32dc4149e308e00b01a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package cn.flightfeather.supervision.lightshare.repository.impl
 
import cn.flightfeather.supervision.domain.entity.EnvironmentalSchedule
import cn.flightfeather.supervision.domain.entity.UserConfig
import cn.flightfeather.supervision.domain.entity.Userinfo
import cn.flightfeather.supervision.domain.mapper.EnvironmentalScheduleMapper
import cn.flightfeather.supervision.lightshare.repository.ScheduleRepository
import cn.flightfeather.supervision.lightshare.vo.ScheduleOption
import org.springframework.stereotype.Repository
 
@Repository
class ScheduleRepositoryImpl(private val scheduleMapper: EnvironmentalScheduleMapper) : ScheduleRepository {
 
    override fun getSchedules(
        userInfo: Userinfo,
        configs: List<UserConfig?>,
        option: ScheduleOption,
    ): List<EnvironmentalSchedule?> {
        if (userInfo.guid == null || configs.isEmpty() || userInfo.extension2 == null) return emptyList()
        val configId = mutableListOf<Int>()
        configs.forEach { it?.let { configId.add(it.ucId) } }
        return scheduleMapper.getSchedules(userInfo.guid!!, configId, userInfo.extension2!!, option.type)
    }
}