AutoAdmin, 高效Java服务端
快速实现增删改查 使用JPA语法省去了大部分SQL
部署容易 内置Tomcat可直接运行,省去了配置tomcat的步骤
配置简单
使用 application properties
替代了大部分XML的繁琐配置。
漂亮的UI 使用LayUI效率和美观兼得。
开发效率高 在本项目代码量相对较少的情况下提供了AutoCoding,只需要表SQL就能生成管理端的增删改查的大部分代码。
├─src main
│ ├─java
│ │ ├─annotation 自定义注解
│ │ ├─base 基础类
│ │ │ └─BaseController.java
│ │ │ └─BaseEntity.java
│ │ │ └─BaseQuery.java
│ │ │ └─BaseResponse.java
│ │ │ └─BaseResponseList.java
│ │ │ └─BaseViewModel.java
│ │ ├─utils 工具类
│ │ │ └─DateUtil.java
│ │ │ └─MD5Util.java
│ │ ├─constants 常量
│ │ ├─controller 控制层,建议不同的业务包统一前缀,方便过滤和防止Controller重名。
│ │ ├─admin 管理端控制层
│ │ ├─entity 表实体类
│ │ ├─exception 异常
│ │ ├─interceptor 过滤器
│ │ ├─model 视图实体类
│ │ ├─repository 表操作类(JPA)
│ │ └─service 服务类
│ ├─resources
│ ├─static 资源文件
│ └─application.properties 项目主配置文件
│ └─application-dev.properties 开发环境配置文件
│ └─application-test.properties 测量环境配置文件
│ └─application-pro.properties 正式环境配置文件
│ └─log4j.properties 日志配置
│ └─messages.properties 消息定义
└─ README.md
创建数据库,导入 dbscript/auto_admin.sql
修改配置文件中的数据库连接、端口等信息
application.properties为主要配置文件,可修改文件中spring.profiles.active
的值来指定不同环境:
数据库连接信息
spring.datasource.url
spring.datasource.username
spring.datasource.password
application properties 官方文档,这块的内容比较多,有兴趣朋友的可以参考一下。
Maven构建成功后可看到Application可运行,后点击运行即可。(建议IDE使用Idea)
设置热部署 IDEA需要进行一项简单的设置,File > Settings > Build,Excutioni,Deployment > Compiler 将Build project automatically选上。
根据自己配置的端口(server.port
)访问http://localhost:端口
就可以看到AutoAdmin即成功。http://localhost:端口/admin/
为管理端的登录入口。 默认账号和密码都是admin
。
Keyword | Sample | JPQL snippet |
---|---|---|
And | findByLastnameAndFirstname | … where x.lastname = ?1 and x.firstname = ?2 |
Or | findByLastnameOrFirstname | … where x.lastname = ?1 or x.firstname = ?2 |
Is,Equals | findByFirstname,findByFirstnameIs,findByFirstnameEquals | … where x.firstname = ?1 |
Between | findByStartDateBetween | … where x.startDate between ?1 and ?2 |
LessThan | findByAgeLessThan | … where x.age < ?1 |
LessThanEqual | findByAgeLessThanEqual | … where x.age <= ?1 |
GreaterThan | findByAgeGreaterThan | … where x.age > ?1 |
GreaterThanEqual | findByAgeGreaterThanEqual | … where x.age >= ?1 |
After | findByStartDateAfter | … where x.startDate > ?1 |
Before | findByStartDateBefore | … where x.startDate < ?1 |
IsNull | findByAgeIsNull | … where x.age is null |
IsNotNull,NotNull | findByAge(Is)NotNull | … where x.age not null |
Like | findByFirstnameLike | … where x.firstname like ?1 |
NotLike | findByFirstnameNotLike | … where x.firstname not like ?1 |
StartingWith | findByFirstnameStartingWith | … where x.firstname like ?1(parameter bound with appended %) |
EndingWith | findByFirstnameEndingWith | … where x.firstname like ?1(parameter bound with prepended %) |
Containing | findByFirstnameContaining | … where x.firstname like ?1(parameter bound wrapped in %) |
OrderBy | findByAgeOrderByLastnameDesc | … where x.age = ?1 order by x.lastname desc |
Not | findByLastnameNot | … where x.lastname <> ?1 |
In | findByAgeIn(Collection ages) | … where x.age in ?1 |
NotIn | findByAgeNotIn(Collection ages) | … where x.age not in ?1 |
True | findByActiveTrue() | … where x.active = true |
False | findByActiveFalse() | … where x.active = false |
IgnoreCase | findByFirstnameIgnoreCase | … where UPPER(x.firstame) = UPPER(?1) |
交流加QQ群: 805405756
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。