Directory File Description
├── README - Doc document ├── db - database constraint file ├── mvnw ├── mvnw.cmd ├── pom.xml - project depends └── src ├── main │ ├── the Java CN └── │ │ │ │ └── tycoding │ │ ├── SpringbootSeckillApplication.java - SpringBoot starter │ │ ├── controller - MVC web tier │ │ ├── dto - Some results unified package attribute, and entity similar │ │ ├── entity - the entity class │ │ ├── enums - manually defined dictionary enumeration parameters │ │ ├── exception - consistent exception results │ │ ├── mapper - Mybatis-Mapper mapping interface layer, or a layer called DAO │ │ ├── redis - redis, jedis configuration │ │ └── service - service layer │ └── resources │ ├── application.yml - SpringBoot core configuration │ ├── mapper - Mybatis-Mapper layer XML mapping file │ ├── static - static storage resource page can be accessed directly through the browser │ │ ├── css JS ├── │ │ │ │ └── lib │ └── templates - template engine deposit required Thymeleaf HTML, can not be accessed directly in the browser │ ├── page │ └── public - public assemblies HTML page (head, tail) └── the test - test files
XML mapping
<update id="reduceStock"> UPDATE seckill SET stock_count = stock_count - 1 WHERE seckill_id = #{seckillId} AND start_time <= #{killTime} AND end_time >= #{killTime} AND stock_count > 0 </update> <insert id="insertOrder"> INSERT ignore INTO seckill_order(seckill_id, money, user_phone) VALUES (#{seckillId}, #{money}, #{userPhone}) </insert>
Core code
redis injection
redis cache settings
In order to address the high concurrency, lock the data, prevent data overflow
Began to spike
Here, when clicking spike when the spike through time and md5 judgment is valid, then enter the inventory query