package com.xiaopeng.order.mangodb.service.impl; import com.xiaopeng.order.mangodb.model.OrderTrajectory; import com.xiaopeng.order.mangodb.service.OrderTrajectoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.stereotype.Service; import java.util.List; @Service public class OrderTrajectoryServiceImpl implements OrderTrajectoryService { @Autowired private MongoTemplate mongoTemplate; @Override public int create(OrderTrajectory orderTrajectory) { mongoTemplate.insert(orderTrajectory); return 1; } @Override public OrderTrajectory findById(String id) { return mongoTemplate.findById(id, OrderTrajectory.class); } @Override public List findAll() { return mongoTemplate.findAll(OrderTrajectory.class); } }