|
|
@@ -1,8 +1,7 @@
|
|
|
package com.zhongshu.iot.server.core.service.base;
|
|
|
|
|
|
import com.github.microservice.models.common.EnumListModel;
|
|
|
-import com.github.microservice.types.deviceUse.DeviceCategory;
|
|
|
-import com.github.microservice.types.deviceUse.DeviceType;
|
|
|
+import com.github.microservice.types.common.CommonEnum;
|
|
|
import com.mongodb.client.result.UpdateResult;
|
|
|
import com.zhongshu.iot.server.core.util.CommonUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -28,18 +27,17 @@ public class CommonService {
|
|
|
@Autowired
|
|
|
private MongoTemplate mongoTemplate;
|
|
|
|
|
|
- public EnumListModel getEnumListModel() {
|
|
|
+ public EnumListModel getEnums(Enum[] enums) {
|
|
|
EnumListModel model = new EnumListModel();
|
|
|
- for (DeviceType deviceType1 : DeviceType.values()) {
|
|
|
- model.add(deviceType1.getRemark(), deviceType1.name());
|
|
|
- }
|
|
|
- return model;
|
|
|
- }
|
|
|
-
|
|
|
- public EnumListModel getDeviceCategory() {
|
|
|
- EnumListModel model = new EnumListModel();
|
|
|
- for (DeviceCategory deviceType1 : DeviceCategory.values()) {
|
|
|
- model.add(deviceType1.getRemark(), deviceType1.name());
|
|
|
+ if (enums != null) {
|
|
|
+ for (Enum _enum : enums) {
|
|
|
+ String value = _enum.name();
|
|
|
+ String name = "";
|
|
|
+ if (_enum instanceof CommonEnum) {
|
|
|
+ name = ((CommonEnum) _enum).getRemark();
|
|
|
+ }
|
|
|
+ model.add(name, value);
|
|
|
+ }
|
|
|
}
|
|
|
return model;
|
|
|
}
|