package cn.flightfeather.supervision.lightshare.service.Impl
|
|
import cn.flightfeather.supervision.domain.entity.HWFile
|
import cn.flightfeather.supervision.domain.entity.HWRecord
|
import cn.flightfeather.supervision.domain.mapper.BaseInfoMapper
|
import cn.flightfeather.supervision.domain.mapper.CompanyMapper
|
import cn.flightfeather.supervision.domain.mapper.HWFileMapper
|
import cn.flightfeather.supervision.domain.mapper.HWRecordMapper
|
import cn.flightfeather.supervision.lightshare.service.HazardousWasteService
|
import org.springframework.stereotype.Service
|
import tk.mybatis.mapper.entity.Example
|
|
@Service
|
class HazardousWasteServiceImpl(
|
val hwFileMapper: HWFileMapper,
|
val hwRecordMapper: HWRecordMapper,
|
val companyMapper: CompanyMapper,
|
val baseInfoMapper: BaseInfoMapper
|
) : HazardousWasteService {
|
|
override fun getFile(userId: String): List<HWFile?> {
|
val baseInfo = baseInfoMapper.selectByPrimaryKey(userId)
|
val result = hwFileMapper.selectByExample(Example(HWFile::class.java).apply {
|
createCriteria().andEqualTo("ciGuid", baseInfo.ciGuid)
|
orderBy("hbTime").desc()
|
})
|
return result
|
}
|
|
override fun getRecord(userId: String, year: String?): List<HWRecord?> {
|
val baseInfo = baseInfoMapper.selectByPrimaryKey(userId)
|
val result = mutableListOf<HWRecord>()
|
val r = hwRecordMapper.selectByExample(Example(HWRecord::class.java).apply {
|
createCriteria().andEqualTo("ciGuid", baseInfo.ciGuid)
|
.apply {
|
year?.let { andEqualTo("hrTime", year) }
|
}
|
orderBy("hrTime").desc()
|
})
|
if (r.isNotEmpty()) {
|
val maxYear = r[0]?.hrTime
|
r.forEach {
|
it?.let {
|
if (it.hrTime == maxYear) {
|
result.add(it)
|
}
|
}
|
}
|
}
|
return result
|
}
|
|
override fun saveHWFile(info: HWFile): Int {
|
// TODO: 2023/3/20 not yet implemented
|
return 0
|
}
|
|
override fun updateHWFile(info: HWFile): Int {
|
// TODO: 2023/3/20 not yet implemented
|
return 0
|
}
|
|
override fun saveHWRecord(info: HWRecord): Int {
|
// TODO: 2023/3/20 not yet implemented
|
return 0
|
}
|
|
override fun updateHWRecord(info: HWRecord): Int {
|
// TODO: 2023/3/20 not yet implemented
|
return 0
|
}
|
}
|