|
@@ -46,6 +46,9 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
|
+import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
|
+import org.springframework.data.mongodb.core.query.Query;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -1881,4 +1884,26 @@ public class TestController {
|
|
refreshTokenService.getLiveKuaiShouAgentRefresh();
|
|
refreshTokenService.getLiveKuaiShouAgentRefresh();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void save() {
|
|
|
|
+ JSONObject people = new JSONObject();
|
|
|
|
+ people.put("_id","zhao");
|
|
|
|
+ people.put("name","an");
|
|
|
|
+ mongoTemplate.save(people);
|
|
|
|
+ JSONObject people2 = new JSONObject();
|
|
|
|
+ people2.put("_id","yu");
|
|
|
|
+ people2.put("name","meng");
|
|
|
|
+ mongoTemplate.save(people2);
|
|
|
|
+ log.info("save ok");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void find() {
|
|
|
|
+ Criteria criteria = new Criteria();
|
|
|
|
+ criteria = Criteria.where("name").is("an");
|
|
|
|
+ Query query = new Query(criteria);
|
|
|
|
+ List<JSONObject> list = mongoTemplate.find(query, JSONObject.class);
|
|
|
|
+ List<JSONObject> all = mongoTemplate.findAll(JSONObject.class);
|
|
|
|
+ System.out.println("条件筛选结果:" + list);
|
|
|
|
+ System.out.println("----All结果:" + all);
|
|
|
|
+ log.info("find ok");
|
|
|
|
+ }
|
|
}
|
|
}
|