From 43086924a890e1ae64ab98f9b844c3cf8a0b88c8 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Thu, 17 May 2018 17:21:19 +0800 Subject: [PATCH] 地图搜索功能增强 --- src/main/resources/mapper/DeviceMapper.xml | 18 +++++++++++++----- src/main/java/com/moral/mapper/DeviceMapper.java | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/moral/mapper/DeviceMapper.java b/src/main/java/com/moral/mapper/DeviceMapper.java index afba196..a9b1064 100644 --- a/src/main/java/com/moral/mapper/DeviceMapper.java +++ b/src/main/java/com/moral/mapper/DeviceMapper.java @@ -19,7 +19,7 @@ List<Map<String, Object>> getDeviceVersionIdByMonitorPoint(Integer monitorPointId); - List<Device> selectByOrgIdAndDevName(@Param("orgId")Integer orgId,@Param("devName")String devName); + List<Device> selectByOrgIdAndDevName(@Param("orgId")Integer orgId,@Param("name")String name); /** * diff --git a/src/main/resources/mapper/DeviceMapper.xml b/src/main/resources/mapper/DeviceMapper.xml index 2808a19..35c4788 100644 --- a/src/main/resources/mapper/DeviceMapper.xml +++ b/src/main/resources/mapper/DeviceMapper.xml @@ -171,13 +171,21 @@ left join monitor_point mpt on dev.monitor_point_id = mpt.id left join device_version dve on dev.device_version_id = dve.id <where> - <if test="@com.moral.common.bean.Constants@isNotSpecialOrgId(orgId)"> - mpt.organization_id = #{orgId} - </if> - <if test="devName!=null and ''!=devName"> - and dev.name like CONCAT('%',#{devName},'%') + <if test="@com.moral.common.bean.Constants@isNotSpecialOrgId(orgId)"> + mpt.organization_id = #{orgId} </if> and dev.is_delete = 0 + and ( + <![CDATA[ + 1 <> 1 + ]]> + <if test="name!=null and ''!=name"> + or dev.name like CONCAT('%',#{name},'%') + or dev.mac like CONCAT('%',#{name},'%') + or mpt.name like CONCAT('%',#{name},'%') + </if> + ) + </where> </select> <select id="selectByOrgIdAndMpId" resultMap="BaseResultMap"> -- Gitblit v1.8.0