forked from kidgrow-microservices-platform

zhaoxiaohao
2020-11-18 aae97233d9af913104bc7c52a799f6a695c11ec5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.kidgrow.order.mapper;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kidgrow.common.context.DynamicTableContextHolder;
import com.kidgrow.db.sharding.TableSuffix;
import com.kidgrow.order.entity.OrderInfo;
import com.kidgrow.order.service.IOrderDetailService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
 
import java.util.List;
import java.util.Map;
 
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 *
 * @Description: <br>
 * @Project: <br>
 * @CreateDate: Created in 2020/2/6 10:58 <br>
 * @Author: <a href="4345453@kidgrow.com">liuke</a>
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class OrderInfoMapperTest {
    @Autowired
    private OrderInfoMapper orderInfoMapper;
    @Autowired
    private IOrderDetailService orderDetailService;
 
    @Test
    public void getOrderInfo() {
 
        OrderInfo orderInfo = orderInfoMapper.selectById("111");
 
        System.out.println(orderInfo);
 
    }
 
 
    @Test
    public void orderInfoSelectList() {
        List<OrderInfo> list = orderInfoMapper.selectList(new QueryWrapper<OrderInfo>()
                .eq("order_id", "111"));
 
        System.out.println(list);
 
        System.out.println(list.size());
 
 
    }
 
    @Test
    public void orderDetail() {
        Map<String, Object> params = null;
        params.put("page", 1);
        params.put("limit", 10);
        DynamicTableContextHolder.setDynamicTable("order_detail_2020");
        DynamicTableContextHolder.setDynamicTable("order_info_2020");
        orderDetailService.findList(params, "");
 
        System.out.println(orderDetailService.findList(params, ""));
 
 
    }
 
 
 
    @Test
    public void hashTest() {
        String tableTag = TableSuffix.ofHash("1236847735607631873",64,"-000").getSuffix();
        System.out.println(tableTag);
    }
}