【改进】查询固件版本增加当前版本参数

This commit is contained in:
MichaelWin
2026-03-06 14:58:52 +08:00
parent c0896c199d
commit e472a3207f

View File

@@ -126,10 +126,10 @@ public class AppFirmwareController {
*
* @param firmwareType 固件类型
*/
@CommonLog("根据类型,型号查询固件版本")
@ApiOperation("根据类型,型号查询固件版本")
@GetMapping("/type/{firmwareType}/{modelId}")
public Result<List<Firmware>> listByType(@PathVariable Integer firmwareType, @PathVariable Integer modelId) {
@CommonLog("根据类型,型号,当前版本查询固件版本")
@ApiOperation("根据类型,当前版本查询固件版本")
@GetMapping("/type/{firmwareType}/{modelId}/{softwareVersion}")
public Result<List<Firmware>> listByType(@PathVariable Integer firmwareType, @PathVariable Integer modelId, @PathVariable Integer softwareVersion) {
if (firmwareType == null && modelId == null) {
return Result.error(I18nUtil.getMessage("firmware.type.or.model.required"));
}
@@ -144,6 +144,7 @@ public class AppFirmwareController {
LambdaQueryWrapper<Firmware> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Firmware::getFirmwareType, firmwareType);
wrapper.eq(Firmware::getModelId, bizDeviceCategory.getId());
wrapper.ge(Firmware::getVersionId, softwareVersion);
// 按版本号或创建时间倒序排列,最新版本在前
wrapper.orderByDesc(Firmware::getCreateTime);