Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/org/seckill/enums/SeckillStatEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
4 changes: 2 additions & 2 deletions src/main/resources/jdbc.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/test_mysql
jdbc.url=jdbc:mysql://localhost:3306/seckill?characterEncoding=UTF-8
jdbc.username=root
jdbc.password=111111
jdbc.password=root
1 change: 1 addition & 0 deletions src/main/resources/mybatis-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<!--开启驼峰命名转换Table:create_time到 Entity(createTime)-->
<setting name="mapUnderscoreToCamelCase" value="true"/>

</settings>

</configuration>
36 changes: 9 additions & 27 deletions src/main/resources/spring/spring-dao.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,22 @@

<!--2.配置连接池属性-->
<!--todo java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)-->
<!-- <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
&lt;!&ndash; <property name="driverClass" value="${driverClassName}"></property>
<property name="jdbcUrl" value="${jdbc.url}"></property>
<property name="user" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>&ndash;&gt;

<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
&lt;!&ndash;<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/test_mysql"></property>&ndash;&gt;
<property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/test_mysql"></property>
<property name="user" value="root"></property>
<property name="password" value="111111"></property>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${driverClassName}"></property>
<property name="jdbcUrl" value="${jdbc.url}"></property>
<property name="user" value="${jdbc.username}"></property>
<property name="password" value="${jdbc.password}"></property>

<property name="maxPoolSize" value="30"></property>
<property name="minPoolSize" value="10"></property>
&lt;!&ndash;关闭连接后不自动commit&ndash;&gt;
<!--关闭连接后不自动commit-->
<property name="autoCommitOnClose" value="false"></property>
&lt;!&ndash;获取连接超时时间&ndash;&gt;
<!--获取连接超时时间-->
<property name="checkoutTimeout" value="10000"></property>
&lt;!&ndash;获取连接重试次数&ndash;&gt;
<!--获取连接重试次数-->
<property name="acquireRetryAttempts" value="3"></property>
</bean>-->

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
</bean>

<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test_mysql"/>
<property name="username" value="root"/>
<property name="password" value="111111"/>
<!--todo -->
<!-- <property name="driverClassName" value="${driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>-->
</bean>

<!--3.配置SqlSessionFactory对象-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
Expand Down
2 changes: 1 addition & 1 deletion src/main/sql/seckill.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down