| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.pre.dao.MmPredictAlarmMessageDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmMessageEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictAlarmMessageService; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessagePageReqVO; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessageSaveReqVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月19日 |
| | | */ |
| | | public class MmPredictAlarmMessageServiceImpl implements MmPredictAlarmMessageService { |
| | | @Service |
| | | public class MmPredictAlarmMessageServiceImpl extends BaseServiceImpl<MmPredictAlarmMessageDao, MmPredictAlarmMessageEntity> |
| | | implements MmPredictAlarmMessageService { |
| | | |
| | | |
| | | @Override |
| | | public PageResult<MmPredictAlarmMessageEntity> page(MmPredictAlarmMessagePageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public MmPredictAlarmMessageEntity getInfo(String id) { |
| | | return baseDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MmPredictAlarmMessageEntity getLast(String alarmObj) { |
| | | QueryWrapper<MmPredictAlarmMessageEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("alarm_obj", alarmObj) |
| | | .orderByDesc("alarm_time") |
| | | .last("limit 1"); |
| | | return baseDao.selectOne(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void create(MmPredictAlarmMessageSaveReqVO reqVO) { |
| | | MmPredictAlarmMessageEntity entity = BeanUtils.toBean(reqVO, MmPredictAlarmMessageEntity.class); |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | entity.setCreateTime(new Date()); |
| | | baseDao.insert(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(MmPredictAlarmMessageSaveReqVO reqVO) { |
| | | MmPredictAlarmMessageEntity entity = BeanUtils.toBean(reqVO, MmPredictAlarmMessageEntity.class); |
| | | baseDao.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | baseDao.deleteById(id); |
| | | } |
| | | } |