From d83c0b6686623a03daaa05f3bf2105e06027f15f Mon Sep 17 00:00:00 2001 From: 王彬 Date: Thu, 22 Apr 2021 18:37:19 +0800 Subject: [PATCH] 1.test code --- src/test/java/com/taover/repository/test/TestAutoconfigure.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/taover/repository/test/TestAutoconfigure.java b/src/test/java/com/taover/repository/test/TestAutoconfigure.java index 26b1199..312cb79 100644 --- a/src/test/java/com/taover/repository/test/TestAutoconfigure.java +++ b/src/test/java/com/taover/repository/test/TestAutoconfigure.java @@ -1,5 +1,6 @@ package com.taover.repository.test; +import java.math.BigDecimal; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; @@ -59,9 +60,25 @@ public class TestAutoconfigure { // testKeyHolder(); // testKeyHolderWithoutId(); - testKeyHolderWithMultiInsert(); +// testKeyHolderWithMultiInsert(); + //testExpressSql(); + testSimpleQuery(); } + private static void testSimpleQuery() { + String sql = "select id from demo limit 1; "; + System.out.println(jdbcTemplate.queryForObject(sql, BigDecimal.class)); + } + + private static void testExpressSql() { + String basicSql = " SELECT sum(wog.`goods_base_sku_price` * wog.`goods_number`+wog.`ware_shipping_price`) as newWareMoneyPaid " + + " FROM wxorder_order wo INNER JOIN `wxorder_order_goods` wog on wog.`order_id` = wo.id " + + " where wo.id = 16" + + " and wo.tenant_id= 16" + + " and wog.tenant_id= 16"; + System.out.println(jdbcTemplate.queryForObject(basicSql, BigDecimal.class)); + } + private static void testKeyHolderWithMultiInsert() { KeyHolder keyHolder = new GeneratedKeyHolder(); String exeSql = "insert into demo(`name`) values(?),(?),(?),(?),(?),(?);"; -- libgit2 0.21.2