道路线索应急巡查系统服务后台
feiyu02
2025-04-22 41548e262362faf603a71e066e01bd4ef46619d2
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
package com.flightfeather.grid.service.impl
 
import com.flightfeather.grid.config.exception.BizException
import com.flightfeather.grid.domain.ds1.entity.ClueTask
import com.flightfeather.grid.domain.ds1.mapper.ClueTaskMapper
import com.flightfeather.grid.service.ClueTaskService
import org.springframework.stereotype.Service
import java.util.*
 
/**
 *
 * @date 2025/4/18
 * @author feiyu02
 */
@Service
class ClueTaskServiceImpl(private val clueTaskMapper: ClueTaskMapper) : ClueTaskService {
 
    override fun createClueTask(clueTask: ClueTask): Int {
        if (clueTask.guid == null) {
            clueTask.guid = UUID.randomUUID().toString()
        }
        clueTask.createTime = Date()
        clueTask.updateTime = Date()
        return clueTaskMapper.insert(clueTask)
    }
 
    override fun updateClueTask(clueTask: ClueTask): Int {
        if (clueTask.guid == null) throw BizException("更新线索任务失败,缺失主键id")
        clueTask.updateTime = Date()
        clueTaskMapper.selectByPrimaryKey(clueTask.guid) ?: throw BizException("更新线索任务失败,任务不存在")
        return clueTaskMapper.updateByPrimaryKeySelective(clueTask)
    }
 
    override fun getClueTask(clueTask: ClueTask): List<ClueTask?> {
        return clueTaskMapper.select(clueTask)
    }
}