Coder Social home page Coder Social logo

testjob's Introduction

Spring+AOP+Redis+MySQL练习

请开发一个简单的应用,练习Spring+AOP/MySQL/Redis完成如下功能:

  • src/main/resources/db/migration中的数据导入本地的MySQL数据库jdbc:mysql://localhost:3306/mall中。
  • 通过编写SQL查询该MySQL数据库的内容,获取商品排行榜,即商品按照其销售金额倒序的表格,如下所示。
  • 该排行榜页面使用Redis进行缓存,缓存时间1s——即,在同一秒中,无论有多少次页面访问请求,都只查数据库一次,其他数据都从Redis缓存获取。

你最终渲染成的页面应该大致长这个样子:

排名 商品名 成交金额
1 商品1 1000
2 商品2 200
3 ... ...
<!DOCTYPE html>
<html>
<head>
<title>商品排行榜</title>
<style>
table {
  border-collapse: collapse;
  width: 100%;
}

td, th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
</style>
</head>
<body>

<h2>商品排行榜</h2>

<table>
  <tr>
    <th>排名</th>
    <th>商品名</th>
    <th>成交金额</th>
  </tr>
  <tr>
    <td>1</td>
    <td>西瓜</td>
    <td>400</td>
  </tr>
  <tr>
    <td>2</td>
    <td>香蕉</td>
    <td>200</td>
  </tr>  
  <tr>
    <td>3</td>
    <td>...</td>
    <td>...</td>
  </tr>  	
</table>

</body>
</html>

在提交Pull Request之前,你应当在本地确保所有代码已经编译通过,并且通过了测试(mvn clean verify)

完成题目有困难?不妨来看看写代码啦的相应课程吧!

testjob's People

Contributors

uuflyer avatar hcsp-bot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.