fix(search): 优化事件用户查询功能

- 修改CsEventUserPOMapper.xml中的搜索条件,同时支持名称和代码字段的模糊匹配
- 修复CsEventUserPOServiceImpl中线路ID判断逻辑,避免空字符串和null值导致的异常
- 调整MqttMessageHandler中消息发送的缩进格式,确保代码风格一致
This commit is contained in:
xy
2026-07-14 11:10:46 +08:00
parent 4e7a10f46e
commit a07a0fe6ed
3 changed files with 5 additions and 5 deletions

View File

@@ -75,7 +75,7 @@ public class MqttMessageHandler {
public void responseRtData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) {
List<CsRtDataVO> list = lineTargetService.getLineData(pageId);
Gson gson = new Gson();
publisher.send("/zl/rtData/" + pageId, gson.toJson(list), 1, false);
publisher.send("/zl/rtData/" + pageId, gson.toJson(list), 1, false);
}
@MqttSubscribe(value = "/zl/askTemperData/{devId}", qos = 1)

View File

@@ -228,7 +228,7 @@
<!-- 名称匹配根据type区分线路名/设备名) -->
<choose>
<when test="csEventUserQueryPage.type != null and csEventUserQueryPage.type == 3">
e.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%')
(e.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%') OR b.code LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%'))
</when>
<otherwise>
d.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%')
@@ -338,7 +338,8 @@
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.searchValue != null and csEventUserQueryPage.searchValue !=''">
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type == 3 ">
AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
-- AND e.name like concat('%',#{csEventUserQueryPage.searchValue},'%')
AND (e.name LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%') OR b.code LIKE CONCAT('%', #{csEventUserQueryPage.searchValue}, '%'))
</if>
<if test="csEventUserQueryPage.type != null and csEventUserQueryPage.type !='' and csEventUserQueryPage.type != 3 ">
AND d.name like concat('%',#{csEventUserQueryPage.searchValue},'%')

View File

@@ -419,8 +419,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
List<String> portableDevIds = new ArrayList<>();
if (Objects.equals(csEventUserQueryPage.getEngineeringid(),"1")
|| Objects.equals(csEventUserQueryPage.getProjectId(),"2")
|| !ObjectUtil.isNull(csEventUserQueryPage.getLineId())
|| !StringUtils.isEmpty(csEventUserQueryPage.getLineId())) {
|| (!ObjectUtil.isNull(csEventUserQueryPage.getLineId()) && !StringUtils.isEmpty(csEventUserQueryPage.getLineId()))) {
portableDevIds = portableDevTree.stream().map(CsLedgerVO::getId).filter(
id -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
Objects.equals(id, csEventUserQueryPage.getDeviceId())