| | |
| | | @Repository |
| | | class ObdThresholdValueDaoImpl(val obdThresholdValueMapper: ThresholdValueMapper) : ObdThresholdValueRepository { |
| | | |
| | | override fun save(thresholdValueVo: ThresholdValueVo): Boolean { |
| | | override fun save(userId: String, thresholdValueVo: ThresholdValueVo): Boolean { |
| | | val thresholdValue = ThresholdValue() |
| | | BeanUtils.copyProperties(thresholdValueVo, thresholdValue) |
| | | return obdThresholdValueMapper.insert(thresholdValue) == 1 |
| | | val example = Example(ThresholdValue::class.java).apply { |
| | | createCriteria().andEqualTo("obdVin", thresholdValueVo.obdVin) |
| | | } |
| | | val tempResult = obdThresholdValueMapper.selectByExample(example) |
| | | return if (tempResult.isNotEmpty()) |
| | | false |
| | | else |
| | | obdThresholdValueMapper.insert(thresholdValue) == 1 |
| | | } |
| | | |
| | | override fun update(thresholdValueVo: ThresholdValueVo): Boolean { |
| | | override fun update(userId: String, thresholdValueVo: ThresholdValueVo): Boolean { |
| | | val thresholdValue = ThresholdValue() |
| | | BeanUtils.copyProperties(thresholdValueVo, thresholdValue) |
| | | return obdThresholdValueMapper.updateByPrimaryKey(thresholdValue) == 1 |
| | | val example = Example(ThresholdValue::class.java).apply { |
| | | createCriteria().andEqualTo("obdVin", thresholdValue.obdVin) |
| | | } |
| | | return obdThresholdValueMapper.updateByExample(thresholdValue, example) == 1 |
| | | } |
| | | |
| | | override fun getByVinCode(vinCode: String): ThresholdValueVo? { |
| | |
| | | |
| | | if (result.isNotEmpty()) { |
| | | val vo = ThresholdValueVo() |
| | | BeanUtils.copyProperties(vo, result[0]) |
| | | BeanUtils.copyProperties(result[0], vo) |
| | | return vo |
| | | } |
| | | |