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.framework.common.util.object.ConvertUtils;
|
import com.iailab.module.device.dao.DeviceFaultDao;
|
import com.iailab.module.device.dto.DeviceFaultDTO;
|
import com.iailab.module.device.entity.DeviceFaultEntity;
|
import com.iailab.module.device.service.DeviceFaultService;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Map;
|
|
/**
|
* 设备故障库;
|
*
|
* @author lirm ${email}
|
* @since 1.0.0 2024-05-23
|
*/
|
@Service
|
public class DeviceFaultServiceImpl extends CrudServiceImpl<DeviceFaultDao, DeviceFaultEntity, DeviceFaultDTO> implements DeviceFaultService {
|
|
@Override
|
public QueryWrapper<DeviceFaultEntity> getWrapper(Map<String, Object> params) {
|
String className = (String) params.get("className");
|
String faultType = (String) params.get("faultType");
|
|
QueryWrapper<DeviceFaultEntity> wrapper = new QueryWrapper<>();
|
wrapper.like(StringUtils.isNotBlank(className), "class_name", className)
|
.like(StringUtils.isNotBlank(faultType), "fault_type", faultType);
|
|
return wrapper;
|
}
|
|
@Override
|
public DeviceFaultDTO getSolution(DeviceFaultDTO queryDto) {
|
QueryWrapper<DeviceFaultEntity> wrapper = new QueryWrapper<>();
|
wrapper.eq("class_no", queryDto.getClassNo())
|
.eq("index_type", queryDto.getIndexType())
|
.eq("fault_type", queryDto.getFaultType());
|
DeviceFaultEntity entity = baseDao.selectOne(wrapper);
|
return ConvertUtils.sourceToTarget(entity, DeviceFaultDTO.class);
|
}
|
|
|
}
|