From ba7b5e1a9d014263a332c38b1cea9a2603454b40 Mon Sep 17 00:00:00 2001 From: licy13 Date: Sun, 12 Jun 2016 11:42:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=93=BE=E6=8E=A5mysql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/jdbc.properties | 4 +- src/main/resources/spring/spring-dao.xml | 54 ++++++------------------ src/main/sql/seckill.sql | 2 +- 3 files changed, 17 insertions(+), 43 deletions(-) diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 0615f28..dea8a8a 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -1,4 +1,4 @@ driverClassName=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://localhost:3306/test_mysql +jdbc.url=jdbc:mysql://localhost:3306/seckill jdbc.username=root -jdbc.password=111111 \ No newline at end of file +jdbc.password=root \ No newline at end of file diff --git a/src/main/resources/spring/spring-dao.xml b/src/main/resources/spring/spring-dao.xml index 5775e76..0f610ac 100644 --- a/src/main/resources/spring/spring-dao.xml +++ b/src/main/resources/spring/spring-dao.xml @@ -5,49 +5,25 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd" > - - - - - - - - - - - - - + + + + + + + + + + + + + - @@ -59,7 +35,6 @@ - @@ -67,11 +42,10 @@ - - + \ No newline at end of file diff --git a/src/main/sql/seckill.sql b/src/main/sql/seckill.sql index 64e596a..c92f22f 100644 --- a/src/main/sql/seckill.sql +++ b/src/main/sql/seckill.sql @@ -5,7 +5,7 @@ DELIMITER $$ -- console ; 转换为 $$ -- 参数: in 输入参数; out 输出参数 -- row_count():返回上一条修改类型的sql(delete,update,insert)的影响行数 -- row_count(): 0:未修改数据;>0 :表示修改的行数;<0:sql错误/未执行修改的sql -CREATE PROCEDURE `test_mysql`.`execute_seckill` +CREATE PROCEDURE `seckill`.`execute_seckill` (in v_seckill_id bigint,in v_phone bigint,in v_kill_time TIMESTAMP ,out r_result int) BEGIN From 13394e637aa3d4d6d22c26e1fc513738fc785665 Mon Sep 17 00:00:00 2001 From: licy13 Date: Sun, 12 Jun 2016 13:34:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=93=BE=E6=8E=A5mysql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/seckill/enums/SeckillStatEnum.java | 3 ++ src/main/resources/jdbc.properties | 2 +- src/main/resources/mybatis-config.xml | 1 + src/main/resources/spring/spring-dao.xml | 38 +++++++++++-------- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/seckill/enums/SeckillStatEnum.java b/src/main/java/org/seckill/enums/SeckillStatEnum.java index 2795ce1..b32a35e 100644 --- a/src/main/java/org/seckill/enums/SeckillStatEnum.java +++ b/src/main/java/org/seckill/enums/SeckillStatEnum.java @@ -38,4 +38,7 @@ public static SeckillStatEnum stateOf(int index) { return null; } + public static void main(String[] args) { + System.out.println(SeckillStatEnum.stateOf(1).getStateInfo()); + } } diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index dea8a8a..5109f7d 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -1,4 +1,4 @@ driverClassName=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://localhost:3306/seckill +jdbc.url=jdbc:mysql://localhost:3306/seckill?characterEncoding=UTF-8 jdbc.username=root jdbc.password=root \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index 98133b7..68f1908 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -14,6 +14,7 @@ + diff --git a/src/main/resources/spring/spring-dao.xml b/src/main/resources/spring/spring-dao.xml index 0f610ac..cfacf71 100644 --- a/src/main/resources/spring/spring-dao.xml +++ b/src/main/resources/spring/spring-dao.xml @@ -5,25 +5,31 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd" > + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -35,6 +41,7 @@ + @@ -42,10 +49,11 @@ + - \ No newline at end of file +