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.ds2.repository
 
import cn.flightfeather.supervision.domain.ds2.entity.DustSiteMap
import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteInfoMapper
import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteMapMapper
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 JADustSiteRep(
    private val dustSiteMapMapper: DustSiteMapMapper,
    private val dustSiteInfoMapper: DustSiteInfoMapper,
) {
 
    /**
     * 根据飞羽监管用户id查询场景和监测设备的匹配关系
     * @param idList 监管场景对应的用户id列表
     * @return 匹配关系列表
     */
    fun findMapBySVUserId(idList: List<String?>): List<DeviceMapVo> {
        val res = dustSiteMapMapper.selectByExample(Example(DustSiteMap::class.java).apply {
            createCriteria().andIn("svUserId", idList)
        })
        return DeviceMapVo.fromJADustSiteMap(res)
    }
 
    /**
     * 获取静安工地点位基本信息
     * @return 监测点信息列表
     */
    fun findSiteInfo(): List<DeviceSiteVo> {
        val res = dustSiteInfoMapper.selectAll()
        return DeviceSiteVo.fromJADustSiteInfo(res)
    }
}