package cn.flightfeather.supervision.domain.ds1.repository
|
|
import cn.flightfeather.supervision.common.utils.Constant
|
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
|
import cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper
|
import cn.flightfeather.supervision.lightshare.vo.AreaVo
|
import cn.flightfeather.supervision.lightshare.vo.SubTaskSummary
|
import org.springframework.stereotype.Repository
|
import tk.mybatis.mapper.entity.Example
|
import java.time.LocalDateTime
|
|
@Repository
|
class SubTaskRep(private val subtaskMapper: SubtaskMapper) {
|
|
fun update(subtask: Subtask): Int {
|
return subtaskMapper.updateByPrimaryKey(subtask)
|
}
|
|
fun findOne(primaryKey:String): Subtask? {
|
return subtaskMapper.selectByPrimaryKey(primaryKey)
|
}
|
|
fun findAll(subtask: Subtask): List<Subtask?> {
|
return subtaskMapper.select(subtask)
|
}
|
|
/**
|
* 根据总任务、场景类型、问题类型,获取发现该种类问题的场景信息
|
*/
|
fun findSubtasks(topTaskId: String, sceneTypeId:String, proType: String): List<Subtask?> {
|
return subtaskMapper.findSubTasksByProType(topTaskId, sceneTypeId, proType)
|
}
|
|
/**
|
* 查找正在执行的巡查任务
|
*/
|
fun findByStatus(status: Constant.TaskProgress): List<Subtask?> {
|
return subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
|
createCriteria().andEqualTo("status", status.text)
|
})
|
}
|
|
fun findByTime(sT: LocalDateTime, eT: LocalDateTime): List<Subtask?> {
|
return subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
|
createCriteria().andBetween("planstarttime", sT, eT)
|
})
|
}
|
|
fun findByTime(year: Int, month: Int): List<Subtask?> {
|
val sT = LocalDateTime.of(year, month, 1, 0, 0, 0)
|
val eT = sT.plusMonths(1).minusSeconds(1)
|
return findByTime(sT, eT)
|
}
|
|
|
// 巡查任务问题整改详情统计相关
|
fun findSummary(areaVo: AreaVo): List<SubTaskSummary> {
|
return subtaskMapper.getSummaryByArea(areaVo)
|
}
|
}
|