| | |
| | | |
| | | import com.flightfeather.obd.domain.entity.ObdInfo |
| | | import com.flightfeather.obd.domain.mapper.ObdInfoMapper |
| | | import com.flightfeather.obd.lightshare.bean.ObdInfoVo |
| | | import com.flightfeather.obd.repository.ObdInfoRepository |
| | | import com.flightfeather.obd.socket.bean.ObdPackageData |
| | | import com.flightfeather.obd.socket.eunm.ObdCommandUnit |
| | | import com.github.pagehelper.PageHelper |
| | | import org.springframework.beans.BeanUtils |
| | | import org.springframework.stereotype.Repository |
| | | import tk.mybatis.mapper.entity.Example |
| | | |
| | | /** |
| | | * @author riku |
| | |
| | | } else { |
| | | false |
| | | } |
| | | |
| | | } |
| | | |
| | | override fun getObdInfo(deviceCode: String, pageNum: Int?, pageSize: Int?): List<ObdInfoVo> { |
| | | val example = Example(ObdInfo::class.java).apply { |
| | | createCriteria().andEqualTo("obdDeviceCode", deviceCode).run { |
| | | orderBy("obdDataTime").desc() |
| | | } |
| | | } |
| | | |
| | | //分页 |
| | | val offset = (pageSize?.times(pageNum?.minus(1) ?: 0)) ?: 0 |
| | | PageHelper.offsetPage<ObdInfo>(offset, pageSize ?: 10) |
| | | val result = obdInfoMapper.selectByExample(example) |
| | | |
| | | val resultList = mutableListOf<ObdInfoVo>() |
| | | result.forEach { |
| | | val vo = ObdInfoVo() |
| | | BeanUtils.copyProperties(it, vo) |
| | | resultList.add(vo) |
| | | } |
| | | |
| | | return resultList |
| | | } |
| | | } |