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

Configure datasource and mybatis-plus #29

Merged
merged 7 commits into from
Aug 21, 2024
Merged

Conversation

Kaiser-Yang
Copy link
Contributor

@Kaiser-Yang Kaiser-Yang commented Aug 20, 2024

一共包含三个提交。

  • 对于第一个提交,其修改了 Finish the deploy script for database #25 中的错误(之前使用了错误的密码,在测试的时候两个密码一致,导致没有测试出来)。
  • 对于第二个提交,完成了数据源的配置(使用 druid 数据源)。
  • 对于第三个提交,完成了 mybatis-plus 的配置。

druid 数据源提供数据监控的功能,通过部署脚本启动后,可以访问 http://localhost:8080/druid/login.html 可以进入登录界面,默认的用户名和密码均为 druid,登录后可以看到监控界面:

image

在我事先向数据库插入一条表项后,测试的结果如下( mvn test 进行测试):

image

新增两个提交:

  • 对于第四个提交,解决了当 application.properties 不为空的时候部署失败的问题。
  • 对于第五个提交,解决 format 的时候,JDK 默认版本为 11 会导致格式化失败的问题。

新增一个提交:

  • 修复了一处笔误。

In the helper script, we use the wrong password to login the server.
We used the password for the user in database rather in the OS, which
is wrong. We did not find this bug before because we use the same
password for both the user in database and the user in OS.
We use druid as datasource, and finish the configuration for it.

This should solve #26.
In this commit, we add the `mybatis-plus` dependency to the `pom.xml`
file, and configure the `mybatis-plus` in the `application-dev.yml`
file. We also add the `UserMapper` interface and `UserPO` class to the
project for testing. The `UserMapper` interface is used to define the
database operations (the real operations will generated by
`mybatis-plus`), and the `UserPO` class is used to define the user
entity. We use `spring-boot-test` to test this function (I've add one
item in the `t_user` table).

This solved #28.
@Kaiser-Yang Kaiser-Yang changed the title [WIP] Database kaiser Configure datasource and mybatis-plus Aug 20, 2024
We find that the deploy_helper.py script will fail if the
`application.properties` file is not empty. This is because the `write`
in `Python` will not add `\n` automatically. So we need to add a new
line after writing the content to the file.
@Kaiser-Yang Kaiser-Yang force-pushed the database-kaiser branch 3 times, most recently from 4549106 to 6167ca7 Compare August 20, 2024 13:21
@Kaiser-Yang Kaiser-Yang added the project initialization Building the project framework for the first time label Aug 20, 2024
@Quentin9922 Quentin9922 merged commit 0525f56 into develop Aug 21, 2024
1 check passed
@Kaiser-Yang Kaiser-Yang deleted the database-kaiser branch August 30, 2024 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project initialization Building the project framework for the first time