1. Official website address
- Official website demo addressfly.layui.com/
- The template download address: www.layui.com/template/fl…
- Development of detailed documentation: www.sunnyblog.top/index.html?…
2. Technology stack
- Development tool Idea
- Database design PowerDesign
- JDK version Java8
- Database MySQL V5.7
- The backend development language SpringBoot2.6.release
- Data access layer Mybatis-Plus 3.3.1
- Front-end related HTML5, LayUI, jQuery, LayUI_fly community template, etc
- Middleware Redis cache, RabbitMQ messages, Nginx, etc
- File service FastDFS distributed file storage, qiuniuyun, etc
- Rich text editors WangEditor, editor.md
- Third party login QQ, wechat, Weibo, Gitee, etc
- Send an email, send a pin message, or send an SMS message
- Integrate three-party API post content audit (Baidu audit), Baidu push, etc
3. Pd diagram of table structure design
- Detailed script download address:www.sunnyblog.top/detail.html…
4. Frame building
4.1. Integrate MyBatis-Plus operation database
-
Introducing Maven dependencies
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> < the groupId > com. Baomidou < / groupId > < artifactId > mybatis - plus - the boot - starter < / artifactId > < version > 3.3.1 < / version > </dependency>Copy the code
-
Spring: datasource: driver-class-name: com.mysql.cj.jdbc.driver url: JDBC: mysql: / / 127.0.0.1:3306 / sunny - fly? characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&useAffectedRows=true username: root password: admin1009 type: com.zaxxer.hikari.HikariDataSource hikari: maximum-pool-size: Idle-timeout: 18000 # Pool-name: specifies the maximum number of connections in the pool. The default value is 10. SunnyHikariCP # connection-test-query: SELECT 1Copy the code
-
Mybatis - plus basic Configuration class: MybatisPlusConfig. Java @ EnableTransactionManagement @ Configuration @ MapperScan (com. Sunny. Fly. "" mapper") public class MybatisPlusConfig { @Bean public PaginationInterceptor paginationInterceptor() { PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true)); return paginationInterceptor; }}Copy the code
-
The test operates the database through Mybatis – Plus
-
Creating a test script
CREATE TABLE `test` ( `NAME` varchar(255) DEFAULT NULL, `AGE` int(11) DEFAULT NULL, `BIRTHDAY` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Copy the code
-
Create a pojo, mapper, the service, the controller
@Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName(“TEST”) public class TestBean implements Serializable {
private static final long serialVersionUID = 1L; /** * name */ private String name; /** * age */ private int age; /** * age */ private Date birthday; }Copy the code
mapper
@Repository
public interface TestMapper extends BaseMapper<TestBean> {
}
Copy the code
service
public List<TestBean> queryAll() {
return testMapper.selectList(null);
}
Copy the code
controller
@GetMapping("queryAll")
@ResponseBody
public ResponseResult<List<TestBean>> queryAll() {
List<TestBean> testList = testService.queryAll();
return ResponseUtil.makeOKRsp(testList);
}
Copy the code
- Page access
4.2. Integrate Redis cache
Detailed integration document
5. Homepage development
Home page detailed development documents
6. Detail page development
Detail page detailed development documentation
7, login registration and personal center development documents
Log in and sign up for detailed development documentation
Source code download address
Source code download address
Detailed development technical documents can be viewed here technical documents; More technical articles: www.sunnyblog.top; Any question plus QQ group consultation :534073451