package cn.flightfeather.supervision.lightshare.service.impl
|
|
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
|
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
|
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper
|
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper
|
import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService
|
import org.springframework.stereotype.Service
|
import tk.mybatis.mapper.entity.Example
|
|
@Service
|
class EvaluationsubruleServiceImpl (
|
val evaluationsubruleMapper: EvaluationsubruleMapper,
|
val evaluationruleMapper: EvaluationruleMapper
|
):EvaluationsubruleService {
|
|
override fun findOne(id: String): Evaluationsubrule = evaluationsubruleMapper.selectByPrimaryKey(id)
|
|
override fun findAll(): MutableList<Evaluationsubrule> = evaluationsubruleMapper.selectAll()
|
|
override fun save(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.insert(evaluationsubrule)
|
|
override fun update(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule)
|
|
override fun delete(id: String): Int = evaluationsubruleMapper.deleteByPrimaryKey(id)
|
|
override fun findByRuleId(erguid: String): List<Evaluationsubrule> {
|
val example = Example(Evaluationsubrule::class.java)
|
val criteria = example.createCriteria()
|
criteria.andEqualTo("erguid", erguid)
|
example.orderBy("extension1").desc()
|
return evaluationsubruleMapper.selectByExample(example)
|
}
|
|
override fun search(districtCode: String, sceneTypeId: String, version: String?): List<Evaluationsubrule> {
|
val result = mutableListOf<Evaluationsubrule>()
|
evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
|
createCriteria().andEqualTo("districtcode", districtCode)
|
.andEqualTo("scensetypeid", sceneTypeId)
|
}).takeIf { it.isNotEmpty() }?.get(0)?.let {rule ->
|
evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule::class.java).apply {
|
createCriteria().andEqualTo("erguid", rule.guid)
|
})
|
}?.also {
|
result.addAll(it)
|
}
|
|
return result
|
}
|
}
|