Преглед на файлове

商品清单应用到设备-获取商户线路列表

谭斌 преди 2 години
родител
ревизия
4c862d454f

+ 24 - 14
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -156,23 +156,23 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
 
 
     @Override
     @Override
     @ApiOperation("更新商户线路")
     @ApiOperation("更新商户线路")
-    public R updateLine(@RequestBody @Validated DeviceInfoDto.UpdateLine updateLine){
-        LambdaUpdateWrapper<DeviceInfo> luw = new LambdaUpdateWrapper<DeviceInfo>().eq(DeviceInfo::getMercId,updateLine.getMercId());
+    public R updateLine(@RequestBody @Validated DeviceInfoDto.UpdateLine updateLine) {
+        LambdaUpdateWrapper<DeviceInfo> luw = new LambdaUpdateWrapper<DeviceInfo>().eq(DeviceInfo::getMercId, updateLine.getMercId());
         //绑定线路,更换线路
         //绑定线路,更换线路
-        if(DeviceInfoDto.UPDATE.equals(updateLine.getType())){
+        if (DeviceInfoDto.UPDATE.equals(updateLine.getType())) {
             DeviceInfo deviceInfo = new DeviceInfo();
             DeviceInfo deviceInfo = new DeviceInfo();
             deviceInfo.setPlaceLineId(updateLine.getPlaceLineId());
             deviceInfo.setPlaceLineId(updateLine.getPlaceLineId());
-            luw.in(DeviceInfo::getDeviceId,updateLine.getDeviceIds());
-            baseMapper.update(deviceInfo,luw);
+            luw.in(DeviceInfo::getDeviceId, updateLine.getDeviceIds());
+            baseMapper.update(deviceInfo, luw);
         }
         }
         //删除线路
         //删除线路
-        if(DeviceInfoDto.DEL.equals(updateLine.getType())) {
+        if (DeviceInfoDto.DEL.equals(updateLine.getType())) {
             luw.eq(DeviceInfo::getPlaceLineId, updateLine.getWherePlaceLineId());
             luw.eq(DeviceInfo::getPlaceLineId, updateLine.getWherePlaceLineId());
             luw.set(DeviceInfo::getPlaceLineId, null);
             luw.set(DeviceInfo::getPlaceLineId, null);
             baseMapper.update(null, luw);
             baseMapper.update(null, luw);
         }
         }
         //解绑线路 设置线路ID为null
         //解绑线路 设置线路ID为null
-        if(DeviceInfoDto.CLEAR.equals(updateLine.getType())) {
+        if (DeviceInfoDto.CLEAR.equals(updateLine.getType())) {
             luw.in(DeviceInfo::getDeviceId, updateLine.getDeviceIds());
             luw.in(DeviceInfo::getDeviceId, updateLine.getDeviceIds());
             luw.set(DeviceInfo::getPlaceLineId, null);
             luw.set(DeviceInfo::getPlaceLineId, null);
             baseMapper.update(null, luw);
             baseMapper.update(null, luw);
@@ -183,23 +183,23 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
 
 
     @Override
     @Override
     @ApiOperation("更新商户点位")
     @ApiOperation("更新商户点位")
-    public R updatePlace(@RequestBody @Validated DeviceInfoDto.UpdatePlace updatePlace){
-        LambdaUpdateWrapper<DeviceInfo> luw = new LambdaUpdateWrapper<DeviceInfo>().eq(DeviceInfo::getMercId,updatePlace.getMercId());
+    public R updatePlace(@RequestBody @Validated DeviceInfoDto.UpdatePlace updatePlace) {
+        LambdaUpdateWrapper<DeviceInfo> luw = new LambdaUpdateWrapper<DeviceInfo>().eq(DeviceInfo::getMercId, updatePlace.getMercId());
         //绑定点位,更换点位
         //绑定点位,更换点位
-        if(DeviceInfoDto.UPDATE.equals(updatePlace.getType())){
+        if (DeviceInfoDto.UPDATE.equals(updatePlace.getType())) {
             DeviceInfo deviceInfo = new DeviceInfo();
             DeviceInfo deviceInfo = new DeviceInfo();
             deviceInfo.setPlaceId(updatePlace.getPlaceId());
             deviceInfo.setPlaceId(updatePlace.getPlaceId());
-            luw.in(DeviceInfo::getDeviceId,updatePlace.getDeviceIds());
-            baseMapper.update(deviceInfo,luw);
+            luw.in(DeviceInfo::getDeviceId, updatePlace.getDeviceIds());
+            baseMapper.update(deviceInfo, luw);
         }
         }
         //删除点位
         //删除点位
-        if(DeviceInfoDto.DEL.equals(updatePlace.getType())) {
+        if (DeviceInfoDto.DEL.equals(updatePlace.getType())) {
             luw.eq(DeviceInfo::getPlaceId, updatePlace.getWherePlaceId());
             luw.eq(DeviceInfo::getPlaceId, updatePlace.getWherePlaceId());
             luw.set(DeviceInfo::getPlaceId, null);
             luw.set(DeviceInfo::getPlaceId, null);
             baseMapper.update(null, luw);
             baseMapper.update(null, luw);
         }
         }
         //解绑点位 设置点位ID为null
         //解绑点位 设置点位ID为null
-        if(DeviceInfoDto.CLEAR.equals(updatePlace.getType())) {
+        if (DeviceInfoDto.CLEAR.equals(updatePlace.getType())) {
             luw.in(DeviceInfo::getDeviceId, updatePlace.getDeviceIds());
             luw.in(DeviceInfo::getDeviceId, updatePlace.getDeviceIds());
             luw.set(DeviceInfo::getPlaceId, null);
             luw.set(DeviceInfo::getPlaceId, null);
             baseMapper.update(null, luw);
             baseMapper.update(null, luw);
@@ -297,6 +297,16 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         return R.ok(copy(DeviceInfoDto.Vo.class, list));
         return R.ok(copy(DeviceInfoDto.Vo.class, list));
     }
     }
 
 
+    @Override
+    public R<List<DeviceInfoDto.Vo>> listCommon(DeviceInfoDto.ListCommon dto) {
+        LambdaQueryWrapper<DeviceInfo> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(dto.getVo(), DeviceInfo.class).build();
+        List<Long> placeLineIds = dto.getPlaceLineIds();
+        if (CollUtil.isNotEmpty(placeLineIds)) {
+            lambdaQueryWrapper.eq(DeviceInfo::getPlaceId, placeLineIds);
+        }
+        return R.ok(copy(DeviceInfoDto.Vo.class, list(lambdaQueryWrapper)));
+    }
+
     /**
     /**
      * 获取商户设备列表
      * 获取商户设备列表
      *
      *

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

@@ -46,6 +46,15 @@ public class DeviceInfoDto {
         private List<Long> deviceIds;
         private List<Long> deviceIds;
     }
     }
 
 
+    @Data
+    @Accessors(chain = true)
+    public static class ListCommon {
+        @ApiModelProperty("线路id")
+        Vo vo;
+        @ApiModelProperty("线路id多个")
+        private List<Long> placeLineIds;
+    }
+
     @Data
     @Data
     @Accessors(chain = true)
     @Accessors(chain = true)
     public static class UpdateLine {
     public static class UpdateLine {
@@ -87,6 +96,7 @@ public class DeviceInfoDto {
         @ApiModelProperty(value = "原点位ID")
         @ApiModelProperty(value = "原点位ID")
         private Long wherePlaceId;
         private Long wherePlaceId;
     }
     }
+
     @Data
     @Data
     @Accessors(chain = true)
     @Accessors(chain = true)
     public static class Update extends Vo {
     public static class Update extends Vo {

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

@@ -67,8 +67,18 @@ public interface DeviceInfoService {
     @PostMapping("list")
     @PostMapping("list")
     R<List<DeviceInfoDto.Vo>> list(DeviceInfoDto.ListDto dto);
     R<List<DeviceInfoDto.Vo>> list(DeviceInfoDto.ListDto dto);
 
 
+    /**
+     * 通用列表查询
+     *
+     * @param dto
+     * @return
+     */
+    @PostMapping("listCommon")
+    R<List<DeviceInfoDto.Vo>> listCommon(DeviceInfoDto.ListCommon dto);
+
     /**
     /**
      * 更新商户线路
      * 更新商户线路
+     *
      * @param updateLine
      * @param updateLine
      * @return
      * @return
      */
      */
@@ -77,6 +87,7 @@ public interface DeviceInfoService {
 
 
     /**
     /**
      * 更新商户点位
      * 更新商户点位
+     *
      * @param updatePlace
      * @param updatePlace
      * @return
      * @return
      */
      */