MrShi
2025-01-06 e1ec365640eefdcb06abb1d73da0d80367f79be3
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwDeviceServiceImpl.java
@@ -12,6 +12,7 @@
import com.doumee.dao.business.YwDeviceMapper;
import com.doumee.dao.business.YwDeviceRecordMapper;
import com.doumee.dao.business.model.Category;
import com.doumee.dao.business.model.Company;
import com.doumee.dao.business.model.YwDevice;
import com.doumee.dao.business.model.YwDeviceRecord;
import com.doumee.dao.business.vo.YwDeviceDataVO;
@@ -184,6 +185,30 @@
    }
    /**
     * 根据编码查询
     * @param deviceCode
     * @return
     */
    @Override
    public YwDevice findByCode(String deviceCode) {
        YwDevice ywDevice =  ywDeviceMapper.selectOne(
                new QueryWrapper<YwDevice>()
                        .lambda()
                        .eq(YwDevice::getIsdeleted,Constants.ZERO)
                        .eq(YwDevice::getCode,deviceCode)
                        .last(" limit  1 ")
        );
        if(Objects.isNull(ywDevice)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        return ywDevice;
    }
    @Override
    public YwDevice findOne(YwDevice ywDevice) {
        QueryWrapper<YwDevice> wrapper = new QueryWrapper<>(ywDevice);