feiyu02
2025-09-12 dc4f12f66685260ac357997680e5f3fe723c3c4a
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
41
42
43
44
45
46
47
48
49
50
51
52
53
package cn.flightfeather.supervision.domain.ds3.repository
 
import cn.flightfeather.supervision.domain.ds3.entity.FumeSiteMap
import cn.flightfeather.supervision.domain.ds3.mapper.FumeSiteMapMapper
import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
import java.util.*
 
/**
 * 徐汇油烟监测点位和系统用户映射关系数据库相关操作
 */
@Repository
class XHFumeSiteMapRep(
    private val fumeSiteMapMapper: FumeSiteMapMapper,
) {
 
    /**
     * 根据飞羽监管用户id查询
     */
    fun findBySVUserId(idList: List<String?>): List<DeviceMapVo> {
        val res = fumeSiteMapMapper.selectByExample(Example(FumeSiteMap::class.java).apply {
            createCriteria().andIn("svUserId", idList)
        })
        return DeviceMapVo.fromXHFumeSiteMap(res)
    }
 
    /**
     * 新增
     */
    fun insert(fumeSiteMap: FumeSiteMap): Int {
        fumeSiteMap.createTime = Date()
        return fumeSiteMapMapper.insert(fumeSiteMap)
    }
 
    /**
     * 更新
     */
    fun update(fumeSiteMap: FumeSiteMap): Int {
        fumeSiteMap.createTime = Date()
        return fumeSiteMapMapper.updateByPrimaryKeySelective(fumeSiteMap)
    }
 
    /**
     * 根据id查询
     */
    fun findByPrimaryKey(id: Int?): FumeSiteMap? {
        if (id == null) {
            return null
        }
        return fumeSiteMapMapper.selectByPrimaryKey(id)
    }
}