|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.iflytop.sgs.app.mapper.CraftMonitorMapper; |
|
|
|
import com.iflytop.sgs.app.model.entity.CraftMonitor; |
|
|
|
import com.iflytop.sgs.common.enums.HeatModuleCode; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -21,10 +22,14 @@ public class CraftMonitorService extends ServiceImpl<CraftMonitorMapper, CraftMo |
|
|
|
public void saveMonitor(CraftMonitor craftMonitor) { |
|
|
|
CraftMonitor craftMonitorExist = this.getOne(new LambdaQueryWrapper<CraftMonitor>().eq(CraftMonitor::getHeatId, craftMonitor.getHeatId())); |
|
|
|
if (craftMonitorExist != null) { |
|
|
|
BeanUtil.copyProperties(craftMonitor, craftMonitorExist,"id"); |
|
|
|
BeanUtil.copyProperties(craftMonitor, craftMonitorExist, "id"); |
|
|
|
this.updateById(craftMonitorExist); |
|
|
|
} else { |
|
|
|
this.save(craftMonitor); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public CraftMonitor getByHeatModule(HeatModuleCode heatModuleCode) { |
|
|
|
return this.getOne(new LambdaQueryWrapper<CraftMonitor>().eq(CraftMonitor::getHeatId, heatModuleCode)); |
|
|
|
} |
|
|
|
} |