瀏覽代碼

增加搜索条件

hechunping 1 年之前
父節點
當前提交
b0f124e735

+ 14 - 1
device-api-service/src/main/resources/mapper/DeviceInfoMapper.xml

@@ -114,9 +114,10 @@
     </select>
 
     <select id="pageByAdminName" resultType="com.xy.dto.DeviceInfoDto$ListByAdminName">
-        SELECT d.device_id, d.device_name, p.admin_name, d.device_type
+        SELECT d.device_id, d.device_name, p.admin_name, d.device_type,p.region_name,p.place_name,m.name as merc_name
         FROM device_info d
         left join merc_place p on p.id = d.place_id
+        left join merc m on m.id = d.merc_id
         <where>
             and d.merc_id = #{dto.mercId}
             and d.active_state = 1
@@ -129,6 +130,18 @@
             <if test="dto.searchKey != null and dto.searchKey != ''">
                 and CONCAT(IFNULL(d.device_name, ''), IFNULL(p.admin_name, '')) like CONCAT('%', #{dto.searchKey}, '%')
             </if>
+            <if test="dto.deviceType != null">
+                and d.device_type = #{dto.deviceType}
+            </if>
+            <if test="dto.placeId != null">
+                and d.place_id = #{dto.placeId}
+            </if>
+            <if test="dto.deviceId != null">
+                and d.device_id = #{dto.deviceId}
+            </if>
+            <if test="dto.regionName != null and dto.regionName != ''">
+                and p.region_name = #{dto.regionName}
+            </if>
         </where>
         order by p.admin_name asc,d.device_id desc
     </select>

+ 21 - 0
device-api/src/main/java/com/xy/dto/DeviceInfoDto.java

@@ -44,6 +44,18 @@ public final static String DEL = "del";
         @NotNull(message = "分页信息不能为空")
         @ApiModelProperty(value = "商户ID",required = true)
         private PageBean page;
+
+        @ApiModelProperty("设备类型")
+        private Integer deviceType;
+
+        @ApiModelProperty("点位id")
+        private Long placeId;
+
+        @ApiModelProperty("设备id")
+        private Long deviceId;
+
+        @ApiModelProperty("区域名称")
+        private String regionName;
     }
 
     @Data
@@ -91,6 +103,15 @@ public final static String DEL = "del";
 
         @ApiModelProperty("设备类型名称")
         private String deviceTypeName;
+
+        @ApiModelProperty("区域名称")
+        private String regionName;
+
+        @ApiModelProperty("点位名称")
+        private String placeName;
+
+        @ApiModelProperty("商户名称")
+        private String mercName;
     }
 
     @Data