feiyu02
2025-09-12 dc4f12f66685260ac357997680e5f3fe723c3c4a
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt
@@ -1,12 +1,15 @@
package cn.flightfeather.supervision.domain.ds2.repository
import cn.flightfeather.supervision.domain.ds2.entity.DustSiteInfo
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 com.github.pagehelper.PageHelper
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
import java.util.*
/**
 * 静安工地扬尘监测点位数据库相关操作
@@ -37,4 +40,37 @@
        val res = dustSiteInfoMapper.selectAll()
        return DeviceSiteVo.fromJADustSiteInfo(res)
    }
    fun searchSiteInfo(keyword: String): List<DeviceSiteVo> {
        val res = dustSiteInfoMapper.selectByExample(Example(DustSiteInfo::class.java).apply {
            createCriteria().andLike("name", "%$keyword%")
        })
        return DeviceSiteVo.fromJADustSiteInfo(res)
    }
    /**
     * 根据id查询
     */
    fun findByPrimaryKey(id: Int?): DustSiteMap? {
        if (id == null) {
            return null
        }
        return dustSiteMapMapper.selectByPrimaryKey(id)
    }
    /**
     * 新增
     */
    fun insert(dustSiteMap: DustSiteMap): Int {
        dustSiteMap.createTime = Date()
        return dustSiteMapMapper.insert(dustSiteMap)
    }
    /**
     * 更新
     */
    fun update(dustSiteMap: DustSiteMap): Int {
        dustSiteMap.createTime = Date()
        return dustSiteMapMapper.updateByPrimaryKeySelective(dustSiteMap)
    }
}