infoByGbDeviceId 调整

This commit is contained in:
shikong 2023-09-12 09:56:50 +08:00
parent 2e42490440
commit 5cbd6a6b49
2 changed files with 7 additions and 4 deletions

View File

@ -21,6 +21,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j @Slf4j
@Tag(name = "设备信息") @Tag(name = "设备信息")
@RestController @RestController
@ -55,8 +57,8 @@ public class DeviceController {
@Operation(summary = "根据国标id(20位) 查询指定设备信息") @Operation(summary = "根据国标id(20位) 查询指定设备信息")
@GetJson("/info/gbDeviceId") @GetJson("/info/gbDeviceId")
public JsonResponse<WvpProxyDevice> infoByGbDeviceId(@RequestParam String gbDeviceId) { public JsonResponse<List<WvpProxyDevice>> infoByGbDeviceId(@RequestParam String gbDeviceId) {
WvpProxyDevice wvpProxyDevice = deviceService.getDeviceByGbDeviceId(gbDeviceId).orElse(null); List<WvpProxyDevice> wvpProxyDevice = deviceService.getDeviceByGbDeviceId(gbDeviceId);
return JsonResponse.success(wvpProxyDevice); return JsonResponse.success(wvpProxyDevice);
} }

View File

@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo; import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
@ -35,8 +36,8 @@ public class DeviceService {
s.where(WvpProxyDeviceDynamicSqlSupport.deviceCode,isEqualTo(deviceCode))); s.where(WvpProxyDeviceDynamicSqlSupport.deviceCode,isEqualTo(deviceCode)));
} }
public Optional<WvpProxyDevice> getDeviceByGbDeviceId(String gbDeviceId){ public List<WvpProxyDevice> getDeviceByGbDeviceId(String gbDeviceId){
return deviceMapper.selectOne(s-> return deviceMapper.select(s->
s.where(WvpProxyDeviceDynamicSqlSupport.gbDeviceId,isEqualTo(gbDeviceId))); s.where(WvpProxyDeviceDynamicSqlSupport.gbDeviceId,isEqualTo(gbDeviceId)));
} }