feat: bug-905 优化设备信息查询

This commit is contained in:
曹鹏飞 2025-11-14 10:46:57 +08:00
parent 8fe17faca6
commit cfcde9db80
2 changed files with 1 additions and 18 deletions

View File

@ -41,7 +41,6 @@ import org.ttzero.excel.entity.Workbook;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -771,20 +770,4 @@ public class DeviceController extends ControllerBase {
} }
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
} }
/**
* 获取设备机型
* @param deviceNo 设备编号
* @return 设备机型
*/
@GetMapping("/getModelNo")
public ApiResult<String> getModelNo(@RequestParam @NotBlank String deviceNo) {
Device device = deviceService.lambdaQuery()
.eq(Device::getDeviceNo, deviceNo)
.orderByDesc(Device::getDeviceState)
.last("limit 1")
.one();
VUtils.trueThrowBusinessError(Objects.isNull(device)).throwMessage("设备编号无效");
return ApiResult.success(device.getModelNo());
}
} }

View File

@ -19,7 +19,7 @@
LEFT JOIN device_component dc ON d.model_no = dc.model_no AND dc.`enable` = 1 LEFT JOIN device_component dc ON d.model_no = dc.model_no AND dc.`enable` = 1
LEFT JOIN t_base_customer c ON c.agency_company_code=d.agent_code LEFT JOIN t_base_customer c ON c.agency_company_code=d.agent_code
WHERE d.device_no = #{deviceNo} WHERE d.device_no = #{deviceNo}
ORDER BY d.data_valid_state DESC,d.device_state ORDER BY d.data_valid_state DESC,d.device_state DESC
LIMIT 1; LIMIT 1;
</select> </select>
<sql id="whr"> <sql id="whr">