feiyu02
2024-04-25 0392c333ed3d987cb2ab3dac4e1a972cff405f21
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
35
36
37
38
39
40
package cn.flightfeather.supervision.domain.ds3.repository
 
import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap
import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteInfoMapper
import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper
import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
import cn.flightfeather.supervision.lightshare.vo.DeviceSiteVo
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
 
/**
 * 金山扬尘监测点位和系统用户映射关系数据库相关操作
 */
@Repository
class JSDustSiteRep(
    private val jsDustSiteMapMapper: JSDustSiteMapMapper,
    private val jsDustSiteInfoMapper: JSDustSiteInfoMapper,
) {
 
    /**
     * 根据飞羽监管用户id查询场景和监测设备的匹配关系
     * @param idList 监管场景对应的用户id列表
     * @return 匹配关系列表
     */
    fun findMapBySVUserId(idList: List<String?>): List<DeviceMapVo> {
        val res = jsDustSiteMapMapper.selectByExample(Example(JSDustSiteMap::class.java).apply {
            createCriteria().andIn("svUserId", idList)
        })
        return DeviceMapVo.fromJSDustSiteMap(res)
    }
 
    /**
     * 获取金山监测点位基本信息
     * @return 监测点信息列表
     */
    fun findSiteInfo(): List<DeviceSiteVo> {
        val res = jsDustSiteInfoMapper.selectAll()
        return DeviceSiteVo.fromJSDustSiteInfo(res)
    }
}