package com.iailab.module.device.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.iailab.framework.common.constant.Constant;
|
import com.iailab.framework.common.page.PageData;
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.module.device.dao.DeviceHealthAlarmDao;
|
import com.iailab.module.device.dto.DeviceHealthAlarmDTO;
|
import com.iailab.module.device.entity.DeviceHealthAlarmEntity;
|
import com.iailab.module.device.service.DeviceHealthAlarmService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Map;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年06月28日
|
*/
|
@Slf4j
|
@Service
|
public class DeviceHealthAlarmServiceImpl extends BaseServiceImpl<DeviceHealthAlarmDao, DeviceHealthAlarmEntity>
|
implements DeviceHealthAlarmService {
|
@Override
|
public PageData<DeviceHealthAlarmDTO> page(Map<String, Object> params) {
|
IPage<DeviceHealthAlarmEntity> page = baseDao.selectPage(
|
getPage(params, Constant.CREATE_DATE, false),
|
getWrapper(params)
|
);
|
return getPageData(page, DeviceHealthAlarmDTO.class);
|
}
|
|
@Override
|
public DeviceHealthAlarmDTO get(String id) {
|
return baseDao.getInfo(id);
|
}
|
|
private QueryWrapper<DeviceHealthAlarmEntity> getWrapper(Map<String, Object> params) {
|
String devNo = (String) params.get("devNo");
|
String devName = (String) params.get("devName");
|
String faultName = (String) params.get("faultName");
|
String startTime = (String) params.get("startTime");
|
String endTime = (String) params.get("endTime");
|
QueryWrapper<DeviceHealthAlarmEntity> wrapper = new QueryWrapper<>();
|
wrapper.like(StringUtils.isNotBlank(devNo), "dev_no", devNo)
|
.like(StringUtils.isNotBlank(devName), "dev_name", devName)
|
.eq(StringUtils.isNotBlank(faultName), "fault_name", faultName)
|
.ge(StringUtils.isNotBlank(startTime), "fault_time", startTime)
|
.le(StringUtils.isNotBlank(endTime), "fault_time", endTime);
|
return wrapper;
|
}
|
}
|