package com.iailab.module.device.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.service.impl.CrudServiceImpl; import com.iailab.module.device.dao.DeviceAbnormalHistoryDao; import com.iailab.module.device.dto.DeviceAbnormalHistoryDTO; import com.iailab.module.device.entity.DeviceAbnormalHistoryEntity; import com.iailab.module.device.service.DeviceAbnormalHistoryService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 异常设备历史表 * * @author lirm ${email} * @since 1.0.0 2024-05-22 */ @Service public class DeviceAbnormalHistoryServiceImpl extends CrudServiceImpl implements DeviceAbnormalHistoryService { @Override public QueryWrapper getWrapper(Map params){ String id = (String)params.get("id"); String endDate = (String)params.get("endDate"); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), "id", id); return wrapper; } @Override public void insertHistory(Map tMap) { Map map = new HashMap<>(); int normal = Integer.parseInt(tMap.get("normal").toString()); int common = Integer.parseInt(tMap.get("common").toString()); int heavy = Integer.parseInt(tMap.get("heavy").toString()); int serious = Integer.parseInt(tMap.get("serious").toString()); int espSerious = Integer.parseInt(tMap.get("espSerious").toString()); int total_count = normal + common + heavy + serious + espSerious; int abnormal_count = common + heavy + serious + espSerious; map.put("total_count",total_count); map.put("abnormal_count",abnormal_count); baseDao.insertHistory(map); } @Override public List getlist(Map params) { return baseDao.getlist(params); } }