Ver Fonte

查询商户设备算法列表

hechunping há 2 anos atrás
pai
commit
c4a3aaaf43

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

@@ -25,6 +25,7 @@ import com.xy.utils.enums.DictEnum;
 import com.xy.utils.enums.DictSonEnum;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import jodd.introspector.MapperFunction;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -325,6 +326,18 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         return R.ok(copy(DeviceInfoDto.Vo.class, list(queryWrapper)));
     }
 
+    @Override
+    @ApiOperation("商户设备算法列表")
+    public R<List<Long>> mercAlgorithmIdList(DeviceInfoDto.MercAlgorithmIdListDto dto){
+        String algorithmIdStr = LambdaUtils.getProperty(DeviceInfo::getAlgorithmId);
+        String mercStr = StringTools.humpToLine(LambdaUtils.getProperty(DeviceInfo::getMercId));
+        QueryWrapper<DeviceInfo> lqw = new QueryWrapper<DeviceInfo>()
+                .isNotNull(StringTools.humpToLine(algorithmIdStr))
+                .eq(mercStr,dto.getMercId())
+                .select(String.format("DISTINCT (%s) as %s",StringTools.humpToLine(algorithmIdStr),algorithmIdStr));
+        List<Long> list = listObjs(lqw, (MapperFunction<Object, Long>) o -> (Long)o);
+        return R.ok(list);
+    }
     /**
      * 获取商户设备列表
      *
@@ -345,4 +358,4 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
             throw new CommRuntimeException(msg);
         }
     }
-}
+}

+ 7 - 2
device-api/src/main/java/com/xy/dto/DeviceInfoDto.java

@@ -298,7 +298,12 @@ public class DeviceInfoDto {
 
         @ApiModelProperty(value = "算法ID")
         private Long algorithmId;
+    }
 
-
+    @Data
+    @Accessors(chain = true)
+    public static class MercAlgorithmIdListDto {
+        @ApiModelProperty(value = "商户ID")
+        private Long mercId;
     }
-}
+}

+ 10 - 1
device-api/src/main/java/com/xy/service/DeviceInfoService.java

@@ -93,4 +93,13 @@ public interface DeviceInfoService {
      */
     @PostMapping("updatePlace")
     R updatePlace(@RequestBody @Validated DeviceInfoDto.UpdatePlace updatePlace);
-}
+
+
+    /**
+     *商户设备算法列表
+     * @param dto
+     * @return
+     */
+    @PostMapping("mercAlgorithmIdList")
+    R<List<Long>> mercAlgorithmIdList(DeviceInfoDto.MercAlgorithmIdListDto dto);
+}