@@ -0,0 +1,2343 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * %3C/p%3E%0A */%0A%0Apackage io.shardingsphere.example.repository.api.service;%0A%0Aimport io.shardingsphere.example.repository.api.entity.Order;%0Aimport io.shardingsphere.example.repository.api.entity.OrderItem;%0Aimport org.springframework.stereotype.Service;%0A%0Aimport javax.annotation.Resource;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A@Service%0Apublic class DemoService %7B%0A    %0A    @Resource%0A    private OrderRepository orderRepository;%0A    %0A    @Resource%0A    private OrderItemRepository orderItemRepository;%0A    %0A    public void demo() %7B%0A        orderRepository.createIfNotExistsTable();%0A        orderItemRepository.createIfNotExistsTable();%0A        orderRepository.truncateTable();%0A        orderItemRepository.truncateTable();%0A        List%3CLong%3E orderIds = new ArrayList%3C%3E(10);%0A        System.out.println(%221.Insert--------------%22);%0A        for (int i = 0; i %3C 10; i++) %7B%0A            Order order = new Order();%0A            order.setUserId(51);%0A            order.setStatus(%22INSERT_TEST%22);%0A            orderRepository.insert(order);%0A            long orderId = order.getOrderId();%0A            orderIds.add(orderId);%0A            %0A            OrderItem item = new OrderItem();%0A            item.setOrderId(orderId);%0A            item.setUserId(51);%0A            item.setStatus(%22INSERT_TEST%22);%0A            orderItemRepository.insert(item);%0A        %7D%0A        System.out.println(orderItemRepository.selectAll());%0A        System.out.println(%222.Delete--------------%22);%0A        for (Long each : orderIds) %7B%0A            orderRepository.delete(each);%0A            orderItemRepository.delete(each);%0A        %7D%0A        System.out.println(orderItemRepository.selectAll());%0A        orderItemRepository.dropTable();%0A        orderRepository.dropTable();%0A    %7D%0A%7D%0A

add demo service