|
@@ -1,71 +1,71 @@
|
|
|
-package com.pavis.ltw.service.impl;
|
|
|
-
|
|
|
-import com.pavis.ltw.mapper.MongoMapper;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author guanhuijuan
|
|
|
- * @create 2019-04-12 10:57
|
|
|
- * @desc MongoServiceImpl
|
|
|
- **/
|
|
|
-public class MongoServiceImpl implements MongoMapper {
|
|
|
- // @Override
|
|
|
- // public void insertMethod(MongoDatabase mongoDatabase, String table, Object object) {
|
|
|
- //
|
|
|
- // MongoCollection<Document> collection = mongoDatabase.getCollection(table);
|
|
|
- // Document doc = new Document();
|
|
|
- // MongoDBUtils.getInstance().dymParms(doc, object,"put");
|
|
|
- // collection.insertOne(doc);
|
|
|
- // FindIterable<Document> iterable = collection.find();
|
|
|
- // MongoCursor<Document> cursor = iterable.iterator();
|
|
|
- // while (cursor.hasNext()) {
|
|
|
- // Document user = cursor.next();
|
|
|
- // System.out.println(user.toString());
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // @Override
|
|
|
- // public void deleteMethod(MongoDatabase db, String table, Object obj) {
|
|
|
- // MongoCollection<Document> collection = db.getCollection(table);
|
|
|
- // BasicDBObject query = new BasicDBObject();
|
|
|
- // MongoDBUtils.getInstance().dymParms(query, obj, "append");
|
|
|
- // collection.deleteMany(query);
|
|
|
- // FindIterable<Document> iterable = collection.find();
|
|
|
- // MongoCursor<Document> cursor = iterable.iterator();
|
|
|
- // while (cursor.hasNext()) {
|
|
|
- // Document user = cursor.next();
|
|
|
- // System.out.println(user.toString());
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // @Override
|
|
|
- // public void updateMethod(MongoDatabase db, String table, Object conditions, Object obj) {
|
|
|
- // MongoCollection<Document> collection = db.getCollection(table);
|
|
|
- // BasicDBObject where = new BasicDBObject();
|
|
|
- // MongoDBUtils.getInstance().dymParms(where, conditions, "append");
|
|
|
- // BasicDBObject newContent = new BasicDBObject();
|
|
|
- // MongoDBUtils.getInstance().dymParms(newContent, obj, "append");
|
|
|
- // BasicDBObject update = new BasicDBObject("$set",newContent);
|
|
|
- // //updateMany updateOne
|
|
|
- // collection.updateMany(where, update);
|
|
|
- // FindIterable<Document> iterable = collection.find();
|
|
|
- // MongoCursor<Document> cursor = iterable.iterator();
|
|
|
- // while (cursor.hasNext()) {
|
|
|
- // Document user = cursor.next();
|
|
|
- // System.out.println(user.toString());
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // @Override
|
|
|
- // public void queryMethodByID(MongoDatabase db, String table, String Id) {
|
|
|
- // MongoCollection<Document> collection = db.getCollection(table);
|
|
|
- // BasicDBObject query = new BasicDBObject("id", Id);
|
|
|
- // FindIterable<Document> iterable = collection.find(query);
|
|
|
- // MongoCursor<Document> cursor = iterable.iterator();
|
|
|
- //
|
|
|
- // while (cursor.hasNext()) {
|
|
|
- // Document user = cursor.next();
|
|
|
- // System.out.println(user.toJson());
|
|
|
- // }
|
|
|
- // cursor.close();
|
|
|
- // }
|
|
|
-}
|
|
|
+// package com.pavis.ltw.service.impl;
|
|
|
+//
|
|
|
+// // import com.pavis.ltw.mapper.MongoMapper;
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * @author guanhuijuan
|
|
|
+// * @create 2019-04-12 10:57
|
|
|
+// * @desc MongoServiceImpl
|
|
|
+// **/
|
|
|
+// public class MongoServiceImpl implements MongoMapper {
|
|
|
+// // @Override
|
|
|
+// // public void insertMethod(MongoDatabase mongoDatabase, String table, Object object) {
|
|
|
+// //
|
|
|
+// // MongoCollection<Document> collection = mongoDatabase.getCollection(table);
|
|
|
+// // Document doc = new Document();
|
|
|
+// // MongoDBUtils.getInstance().dymParms(doc, object,"put");
|
|
|
+// // collection.insertOne(doc);
|
|
|
+// // FindIterable<Document> iterable = collection.find();
|
|
|
+// // MongoCursor<Document> cursor = iterable.iterator();
|
|
|
+// // while (cursor.hasNext()) {
|
|
|
+// // Document user = cursor.next();
|
|
|
+// // System.out.println(user.toString());
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// //
|
|
|
+// // @Override
|
|
|
+// // public void deleteMethod(MongoDatabase db, String table, Object obj) {
|
|
|
+// // MongoCollection<Document> collection = db.getCollection(table);
|
|
|
+// // BasicDBObject query = new BasicDBObject();
|
|
|
+// // MongoDBUtils.getInstance().dymParms(query, obj, "append");
|
|
|
+// // collection.deleteMany(query);
|
|
|
+// // FindIterable<Document> iterable = collection.find();
|
|
|
+// // MongoCursor<Document> cursor = iterable.iterator();
|
|
|
+// // while (cursor.hasNext()) {
|
|
|
+// // Document user = cursor.next();
|
|
|
+// // System.out.println(user.toString());
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// //
|
|
|
+// // @Override
|
|
|
+// // public void updateMethod(MongoDatabase db, String table, Object conditions, Object obj) {
|
|
|
+// // MongoCollection<Document> collection = db.getCollection(table);
|
|
|
+// // BasicDBObject where = new BasicDBObject();
|
|
|
+// // MongoDBUtils.getInstance().dymParms(where, conditions, "append");
|
|
|
+// // BasicDBObject newContent = new BasicDBObject();
|
|
|
+// // MongoDBUtils.getInstance().dymParms(newContent, obj, "append");
|
|
|
+// // BasicDBObject update = new BasicDBObject("$set",newContent);
|
|
|
+// // //updateMany updateOne
|
|
|
+// // collection.updateMany(where, update);
|
|
|
+// // FindIterable<Document> iterable = collection.find();
|
|
|
+// // MongoCursor<Document> cursor = iterable.iterator();
|
|
|
+// // while (cursor.hasNext()) {
|
|
|
+// // Document user = cursor.next();
|
|
|
+// // System.out.println(user.toString());
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// //
|
|
|
+// // @Override
|
|
|
+// // public void queryMethodByID(MongoDatabase db, String table, String Id) {
|
|
|
+// // MongoCollection<Document> collection = db.getCollection(table);
|
|
|
+// // BasicDBObject query = new BasicDBObject("id", Id);
|
|
|
+// // FindIterable<Document> iterable = collection.find(query);
|
|
|
+// // MongoCursor<Document> cursor = iterable.iterator();
|
|
|
+// //
|
|
|
+// // while (cursor.hasNext()) {
|
|
|
+// // Document user = cursor.next();
|
|
|
+// // System.out.println(user.toJson());
|
|
|
+// // }
|
|
|
+// // cursor.close();
|
|
|
+// // }
|
|
|
+// }
|