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.DeviceIndexDao;
|
import com.iailab.module.device.dto.DeviceIndexDTO;
|
import com.iailab.module.device.entity.DeviceIndexEntity;
|
import com.iailab.module.device.service.DeviceIndexService;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 设备故障库;
|
*
|
* @author lirm ${email}
|
* @since 1.0.0 2024-05-23
|
*/
|
@Service
|
public class DeviceIndexServiceImpl extends CrudServiceImpl<DeviceIndexDao, DeviceIndexEntity, DeviceIndexDTO> implements DeviceIndexService {
|
|
@Override
|
public QueryWrapper<DeviceIndexEntity> getWrapper(Map<String, Object> params){
|
String faultType = (String)params.get("faultType");
|
|
QueryWrapper<DeviceIndexEntity> wrapper = new QueryWrapper<>();
|
wrapper.like(StringUtils.isNotBlank(faultType), "fault_type", faultType);
|
|
return wrapper;
|
}
|
|
|
@Override
|
public void deleteByDeviceId(String id) {
|
QueryWrapper<DeviceIndexEntity> wrapper = new QueryWrapper<>();
|
wrapper.eq(StringUtils.isNotBlank(id), "device_id", id);
|
baseDao.delete(wrapper);
|
}
|
|
@Override
|
public List<DeviceIndexDTO> getByDeviceId(String id) {
|
QueryWrapper<DeviceIndexEntity> wrapper = new QueryWrapper<>();
|
wrapper.eq(StringUtils.isNotBlank(id), "device_id", id);
|
return ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), DeviceIndexDTO.class);
|
}
|
}
|