Commit d83c0b6686623a03daaa05f3bf2105e06027f15f
1 parent
bc9760ff
Exists in
master
and in
1 other branch
1.test code
Showing
1 changed file
with
18 additions
and
1 deletions
Show diff stats
src/test/java/com/taover/repository/test/TestAutoconfigure.java
1 | 1 | package com.taover.repository.test; |
2 | 2 | |
3 | +import java.math.BigDecimal; | |
3 | 4 | import java.sql.Connection; |
4 | 5 | import java.sql.PreparedStatement; |
5 | 6 | import java.sql.SQLException; |
... | ... | @@ -59,9 +60,25 @@ public class TestAutoconfigure { |
59 | 60 | |
60 | 61 | // testKeyHolder(); |
61 | 62 | // testKeyHolderWithoutId(); |
62 | - testKeyHolderWithMultiInsert(); | |
63 | +// testKeyHolderWithMultiInsert(); | |
64 | + //testExpressSql(); | |
65 | + testSimpleQuery(); | |
63 | 66 | } |
64 | 67 | |
68 | + private static void testSimpleQuery() { | |
69 | + String sql = "select id from demo limit 1; "; | |
70 | + System.out.println(jdbcTemplate.queryForObject(sql, BigDecimal.class)); | |
71 | + } | |
72 | + | |
73 | + private static void testExpressSql() { | |
74 | + String basicSql = " SELECT sum(wog.`goods_base_sku_price` * wog.`goods_number`+wog.`ware_shipping_price`) as newWareMoneyPaid " | |
75 | + + " FROM wxorder_order wo INNER JOIN `wxorder_order_goods` wog on wog.`order_id` = wo.id " | |
76 | + + " where wo.id = 16" | |
77 | + + " and wo.tenant_id= 16" | |
78 | + + " and wog.tenant_id= 16"; | |
79 | + System.out.println(jdbcTemplate.queryForObject(basicSql, BigDecimal.class)); | |
80 | + } | |
81 | + | |
65 | 82 | private static void testKeyHolderWithMultiInsert() { |
66 | 83 | KeyHolder keyHolder = new GeneratedKeyHolder(); |
67 | 84 | String exeSql = "insert into demo(`name`) values(?),(?),(?),(?),(?),(?);"; | ... | ... |