1a41cb3b 张雷

fix(equipment): 修复设备列表排序字段转换错误

- 新增 getFiledName 方法,用于将前端传入的字段代码转换为数据库字段名
- 在设备列表查询中使用 getFiledName 方法,确保排序字段的正确性
- 默认排序字段改为 create_time,提高用户体验
1 个父辈 bbf071e3
......@@ -557,7 +557,7 @@ public class EquipmentController {
.like(StringUtils.isNotEmpty(installPosition), EquipmentInfo::getInstallPosition, installPosition)
.eq(StringUtils.isNotEmpty(equipmentDTO.getEquipmentInfo().getId()), "equipment_info.id", equipmentDTO.getEquipmentInfo().getId());
if (StringUtils.isNotEmpty(orderFiled)) {
base.orderBy(true,orderType,"equipment_info." + orderFiled);
base.orderBy(true,orderType,"equipment_info." + getFiledName(orderFiled));
}else {
base.orderBy(true,false,"equipment_info.create_time");
}
......@@ -612,6 +612,21 @@ public class EquipmentController {
return result;
}
public String getFiledName(String filedCode) {
Map<String,String> map = new HashMap<>();
map.put("createTime","create_time");
map.put("equipmentName","equipment_name");
map.put("departId_dictText","depart_id");
map.put("equipmentType_dictText","equipment_type");
map.put("equipmentStatus_dictText","equipment_status");
map.put("equipmentHealthStatus_dictText","equipment_health_status");
if(map.get(filedCode)!=null){
return map.get(filedCode);
}else{
return "create_time";
}
}
@CustomExceptionAnno(description = "设备-采集实时数据")
@AutoLog(value = "设备-采集实时数据")
@ApiOperation(value = "设备-采集实时数据", notes = "设备-采集实时数据")
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!