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

View File

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