feiyu02
2023-11-13 7ecdc67dfb92b63bdc742e5c95d62bf9774cbd7f
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
package com.flightfeather.monitor.domain.ds1.repository
 
import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting
import com.flightfeather.monitor.domain.ds1.mapper.DustExceptionSettingMapper
import com.github.pagehelper.PageHelper
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
 
@Repository
class DustExceptionSettingRep(private val dustExceptionSettingMapper: DustExceptionSettingMapper) {
 
    /**
     * 获取最新配置
     * @param region 区县
     */
    fun findLatestSetting(region: String): DustExceptionSetting? {
        val p = PageHelper.startPage<DustExceptionSetting>(1, 1)
        dustExceptionSettingMapper.selectByExample(Example(DustExceptionSetting::class.java).apply {
            createCriteria().andEqualTo("region", region)
            orderBy("version").desc()
        })
        return if (p.isNotEmpty()) {
            p[0]
        } else {
            null
        }
    }
}