Explorar o código

增加设备查询点位数

hechunping hai 1 ano
pai
achega
d1eab03abd

+ 2 - 0
device-api-service/src/main/java/com/xy/mapper/DeviceInfoMapper.java

@@ -37,4 +37,6 @@ public interface DeviceInfoMapper extends BaseMapper<DeviceInfo> {
     List<DeviceInfoDto.MercHomeCountVO> merHomeCountList(@Param("query") DeviceInfoDto.MercHomeQueryDTO queryDTO);
 
     List<DeviceInfoDto.NetStateCount> netStateCount(@Param("mercIdList") List<Long> mercIdList);
+
+    List<DeviceInfoDto.PlaceDeviceNumVo> placeDeviceNum(@Param("dto") DeviceInfoDto.PlaceDeviceNumDto dto);
 }

+ 7 - 0
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -105,6 +105,13 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
 
     private final DeviceAlgorithmChargingServiceImpl deviceAlgorithmChargingService;
 
+
+    @ApiOperation("点位设备数量查询")
+    @Override
+    public R<List<DeviceInfoDto.PlaceDeviceNumVo>> placeDeviceNum(@RequestBody @Validated DeviceInfoDto.PlaceDeviceNumDto dto){
+        return R.ok(baseMapper.placeDeviceNum(dto));
+    }
+
     @ApiOperation("设备列表带卡包数")
     @PostMapping("algorithmChargingDevice")
     public R<PageBean<DeviceInfoDto.AlgorithmChargingVo>> algorithmChargingDevice(@RequestBody @Validated DeviceInfoDto.AlgorithmCharging algorithmCharging) {

+ 16 - 0
device-api-service/src/main/resources/mapper/DeviceInfoMapper.xml

@@ -353,4 +353,20 @@
         </where>
         GROUP BY d.merc_id,s.net_state
     </select>
+    <select id="placeDeviceNum" resultType="com.xy.dto.DeviceInfoDto$PlaceDeviceNumVo">
+        SELECT place_id,count(*) as num
+        FROM device_info
+        <where>
+            <if test="dto.placeId != null">
+                AND place_id = #{dto.placeId}
+            </if>
+            <if test="dto.placeIdList != null and dto.placeIdList.size() > 0">
+                AND place_id IN
+                <foreach collection="dto.placeIdList" item="placeId" index="index" open="(" close=")" separator=",">
+                    #{placeId}
+                </foreach>
+            </if>
+        </where>
+        GROUP BY place_id
+    </select>
 </mapper>

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

@@ -1019,4 +1019,24 @@ public class DeviceInfoDto {
         private List<Long> deviceId;
     }
 
+    @Data
+    @Accessors(chain = true)
+    public static class PlaceDeviceNumDto {
+        @ApiModelProperty("点位id")
+        private Long placeId;
+
+        @ApiModelProperty("点位ID列表")
+        private List<Long> placeIdList;
+    }
+
+    @Data
+    @Accessors(chain = true)
+    public static class PlaceDeviceNumVo {
+        @ApiModelProperty("点位id")
+        private Long placeId;
+
+        @ApiModelProperty("数量")
+        private Integer num;
+    }
+
 }

+ 8 - 0
device-api/src/main/java/com/xy/service/DeviceInfoService.java

@@ -174,4 +174,12 @@ public interface DeviceInfoService {
     @PostMapping("getDeviceSysinfo")
     R<DeviceSysinfoDto.Vo> getDeviceSysinfo(@RequestBody @Validated DeviceSysinfoDto.DeviceSysInfo dto);
 
+    /**
+     * 点位设备数量查询
+     *
+     * @param dto
+     * @return
+     */
+    @PostMapping("placeDeviceNum")
+    R<List<DeviceInfoDto.PlaceDeviceNumVo>> placeDeviceNum(@RequestBody @Validated DeviceInfoDto.PlaceDeviceNumDto dto);
 }