# java-practice **Repository Path**: quanw20/java-practice ## Basic Information - **Project Name**: java-practice - **Description**: Java 假期实训 使用SpringBoot - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-07-05 - **Last Updated**: 2023-07-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: Java, MySQL, JPA ## README # Java 假期实训 # Java 假期实习终极版 ## 技术栈 ### 前端 | 技术 | 描述 | 文档/官网 | | ------------ | --------------------------------- | ---------------------------------------- | | TypeScript | 有类型的JavaScript | https://www.typescriptlang.org/ | | React.js | 用于构建 Web 和原生交互界面的库 | https://react.dev/ | | Next.js | 服务器渲染、基于目录的路由 | https://nextjs.org/ | | Ant Design | 企业级 UI 设计语言和 React 组件库 | https://ant.design/docs/react/introduce/ | | Tailwind CSS | 类似BootStrap的CSS 库 | https://www.tailwindcss.cn/ | | PostCSS | 将CSS翻译成JavaScript | https://postcss.org/ | | SWR | 用于数据请求的 React Hooks 库 | https://swr.bootcss.com/ | ### 后端 | 技术 | 描述 | 文档/官网 | | ------------ | ---------------------------- | ------------------------------------------ | | SpringBoot | Java Spring开发框架 | https://spring.io/projects/spring-boot | | Spring Cloud | 微服务框架 | https://spring.io/projects/spring-cloud | | Lombok | Java 对象封装代码生成工具 | https://projectlombok.org/ | | MySQL | 关系型数据库 | https://www.mysql.com/cn | | JUnit | Java单元测试 | https://junit.org/junit5 | | JPA | 全自动ORM框架 | https://spring.io/projects/spring-data-jpa | | MyBatis | ORM框架 | http://www.mybatis.org | | Redis | 内存KV数据存储 | https://redis.io/ | | Nginx | 反向代理、负载均衡服务器 | https://www.nginx.com/ | | Docker | 应用容器引擎 | https://www.docker.com | | Swagger | API 接口测试工具 | https://swagger.io/ | | MongoDB | 文档数据库 | https://www.mongodb.com | | Mongoose | Node.js的MongoDB对象建模工具 | https://mongoosejs.com/ | | Express | Node.js的Web应用框架 | http://expressjs.com/ | ## 接口 /users post /login post /signup put / /products get / get /{pid} /carts get /{uid} post /{uid}/ /orders get /{uid} post /{uid} ## 环境 JDK 17 SpringBoot 3.1.1 spring-data 2023.0.1 ## 模块 - module-view 前端页面 - module-user 用户管理模块 - module-product 商品管理模块 - ## MySQL 数据库 ## JPA 通过id和password验证用户,返回User对象(User对象中没有password) 数据库中存储password的摘要,password字段只用于比对 插入password时摘要(将id作为盐值) 比对时对输入的password摘要,和数据库中的password比对 ## Redis 先读缓存,未命中再读数据库,读取结果写缓存,返回 ## ThymeLeaf Thymeleaf is a popular Java-based template engine used for server-side rendering in web applications. It provides a wide range of tags and attributes to dynamically generate HTML content. Here are some commonly used Thymeleaf tags: 1. `th:text`: Used to set the text content of an HTML element. Example: `

Default message

` 2. `th:if` and `th:unless`: Used for conditional rendering of HTML elements. Example: `

This will be shown if the condition is true

` 3. `th:each`: Used for iterating over a collection and generating multiple HTML elements. Example: ```html ``` 4. `th:attr`: Used to set or modify HTML attributes of an element. Example: `Home` 5. `th:fragment` and `th:include`: Used for reusing HTML fragments across multiple templates. Example: ```html
Header content
``` 6. `th:switch` and `th:case`: Used for conditional rendering based on multiple cases. Example: ```html

Case 1 content

Case 2 content

Default case content

``` ``` Simple expressions: Variable Expressions: ${...} Selection Variable Expressions: *{...} Message Expressions: #{...} Link URL Expressions: @{...} Fragment Expressions: ~{...} Literals Text literals: 'one text', 'Another one!',… Number literals: 0, 34, 3.0, 12.3,… Boolean literals: true, false Null literal: null Literal tokens: one, sometext, main,… Text operations: String concatenation: + Literal substitutions: |The name is ${name}| Arithmetic operations: Binary operators: +, -, *, /, % Minus sign (unary operator): - Boolean operations: Binary operators: and, or Boolean negation (unary operator): !, not Comparisons and equality: Comparators: >, <, >=, <= (gt, lt, ge, le) Equality operators: ==, != (eq, ne) Conditional operators: If-then: (if) ? (then) If-then-else: (if) ? (then) : (else) Default: (value) ?: (defaultvalue) Special tokens: No-Operation: _ ``` ## BootStrap ```html ```