整合提交
This commit is contained in:
parent
32e35666af
commit
0b4860f46e
18
.gitignore
vendored
18
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
# ---> Java
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
@ -10,28 +9,17 @@
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
target
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
*.iml
|
||||
.idea
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
# ---> Vue
|
||||
# gitignore template for Vue.js projects
|
||||
#
|
||||
# Recommended template: Node.gitignore
|
||||
|
||||
# TODO: where does this rule come from?
|
||||
docs/_book
|
||||
|
||||
# TODO: where does this rule come from?
|
||||
test/
|
||||
|
||||
|
||||
67
AGENTS.md
Normal file
67
AGENTS.md
Normal file
@ -0,0 +1,67 @@
|
||||
# AGENTS.md
|
||||
|
||||
## Repo
|
||||
|
||||
Fork of [renren-security](https://gitee.com/renrenio/renren-security) customized as a weather-data management system. Spring Boot 3.5.x multi-module Maven project, Java 17.
|
||||
|
||||
## Quick start
|
||||
|
||||
```bash
|
||||
mvn clean install -DskipTests
|
||||
```
|
||||
|
||||
Run `AdminApplication.java` (`system-admin/`), context path `/system-admin`, port 8080. DB = `weather_data_system` (MySQL). Init from `system-admin/db/mysql.sql`. Default admin: `admin` / `admin` (pw encoded w/ BCrypt).
|
||||
|
||||
Tests are **skipped by default** (`<skipTests>true</skipTests>` in pom). If running tests, pass `-DskipTests=false`.
|
||||
|
||||
## Modules
|
||||
|
||||
| Module | Purpose |
|
||||
|---|---|
|
||||
| `system-admin` | Main admin backend. Entrypoint: `com.weather.AdminApplication` |
|
||||
| `system-api` | API service (separate process). Entrypoint: `com.weather.ApiApplication` |
|
||||
| `system-common` | Shared lib: base entities, utils, Redis, XSS, validators |
|
||||
| `system-dynamic-datasource` | Multi-DS support (stub, not populated) |
|
||||
| `renren-generator` | Code generator. Entrypoint: `com.weather.GeneratorApplication` |
|
||||
|
||||
All sub-modules depend on `system-common`. Maven repo: Aliyun mirror.
|
||||
|
||||
## Key framework choices
|
||||
|
||||
- **Security**: Apache Shiro 1.12 (Jakarta classifier) with OAuth2 token auth, not Spring Security.
|
||||
- **ORM**: MyBatis-Plus 3.5.8. Mapper XMLs in `src/main/resources/mapper/**/*.xml`.
|
||||
- **Scheduled tasks**: Quartz via `schedule_job` table. All tasks implement `ITask` interface and are `@Component`-named beans. Jobs auto-register at startup via `JobCommandLineRunner`.
|
||||
- **Data permissions**: `@DataFilter` annotation + `DataFilterAspect`. Dept-based filtering injected into MyBatis via `DataFilterInterceptor`.
|
||||
- **Auto-fill**: `FieldMetaObjectHandler` fills `creator`/`createDate`/`updater`/`updateDate`.
|
||||
- **API docs**: Knife4j (Swagger UI) at `/doc.html` when enabled (disabled by default).
|
||||
- **Redis**: Optional. Toggle via `project-options.redis.open: false`.
|
||||
- **Validation**: Hibernate Validator. XSS filter via custom `XssFilter`.
|
||||
- **Excel**: EasyExcel. Async import with progress tracking (`WeatherDataImportManager`).
|
||||
|
||||
## Custom weather module (`modules/weather/`)
|
||||
|
||||
- `dailydata/` — daily weather observations. Supports Excel batch import (async, via `EasyExcel` listener pattern).
|
||||
- `station/` — weather station CRUD. Stations are linked to departments (`dept_id`).
|
||||
- `filescan/` — file scanning module (receive/display/archive). WatchService primary + Quartz fallback. Files served via `FileDownloadController` (`/filescan/file/display/{id}`).
|
||||
|
||||
## Database
|
||||
|
||||
- Scripts in `system-admin/db/` (mysql.sql + Oracle/SQLServer/PostgreSQL/Dameng variants).
|
||||
- Custom tables: `weather_daily_data`, `weather_station`.
|
||||
|
||||
## Conventions
|
||||
|
||||
- `Result` wrapper class for all API responses (in `system-common`).
|
||||
- `CrudService`/`BaseService` pattern for service layer.
|
||||
- DTO/Entity/Excel VO separation per module.
|
||||
- PK strategy: `ASSIGN_ID` (Snowflake via `IdUtil.getSnowflakeNextId()`).
|
||||
- Lombok everywhere (`@Data`, `@AllArgsConstructor`, `@Slf4j`).
|
||||
|
||||
## Gotchas
|
||||
|
||||
- Do **not** introduce Spring Security dependencies — project uses Shiro exclusively.
|
||||
- Swagger (Knife4j) is **disabled by default** (`knife4j.enable: false`). Enable in dev profile.
|
||||
- `schedule_job` table seed includes a test task `testTask` (paused by default). New tasks must be `@Component("beanName")` implementing `ITask`.
|
||||
- The `system-dynamic-datasource` module is a placeholder. Multi-DS config in `application-dev.yml` is commented out.
|
||||
- No frontend sources in this repo (separate `renren-ui` Vue3 project).
|
||||
- `.gitignore` excludes `.idea/` but `.idea/` is tracked (committed IDE config).
|
||||
107
CLAUDE.md
Normal file
107
CLAUDE.md
Normal file
@ -0,0 +1,107 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
> **See also** `AGENTS.md` for module breakdown, framework choices, conventions, and gotchas. This file supplements it with build commands and architectural patterns.
|
||||
|
||||
## Build & Run
|
||||
|
||||
```bash
|
||||
# Full build (tests skipped by default per pom.xml <skipTests>true</skipTests>)
|
||||
mvn clean install -DskipTests
|
||||
|
||||
# Build with tests
|
||||
mvn clean install -DskipTests=false
|
||||
|
||||
# Run single test class
|
||||
mvn -pl system-admin -DskipTests=false -Dtest=YourTestClass test
|
||||
```
|
||||
|
||||
**Run applications** from IntelliJ:
|
||||
- **Admin backend**: `com.weather.AdminApplication` (`system-admin/`) — port 8080, context path `/system-admin`
|
||||
- **API service**: `com.weather.ApiApplication` (`system-api/`) — port 8081
|
||||
- **Code generator**: `com.weather.GeneratorApplication` (`renren-generator/`)
|
||||
|
||||
**Database**: `weather_data_system` (MySQL). Init from `system-admin/db/mysql.sql`. Default admin: `admin` / `admin`.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Multi-module Maven project (Java 17, Spring Boot 3.5.x)
|
||||
|
||||
```
|
||||
weather-data (pom)
|
||||
├── system-common → shared lib (all modules depend on this)
|
||||
├── system-admin → main admin backend
|
||||
├── system-api → external API service
|
||||
├── system-dynamic-datasource → multi-DS support (placeholder)
|
||||
└── renren-generator → code generator
|
||||
```
|
||||
|
||||
### Service layer pattern
|
||||
|
||||
All services extend one of two base classes from `system-common`:
|
||||
- **`CrudService<Dao, Entity, DTO>`** — generic CRUD with `page()`, `get()`, `save()`, `update()`, `delete()`. The DTO type param is used for query criteria wrapping.
|
||||
- **`BaseService<Dao>`** — lighter base without DTO generic.
|
||||
|
||||
New modules follow this convention:
|
||||
```
|
||||
modules/<name>/
|
||||
├── controller/ → @RestController, returns Result
|
||||
├── dao/ → extends BaseMapper<Entity> (MyBatis-Plus)
|
||||
├── dto/ → request/query DTOs (often extends BaseEntity for auto-fill)
|
||||
├── entity/ → @TableName JPA entity
|
||||
├── service/ → interface extends CrudService/BaseService
|
||||
│ └── impl/ → @Service implementation
|
||||
├── excel/ → EasyExcel VO classes (optional)
|
||||
└── vo/ → response VO classes (optional)
|
||||
```
|
||||
|
||||
Mapper XMLs: `src/main/resources/mapper/<domain>/**/*.xml`
|
||||
|
||||
### Key cross-cutting mechanisms
|
||||
|
||||
| Mechanism | How it works |
|
||||
|---|---|
|
||||
| **Data permissions** | `@DataFilter` annotation on controller → `DataFilterAspect` → `DataFilterInterceptor` injects dept-based SQL filtering into MyBatis |
|
||||
| **Auto-fill** | `FieldMetaObjectHandler` fills `creator`/`createDate`/`updater`/`updateDate` via MyBatis-Plus meta-object handler |
|
||||
| **Scheduled jobs** | Quartz. Jobs in `schedule_job` table, implement `ITask`, annotated `@Component("beanName")`. `JobCommandLineRunner` auto-registers at startup |
|
||||
| **File scanning** | Three-part weather module: `WatchService` (primary, `FileWatchServiceManager`) + Quartz fallback (`FileScanTask`) + startup scan (`FileScanStartupRunner`). Files served via `FileDownloadController` |
|
||||
| **Excel import** | EasyExcel with async progress tracking via `WeatherDataImportManager` |
|
||||
| **API responses** | Always wrapped in `Result` class (`system-common`) |
|
||||
| **Validation** | Hibernate Validator on DTOs. XSS filter via `XssFilter` |
|
||||
|
||||
### PK strategy
|
||||
|
||||
`ASSIGN_ID` (Snowflake via `IdUtil.getSnowflakeNextId()`), set globally in MyBatis-Plus config. All entities extend `BaseEntity` which declares the `id` field.
|
||||
|
||||
### Auth flow
|
||||
|
||||
- Apache Shiro 1.12 (Jakarta classifier) with OAuth2 token auth
|
||||
- Login → get token → pass `token` header on subsequent requests
|
||||
- API module (`system-api`) uses `@Login` annotation + `AuthorizationInterceptor`
|
||||
|
||||
### Redis
|
||||
|
||||
Optional, controlled by `project-options.redis.open` (default `false` in dev). Cache aspect: `RedisAspect`.
|
||||
|
||||
### API docs
|
||||
|
||||
Knife4j (Swagger UI) at `/doc.html`. **Disabled by default** (`knife4j.enable: false`). Enable only in dev profile.
|
||||
|
||||
## Custom Weather Domain
|
||||
|
||||
Three sub-modules under `system-admin/.../modules/weather/`:
|
||||
|
||||
| Sub-module | Purpose | Key detail |
|
||||
|---|---|---|
|
||||
| `dailydata/` | Daily weather observations | Excel batch import (async), EasyExcel listener pattern |
|
||||
| `station/` | Weather station CRUD | Linked to dept via `dept_id`, data-permission aware |
|
||||
| `filescan/` | File monitoring & serving | WatchService → record → serve via `FileDownloadController` |
|
||||
|
||||
File format convention (from `需求文档.md`): `<地区>地区-<指标>.png` for charts, `<地区>地区631信息.txt` for text data. `FileNameParser` extracts region/indicator keywords.
|
||||
|
||||
## Database
|
||||
|
||||
Custom tables: `weather_daily_data`, `weather_station`, `weather_file_scan_record`.
|
||||
Seed scripts in `system-admin/db/` (mysql.sql + Oracle/SQLServer/PostgreSQL/Dameng variants).
|
||||
Parameter `scan_root_path` in `sys_params` controls the file-scan base directory.
|
||||
192
LICENSE
192
LICENSE
@ -1,9 +1,191 @@
|
||||
MIT License
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
Copyright (c) 2026 sansenhoshi
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
1. Definitions.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "{}" replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same "printed page" as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright 2018 人人开源
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
127
README.md
127
README.md
@ -1,3 +1,126 @@
|
||||
# weather-data
|
||||
### 项目说明
|
||||
- renren-security是一个轻量级的,前后端分离的Java快速开发平台,能快速开发项目并交付【接私活利器】
|
||||
- 采用SpringBoot3.x、Shiro、MyBatis-Plus、Vue3、TypeScript、Element Plus、Vue Router、Pinia、Axios、Vite框架,开发的一套权限系统,极低门槛,拿来即用。设计之初,就非常注重安全性,为企业系统保驾护航,让一切都变得如此简单。
|
||||
- 提供了代码生成器,只需编写30%左右代码,其余的代码交给系统自动生成,可快速完成开发任务
|
||||
- 支持MySQL、达梦、Oracle、SQL Server、PostgreSQL等主流数据库
|
||||
- 演示地址:http://demo.open.renren.io/renren-security (账号密码:admin/admin)
|
||||
|
||||
<br>
|
||||
|
||||
### 微信交流群
|
||||
我们提供了微信交流群,扫码下面的二维码,关注【人人开源】公众号,回复【加群】,即可根据提示加入微信群!
|
||||
<br><br>
|
||||

|
||||
|
||||
<br>
|
||||
|
||||
### 具有如下特点
|
||||
- 友好的代码结构及注释,便于阅读及二次开发
|
||||
- 实现前后端分离,通过token进行数据交互,前端再也不用关注后端技术
|
||||
- 灵活的权限控制,可控制到页面或按钮,满足绝大部分的权限需求
|
||||
- 提供CrudService接口,对增删改查进行封装,代码更简洁
|
||||
- 页面交互使用Vue3.x,极大的提高了开发效率
|
||||
- 完善的部门管理及数据权限,通过注解实现数据权限的控制
|
||||
- 完善的XSS防范及脚本过滤,彻底杜绝XSS攻击
|
||||
- 完善的代码生成机制,可在线生成entity、xml、dao、service、vue、sql代码,减少70%以上的开发任务
|
||||
- 引入quartz定时任务,可动态完成任务的添加、修改、删除、暂停、恢复及日志查看等功能
|
||||
- 引入Hibernate Validator校验框架,轻松实现后端校验
|
||||
- 引入云存储服务,已支持:七牛云、阿里云、腾讯云等
|
||||
- 引入swagger文档支持,方便编写API接口文档
|
||||
|
||||
<br>
|
||||
|
||||
### 数据权限设计思想
|
||||
- 用户管理、角色管理、部门管理,可操作本部门及子部门数据
|
||||
- 菜单管理、定时任务、参数管理、字典管理、系统日志,没有数据权限
|
||||
- 业务功能,按照用户数据权限,查询、操作数据【没有本部门数据权限,也能查询本人数据】
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
**项目结构**
|
||||
```
|
||||
renren-security
|
||||
├─renren-common 公共模块
|
||||
│
|
||||
├─renren-admin 管理后台
|
||||
│ ├─db 数据库SQL脚本
|
||||
│ │
|
||||
│ ├─modules 模块
|
||||
│ │ ├─job 定时任务
|
||||
│ │ ├─log 日志管理
|
||||
│ │ ├─oss 文件存储
|
||||
│ │ ├─security 安全模块
|
||||
│ │ └─sys 系统管理(核心)
|
||||
│ │
|
||||
│ └─resources
|
||||
│ ├─mapper MyBatis文件
|
||||
│ ├─public 静态资源
|
||||
│ └─application.yml 全局配置文件
|
||||
│
|
||||
│
|
||||
├─renren-api API服务
|
||||
│
|
||||
├─renren-generator 代码生成器
|
||||
│ └─resources
|
||||
│ ├─mapper MyBatis文件
|
||||
│ ├─template 代码生成器模板(可增加或修改相应模板)
|
||||
│ ├─application.yml 全局配置文件
|
||||
│ └─generator.properties 代码生成器,配置文件
|
||||
│
|
||||
├─renren-ui Vue3前端工程
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
**技术选型:**
|
||||
- 核心框架:Spring Boot 3.x
|
||||
- 安全框架:Apache Shiro 1.12
|
||||
- 持久层框架:MyBatis 3.5
|
||||
- 定时器:Quartz 2.3
|
||||
- 数据库连接池:Druid 1.2
|
||||
- 日志管理:Logback
|
||||
- 页面交互:Vue3.x
|
||||
|
||||
<br>
|
||||
|
||||
**软件需求**
|
||||
- JDK17+
|
||||
- Maven3.6+
|
||||
- MySQL8.0+
|
||||
- Oracle 11g+
|
||||
- SQLServer 2012+
|
||||
- PostgreSQL 9.4+
|
||||
- 达梦8
|
||||
<br>
|
||||
|
||||
|
||||
**本地部署**
|
||||
- 通过git下载源码
|
||||
- 创建数据库renren_security,数据库编码为UTF-8
|
||||
- 执行db/mysql.sql文件,初始化数据
|
||||
- 修改application-dev.yml文件,更新MySQL账号和密码
|
||||
- 在renren-security目录下,执行mvn clean install
|
||||
- IDEA运行AdminApplication.java,则可启动项目【renren-admin】
|
||||
- renren-admin访问路径:http://localhost:8080/renren-admin
|
||||
- swagger文档路径:http://localhost:8080/renren-admin/doc.html
|
||||
- 再启动前端工程
|
||||
- 账号密码:admin/admin
|
||||
<br>
|
||||
|
||||

|
||||
|
||||
<br>
|
||||
|
||||

|
||||
|
||||
<br>
|
||||
|
||||
### 如何交流、反馈、参与贡献?
|
||||
- 开发文档:https://www.renren.io/guide/security
|
||||
- Gitee仓库:https://gitee.com/renrenio/renren-security
|
||||
- GitCode仓库:https://gitcode.com/renrenio/renren-security
|
||||
- [人人开源](https://www.renren.io):https://www.renren.io
|
||||
- 如需关注项目最新动态,请Watch、Star项目,同时也是对项目最好的支持
|
||||
<br>
|
||||
|
||||
气象管理系统
|
||||
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
||||
version: '2'
|
||||
services:
|
||||
renren-admin:
|
||||
image: renren/renren-admin
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
- spring.profiles.active=dev
|
||||
renren-api:
|
||||
image: renren/renren-api
|
||||
ports:
|
||||
- "8081:8081"
|
||||
environment:
|
||||
- spring.profiles.active=dev
|
||||
162
pom.xml
Normal file
162
pom.xml
Normal file
@ -0,0 +1,162 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.weather</groupId>
|
||||
<artifactId>weather-data</artifactId>
|
||||
<version>5.5.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>weather-data</name>
|
||||
<description>气象数据管理系统</description>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.5.11</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<module>system-common</module>
|
||||
<module>system-dynamic-datasource</module>
|
||||
<module>system-admin</module>
|
||||
<module>system-api</module>
|
||||
<!-- <module>renren-generator</module>-->
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>17</java.version>
|
||||
<druid.version>1.2.23</druid.version>
|
||||
<mybatisplus.version>3.5.8</mybatisplus.version>
|
||||
<sqlserver.version>4.0</sqlserver.version>
|
||||
<oracle.version>11.2.0.3</oracle.version>
|
||||
<dameng.version>8.1.2.141</dameng.version>
|
||||
<hutool.version>5.8.29</hutool.version>
|
||||
<jsoup.version>1.15.3</jsoup.version>
|
||||
<knife4j.version>4.5.0</knife4j.version>
|
||||
<springdoc.version>2.8.4</springdoc.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- mysql驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<!-- oracle驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>${oracle.version}</version>
|
||||
</dependency>
|
||||
<!-- sqlserver驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>${sqlserver.version}</version>
|
||||
</dependency>
|
||||
<!-- postgresql驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<!-- 达梦驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.dameng</groupId>
|
||||
<artifactId>DmJdbcDriver18</artifactId>
|
||||
<version>${dameng.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>${jsoup.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>${springdoc.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!-- 阿里云maven仓库 -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>https://maven.aliyun.com/repository/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>https://maven.aliyun.com/repository/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
7
system-admin/Dockerfile
Normal file
7
system-admin/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM java:8
|
||||
EXPOSE 8080
|
||||
|
||||
VOLUME /tmp
|
||||
ADD renren-admin.jar /app.jar
|
||||
RUN bash -c 'touch /app.jar'
|
||||
ENTRYPOINT ["java","-jar","/app.jar"]
|
||||
674
system-admin/db/dm8.sql
Normal file
674
system-admin/db/dm8.sql
Normal file
@ -0,0 +1,674 @@
|
||||
CREATE TABLE sys_user (
|
||||
id bigint NOT NULL,
|
||||
username varchar(50) NOT NULL,
|
||||
password varchar(100),
|
||||
real_name varchar(50),
|
||||
head_url varchar(200),
|
||||
gender int,
|
||||
email varchar(100),
|
||||
mobile varchar(100),
|
||||
dept_id bigint,
|
||||
super_admin int,
|
||||
status int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uk_sys_user_username on sys_user(username);
|
||||
CREATE INDEX idx_sys_user_create_date on sys_user(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_user IS '用户管理';
|
||||
COMMENT ON COLUMN sys_user.id IS 'id';
|
||||
COMMENT ON COLUMN sys_user.username IS '用户名';
|
||||
COMMENT ON COLUMN sys_user.password IS '密码';
|
||||
COMMENT ON COLUMN sys_user.real_name IS '姓名';
|
||||
COMMENT ON COLUMN sys_user.head_url IS '头像';
|
||||
COMMENT ON COLUMN sys_user.gender IS '性别 0:男 1:女 2:保密';
|
||||
COMMENT ON COLUMN sys_user.email IS '邮箱';
|
||||
COMMENT ON COLUMN sys_user.mobile IS '手机号';
|
||||
COMMENT ON COLUMN sys_user.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN sys_user.super_admin IS '超级管理员 0:否 1:是';
|
||||
COMMENT ON COLUMN sys_user.status IS '状态 0:停用 1:正常';
|
||||
COMMENT ON COLUMN sys_user.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_user.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_user.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_user.update_date IS '更新时间';
|
||||
|
||||
|
||||
CREATE TABLE sys_dept (
|
||||
id bigint NOT NULL,
|
||||
pid bigint,
|
||||
pids varchar(500),
|
||||
name varchar(50),
|
||||
sort int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_dept_pid on sys_dept(pid);
|
||||
CREATE INDEX idx_sys_dept_idx_sort on sys_dept(sort);
|
||||
|
||||
COMMENT ON TABLE sys_dept IS '部门管理';
|
||||
COMMENT ON COLUMN sys_dept.id IS 'id';
|
||||
COMMENT ON COLUMN sys_dept.pid IS '上级ID';
|
||||
COMMENT ON COLUMN sys_dept.pids IS '所有上级ID,用逗号分开';
|
||||
COMMENT ON COLUMN sys_dept.name IS '部门名称';
|
||||
COMMENT ON COLUMN sys_dept.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_dept.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_dept.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_dept.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_dept.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_role
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
name varchar(50),
|
||||
remark varchar(100),
|
||||
dept_id bigint,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_dept_id on sys_role(dept_id);
|
||||
|
||||
COMMENT ON TABLE sys_role IS '角色管理';
|
||||
COMMENT ON COLUMN sys_role.id IS 'id';
|
||||
COMMENT ON COLUMN sys_role.name IS '角色名称';
|
||||
COMMENT ON COLUMN sys_role.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_role.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN sys_role.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_role.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_role.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_menu
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
pid bigint,
|
||||
name varchar(200),
|
||||
url varchar(200),
|
||||
permissions varchar(500),
|
||||
menu_type int,
|
||||
icon varchar(50),
|
||||
sort int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_menu_pid on sys_menu(pid);
|
||||
CREATE INDEX idx_sys_menu_sort on sys_menu(sort);
|
||||
|
||||
COMMENT ON TABLE sys_menu IS '菜单管理';
|
||||
COMMENT ON COLUMN sys_menu.id IS 'id';
|
||||
COMMENT ON COLUMN sys_menu.pid IS '上级ID,一级菜单为0';
|
||||
COMMENT ON COLUMN sys_menu.name IS '名称';
|
||||
COMMENT ON COLUMN sys_menu.url IS '菜单URL';
|
||||
COMMENT ON COLUMN sys_menu.permissions IS '授权(多个用逗号分隔,如:sys:user:list,sys:user:save)';
|
||||
COMMENT ON COLUMN sys_menu.menu_type IS '类型 0:菜单 1:按钮';
|
||||
COMMENT ON COLUMN sys_menu.icon IS '菜单图标';
|
||||
COMMENT ON COLUMN sys_menu.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_menu.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_menu.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_menu.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_menu.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_role_user
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
role_id bigint,
|
||||
user_id bigint,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_user_role_id on sys_role_user(role_id);
|
||||
CREATE INDEX idx_sys_role_user_user_id on sys_role_user(user_id);
|
||||
|
||||
COMMENT ON TABLE sys_role_user IS '角色用户关系';
|
||||
COMMENT ON COLUMN sys_role_user.role_id IS '角色ID';
|
||||
COMMENT ON COLUMN sys_role_user.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN sys_role_user.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role_user.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_role_menu
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
role_id bigint,
|
||||
menu_id bigint,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_menu_role_id on sys_role_menu(role_id);
|
||||
CREATE INDEX idx_sys_role_menu_menu_id on sys_role_menu(menu_id);
|
||||
|
||||
COMMENT ON TABLE sys_role_menu IS '角色菜单关系';
|
||||
COMMENT ON COLUMN sys_role_menu.role_id IS '角色ID';
|
||||
COMMENT ON COLUMN sys_role_menu.menu_id IS '菜单ID';
|
||||
COMMENT ON COLUMN sys_role_menu.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role_menu.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_role_data_scope
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
role_id bigint,
|
||||
dept_id bigint,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_data_scope_role_id on sys_role_data_scope(role_id);
|
||||
|
||||
COMMENT ON TABLE sys_role_data_scope IS '角色数据权限';
|
||||
COMMENT ON COLUMN sys_role_data_scope.role_id IS '角色ID';
|
||||
COMMENT ON COLUMN sys_role_data_scope.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN sys_role_data_scope.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role_data_scope.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_params
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
param_code varchar(32),
|
||||
param_value varchar(2000),
|
||||
param_type int DEFAULT 1 NOT NULL,
|
||||
remark varchar(200),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX uk_sys_params_param_code on sys_params(param_code);
|
||||
CREATE INDEX idx_sys_params_create_date on sys_params(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_params IS '参数管理';
|
||||
COMMENT ON COLUMN sys_params.param_code IS '参数编码';
|
||||
COMMENT ON COLUMN sys_params.param_value IS '参数值';
|
||||
COMMENT ON COLUMN sys_params.param_type IS '类型 0:系统参数 1:非系统参数';
|
||||
COMMENT ON COLUMN sys_params.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_params.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_params.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_params.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_params.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_dict_type
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
dict_type varchar(100),
|
||||
dict_name varchar(255),
|
||||
remark varchar(255),
|
||||
sort int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX uk_sys_dict_type_dict_type on sys_dict_type(dict_type);
|
||||
|
||||
COMMENT ON TABLE sys_dict_type IS '字典类型';
|
||||
COMMENT ON COLUMN sys_dict_type.id IS 'id';
|
||||
COMMENT ON COLUMN sys_dict_type.dict_type IS '字典类型';
|
||||
COMMENT ON COLUMN sys_dict_type.dict_name IS '字典名称';
|
||||
COMMENT ON COLUMN sys_dict_type.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_dict_type.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_dict_type.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_dict_type.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_dict_type.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_dict_type.update_date IS '更新时间';
|
||||
|
||||
create table sys_dict_data
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
dict_type_id bigint NOT NULL,
|
||||
dict_label varchar(255),
|
||||
dict_value varchar(255),
|
||||
remark varchar(255),
|
||||
sort int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_dict_data_sort on sys_dict_data(sort);
|
||||
CREATE UNIQUE INDEX uk_dict_type_value on sys_dict_data(dict_type_id, dict_value);
|
||||
|
||||
COMMENT ON TABLE sys_dict_data IS '字典数据';
|
||||
COMMENT ON COLUMN sys_dict_data.id IS 'id';
|
||||
COMMENT ON COLUMN sys_dict_data.dict_type_id IS '字典类型ID';
|
||||
COMMENT ON COLUMN sys_dict_data.dict_label IS '字典标签';
|
||||
COMMENT ON COLUMN sys_dict_data.dict_value IS '字典值';
|
||||
COMMENT ON COLUMN sys_dict_data.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_dict_data.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_dict_data.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_dict_data.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_dict_data.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_dict_data.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_log_login
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
operation int,
|
||||
status int,
|
||||
user_agent varchar(500),
|
||||
ip varchar(32),
|
||||
creator_name varchar(50),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_login_status on sys_log_login(status);
|
||||
CREATE INDEX idx_login_create_date on sys_log_login(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_log_login IS '登录日志';
|
||||
COMMENT ON COLUMN sys_log_login.id IS 'id';
|
||||
COMMENT ON COLUMN sys_log_login.operation IS '用户操作 0:用户登录 1:用户退出';
|
||||
COMMENT ON COLUMN sys_log_login.status IS '状态 0:失败 1:成功 2:账号已锁定';
|
||||
COMMENT ON COLUMN sys_log_login.user_agent IS '用户代理';
|
||||
COMMENT ON COLUMN sys_log_login.ip IS '操作IP';
|
||||
COMMENT ON COLUMN sys_log_login.creator_name IS '用户名';
|
||||
COMMENT ON COLUMN sys_log_login.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_log_login.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_log_operation
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
operation varchar(50),
|
||||
request_uri varchar(200),
|
||||
request_method varchar(20),
|
||||
request_params text,
|
||||
request_time int,
|
||||
user_agent varchar(500),
|
||||
ip varchar(32),
|
||||
status int,
|
||||
creator_name varchar(50),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_operation_create_date on sys_log_operation(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_log_operation IS '操作日志';
|
||||
COMMENT ON COLUMN sys_log_operation.id IS 'id';
|
||||
COMMENT ON COLUMN sys_log_operation.operation IS '用户操作';
|
||||
COMMENT ON COLUMN sys_log_operation.request_uri IS '请求URI';
|
||||
COMMENT ON COLUMN sys_log_operation.request_method IS '请求方式';
|
||||
COMMENT ON COLUMN sys_log_operation.request_params IS '请求参数';
|
||||
COMMENT ON COLUMN sys_log_operation.request_time IS '请求时长(毫秒)';
|
||||
COMMENT ON COLUMN sys_log_operation.user_agent IS '用户代理';
|
||||
COMMENT ON COLUMN sys_log_operation.ip IS '操作IP';
|
||||
COMMENT ON COLUMN sys_log_operation.status IS '状态 0:失败 1:成功';
|
||||
COMMENT ON COLUMN sys_log_operation.creator_name IS '用户名';
|
||||
COMMENT ON COLUMN sys_log_operation.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_log_operation.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_log_error
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
request_uri varchar(200),
|
||||
request_method varchar(20),
|
||||
request_params text,
|
||||
user_agent varchar(500),
|
||||
ip varchar(32),
|
||||
error_info text,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_error_create_date on sys_log_error(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_log_error IS '异常日志';
|
||||
COMMENT ON COLUMN sys_log_error.id IS 'id';
|
||||
COMMENT ON COLUMN sys_log_error.request_uri IS '请求URI';
|
||||
COMMENT ON COLUMN sys_log_error.request_method IS '请求方式';
|
||||
COMMENT ON COLUMN sys_log_error.request_params IS '请求参数';
|
||||
COMMENT ON COLUMN sys_log_error.user_agent IS '用户代理';
|
||||
COMMENT ON COLUMN sys_log_error.ip IS '操作IP';
|
||||
COMMENT ON COLUMN sys_log_error.error_info IS '异常信息';
|
||||
COMMENT ON COLUMN sys_log_error.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_log_error.create_date IS '创建时间';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE sys_oss (
|
||||
id bigint NOT NULL,
|
||||
url varchar(200),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_oss_create_date on sys_oss(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_oss IS '文件上传';
|
||||
COMMENT ON COLUMN sys_oss.id IS 'id';
|
||||
COMMENT ON COLUMN sys_oss.url IS 'URL地址';
|
||||
COMMENT ON COLUMN sys_oss.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_oss.create_date IS '创建时间';
|
||||
|
||||
|
||||
CREATE TABLE schedule_job (
|
||||
id bigint NOT NULL,
|
||||
bean_name varchar(200),
|
||||
params varchar(2000),
|
||||
cron_expression varchar(100),
|
||||
status int,
|
||||
remark varchar(255),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_schedule_job_create_date on schedule_job(create_date);
|
||||
|
||||
COMMENT ON TABLE schedule_job IS '定时任务';
|
||||
COMMENT ON COLUMN schedule_job.id IS 'id';
|
||||
COMMENT ON COLUMN schedule_job.bean_name IS 'spring bean名称';
|
||||
COMMENT ON COLUMN schedule_job.params IS '参数';
|
||||
COMMENT ON COLUMN schedule_job.cron_expression IS 'cron表达式';
|
||||
COMMENT ON COLUMN schedule_job.status IS '任务状态 0:暂停 1:正常';
|
||||
COMMENT ON COLUMN schedule_job.remark IS '备注';
|
||||
COMMENT ON COLUMN schedule_job.creator IS '创建者';
|
||||
COMMENT ON COLUMN schedule_job.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN schedule_job.updater IS '更新者';
|
||||
COMMENT ON COLUMN schedule_job.update_date IS '更新时间';
|
||||
|
||||
|
||||
CREATE TABLE schedule_job_log (
|
||||
id bigint NOT NULL,
|
||||
job_id bigint NOT NULL,
|
||||
bean_name varchar(200),
|
||||
params varchar(2000),
|
||||
status int,
|
||||
error varchar(2000),
|
||||
times int,
|
||||
create_date datetime,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_job_log_job_id on schedule_job_log(job_id);
|
||||
CREATE INDEX idx_job_log_create_date on schedule_job_log(create_date);
|
||||
|
||||
COMMENT ON TABLE schedule_job_log IS '定时任务日志';
|
||||
COMMENT ON COLUMN schedule_job_log.id IS 'id';
|
||||
COMMENT ON COLUMN schedule_job_log.bean_name IS 'spring bean名称';
|
||||
COMMENT ON COLUMN schedule_job_log.params IS '参数';
|
||||
COMMENT ON COLUMN schedule_job_log.status IS '任务状态 0:失败 1:成功';
|
||||
COMMENT ON COLUMN schedule_job_log.error IS '失败信息';
|
||||
COMMENT ON COLUMN schedule_job_log.times IS '耗时(单位:毫秒)';
|
||||
COMMENT ON COLUMN schedule_job.create_date IS '创建时间';
|
||||
|
||||
|
||||
CREATE TABLE sys_user_token (
|
||||
id bigint NOT NULL,
|
||||
user_id bigint,
|
||||
token varchar(100),
|
||||
expire_date datetime,
|
||||
update_date datetime,
|
||||
create_date datetime,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uk_sys_user_token_user_id on sys_user_token(user_id);
|
||||
CREATE UNIQUE INDEX uk_sys_user_token on sys_user_token(token);
|
||||
|
||||
COMMENT ON TABLE sys_user_token IS '系统用户Token';
|
||||
COMMENT ON COLUMN sys_user_token.id IS 'id';
|
||||
COMMENT ON COLUMN sys_user_token.user_id IS '用户id';
|
||||
COMMENT ON COLUMN sys_user_token.token IS '用户token';
|
||||
COMMENT ON COLUMN sys_user_token.expire_date IS '过期时间';
|
||||
COMMENT ON COLUMN sys_user_token.update_date IS '更新时间';
|
||||
COMMENT ON COLUMN sys_user_token.create_date IS '创建时间';
|
||||
|
||||
|
||||
|
||||
-- 初始数据
|
||||
INSERT INTO sys_user(id, username, password, real_name, gender, email, mobile, status, dept_id, super_admin, creator, create_date, updater, update_date) VALUES (1067246875800000001, 'admin', '$2a$10$012Kx2ba5jzqr9gLlG4MX.bnQJTD9UWqF57XDo2N3.fPtLne02u/m', '管理员', 0, 'root@weather.io', '13612345678', 1, null, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000002, 0, '权限管理', NULL, NULL, 0, 'icon-safetycertificate', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000003, 1067246875800000055, '新增', NULL, 'sys:user:save,sys:dept:list,sys:role:list', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000004, 1067246875800000055, '修改', NULL, 'sys:user:update,sys:dept:list,sys:role:list', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000005, 1067246875800000055, '删除', NULL, 'sys:user:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000006, 1067246875800000055, '导出', NULL, 'sys:user:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000007, 1067246875800000002, '角色管理', 'sys/role', NULL, 0, 'icon-team', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000008, 1067246875800000007, '查看', NULL, 'sys:role:page,sys:role:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000009, 1067246875800000007, '新增', NULL, 'sys:role:save,sys:menu:select,sys:dept:list', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000010, 1067246875800000007, '修改', NULL, 'sys:role:update,sys:menu:select,sys:dept:list', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000011, 1067246875800000007, '删除', NULL, 'sys:role:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000012, 1067246875800000002, '部门管理', 'sys/dept', NULL, 0, 'icon-apartment', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000014, 1067246875800000012, '查看', NULL, 'sys:dept:list,sys:dept:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000015, 1067246875800000012, '新增', NULL, 'sys:dept:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000016, 1067246875800000012, '修改', NULL, 'sys:dept:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000017, 1067246875800000012, '删除', NULL, 'sys:dept:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000025, 1067246875800000035, '菜单管理', 'sys/menu', NULL, 0, 'icon-unorderedlist', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000026, 1067246875800000025, '查看', NULL, 'sys:menu:list,sys:menu:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000027, 1067246875800000025, '新增', NULL, 'sys:menu:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000028, 1067246875800000025, '修改', NULL, 'sys:menu:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000029, 1067246875800000025, '删除', NULL, 'sys:menu:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000030, 1067246875800000035, '定时任务', 'job/schedule', NULL, 0, 'icon-dashboard', 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000031, 1067246875800000030, '查看', NULL, 'sys:schedule:page,sys:schedule:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000032, 1067246875800000030, '新增', NULL, 'sys:schedule:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000033, 1067246875800000030, '修改', NULL, 'sys:schedule:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000034, 1067246875800000030, '删除', NULL, 'sys:schedule:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000035, 0, '系统设置', NULL, NULL, 0, 'icon-setting', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000036, 1067246875800000030, '暂停', NULL, 'sys:schedule:pause', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000037, 1067246875800000030, '恢复', NULL, 'sys:schedule:resume', 1, NULL, 5, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000038, 1067246875800000030, '立即执行', NULL, 'sys:schedule:run', 1, NULL, 6, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000039, 1067246875800000030, '日志列表', NULL, 'sys:schedule:log', 1, NULL, 7, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000040, 1067246875800000035, '参数管理', 'sys/params', '', 0, 'icon-fileprotect', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000041, 1067246875800000035, '字典管理', 'sys/dict-type', NULL, 0, 'icon-golden-fill', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000042, 1067246875800000041, '查看', NULL, 'sys:dict:page,sys:dict:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000043, 1067246875800000041, '新增', NULL, 'sys:dict:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000044, 1067246875800000041, '修改', NULL, 'sys:dict:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000045, 1067246875800000041, '删除', NULL, 'sys:dict:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000046, 0, '日志管理', NULL, NULL, 0, 'icon-container', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000047, 1067246875800000035, '文件上传', 'oss/oss', 'sys:oss:all', 0, 'icon-upload', 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000048, 1067246875800000046, '登录日志', 'sys/log-login', 'sys:log:login', 0, 'icon-filedone', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000049, 1067246875800000046, '操作日志', 'sys/log-operation', 'sys:log:operation', 0, 'icon-solution', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000050, 1067246875800000046, '异常日志', 'sys/log-error', 'sys:log:error', 0, 'icon-file-exception', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000051, 1067246875800000053, 'SQL监控', '{{ApiUrl}}/druid/sql.html', NULL, 0, 'icon-database', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000053, 0, '系统监控', NULL, NULL, 0, 'icon-desktop', 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000055, 1067246875800000002, '用户管理', 'sys/user', NULL, 0, 'icon-user', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000056, 1067246875800000055, '查看', NULL, 'sys:user:page,sys:user:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000057, 1067246875800000040, '新增', NULL, 'sys:params:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000058, 1067246875800000040, '导出', NULL, 'sys:params:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000059, 1067246875800000040, '查看', '', 'sys:params:page,sys:params:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000060, 1067246875800000040, '修改', NULL, 'sys:params:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000061, 1067246875800000040, '删除', '', 'sys:params:delete', 1, '', 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1156748733921165314, 1067246875800000053, '接口文档', '{{ApiUrl}}/doc.html', '', 0, 'icon-file-word', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000062, 1067246875800000063, '1067246875800000066,1067246875800000063', '技术部', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000063, 1067246875800000066, '1067246875800000066', '长沙分公司', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000064, 1067246875800000066, '1067246875800000066', '上海分公司', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000065, 1067246875800000064, '1067246875800000066,1067246875800000064', '市场部', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000066, 0, '0', '人人开源集团', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000067, 1067246875800000064, '1067246875800000066,1067246875800000064', '销售部', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000068, 1067246875800000063, '1067246875800000066,1067246875800000063', '产品部', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1160061077912858625, 'gender', '性别', '', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061112075464705, 1160061077912858625, '男', '0', '', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061146967879681, 1160061077912858625, '女', '1', '', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061190127267841, 1160061077912858625, '保密', '2', '', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1225813644059140097, 'notice_type', '站内通知-类型', '', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814069634195457, 1225813644059140097, '公告', '0', '', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814107559092225, 1225813644059140097, '会议', '1', '', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814271879340034, 1225813644059140097, '其他', '2', '', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO sys_params(id, param_code, param_value, param_type, remark, creator, create_date, updater, update_date) VALUES (1067246875800000073, 'CLOUD_STORAGE_CONFIG_KEY', '{"type":1,"qiniuDomain":"http://test.oss.weather.io","qiniuPrefix":"upload","qiniuAccessKey":"NrgMfABZxWLo5B-YYSjoE8-AZ1EISdi1Z3ubLOeZ","qiniuSecretKey":"uIwJHevMRWU0VLxFvgy0tAcOdGqasdtVlJkdy6vV","qiniuBucketName":"weather-oss","aliyunDomain":"","aliyunPrefix":"","aliyunEndPoint":"","aliyunAccessKeyId":"","aliyunAccessKeySecret":"","aliyunBucketName":"","qcloudDomain":"","qcloudPrefix":"","qcloudSecretId":"","qcloudSecretKey":"","qcloudBucketName":""}', '0', '云存储配置信息', 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO schedule_job (id, bean_name, params, cron_expression, status, remark, creator, create_date, updater, update_date) VALUES (1067246875800000076, 'testTask', 'weather', '0 0/30 * * * ?', 0, '有参测试,多个参数使用json', 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
|
||||
|
||||
|
||||
-- quartz自带表结构
|
||||
DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS;
|
||||
DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE;
|
||||
DROP TABLE IF EXISTS QRTZ_LOCKS;
|
||||
DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_TRIGGERS;
|
||||
DROP TABLE IF EXISTS QRTZ_JOB_DETAILS;
|
||||
DROP TABLE IF EXISTS QRTZ_CALENDARS;
|
||||
|
||||
create table QRTZ_JOB_DETAILS (
|
||||
sched_name varchar(120) not null,
|
||||
job_name varchar(200) not null,
|
||||
job_group varchar(200) not null,
|
||||
description varchar(250) null,
|
||||
job_class_name varchar(250) not null,
|
||||
is_durable varchar(1) not null,
|
||||
is_nonconcurrent varchar(1) not null,
|
||||
is_update_data varchar(1) not null,
|
||||
requests_recovery varchar(1) not null,
|
||||
job_data blob null,
|
||||
primary key (sched_name, job_name, job_group)
|
||||
);
|
||||
|
||||
create table QRTZ_TRIGGERS (
|
||||
sched_name varchar(120) not null,
|
||||
trigger_name varchar(200) not null,
|
||||
trigger_group varchar(200) not null,
|
||||
job_name varchar(200) not null,
|
||||
job_group varchar(200) not null,
|
||||
description varchar(250) null,
|
||||
next_fire_time bigint null,
|
||||
prev_fire_time bigint null,
|
||||
priority int null,
|
||||
trigger_state varchar(16) not null,
|
||||
trigger_type varchar(8) not null,
|
||||
start_time bigint not null,
|
||||
end_time bigint null,
|
||||
calendar_name varchar(200) null,
|
||||
misfire_instr int null,
|
||||
job_data blob null,
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, job_name, job_group)
|
||||
references QRTZ_JOB_DETAILS(sched_name, job_name, job_group)
|
||||
);
|
||||
|
||||
create table QRTZ_SIMPLE_TRIGGERS (
|
||||
sched_name varchar(120) not null,
|
||||
trigger_name varchar(200) not null,
|
||||
trigger_group varchar(200) not null,
|
||||
repeat_count bigint not null,
|
||||
repeat_interval bigint not null,
|
||||
times_triggered bigint not null,
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, trigger_name, trigger_group)
|
||||
references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
||||
);
|
||||
|
||||
create table QRTZ_CRON_TRIGGERS (
|
||||
sched_name varchar(120) not null,
|
||||
trigger_name varchar(200) not null,
|
||||
trigger_group varchar(200) not null,
|
||||
cron_expression varchar(200) not null,
|
||||
time_zone_id varchar(80),
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, trigger_name, trigger_group)
|
||||
references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
||||
);
|
||||
|
||||
create table QRTZ_BLOB_TRIGGERS (
|
||||
sched_name varchar(120) not null,
|
||||
trigger_name varchar(200) not null,
|
||||
trigger_group varchar(200) not null,
|
||||
blob_data blob null,
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, trigger_name, trigger_group)
|
||||
references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
||||
);
|
||||
|
||||
create table QRTZ_CALENDARS (
|
||||
sched_name varchar(120) not null,
|
||||
calendar_name varchar(200) not null,
|
||||
calendar blob not null,
|
||||
primary key (sched_name, calendar_name)
|
||||
);
|
||||
|
||||
create table QRTZ_PAUSED_TRIGGER_GRPS (
|
||||
sched_name varchar(120) not null,
|
||||
trigger_group varchar(200) not null,
|
||||
primary key (sched_name, trigger_group)
|
||||
);
|
||||
|
||||
create table QRTZ_FIRED_TRIGGERS (
|
||||
sched_name varchar(120) not null,
|
||||
entry_id varchar(95) not null,
|
||||
trigger_name varchar(200) not null,
|
||||
trigger_group varchar(200) not null,
|
||||
instance_name varchar(200) not null,
|
||||
fired_time bigint not null,
|
||||
sched_time bigint not null,
|
||||
priority int not null,
|
||||
state varchar(16) not null,
|
||||
job_name varchar(200) null,
|
||||
job_group varchar(200) null,
|
||||
is_nonconcurrent varchar(1) null,
|
||||
requests_recovery varchar(1) null,
|
||||
primary key (sched_name, entry_id)
|
||||
);
|
||||
|
||||
create table QRTZ_SCHEDULER_STATE (
|
||||
sched_name varchar(120) not null,
|
||||
instance_name varchar(200) not null,
|
||||
last_checkin_time bigint not null,
|
||||
checkin_interval bigint not null,
|
||||
primary key (sched_name, instance_name)
|
||||
);
|
||||
|
||||
create table QRTZ_LOCKS (
|
||||
sched_name varchar(120) not null,
|
||||
lock_name varchar(40) not null,
|
||||
primary key (sched_name, lock_name)
|
||||
);
|
||||
|
||||
create table QRTZ_SIMPROP_TRIGGERS (
|
||||
sched_name varchar(120) not null,
|
||||
trigger_name varchar(200) not null,
|
||||
trigger_group varchar(200) not null,
|
||||
str_prop_1 varchar(512) null,
|
||||
str_prop_2 varchar(512) null,
|
||||
str_prop_3 varchar(512) null,
|
||||
int_prop_1 int null,
|
||||
int_prop_2 int null,
|
||||
long_prop_1 bigint null,
|
||||
long_prop_2 bigint null,
|
||||
dec_prop_1 numeric(13,4) null,
|
||||
dec_prop_2 numeric(13,4) null,
|
||||
bool_prop_1 varchar(1) null,
|
||||
bool_prop_2 varchar(1) null,
|
||||
primary key (sched_name, trigger_name, trigger_group),
|
||||
foreign key (sched_name, trigger_name, trigger_group)
|
||||
references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group)
|
||||
);
|
||||
504
system-admin/db/mysql.sql
Normal file
504
system-admin/db/mysql.sql
Normal file
@ -0,0 +1,504 @@
|
||||
-- 系统用户
|
||||
CREATE TABLE sys_user (
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
username varchar(50) NOT NULL COMMENT '用户名',
|
||||
password varchar(100) COMMENT '密码',
|
||||
real_name varchar(50) COMMENT '姓名',
|
||||
head_url varchar(200) COMMENT '头像',
|
||||
gender tinyint unsigned COMMENT '性别 0:男 1:女 2:保密',
|
||||
email varchar(100) COMMENT '邮箱',
|
||||
mobile varchar(100) COMMENT '手机号',
|
||||
dept_id bigint COMMENT '部门ID',
|
||||
super_admin tinyint unsigned COMMENT '超级管理员 0:否 1:是',
|
||||
status tinyint COMMENT '状态 0:停用 1:正常',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
updater bigint COMMENT '更新者',
|
||||
update_date datetime COMMENT '更新时间',
|
||||
primary key (id),
|
||||
unique key uk_username (username),
|
||||
key idx_create_date (create_date)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统用户';
|
||||
|
||||
-- 部门
|
||||
CREATE TABLE sys_dept (
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
pid bigint COMMENT '上级ID',
|
||||
pids varchar(500) COMMENT '所有上级ID,用逗号分开',
|
||||
name varchar(50) COMMENT '部门名称',
|
||||
sort int unsigned COMMENT '排序',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
updater bigint COMMENT '更新者',
|
||||
update_date datetime COMMENT '更新时间',
|
||||
primary key (id),
|
||||
key idx_pid (pid),
|
||||
key idx_sort (sort)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='部门管理';
|
||||
|
||||
-- 角色管理
|
||||
create table sys_role
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
name varchar(50) COMMENT '角色名称',
|
||||
remark varchar(100) COMMENT '备注',
|
||||
dept_id bigint COMMENT '部门ID',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
updater bigint COMMENT '更新者',
|
||||
update_date datetime COMMENT '更新时间',
|
||||
primary key (id),
|
||||
key idx_dept_id (dept_id)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='角色管理';
|
||||
|
||||
-- 菜单管理
|
||||
create table sys_menu
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
pid bigint COMMENT '上级ID,一级菜单为0',
|
||||
name varchar(200) COMMENT '名称',
|
||||
url varchar(200) COMMENT '菜单URL',
|
||||
permissions varchar(500) COMMENT '授权(多个用逗号分隔,如:sys:user:list,sys:user:save)',
|
||||
menu_type tinyint unsigned COMMENT '类型 0:菜单 1:按钮',
|
||||
icon varchar(50) COMMENT '菜单图标',
|
||||
sort int COMMENT '排序',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
updater bigint COMMENT '更新者',
|
||||
update_date datetime COMMENT '更新时间',
|
||||
primary key (id),
|
||||
key idx_pid (pid),
|
||||
key idx_sort (sort)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='菜单管理';
|
||||
|
||||
-- 角色用户关系
|
||||
create table sys_role_user
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
role_id bigint COMMENT '角色ID',
|
||||
user_id bigint COMMENT '用户ID',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
primary key (id),
|
||||
key idx_role_id (role_id),
|
||||
key idx_user_id (user_id)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='角色用户关系';
|
||||
|
||||
-- 角色菜单关系
|
||||
create table sys_role_menu
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
role_id bigint COMMENT '角色ID',
|
||||
menu_id bigint COMMENT '菜单ID',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
primary key (id),
|
||||
key idx_role_id (role_id),
|
||||
key idx_menu_id (menu_id)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='角色菜单关系';
|
||||
|
||||
-- 角色数据权限
|
||||
create table sys_role_data_scope
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
role_id bigint COMMENT '角色ID',
|
||||
dept_id bigint COMMENT '部门ID',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
primary key (id),
|
||||
key idx_role_id (role_id)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='角色数据权限';
|
||||
|
||||
-- 参数管理
|
||||
create table sys_params
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
param_code varchar(32) COMMENT '参数编码',
|
||||
param_value varchar(2000) COMMENT '参数值',
|
||||
param_type tinyint unsigned default 1 COMMENT '类型 0:系统参数 1:非系统参数',
|
||||
remark varchar(200) COMMENT '备注',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
updater bigint COMMENT '更新者',
|
||||
update_date datetime COMMENT '更新时间',
|
||||
primary key (id),
|
||||
unique key uk_param_code (param_code),
|
||||
key idx_create_date (create_date)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='参数管理';
|
||||
|
||||
-- 字典类型
|
||||
create table sys_dict_type
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
dict_type varchar(100) NOT NULL COMMENT '字典类型',
|
||||
dict_name varchar(255) NOT NULL COMMENT '字典名称',
|
||||
remark varchar(255) COMMENT '备注',
|
||||
sort int unsigned COMMENT '排序',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
updater bigint COMMENT '更新者',
|
||||
update_date datetime COMMENT '更新时间',
|
||||
primary key (id),
|
||||
UNIQUE KEY(dict_type)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='字典类型';
|
||||
|
||||
-- 字典数据
|
||||
create table sys_dict_data
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
dict_type_id bigint NOT NULL COMMENT '字典类型ID',
|
||||
dict_label varchar(255) NOT NULL COMMENT '字典标签',
|
||||
dict_value varchar(255) COMMENT '字典值',
|
||||
remark varchar(255) COMMENT '备注',
|
||||
sort int unsigned COMMENT '排序',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
updater bigint COMMENT '更新者',
|
||||
update_date datetime COMMENT '更新时间',
|
||||
primary key (id),
|
||||
unique key uk_dict_type_value (dict_type_id, dict_value),
|
||||
key idx_sort (sort)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='字典数据';
|
||||
|
||||
-- 登录日志
|
||||
create table sys_log_login
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
operation tinyint unsigned COMMENT '用户操作 0:用户登录 1:用户退出',
|
||||
status tinyint unsigned NOT NULL COMMENT '状态 0:失败 1:成功 2:账号已锁定',
|
||||
user_agent varchar(500) COMMENT '用户代理',
|
||||
ip varchar(32) COMMENT '操作IP',
|
||||
creator_name varchar(50) COMMENT '用户名',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
primary key (id),
|
||||
key idx_status (status),
|
||||
key idx_create_date (create_date)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='登录日志';
|
||||
|
||||
-- 操作日志
|
||||
create table sys_log_operation
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
operation varchar(50) COMMENT '用户操作',
|
||||
request_uri varchar(200) COMMENT '请求URI',
|
||||
request_method varchar(20) COMMENT '请求方式',
|
||||
request_params text COMMENT '请求参数',
|
||||
request_time int unsigned NOT NULL COMMENT '请求时长(毫秒)',
|
||||
user_agent varchar(500) COMMENT '用户代理',
|
||||
ip varchar(32) COMMENT '操作IP',
|
||||
status tinyint unsigned NOT NULL COMMENT '状态 0:失败 1:成功',
|
||||
creator_name varchar(50) COMMENT '用户名',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
primary key (id),
|
||||
key idx_create_date (create_date)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='操作日志';
|
||||
|
||||
-- 异常日志
|
||||
create table sys_log_error
|
||||
(
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
request_uri varchar(200) COMMENT '请求URI',
|
||||
request_method varchar(20) COMMENT '请求方式',
|
||||
request_params text COMMENT '请求参数',
|
||||
user_agent varchar(500) COMMENT '用户代理',
|
||||
ip varchar(32) COMMENT '操作IP',
|
||||
error_info text COMMENT '异常信息',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
primary key (id),
|
||||
key idx_create_date (create_date)
|
||||
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='异常日志';
|
||||
|
||||
|
||||
-- 文件上传
|
||||
CREATE TABLE sys_oss (
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
url varchar(200) COMMENT 'URL地址',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
PRIMARY KEY (id),
|
||||
key idx_create_date (create_date)
|
||||
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT='文件上传';
|
||||
|
||||
-- 定时任务
|
||||
CREATE TABLE schedule_job (
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
bean_name varchar(200) DEFAULT NULL COMMENT 'spring bean名称',
|
||||
params varchar(2000) DEFAULT NULL COMMENT '参数',
|
||||
cron_expression varchar(100) DEFAULT NULL COMMENT 'cron表达式',
|
||||
status tinyint unsigned COMMENT '任务状态 0:暂停 1:正常',
|
||||
remark varchar(255) DEFAULT NULL COMMENT '备注',
|
||||
creator bigint COMMENT '创建者',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
updater bigint COMMENT '更新者',
|
||||
update_date datetime COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
key idx_create_date (create_date)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='定时任务';
|
||||
|
||||
-- 定时任务日志
|
||||
CREATE TABLE schedule_job_log (
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
job_id bigint NOT NULL COMMENT '任务id',
|
||||
bean_name varchar(200) DEFAULT NULL COMMENT 'spring bean名称',
|
||||
params varchar(2000) DEFAULT NULL COMMENT '参数',
|
||||
status tinyint unsigned NOT NULL COMMENT '任务状态 0:失败 1:成功',
|
||||
error varchar(2000) DEFAULT NULL COMMENT '失败信息',
|
||||
times int NOT NULL COMMENT '耗时(单位:毫秒)',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
PRIMARY KEY (id),
|
||||
key idx_job_id (job_id),
|
||||
key idx_create_date (create_date)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='定时任务日志';
|
||||
|
||||
-- 系统用户Token
|
||||
CREATE TABLE sys_user_token (
|
||||
id bigint NOT NULL COMMENT 'id',
|
||||
user_id bigint NOT NULL COMMENT '用户id',
|
||||
token varchar(100) NOT NULL COMMENT '用户token',
|
||||
expire_date datetime COMMENT '过期时间',
|
||||
update_date datetime COMMENT '更新时间',
|
||||
create_date datetime COMMENT '创建时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY user_id (user_id),
|
||||
UNIQUE KEY token (token)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统用户Token';
|
||||
|
||||
-- 初始数据
|
||||
INSERT INTO sys_user(id, username, password, real_name, gender, email, mobile, status, dept_id, super_admin, creator, create_date, updater, update_date) VALUES (1067246875800000001, 'admin', '$2a$10$012Kx2ba5jzqr9gLlG4MX.bnQJTD9UWqF57XDo2N3.fPtLne02u/m', '管理员', 0, 'root@weather.io', '13612345678', 1, null, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000002, 0, '权限管理', NULL, NULL, 0, 'icon-safetycertificate', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000003, 1067246875800000055, '新增', NULL, 'sys:user:save,sys:dept:list,sys:role:list', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000004, 1067246875800000055, '修改', NULL, 'sys:user:update,sys:dept:list,sys:role:list', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000005, 1067246875800000055, '删除', NULL, 'sys:user:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000006, 1067246875800000055, '导出', NULL, 'sys:user:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000007, 1067246875800000002, '角色管理', 'sys/role', NULL, 0, 'icon-team', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000008, 1067246875800000007, '查看', NULL, 'sys:role:page,sys:role:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000009, 1067246875800000007, '新增', NULL, 'sys:role:save,sys:menu:select,sys:dept:list', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000010, 1067246875800000007, '修改', NULL, 'sys:role:update,sys:menu:select,sys:dept:list', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000011, 1067246875800000007, '删除', NULL, 'sys:role:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000012, 1067246875800000002, '部门管理', 'sys/dept', NULL, 0, 'icon-apartment', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000014, 1067246875800000012, '查看', NULL, 'sys:dept:list,sys:dept:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000015, 1067246875800000012, '新增', NULL, 'sys:dept:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000016, 1067246875800000012, '修改', NULL, 'sys:dept:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000017, 1067246875800000012, '删除', NULL, 'sys:dept:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000025, 1067246875800000035, '菜单管理', 'sys/menu', NULL, 0, 'icon-unorderedlist', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000026, 1067246875800000025, '查看', NULL, 'sys:menu:list,sys:menu:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000027, 1067246875800000025, '新增', NULL, 'sys:menu:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000028, 1067246875800000025, '修改', NULL, 'sys:menu:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000029, 1067246875800000025, '删除', NULL, 'sys:menu:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000030, 1067246875800000035, '定时任务', 'job/schedule', NULL, 0, 'icon-dashboard', 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000031, 1067246875800000030, '查看', NULL, 'sys:schedule:page,sys:schedule:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000032, 1067246875800000030, '新增', NULL, 'sys:schedule:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000033, 1067246875800000030, '修改', NULL, 'sys:schedule:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000034, 1067246875800000030, '删除', NULL, 'sys:schedule:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000035, 0, '系统设置', NULL, NULL, 0, 'icon-setting', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000036, 1067246875800000030, '暂停', NULL, 'sys:schedule:pause', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000037, 1067246875800000030, '恢复', NULL, 'sys:schedule:resume', 1, NULL, 5, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000038, 1067246875800000030, '立即执行', NULL, 'sys:schedule:run', 1, NULL, 6, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000039, 1067246875800000030, '日志列表', NULL, 'sys:schedule:log', 1, NULL, 7, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000040, 1067246875800000035, '参数管理', 'sys/params', '', 0, 'icon-fileprotect', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000041, 1067246875800000035, '字典管理', 'sys/dict-type', NULL, 0, 'icon-golden-fill', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000042, 1067246875800000041, '查看', NULL, 'sys:dict:page,sys:dict:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000043, 1067246875800000041, '新增', NULL, 'sys:dict:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000044, 1067246875800000041, '修改', NULL, 'sys:dict:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000045, 1067246875800000041, '删除', NULL, 'sys:dict:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000046, 0, '日志管理', NULL, NULL, 0, 'icon-container', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000047, 1067246875800000035, '文件上传', 'oss/oss', 'sys:oss:all', 0, 'icon-upload', 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000048, 1067246875800000046, '登录日志', 'sys/log-login', 'sys:log:login', 0, 'icon-filedone', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000049, 1067246875800000046, '操作日志', 'sys/log-operation', 'sys:log:operation', 0, 'icon-solution', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000050, 1067246875800000046, '异常日志', 'sys/log-error', 'sys:log:error', 0, 'icon-file-exception', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000051, 1067246875800000053, 'SQL监控', '{{ApiUrl}}/druid/sql.html', NULL, 0, 'icon-database', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000053, 0, '系统监控', NULL, NULL, 0, 'icon-desktop', 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000055, 1067246875800000002, '用户管理', 'sys/user', NULL, 0, 'icon-user', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000056, 1067246875800000055, '查看', NULL, 'sys:user:page,sys:user:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000057, 1067246875800000040, '新增', NULL, 'sys:params:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000058, 1067246875800000040, '导出', NULL, 'sys:params:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000059, 1067246875800000040, '查看', '', 'sys:params:page,sys:params:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000060, 1067246875800000040, '修改', NULL, 'sys:params:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000061, 1067246875800000040, '删除', '', 'sys:params:delete', 1, '', 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1156748733921165314, 1067246875800000053, '接口文档', '{{ApiUrl}}/doc.html', '', 0, 'icon-file-word', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000062, 1067246875800000063, '1067246875800000066,1067246875800000063', '技术部', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000063, 1067246875800000066, '1067246875800000066', '长沙分公司', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000064, 1067246875800000066, '1067246875800000066', '上海分公司', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000065, 1067246875800000064, '1067246875800000066,1067246875800000064', '市场部', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000066, 0, '0', '人人开源集团', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000067, 1067246875800000064, '1067246875800000066,1067246875800000064', '销售部', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000068, 1067246875800000063, '1067246875800000066,1067246875800000063', '产品部', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1160061077912858625, 'gender', '性别', '', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061112075464705, 1160061077912858625, '男', '0', '', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061146967879681, 1160061077912858625, '女', '1', '', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061190127267841, 1160061077912858625, '保密', '2', '', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1225813644059140097, 'notice_type', '站内通知-类型', '', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814069634195457, 1225813644059140097, '公告', '0', '', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814107559092225, 1225813644059140097, '会议', '1', '', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814271879340034, 1225813644059140097, '其他', '2', '', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO sys_params(id, param_code, param_value, param_type, remark, creator, create_date, updater, update_date) VALUES (1067246875800000073, 'CLOUD_STORAGE_CONFIG_KEY', '{"type":1,"qiniuDomain":"http://test.oss.weather.io","qiniuPrefix":"upload","qiniuAccessKey":"NrgMfABZxWLo5B-YYSjoE8-AZ1EISdi1Z3ubLOeZ","qiniuSecretKey":"uIwJHevMRWU0VLxFvgy0tAcOdGqasdtVlJkdy6vV","qiniuBucketName":"weather-oss","aliyunDomain":"","aliyunPrefix":"","aliyunEndPoint":"","aliyunAccessKeyId":"","aliyunAccessKeySecret":"","aliyunBucketName":"","qcloudDomain":"","qcloudPrefix":"","qcloudSecretId":"","qcloudSecretKey":"","qcloudBucketName":""}', '0', '云存储配置信息', 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO schedule_job (id, bean_name, params, cron_expression, status, remark, creator, create_date, updater, update_date) VALUES (1067246875800000076, 'testTask', 'weather', '0 0/30 * * * ?', 0, '有参测试,多个参数使用json', 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
|
||||
-- quartz自带表结构
|
||||
CREATE TABLE QRTZ_JOB_DETAILS(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
JOB_NAME VARCHAR(200) NOT NULL,
|
||||
JOB_GROUP VARCHAR(200) NOT NULL,
|
||||
DESCRIPTION VARCHAR(250) NULL,
|
||||
JOB_CLASS_NAME VARCHAR(250) NOT NULL,
|
||||
IS_DURABLE VARCHAR(1) NOT NULL,
|
||||
IS_NONCONCURRENT VARCHAR(1) NOT NULL,
|
||||
IS_UPDATE_DATA VARCHAR(1) NOT NULL,
|
||||
REQUESTS_RECOVERY VARCHAR(1) NOT NULL,
|
||||
JOB_DATA BLOB NULL,
|
||||
PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_TRIGGERS (
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
JOB_NAME VARCHAR(200) NOT NULL,
|
||||
JOB_GROUP VARCHAR(200) NOT NULL,
|
||||
DESCRIPTION VARCHAR(250) NULL,
|
||||
NEXT_FIRE_TIME BIGINT(13) NULL,
|
||||
PREV_FIRE_TIME BIGINT(13) NULL,
|
||||
PRIORITY INTEGER NULL,
|
||||
TRIGGER_STATE VARCHAR(16) NOT NULL,
|
||||
TRIGGER_TYPE VARCHAR(8) NOT NULL,
|
||||
START_TIME BIGINT(13) NOT NULL,
|
||||
END_TIME BIGINT(13) NULL,
|
||||
CALENDAR_NAME VARCHAR(200) NULL,
|
||||
MISFIRE_INSTR SMALLINT(2) NULL,
|
||||
JOB_DATA BLOB NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
|
||||
REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_SIMPLE_TRIGGERS (
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
REPEAT_COUNT BIGINT(7) NOT NULL,
|
||||
REPEAT_INTERVAL BIGINT(12) NOT NULL,
|
||||
TIMES_TRIGGERED BIGINT(10) NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_CRON_TRIGGERS (
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
CRON_EXPRESSION VARCHAR(120) NOT NULL,
|
||||
TIME_ZONE_ID VARCHAR(80),
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_SIMPROP_TRIGGERS
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
STR_PROP_1 VARCHAR(512) NULL,
|
||||
STR_PROP_2 VARCHAR(512) NULL,
|
||||
STR_PROP_3 VARCHAR(512) NULL,
|
||||
INT_PROP_1 INT NULL,
|
||||
INT_PROP_2 INT NULL,
|
||||
LONG_PROP_1 BIGINT NULL,
|
||||
LONG_PROP_2 BIGINT NULL,
|
||||
DEC_PROP_1 NUMERIC(13,4) NULL,
|
||||
DEC_PROP_2 NUMERIC(13,4) NULL,
|
||||
BOOL_PROP_1 VARCHAR(1) NULL,
|
||||
BOOL_PROP_2 VARCHAR(1) NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_BLOB_TRIGGERS (
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
BLOB_DATA BLOB NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
INDEX (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_CALENDARS (
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
CALENDAR_NAME VARCHAR(200) NOT NULL,
|
||||
CALENDAR BLOB NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,CALENDAR_NAME))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS (
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_FIRED_TRIGGERS (
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
ENTRY_ID VARCHAR(95) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
INSTANCE_NAME VARCHAR(200) NOT NULL,
|
||||
FIRED_TIME BIGINT(13) NOT NULL,
|
||||
SCHED_TIME BIGINT(13) NOT NULL,
|
||||
PRIORITY INTEGER NOT NULL,
|
||||
STATE VARCHAR(16) NOT NULL,
|
||||
JOB_NAME VARCHAR(200) NULL,
|
||||
JOB_GROUP VARCHAR(200) NULL,
|
||||
IS_NONCONCURRENT VARCHAR(1) NULL,
|
||||
REQUESTS_RECOVERY VARCHAR(1) NULL,
|
||||
PRIMARY KEY (SCHED_NAME,ENTRY_ID))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_SCHEDULER_STATE (
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
INSTANCE_NAME VARCHAR(200) NOT NULL,
|
||||
LAST_CHECKIN_TIME BIGINT(13) NOT NULL,
|
||||
CHECKIN_INTERVAL BIGINT(13) NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,INSTANCE_NAME))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE QRTZ_LOCKS (
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
LOCK_NAME VARCHAR(40) NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,LOCK_NAME))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY);
|
||||
CREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS(SCHED_NAME,JOB_GROUP);
|
||||
|
||||
CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP);
|
||||
CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP);
|
||||
CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME);
|
||||
CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);
|
||||
CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE);
|
||||
CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE);
|
||||
CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE);
|
||||
CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME);
|
||||
CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME);
|
||||
CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME);
|
||||
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE);
|
||||
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);
|
||||
|
||||
CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME);
|
||||
CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY);
|
||||
CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP);
|
||||
CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP);
|
||||
CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
|
||||
CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);
|
||||
684
system-admin/db/oracle.sql
Normal file
684
system-admin/db/oracle.sql
Normal file
@ -0,0 +1,684 @@
|
||||
CREATE TABLE sys_user (
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
username varchar2(50) NOT NULL,
|
||||
password varchar2(100),
|
||||
real_name varchar2(50),
|
||||
head_url varchar2(200),
|
||||
gender NUMBER(2, 0),
|
||||
email varchar2(100),
|
||||
mobile varchar2(100),
|
||||
dept_id NUMBER(20, 0),
|
||||
super_admin NUMBER(2, 0),
|
||||
status NUMBER(2, 0),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
updater NUMBER(20, 0),
|
||||
update_date date,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uk_sys_user_username on sys_user(username);
|
||||
CREATE INDEX idx_sys_user_create_date on sys_user(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_user IS '用户管理';
|
||||
COMMENT ON COLUMN sys_user.id IS 'id';
|
||||
COMMENT ON COLUMN sys_user.username IS '用户名';
|
||||
COMMENT ON COLUMN sys_user.password IS '密码';
|
||||
COMMENT ON COLUMN sys_user.real_name IS '姓名';
|
||||
COMMENT ON COLUMN sys_user.head_url IS '头像';
|
||||
COMMENT ON COLUMN sys_user.gender IS '性别 0:男 1:女 2:保密';
|
||||
COMMENT ON COLUMN sys_user.email IS '邮箱';
|
||||
COMMENT ON COLUMN sys_user.mobile IS '手机号';
|
||||
COMMENT ON COLUMN sys_user.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN sys_user.super_admin IS '超级管理员 0:否 1:是';
|
||||
COMMENT ON COLUMN sys_user.status IS '状态 0:停用 1:正常';
|
||||
COMMENT ON COLUMN sys_user.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_user.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_user.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_user.update_date IS '更新时间';
|
||||
|
||||
|
||||
CREATE TABLE sys_dept (
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
pid NUMBER(20, 0),
|
||||
pids varchar2(500),
|
||||
name varchar2(50),
|
||||
sort NUMBER(10, 0),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
updater NUMBER(20, 0),
|
||||
update_date date,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_dept_pid on sys_dept(pid);
|
||||
CREATE INDEX idx_sys_dept_idx_sort on sys_dept(sort);
|
||||
|
||||
COMMENT ON TABLE sys_dept IS '部门管理';
|
||||
COMMENT ON COLUMN sys_dept.id IS 'id';
|
||||
COMMENT ON COLUMN sys_dept.pid IS '上级ID';
|
||||
COMMENT ON COLUMN sys_dept.pids IS '所有上级ID,用逗号分开';
|
||||
COMMENT ON COLUMN sys_dept.name IS '部门名称';
|
||||
COMMENT ON COLUMN sys_dept.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_dept.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_dept.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_dept.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_dept.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_role
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
name varchar2(32),
|
||||
remark varchar2(100),
|
||||
dept_id NUMBER(20, 0),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
updater NUMBER(20, 0),
|
||||
update_date date,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_dept_id on sys_role(dept_id);
|
||||
|
||||
COMMENT ON TABLE sys_role IS '角色管理';
|
||||
COMMENT ON COLUMN sys_role.id IS 'id';
|
||||
COMMENT ON COLUMN sys_role.name IS '角色名称';
|
||||
COMMENT ON COLUMN sys_role.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_role.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN sys_role.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_role.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_role.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_menu
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
pid NUMBER(20, 0),
|
||||
name varchar2(200),
|
||||
url varchar2(200),
|
||||
permissions varchar2(500),
|
||||
menu_type NUMBER(2, 0),
|
||||
icon varchar2(50),
|
||||
sort NUMBER(10, 0),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
updater NUMBER(20, 0),
|
||||
update_date date,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_menu_pid on sys_menu(pid);
|
||||
CREATE INDEX idx_sys_menu_sort on sys_menu(sort);
|
||||
|
||||
COMMENT ON TABLE sys_menu IS '菜单管理';
|
||||
COMMENT ON COLUMN sys_menu.id IS 'id';
|
||||
COMMENT ON COLUMN sys_menu.pid IS '上级ID,一级菜单为0';
|
||||
COMMENT ON COLUMN sys_menu.name IS '名称';
|
||||
COMMENT ON COLUMN sys_menu.url IS '菜单URL';
|
||||
COMMENT ON COLUMN sys_menu.permissions IS '授权(多个用逗号分隔,如:sys:user:list,sys:user:save)';
|
||||
COMMENT ON COLUMN sys_menu.menu_type IS '类型 0:菜单 1:按钮';
|
||||
COMMENT ON COLUMN sys_menu.icon IS '菜单图标';
|
||||
COMMENT ON COLUMN sys_menu.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_menu.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_menu.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_menu.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_menu.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_role_user
|
||||
(
|
||||
id varchar2(32) NOT NULL,
|
||||
role_id varchar2(32),
|
||||
user_id varchar2(32),
|
||||
creator varchar2(32),
|
||||
create_date date,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_user_role_id on sys_role_user(role_id);
|
||||
CREATE INDEX idx_sys_role_user_user_id on sys_role_user(user_id);
|
||||
|
||||
COMMENT ON TABLE sys_role_user IS '角色用户关系';
|
||||
COMMENT ON COLUMN sys_role_user.role_id IS '角色ID';
|
||||
COMMENT ON COLUMN sys_role_user.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN sys_role_user.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role_user.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_role_menu
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
role_id NUMBER(20, 0),
|
||||
menu_id NUMBER(20, 0),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_menu_role_id on sys_role_menu(role_id);
|
||||
CREATE INDEX idx_sys_role_menu_menu_id on sys_role_menu(menu_id);
|
||||
|
||||
COMMENT ON TABLE sys_role_menu IS '角色菜单关系';
|
||||
COMMENT ON COLUMN sys_role_menu.role_id IS '角色ID';
|
||||
COMMENT ON COLUMN sys_role_menu.menu_id IS '菜单ID';
|
||||
COMMENT ON COLUMN sys_role_menu.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role_menu.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_role_data_scope
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
role_id NUMBER(20, 0),
|
||||
dept_id NUMBER(20, 0),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_data_scope_role_id on sys_role_data_scope(role_id);
|
||||
|
||||
COMMENT ON TABLE sys_role_data_scope IS '角色数据权限';
|
||||
COMMENT ON COLUMN sys_role_data_scope.role_id IS '角色ID';
|
||||
COMMENT ON COLUMN sys_role_data_scope.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN sys_role_data_scope.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role_data_scope.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_params
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
param_code varchar2(32),
|
||||
param_value varchar2(2000),
|
||||
param_type NUMBER(2, 0) DEFAULT 1 NOT NULL,
|
||||
remark varchar2(200),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
updater NUMBER(20, 0),
|
||||
update_date date,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX uk_sys_params_param_code on sys_params(param_code);
|
||||
CREATE INDEX idx_sys_params_create_date on sys_params(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_params IS '参数管理';
|
||||
COMMENT ON COLUMN sys_params.param_code IS '参数编码';
|
||||
COMMENT ON COLUMN sys_params.param_value IS '参数值';
|
||||
COMMENT ON COLUMN sys_params.param_type IS '类型 0:系统参数 1:非系统参数';
|
||||
COMMENT ON COLUMN sys_params.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_params.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_params.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_params.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_params.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_dict_type
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
dict_type varchar2(100),
|
||||
dict_name varchar2(255),
|
||||
remark varchar2(255),
|
||||
sort NUMBER(10, 0),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
updater NUMBER(20, 0),
|
||||
update_date date,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX uk_sys_dict_type_dict_type on sys_dict_type(dict_type);
|
||||
|
||||
COMMENT ON TABLE sys_dict_type IS '字典类型';
|
||||
COMMENT ON COLUMN sys_dict_type.id IS 'id';
|
||||
COMMENT ON COLUMN sys_dict_type.dict_type IS '字典类型';
|
||||
COMMENT ON COLUMN sys_dict_type.dict_name IS '字典名称';
|
||||
COMMENT ON COLUMN sys_dict_type.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_dict_type.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_dict_type.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_dict_type.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_dict_type.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_dict_type.update_date IS '更新时间';
|
||||
|
||||
create table sys_dict_data
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
dict_type_id NUMBER(20, 0) NOT NULL,
|
||||
dict_label varchar2(255),
|
||||
dict_value varchar2(255),
|
||||
remark varchar2(255),
|
||||
sort NUMBER(10, 0),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
updater NUMBER(20, 0),
|
||||
update_date date,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_dict_data_sort on sys_dict_data(sort);
|
||||
CREATE UNIQUE INDEX uk_dict_type_value on sys_dict_data(dict_type_id, dict_value);
|
||||
|
||||
COMMENT ON TABLE sys_dict_data IS '字典数据';
|
||||
COMMENT ON COLUMN sys_dict_data.id IS 'id';
|
||||
COMMENT ON COLUMN sys_dict_data.dict_type_id IS '字典类型ID';
|
||||
COMMENT ON COLUMN sys_dict_data.dict_label IS '字典标签';
|
||||
COMMENT ON COLUMN sys_dict_data.dict_value IS '字典值';
|
||||
COMMENT ON COLUMN sys_dict_data.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_dict_data.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_dict_data.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_dict_data.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_dict_data.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_dict_data.update_date IS '更新时间';
|
||||
|
||||
create table sys_log_login
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
operation NUMBER(2, 0),
|
||||
status NUMBER(2, 0),
|
||||
user_agent varchar2(500),
|
||||
ip varchar2(32),
|
||||
creator_name varchar2(50),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_login_status on sys_log_login(status);
|
||||
CREATE INDEX idx_login_create_date on sys_log_login(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_log_login IS '登录日志';
|
||||
COMMENT ON COLUMN sys_log_login.id IS 'id';
|
||||
COMMENT ON COLUMN sys_log_login.operation IS '用户操作 0:用户登录 1:用户退出';
|
||||
COMMENT ON COLUMN sys_log_login.status IS '状态 0:失败 1:成功 2:账号已锁定';
|
||||
COMMENT ON COLUMN sys_log_login.user_agent IS '用户代理';
|
||||
COMMENT ON COLUMN sys_log_login.ip IS '操作IP';
|
||||
COMMENT ON COLUMN sys_log_login.creator_name IS '用户名';
|
||||
COMMENT ON COLUMN sys_log_login.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_log_login.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_log_operation
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
operation varchar2(50),
|
||||
request_uri varchar2(200),
|
||||
request_method varchar2(20),
|
||||
request_params clob,
|
||||
request_time NUMBER(10, 0),
|
||||
user_agent varchar2(500),
|
||||
ip varchar2(32),
|
||||
status NUMBER(2, 0),
|
||||
creator_name varchar2(50),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_operation_create_date on sys_log_operation(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_log_operation IS '操作日志';
|
||||
COMMENT ON COLUMN sys_log_operation.id IS 'id';
|
||||
COMMENT ON COLUMN sys_log_operation.operation IS '用户操作';
|
||||
COMMENT ON COLUMN sys_log_operation.request_uri IS '请求URI';
|
||||
COMMENT ON COLUMN sys_log_operation.request_method IS '请求方式';
|
||||
COMMENT ON COLUMN sys_log_operation.request_params IS '请求参数';
|
||||
COMMENT ON COLUMN sys_log_operation.request_time IS '请求时长(毫秒)';
|
||||
COMMENT ON COLUMN sys_log_operation.user_agent IS '用户代理';
|
||||
COMMENT ON COLUMN sys_log_operation.ip IS '操作IP';
|
||||
COMMENT ON COLUMN sys_log_operation.status IS '状态 0:失败 1:成功';
|
||||
COMMENT ON COLUMN sys_log_operation.creator_name IS '用户名';
|
||||
COMMENT ON COLUMN sys_log_operation.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_log_operation.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_log_error
|
||||
(
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
request_uri varchar2(200),
|
||||
request_method varchar2(20),
|
||||
request_params clob,
|
||||
user_agent varchar2(500),
|
||||
ip varchar2(32),
|
||||
error_info clob,
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_error_create_date on sys_log_error(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_log_error IS '异常日志';
|
||||
COMMENT ON COLUMN sys_log_error.id IS 'id';
|
||||
COMMENT ON COLUMN sys_log_error.request_uri IS '请求URI';
|
||||
COMMENT ON COLUMN sys_log_error.request_method IS '请求方式';
|
||||
COMMENT ON COLUMN sys_log_error.request_params IS '请求参数';
|
||||
COMMENT ON COLUMN sys_log_error.user_agent IS '用户代理';
|
||||
COMMENT ON COLUMN sys_log_error.ip IS '操作IP';
|
||||
COMMENT ON COLUMN sys_log_error.error_info IS '异常信息';
|
||||
COMMENT ON COLUMN sys_log_error.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_log_error.create_date IS '创建时间';
|
||||
|
||||
|
||||
CREATE TABLE sys_oss (
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
url varchar2(200),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_oss_create_date on sys_oss(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_oss IS '文件上传';
|
||||
COMMENT ON COLUMN sys_oss.id IS 'id';
|
||||
COMMENT ON COLUMN sys_oss.url IS 'URL地址';
|
||||
COMMENT ON COLUMN sys_mail_log.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_mail_log.create_date IS '创建时间';
|
||||
|
||||
|
||||
CREATE TABLE schedule_job (
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
bean_name varchar2(200),
|
||||
params varchar2(2000),
|
||||
cron_expression varchar2(100),
|
||||
status NUMBER(2, 0),
|
||||
remark varchar2(255),
|
||||
creator NUMBER(20, 0),
|
||||
create_date date,
|
||||
updater NUMBER(20, 0),
|
||||
update_date date,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_schedule_job_create_date on schedule_job(create_date);
|
||||
|
||||
COMMENT ON TABLE schedule_job IS '定时任务';
|
||||
COMMENT ON COLUMN schedule_job.id IS 'id';
|
||||
COMMENT ON COLUMN schedule_job.bean_name IS 'spring bean名称';
|
||||
COMMENT ON COLUMN schedule_job.params IS '参数';
|
||||
COMMENT ON COLUMN schedule_job.cron_expression IS 'cron表达式';
|
||||
COMMENT ON COLUMN schedule_job.status IS '任务状态 0:暂停 1:正常';
|
||||
COMMENT ON COLUMN schedule_job.remark IS '备注';
|
||||
COMMENT ON COLUMN schedule_job.creator IS '创建者';
|
||||
COMMENT ON COLUMN schedule_job.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN schedule_job.updater IS '更新者';
|
||||
COMMENT ON COLUMN schedule_job.update_date IS '更新时间';
|
||||
|
||||
|
||||
CREATE TABLE schedule_job_log (
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
job_id NUMBER(20, 0) NOT NULL,
|
||||
bean_name varchar2(200),
|
||||
params varchar2(2000),
|
||||
status NUMBER(2, 0),
|
||||
error varchar2(2000),
|
||||
times NUMBER(10, 0),
|
||||
create_date date,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_job_log_job_id on schedule_job_log(job_id);
|
||||
CREATE INDEX idx_job_log_create_date on schedule_job_log(create_date);
|
||||
|
||||
COMMENT ON TABLE schedule_job_log IS '定时任务日志';
|
||||
COMMENT ON COLUMN schedule_job_log.id IS 'id';
|
||||
COMMENT ON COLUMN schedule_job_log.bean_name IS 'spring bean名称';
|
||||
COMMENT ON COLUMN schedule_job_log.params IS '参数';
|
||||
COMMENT ON COLUMN schedule_job_log.status IS '任务状态 0:失败 1:成功';
|
||||
COMMENT ON COLUMN schedule_job_log.error IS '失败信息';
|
||||
COMMENT ON COLUMN schedule_job_log.times IS '耗时(单位:毫秒)';
|
||||
COMMENT ON COLUMN schedule_job.create_date IS '创建时间';
|
||||
|
||||
|
||||
CREATE TABLE sys_user_token (
|
||||
id NUMBER(20, 0) NOT NULL,
|
||||
user_id NUMBER(20, 0),
|
||||
token varchar2(100),
|
||||
expire_date date,
|
||||
update_date date,
|
||||
create_date date,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uk_sys_user_token_user_id on sys_user_token(user_id);
|
||||
CREATE UNIQUE INDEX uk_sys_user_token on sys_user_token(token);
|
||||
|
||||
COMMENT ON TABLE sys_user_token IS '系统用户Token';
|
||||
COMMENT ON COLUMN sys_user_token.id IS 'id';
|
||||
COMMENT ON COLUMN sys_user_token.user_id IS '用户id';
|
||||
COMMENT ON COLUMN sys_user_token.token IS '用户token';
|
||||
COMMENT ON COLUMN sys_user_token.expire_date IS '过期时间';
|
||||
COMMENT ON COLUMN sys_user_token.update_date IS '更新时间';
|
||||
COMMENT ON COLUMN sys_user_token.create_date IS '创建时间';
|
||||
|
||||
|
||||
|
||||
-- 初始数据
|
||||
INSERT INTO sys_user(id, username, password, real_name, gender, email, mobile, status, dept_id, super_admin, creator, create_date, updater, update_date) VALUES (1067246875800000001, 'admin', '$2a$10$012Kx2ba5jzqr9gLlG4MX.bnQJTD9UWqF57XDo2N3.fPtLne02u/m', '管理员', 0, 'root@weather.io', '13612345678', 1, null, 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000002, 0, '权限管理', NULL, NULL, 0, 'icon-safetycertificate', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000003, 1067246875800000055, '新增', NULL, 'sys:user:save,sys:dept:list,sys:role:list', 1, NULL, 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000004, 1067246875800000055, '修改', NULL, 'sys:user:update,sys:dept:list,sys:role:list', 1, NULL, 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000005, 1067246875800000055, '删除', NULL, 'sys:user:delete', 1, NULL, 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000006, 1067246875800000055, '导出', NULL, 'sys:user:export', 1, NULL, 4, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000007, 1067246875800000002, '角色管理', 'sys/role', NULL, 0, 'icon-team', 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000008, 1067246875800000007, '查看', NULL, 'sys:role:page,sys:role:info', 1, NULL, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000009, 1067246875800000007, '新增', NULL, 'sys:role:save,sys:menu:select,sys:dept:list', 1, NULL, 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000010, 1067246875800000007, '修改', NULL, 'sys:role:update,sys:menu:select,sys:dept:list', 1, NULL, 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000011, 1067246875800000007, '删除', NULL, 'sys:role:delete', 1, NULL, 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000012, 1067246875800000002, '部门管理', 'sys/dept', NULL, 0, 'icon-apartment', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000014, 1067246875800000012, '查看', NULL, 'sys:dept:list,sys:dept:info', 1, NULL, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000015, 1067246875800000012, '新增', NULL, 'sys:dept:save', 1, NULL, 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000016, 1067246875800000012, '修改', NULL, 'sys:dept:update', 1, NULL, 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000017, 1067246875800000012, '删除', NULL, 'sys:dept:delete', 1, NULL, 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000025, 1067246875800000035, '菜单管理', 'sys/menu', NULL, 0, 'icon-unorderedlist', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000026, 1067246875800000025, '查看', NULL, 'sys:menu:list,sys:menu:info', 1, NULL, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000027, 1067246875800000025, '新增', NULL, 'sys:menu:save', 1, NULL, 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000028, 1067246875800000025, '修改', NULL, 'sys:menu:update', 1, NULL, 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000029, 1067246875800000025, '删除', NULL, 'sys:menu:delete', 1, NULL, 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000030, 1067246875800000035, '定时任务', 'job/schedule', NULL, 0, 'icon-dashboard', 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000031, 1067246875800000030, '查看', NULL, 'sys:schedule:page,sys:schedule:info', 1, NULL, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000032, 1067246875800000030, '新增', NULL, 'sys:schedule:save', 1, NULL, 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000033, 1067246875800000030, '修改', NULL, 'sys:schedule:update', 1, NULL, 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000034, 1067246875800000030, '删除', NULL, 'sys:schedule:delete', 1, NULL, 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000035, 0, '系统设置', NULL, NULL, 0, 'icon-setting', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000036, 1067246875800000030, '暂停', NULL, 'sys:schedule:pause', 1, NULL, 4, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000037, 1067246875800000030, '恢复', NULL, 'sys:schedule:resume', 1, NULL, 5, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000038, 1067246875800000030, '立即执行', NULL, 'sys:schedule:run', 1, NULL, 6, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000039, 1067246875800000030, '日志列表', NULL, 'sys:schedule:log', 1, NULL, 7, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000040, 1067246875800000035, '参数管理', 'sys/params', '', 0, 'icon-fileprotect', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000041, 1067246875800000035, '字典管理', 'sys/dict-type', NULL, 0, 'icon-golden-fill', 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000042, 1067246875800000041, '查看', NULL, 'sys:dict:page,sys:dict:info', 1, NULL, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000043, 1067246875800000041, '新增', NULL, 'sys:dict:save', 1, NULL, 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000044, 1067246875800000041, '修改', NULL, 'sys:dict:update', 1, NULL, 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000045, 1067246875800000041, '删除', NULL, 'sys:dict:delete', 1, NULL, 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000046, 0, '日志管理', NULL, NULL, 0, 'icon-container', 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000047, 1067246875800000035, '文件上传', 'oss/oss', 'sys:oss:all', 0, 'icon-upload', 4, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000048, 1067246875800000046, '登录日志', 'sys/log-login', 'sys:log:login', 0, 'icon-filedone', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000049, 1067246875800000046, '操作日志', 'sys/log-operation', 'sys:log:operation', 0, 'icon-solution', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000050, 1067246875800000046, '异常日志', 'sys/log-error', 'sys:log:error', 0, 'icon-file-exception', 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000051, 1067246875800000053, 'SQL监控', '{{ApiUrl}}/druid/sql.html', NULL, 0, 'icon-database', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000053, 0, '系统监控', NULL, NULL, 0, 'icon-desktop', 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000055, 1067246875800000002, '用户管理', 'sys/user', NULL, 0, 'icon-user', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000056, 1067246875800000055, '查看', NULL, 'sys:user:page,sys:user:info', 1, NULL, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000057, 1067246875800000040, '新增', NULL, 'sys:params:save', 1, NULL, 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000058, 1067246875800000040, '导出', NULL, 'sys:params:export', 1, NULL, 4, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000059, 1067246875800000040, '查看', '', 'sys:params:page,sys:params:info', 1, NULL, 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000060, 1067246875800000040, '修改', NULL, 'sys:params:update', 1, NULL, 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000061, 1067246875800000040, '删除', '', 'sys:params:delete', 1, '', 3, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1156748733921165314, 1067246875800000053, '接口文档', '{{ApiUrl}}/doc.html', '', 0, 'icon-file-word', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
|
||||
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000062, 1067246875800000063, '1067246875800000066,1067246875800000063', '技术部', 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000063, 1067246875800000066, '1067246875800000066', '长沙分公司', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000064, 1067246875800000066, '1067246875800000066', '上海分公司', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000065, 1067246875800000064, '1067246875800000066,1067246875800000064', '市场部', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000066, 0, '0', '人人开源集团', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000067, 1067246875800000064, '1067246875800000066,1067246875800000064', '销售部', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000068, 1067246875800000063, '1067246875800000066,1067246875800000063', '产品部', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1160061077912858625, 'gender', '性别', '', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061112075464705, 1160061077912858625, '男', '0', '', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061146967879681, 1160061077912858625, '女', '1', '', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061190127267841, 1160061077912858625, '保密', '2', '', 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1225813644059140097, 'notice_type', '站内通知-类型', '', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814069634195457, 1225813644059140097, '公告', '0', '', 0, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814107559092225, 1225813644059140097, '会议', '1', '', 1, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814271879340034, 1225813644059140097, '其他', '2', '', 2, 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
|
||||
INSERT INTO sys_params(id, param_code, param_value, param_type, remark, creator, create_date, updater, update_date) VALUES (1067246875800000073, 'CLOUD_STORAGE_CONFIG_KEY', '{"type":1,"qiniuDomain":"http://test.oss.weather.io","qiniuPrefix":"upload","qiniuAccessKey":"NrgMfABZxWLo5B-YYSjoE8-AZ1EISdi1Z3ubLOeZ","qiniuSecretKey":"uIwJHevMRWU0VLxFvgy0tAcOdGqasdtVlJkdy6vV","qiniuBucketName":"weather-oss","aliyunDomain":"","aliyunPrefix":"","aliyunEndPoint":"","aliyunAccessKeyId":"","aliyunAccessKeySecret":"","aliyunBucketName":"","qcloudDomain":"","qcloudPrefix":"","qcloudSecretId":"","qcloudSecretKey":"","qcloudBucketName":""}', '0', '云存储配置信息', 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
|
||||
INSERT INTO schedule_job (id, bean_name, params, cron_expression, status, remark, creator, create_date, updater, update_date) VALUES (1067246875800000076, 'testTask', 'weather', '0 0/30 * * * ?', 0, '有参测试,多个参数使用json', 1067246875800000001, CURRENT_DATE, 1067246875800000001, CURRENT_DATE);
|
||||
|
||||
|
||||
-- quartz自带表结构
|
||||
CREATE TABLE qrtz_job_details
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
JOB_NAME VARCHAR2(200) NOT NULL,
|
||||
JOB_GROUP VARCHAR2(200) NOT NULL,
|
||||
DESCRIPTION VARCHAR2(250) NULL,
|
||||
JOB_CLASS_NAME VARCHAR2(250) NOT NULL,
|
||||
IS_DURABLE VARCHAR2(1) NOT NULL,
|
||||
IS_NONCONCURRENT VARCHAR2(1) NOT NULL,
|
||||
IS_UPDATE_DATA VARCHAR2(1) NOT NULL,
|
||||
REQUESTS_RECOVERY VARCHAR2(1) NOT NULL,
|
||||
JOB_DATA BLOB NULL,
|
||||
CONSTRAINT QRTZ_JOB_DETAILS_PK PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
|
||||
);
|
||||
CREATE TABLE qrtz_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR2(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
|
||||
JOB_NAME VARCHAR2(200) NOT NULL,
|
||||
JOB_GROUP VARCHAR2(200) NOT NULL,
|
||||
DESCRIPTION VARCHAR2(250) NULL,
|
||||
NEXT_FIRE_TIME NUMBER(13) NULL,
|
||||
PREV_FIRE_TIME NUMBER(13) NULL,
|
||||
PRIORITY NUMBER(13) NULL,
|
||||
TRIGGER_STATE VARCHAR2(16) NOT NULL,
|
||||
TRIGGER_TYPE VARCHAR2(8) NOT NULL,
|
||||
START_TIME NUMBER(13) NOT NULL,
|
||||
END_TIME NUMBER(13) NULL,
|
||||
CALENDAR_NAME VARCHAR2(200) NULL,
|
||||
MISFIRE_INSTR NUMBER(2) NULL,
|
||||
JOB_DATA BLOB NULL,
|
||||
CONSTRAINT QRTZ_TRIGGERS_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
CONSTRAINT QRTZ_TRIGGER_TO_JOBS_FK FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
|
||||
REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
|
||||
);
|
||||
CREATE TABLE qrtz_simple_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR2(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
|
||||
REPEAT_COUNT NUMBER(7) NOT NULL,
|
||||
REPEAT_INTERVAL NUMBER(12) NOT NULL,
|
||||
TIMES_TRIGGERED NUMBER(10) NOT NULL,
|
||||
CONSTRAINT QRTZ_SIMPLE_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
CONSTRAINT QRTZ_SIMPLE_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
CREATE TABLE qrtz_cron_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR2(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
|
||||
CRON_EXPRESSION VARCHAR2(120) NOT NULL,
|
||||
TIME_ZONE_ID VARCHAR2(80),
|
||||
CONSTRAINT QRTZ_CRON_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
CONSTRAINT QRTZ_CRON_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
CREATE TABLE qrtz_simprop_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR2(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
|
||||
STR_PROP_1 VARCHAR2(512) NULL,
|
||||
STR_PROP_2 VARCHAR2(512) NULL,
|
||||
STR_PROP_3 VARCHAR2(512) NULL,
|
||||
INT_PROP_1 NUMBER(10) NULL,
|
||||
INT_PROP_2 NUMBER(10) NULL,
|
||||
LONG_PROP_1 NUMBER(13) NULL,
|
||||
LONG_PROP_2 NUMBER(13) NULL,
|
||||
DEC_PROP_1 NUMERIC(13,4) NULL,
|
||||
DEC_PROP_2 NUMERIC(13,4) NULL,
|
||||
BOOL_PROP_1 VARCHAR2(1) NULL,
|
||||
BOOL_PROP_2 VARCHAR2(1) NULL,
|
||||
CONSTRAINT QRTZ_SIMPROP_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
CONSTRAINT QRTZ_SIMPROP_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
CREATE TABLE qrtz_blob_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR2(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
|
||||
BLOB_DATA BLOB NULL,
|
||||
CONSTRAINT QRTZ_BLOB_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
CONSTRAINT QRTZ_BLOB_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
CREATE TABLE qrtz_calendars
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
CALENDAR_NAME VARCHAR2(200) NOT NULL,
|
||||
CALENDAR BLOB NOT NULL,
|
||||
CONSTRAINT QRTZ_CALENDARS_PK PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
|
||||
);
|
||||
CREATE TABLE qrtz_paused_trigger_grps
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
|
||||
CONSTRAINT QRTZ_PAUSED_TRIG_GRPS_PK PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
CREATE TABLE qrtz_fired_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
ENTRY_ID VARCHAR2(95) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR2(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR2(200) NOT NULL,
|
||||
INSTANCE_NAME VARCHAR2(200) NOT NULL,
|
||||
FIRED_TIME NUMBER(13) NOT NULL,
|
||||
SCHED_TIME NUMBER(13) NOT NULL,
|
||||
PRIORITY NUMBER(13) NOT NULL,
|
||||
STATE VARCHAR2(16) NOT NULL,
|
||||
JOB_NAME VARCHAR2(200) NULL,
|
||||
JOB_GROUP VARCHAR2(200) NULL,
|
||||
IS_NONCONCURRENT VARCHAR2(1) NULL,
|
||||
REQUESTS_RECOVERY VARCHAR2(1) NULL,
|
||||
CONSTRAINT QRTZ_FIRED_TRIGGER_PK PRIMARY KEY (SCHED_NAME,ENTRY_ID)
|
||||
);
|
||||
CREATE TABLE qrtz_scheduler_state
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
INSTANCE_NAME VARCHAR2(200) NOT NULL,
|
||||
LAST_CHECKIN_TIME NUMBER(13) NOT NULL,
|
||||
CHECKIN_INTERVAL NUMBER(13) NOT NULL,
|
||||
CONSTRAINT QRTZ_SCHEDULER_STATE_PK PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
|
||||
);
|
||||
CREATE TABLE qrtz_locks
|
||||
(
|
||||
SCHED_NAME VARCHAR2(120) NOT NULL,
|
||||
LOCK_NAME VARCHAR2(40) NOT NULL,
|
||||
CONSTRAINT QRTZ_LOCKS_PK PRIMARY KEY (SCHED_NAME,LOCK_NAME)
|
||||
);
|
||||
|
||||
create index idx_qrtz_j_req_recovery on qrtz_job_details(SCHED_NAME,REQUESTS_RECOVERY);
|
||||
create index idx_qrtz_j_grp on qrtz_job_details(SCHED_NAME,JOB_GROUP);
|
||||
|
||||
create index idx_qrtz_t_j on qrtz_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
|
||||
create index idx_qrtz_t_jg on qrtz_triggers(SCHED_NAME,JOB_GROUP);
|
||||
create index idx_qrtz_t_c on qrtz_triggers(SCHED_NAME,CALENDAR_NAME);
|
||||
create index idx_qrtz_t_g on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP);
|
||||
create index idx_qrtz_t_state on qrtz_triggers(SCHED_NAME,TRIGGER_STATE);
|
||||
create index idx_qrtz_t_n_state on qrtz_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE);
|
||||
create index idx_qrtz_t_n_g_state on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE);
|
||||
create index idx_qrtz_t_next_fire_time on qrtz_triggers(SCHED_NAME,NEXT_FIRE_TIME);
|
||||
create index idx_qrtz_t_nft_st on qrtz_triggers(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME);
|
||||
create index idx_qrtz_t_nft_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME);
|
||||
create index idx_qrtz_t_nft_st_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE);
|
||||
create index idx_qrtz_t_nft_st_misfire_grp on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);
|
||||
|
||||
create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME);
|
||||
create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY);
|
||||
create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
|
||||
create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP);
|
||||
create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
|
||||
create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP);
|
||||
|
||||
|
||||
699
system-admin/db/postgresql.sql
Normal file
699
system-admin/db/postgresql.sql
Normal file
@ -0,0 +1,699 @@
|
||||
CREATE TABLE sys_user (
|
||||
id int8 NOT NULL,
|
||||
username varchar(50) NOT NULL,
|
||||
password varchar(100),
|
||||
real_name varchar(50),
|
||||
head_url varchar(200),
|
||||
gender int,
|
||||
email varchar(100),
|
||||
mobile varchar(100),
|
||||
dept_id int8,
|
||||
super_admin int,
|
||||
status int,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
updater int8,
|
||||
update_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uk_sys_user_username on sys_user(username);
|
||||
CREATE INDEX idx_sys_user_create_date on sys_user(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_user IS '用户管理';
|
||||
COMMENT ON COLUMN sys_user.id IS 'id';
|
||||
COMMENT ON COLUMN sys_user.username IS '用户名';
|
||||
COMMENT ON COLUMN sys_user.password IS '密码';
|
||||
COMMENT ON COLUMN sys_user.real_name IS '姓名';
|
||||
COMMENT ON COLUMN sys_user.head_url IS '头像';
|
||||
COMMENT ON COLUMN sys_user.gender IS '性别 0:男 1:女 2:保密';
|
||||
COMMENT ON COLUMN sys_user.email IS '邮箱';
|
||||
COMMENT ON COLUMN sys_user.mobile IS '手机号';
|
||||
COMMENT ON COLUMN sys_user.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN sys_user.super_admin IS '超级管理员 0:否 1:是';
|
||||
COMMENT ON COLUMN sys_user.status IS '状态 0:停用 1:正常';
|
||||
COMMENT ON COLUMN sys_user.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_user.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_user.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_user.update_date IS '更新时间';
|
||||
|
||||
|
||||
CREATE TABLE sys_dept (
|
||||
id int8 NOT NULL,
|
||||
pid int8,
|
||||
pids varchar(500),
|
||||
name varchar(50),
|
||||
sort int,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
updater int8,
|
||||
update_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_dept_pid on sys_dept(pid);
|
||||
CREATE INDEX idx_sys_dept_idx_sort on sys_dept(sort);
|
||||
|
||||
COMMENT ON TABLE sys_dept IS '部门管理';
|
||||
COMMENT ON COLUMN sys_dept.id IS 'id';
|
||||
COMMENT ON COLUMN sys_dept.pid IS '上级ID';
|
||||
COMMENT ON COLUMN sys_dept.pids IS '所有上级ID,用逗号分开';
|
||||
COMMENT ON COLUMN sys_dept.name IS '部门名称';
|
||||
COMMENT ON COLUMN sys_dept.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_dept.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_dept.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_dept.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_dept.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_role
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
name varchar(50),
|
||||
remark varchar(100),
|
||||
dept_id int8,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
updater int8,
|
||||
update_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_dept_id on sys_role(dept_id);
|
||||
|
||||
COMMENT ON TABLE sys_role IS '角色管理';
|
||||
COMMENT ON COLUMN sys_role.id IS 'id';
|
||||
COMMENT ON COLUMN sys_role.name IS '角色名称';
|
||||
COMMENT ON COLUMN sys_role.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_role.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN sys_role.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_role.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_role.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_menu
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
pid int8,
|
||||
name varchar(200),
|
||||
url varchar(200),
|
||||
permissions varchar(500),
|
||||
menu_type int,
|
||||
icon varchar(50),
|
||||
sort int,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
updater int8,
|
||||
update_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_menu_pid on sys_menu(pid);
|
||||
CREATE INDEX idx_sys_menu_sort on sys_menu(sort);
|
||||
|
||||
COMMENT ON TABLE sys_menu IS '菜单管理';
|
||||
COMMENT ON COLUMN sys_menu.id IS 'id';
|
||||
COMMENT ON COLUMN sys_menu.pid IS '上级ID,一级菜单为0';
|
||||
COMMENT ON COLUMN sys_menu.name IS '名称';
|
||||
COMMENT ON COLUMN sys_menu.url IS '菜单URL';
|
||||
COMMENT ON COLUMN sys_menu.permissions IS '授权(多个用逗号分隔,如:sys:user:list,sys:user:save)';
|
||||
COMMENT ON COLUMN sys_menu.menu_type IS '类型 0:菜单 1:按钮';
|
||||
COMMENT ON COLUMN sys_menu.icon IS '菜单图标';
|
||||
COMMENT ON COLUMN sys_menu.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_menu.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_menu.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_menu.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_menu.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_role_user
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
role_id int8,
|
||||
user_id int8,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_user_role_id on sys_role_user(role_id);
|
||||
CREATE INDEX idx_sys_role_user_user_id on sys_role_user(user_id);
|
||||
|
||||
COMMENT ON TABLE sys_role_user IS '角色用户关系';
|
||||
COMMENT ON COLUMN sys_role_user.role_id IS '角色ID';
|
||||
COMMENT ON COLUMN sys_role_user.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN sys_role_user.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role_user.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_role_menu
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
role_id int8,
|
||||
menu_id int8,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_menu_role_id on sys_role_menu(role_id);
|
||||
CREATE INDEX idx_sys_role_menu_menu_id on sys_role_menu(menu_id);
|
||||
|
||||
COMMENT ON TABLE sys_role_menu IS '角色菜单关系';
|
||||
COMMENT ON COLUMN sys_role_menu.role_id IS '角色ID';
|
||||
COMMENT ON COLUMN sys_role_menu.menu_id IS '菜单ID';
|
||||
COMMENT ON COLUMN sys_role_menu.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role_menu.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_role_data_scope
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
role_id int8,
|
||||
dept_id int8,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_data_scope_role_id on sys_role_data_scope(role_id);
|
||||
|
||||
COMMENT ON TABLE sys_role_data_scope IS '角色数据权限';
|
||||
COMMENT ON COLUMN sys_role_data_scope.role_id IS '角色ID';
|
||||
COMMENT ON COLUMN sys_role_data_scope.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN sys_role_data_scope.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_role_data_scope.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_params
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
param_code varchar(32),
|
||||
param_value varchar(2000),
|
||||
param_type int DEFAULT 1 NOT NULL,
|
||||
remark varchar(200),
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
updater int8,
|
||||
update_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX uk_sys_params_param_code on sys_params(param_code);
|
||||
CREATE INDEX idx_sys_params_create_date on sys_params(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_params IS '参数管理';
|
||||
COMMENT ON COLUMN sys_params.param_code IS '参数编码';
|
||||
COMMENT ON COLUMN sys_params.param_value IS '参数值';
|
||||
COMMENT ON COLUMN sys_params.param_type IS '类型 0:系统参数 1:非系统参数';
|
||||
COMMENT ON COLUMN sys_params.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_params.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_params.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_params.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_params.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_dict_type
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
dict_type varchar(100),
|
||||
dict_name varchar(255),
|
||||
remark varchar(255),
|
||||
sort int,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
updater int8,
|
||||
update_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX uk_sys_dict_type_dict_type on sys_dict_type(dict_type);
|
||||
|
||||
COMMENT ON TABLE sys_dict_type IS '字典类型';
|
||||
COMMENT ON COLUMN sys_dict_type.id IS 'id';
|
||||
COMMENT ON COLUMN sys_dict_type.dict_type IS '字典类型';
|
||||
COMMENT ON COLUMN sys_dict_type.dict_name IS '字典名称';
|
||||
COMMENT ON COLUMN sys_dict_type.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_dict_type.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_dict_type.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_dict_type.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_dict_type.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_dict_type.update_date IS '更新时间';
|
||||
|
||||
create table sys_dict_data
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
dict_type_id int8 NOT NULL,
|
||||
dict_label varchar(255),
|
||||
dict_value varchar(255),
|
||||
remark varchar(255),
|
||||
sort int,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
updater int8,
|
||||
update_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_dict_data_sort on sys_dict_data(sort);
|
||||
CREATE UNIQUE INDEX uk_dict_type_value on sys_dict_data(dict_type_id, dict_value);
|
||||
|
||||
COMMENT ON TABLE sys_dict_data IS '字典数据';
|
||||
COMMENT ON COLUMN sys_dict_data.id IS 'id';
|
||||
COMMENT ON COLUMN sys_dict_data.dict_type_id IS '字典类型ID';
|
||||
COMMENT ON COLUMN sys_dict_data.dict_label IS '字典标签';
|
||||
COMMENT ON COLUMN sys_dict_data.dict_value IS '字典值';
|
||||
COMMENT ON COLUMN sys_dict_data.remark IS '备注';
|
||||
COMMENT ON COLUMN sys_dict_data.sort IS '排序';
|
||||
COMMENT ON COLUMN sys_dict_data.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_dict_data.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN sys_dict_data.updater IS '更新者';
|
||||
COMMENT ON COLUMN sys_dict_data.update_date IS '更新时间';
|
||||
|
||||
|
||||
create table sys_log_login
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
operation int,
|
||||
status int,
|
||||
user_agent varchar(500),
|
||||
ip varchar(32),
|
||||
creator_name varchar(50),
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_login_status on sys_log_login(status);
|
||||
CREATE INDEX idx_login_create_date on sys_log_login(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_log_login IS '登录日志';
|
||||
COMMENT ON COLUMN sys_log_login.id IS 'id';
|
||||
COMMENT ON COLUMN sys_log_login.operation IS '用户操作 0:用户登录 1:用户退出';
|
||||
COMMENT ON COLUMN sys_log_login.status IS '状态 0:失败 1:成功 2:账号已锁定';
|
||||
COMMENT ON COLUMN sys_log_login.user_agent IS '用户代理';
|
||||
COMMENT ON COLUMN sys_log_login.ip IS '操作IP';
|
||||
COMMENT ON COLUMN sys_log_login.creator_name IS '用户名';
|
||||
COMMENT ON COLUMN sys_log_login.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_log_login.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_log_operation
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
operation varchar(50),
|
||||
request_uri varchar(200),
|
||||
request_method varchar(20),
|
||||
request_params text,
|
||||
request_time int,
|
||||
user_agent varchar(500),
|
||||
ip varchar(32),
|
||||
status int,
|
||||
creator_name varchar(50),
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_operation_create_date on sys_log_operation(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_log_operation IS '操作日志';
|
||||
COMMENT ON COLUMN sys_log_operation.id IS 'id';
|
||||
COMMENT ON COLUMN sys_log_operation.operation IS '用户操作';
|
||||
COMMENT ON COLUMN sys_log_operation.request_uri IS '请求URI';
|
||||
COMMENT ON COLUMN sys_log_operation.request_method IS '请求方式';
|
||||
COMMENT ON COLUMN sys_log_operation.request_params IS '请求参数';
|
||||
COMMENT ON COLUMN sys_log_operation.request_time IS '请求时长(毫秒)';
|
||||
COMMENT ON COLUMN sys_log_operation.user_agent IS '用户代理';
|
||||
COMMENT ON COLUMN sys_log_operation.ip IS '操作IP';
|
||||
COMMENT ON COLUMN sys_log_operation.status IS '状态 0:失败 1:成功';
|
||||
COMMENT ON COLUMN sys_log_operation.creator_name IS '用户名';
|
||||
COMMENT ON COLUMN sys_log_operation.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_log_operation.create_date IS '创建时间';
|
||||
|
||||
|
||||
create table sys_log_error
|
||||
(
|
||||
id int8 NOT NULL,
|
||||
request_uri varchar(200),
|
||||
request_method varchar(20),
|
||||
request_params text,
|
||||
user_agent varchar(500),
|
||||
ip varchar(32),
|
||||
error_info text,
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_error_create_date on sys_log_error(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_log_error IS '异常日志';
|
||||
COMMENT ON COLUMN sys_log_error.id IS 'id';
|
||||
COMMENT ON COLUMN sys_log_error.request_uri IS '请求URI';
|
||||
COMMENT ON COLUMN sys_log_error.request_method IS '请求方式';
|
||||
COMMENT ON COLUMN sys_log_error.request_params IS '请求参数';
|
||||
COMMENT ON COLUMN sys_log_error.user_agent IS '用户代理';
|
||||
COMMENT ON COLUMN sys_log_error.ip IS '操作IP';
|
||||
COMMENT ON COLUMN sys_log_error.error_info IS '异常信息';
|
||||
COMMENT ON COLUMN sys_log_error.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_log_error.create_date IS '创建时间';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE sys_oss (
|
||||
id int8 NOT NULL,
|
||||
url varchar(200),
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_oss_create_date on sys_oss(create_date);
|
||||
|
||||
COMMENT ON TABLE sys_oss IS '文件上传';
|
||||
COMMENT ON COLUMN sys_oss.id IS 'id';
|
||||
COMMENT ON COLUMN sys_oss.url IS 'URL地址';
|
||||
COMMENT ON COLUMN sys_oss.creator IS '创建者';
|
||||
COMMENT ON COLUMN sys_oss.create_date IS '创建时间';
|
||||
|
||||
|
||||
CREATE TABLE schedule_job (
|
||||
id int8 NOT NULL,
|
||||
bean_name varchar(200),
|
||||
params varchar(2000),
|
||||
cron_expression varchar(100),
|
||||
status int,
|
||||
remark varchar(255),
|
||||
creator int8,
|
||||
create_date timestamp,
|
||||
updater int8,
|
||||
update_date timestamp,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_schedule_job_create_date on schedule_job(create_date);
|
||||
|
||||
COMMENT ON TABLE schedule_job IS '定时任务';
|
||||
COMMENT ON COLUMN schedule_job.id IS 'id';
|
||||
COMMENT ON COLUMN schedule_job.bean_name IS 'spring bean名称';
|
||||
COMMENT ON COLUMN schedule_job.params IS '参数';
|
||||
COMMENT ON COLUMN schedule_job.cron_expression IS 'cron表达式';
|
||||
COMMENT ON COLUMN schedule_job.status IS '任务状态 0:暂停 1:正常';
|
||||
COMMENT ON COLUMN schedule_job.remark IS '备注';
|
||||
COMMENT ON COLUMN schedule_job.creator IS '创建者';
|
||||
COMMENT ON COLUMN schedule_job.create_date IS '创建时间';
|
||||
COMMENT ON COLUMN schedule_job.updater IS '更新者';
|
||||
COMMENT ON COLUMN schedule_job.update_date IS '更新时间';
|
||||
|
||||
|
||||
CREATE TABLE schedule_job_log (
|
||||
id int8 NOT NULL,
|
||||
job_id int8 NOT NULL,
|
||||
bean_name varchar(200),
|
||||
params varchar(2000),
|
||||
status int,
|
||||
error varchar(2000),
|
||||
times int,
|
||||
create_date timestamp,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_job_log_job_id on schedule_job_log(job_id);
|
||||
CREATE INDEX idx_job_log_create_date on schedule_job_log(create_date);
|
||||
|
||||
COMMENT ON TABLE schedule_job_log IS '定时任务日志';
|
||||
COMMENT ON COLUMN schedule_job_log.id IS 'id';
|
||||
COMMENT ON COLUMN schedule_job_log.bean_name IS 'spring bean名称';
|
||||
COMMENT ON COLUMN schedule_job_log.params IS '参数';
|
||||
COMMENT ON COLUMN schedule_job_log.status IS '任务状态 0:失败 1:成功';
|
||||
COMMENT ON COLUMN schedule_job_log.error IS '失败信息';
|
||||
COMMENT ON COLUMN schedule_job_log.times IS '耗时(单位:毫秒)';
|
||||
COMMENT ON COLUMN schedule_job.create_date IS '创建时间';
|
||||
|
||||
|
||||
CREATE TABLE sys_user_token (
|
||||
id int8 NOT NULL,
|
||||
user_id int8,
|
||||
token varchar(100),
|
||||
expire_date timestamp,
|
||||
update_date timestamp,
|
||||
create_date timestamp,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uk_sys_user_token_user_id on sys_user_token(user_id);
|
||||
CREATE UNIQUE INDEX uk_sys_user_token on sys_user_token(token);
|
||||
|
||||
COMMENT ON TABLE sys_user_token IS '系统用户Token';
|
||||
COMMENT ON COLUMN sys_user_token.id IS 'id';
|
||||
COMMENT ON COLUMN sys_user_token.user_id IS '用户id';
|
||||
COMMENT ON COLUMN sys_user_token.token IS '用户token';
|
||||
COMMENT ON COLUMN sys_user_token.expire_date IS '过期时间';
|
||||
COMMENT ON COLUMN sys_user_token.update_date IS '更新时间';
|
||||
COMMENT ON COLUMN sys_user_token.create_date IS '创建时间';
|
||||
|
||||
|
||||
|
||||
-- 初始数据
|
||||
INSERT INTO sys_user(id, username, password, real_name, gender, email, mobile, status, dept_id, super_admin, creator, create_date, updater, update_date) VALUES (1067246875800000001, 'admin', '$2a$10$012Kx2ba5jzqr9gLlG4MX.bnQJTD9UWqF57XDo2N3.fPtLne02u/m', '管理员', 0, 'root@weather.io', '13612345678', 1, null, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000002, 0, '权限管理', NULL, NULL, 0, 'icon-safetycertificate', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000003, 1067246875800000055, '新增', NULL, 'sys:user:save,sys:dept:list,sys:role:list', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000004, 1067246875800000055, '修改', NULL, 'sys:user:update,sys:dept:list,sys:role:list', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000005, 1067246875800000055, '删除', NULL, 'sys:user:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000006, 1067246875800000055, '导出', NULL, 'sys:user:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000007, 1067246875800000002, '角色管理', 'sys/role', NULL, 0, 'icon-team', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000008, 1067246875800000007, '查看', NULL, 'sys:role:page,sys:role:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000009, 1067246875800000007, '新增', NULL, 'sys:role:save,sys:menu:select,sys:dept:list', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000010, 1067246875800000007, '修改', NULL, 'sys:role:update,sys:menu:select,sys:dept:list', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000011, 1067246875800000007, '删除', NULL, 'sys:role:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000012, 1067246875800000002, '部门管理', 'sys/dept', NULL, 0, 'icon-apartment', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000014, 1067246875800000012, '查看', NULL, 'sys:dept:list,sys:dept:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000015, 1067246875800000012, '新增', NULL, 'sys:dept:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000016, 1067246875800000012, '修改', NULL, 'sys:dept:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000017, 1067246875800000012, '删除', NULL, 'sys:dept:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000025, 1067246875800000035, '菜单管理', 'sys/menu', NULL, 0, 'icon-unorderedlist', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000026, 1067246875800000025, '查看', NULL, 'sys:menu:list,sys:menu:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000027, 1067246875800000025, '新增', NULL, 'sys:menu:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000028, 1067246875800000025, '修改', NULL, 'sys:menu:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000029, 1067246875800000025, '删除', NULL, 'sys:menu:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000030, 1067246875800000035, '定时任务', 'job/schedule', NULL, 0, 'icon-dashboard', 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000031, 1067246875800000030, '查看', NULL, 'sys:schedule:page,sys:schedule:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000032, 1067246875800000030, '新增', NULL, 'sys:schedule:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000033, 1067246875800000030, '修改', NULL, 'sys:schedule:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000034, 1067246875800000030, '删除', NULL, 'sys:schedule:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000035, 0, '系统设置', NULL, NULL, 0, 'icon-setting', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000036, 1067246875800000030, '暂停', NULL, 'sys:schedule:pause', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000037, 1067246875800000030, '恢复', NULL, 'sys:schedule:resume', 1, NULL, 5, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000038, 1067246875800000030, '立即执行', NULL, 'sys:schedule:run', 1, NULL, 6, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000039, 1067246875800000030, '日志列表', NULL, 'sys:schedule:log', 1, NULL, 7, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000040, 1067246875800000035, '参数管理', 'sys/params', '', 0, 'icon-fileprotect', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000041, 1067246875800000035, '字典管理', 'sys/dict-type', NULL, 0, 'icon-golden-fill', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000042, 1067246875800000041, '查看', NULL, 'sys:dict:page,sys:dict:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000043, 1067246875800000041, '新增', NULL, 'sys:dict:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000044, 1067246875800000041, '修改', NULL, 'sys:dict:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000045, 1067246875800000041, '删除', NULL, 'sys:dict:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000046, 0, '日志管理', NULL, NULL, 0, 'icon-container', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000047, 1067246875800000035, '文件上传', 'oss/oss', 'sys:oss:all', 0, 'icon-upload', 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000048, 1067246875800000046, '登录日志', 'sys/log-login', 'sys:log:login', 0, 'icon-filedone', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000049, 1067246875800000046, '操作日志', 'sys/log-operation', 'sys:log:operation', 0, 'icon-solution', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000050, 1067246875800000046, '异常日志', 'sys/log-error', 'sys:log:error', 0, 'icon-file-exception', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000051, 1067246875800000053, 'SQL监控', '{{ApiUrl}}/druid/sql.html', NULL, 0, 'icon-database', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000053, 0, '系统监控', NULL, NULL, 0, 'icon-desktop', 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000055, 1067246875800000002, '用户管理', 'sys/user', NULL, 0, 'icon-user', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000056, 1067246875800000055, '查看', NULL, 'sys:user:page,sys:user:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000057, 1067246875800000040, '新增', NULL, 'sys:params:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000058, 1067246875800000040, '导出', NULL, 'sys:params:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000059, 1067246875800000040, '查看', '', 'sys:params:page,sys:params:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000060, 1067246875800000040, '修改', NULL, 'sys:params:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000061, 1067246875800000040, '删除', '', 'sys:params:delete', 1, '', 3, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1156748733921165314, 1067246875800000053, '接口文档', '{{ApiUrl}}/doc.html', '', 0, 'icon-file-word', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000062, 1067246875800000063, '1067246875800000066,1067246875800000063', '技术部', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000063, 1067246875800000066, '1067246875800000066', '长沙分公司', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000064, 1067246875800000066, '1067246875800000066', '上海分公司', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000065, 1067246875800000064, '1067246875800000066,1067246875800000064', '市场部', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000066, 0, '0', '人人开源集团', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000067, 1067246875800000064, '1067246875800000066,1067246875800000064', '销售部', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000068, 1067246875800000063, '1067246875800000066,1067246875800000063', '产品部', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1160061077912858625, 'gender', '性别', '', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061112075464705, 1160061077912858625, '男', '0', '', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061146967879681, 1160061077912858625, '女', '1', '', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061190127267841, 1160061077912858625, '保密', '2', '', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1225813644059140097, 'notice_type', '站内通知-类型', '', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814069634195457, 1225813644059140097, '公告', '0', '', 0, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814107559092225, 1225813644059140097, '会议', '1', '', 1, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814271879340034, 1225813644059140097, '其他', '2', '', 2, 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO sys_params(id, param_code, param_value, param_type, remark, creator, create_date, updater, update_date) VALUES (1067246875800000073, 'CLOUD_STORAGE_CONFIG_KEY', '{"type":1,"qiniuDomain":"http://test.oss.weather.io","qiniuPrefix":"upload","qiniuAccessKey":"NrgMfABZxWLo5B-YYSjoE8-AZ1EISdi1Z3ubLOeZ","qiniuSecretKey":"uIwJHevMRWU0VLxFvgy0tAcOdGqasdtVlJkdy6vV","qiniuBucketName":"weather-oss","aliyunDomain":"","aliyunPrefix":"","aliyunEndPoint":"","aliyunAccessKeyId":"","aliyunAccessKeySecret":"","aliyunBucketName":"","qcloudDomain":"","qcloudPrefix":"","qcloudSecretId":"","qcloudSecretKey":"","qcloudBucketName":""}', '0', '云存储配置信息', 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
INSERT INTO schedule_job (id, bean_name, params, cron_expression, status, remark, creator, create_date, updater, update_date) VALUES (1067246875800000076, 'testTask', 'weather', '0 0/30 * * * ?', 0, '有参测试,多个参数使用json', 1067246875800000001, now(), 1067246875800000001, now());
|
||||
|
||||
|
||||
|
||||
-- quartz自带表结构
|
||||
CREATE TABLE qrtz_job_details
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
JOB_NAME VARCHAR(200) NOT NULL,
|
||||
JOB_GROUP VARCHAR(200) NOT NULL,
|
||||
DESCRIPTION VARCHAR(250) NULL,
|
||||
JOB_CLASS_NAME VARCHAR(250) NOT NULL,
|
||||
IS_DURABLE BOOL NOT NULL,
|
||||
IS_NONCONCURRENT BOOL NOT NULL,
|
||||
IS_UPDATE_DATA BOOL NOT NULL,
|
||||
REQUESTS_RECOVERY BOOL NOT NULL,
|
||||
JOB_DATA BYTEA NULL,
|
||||
PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
|
||||
);
|
||||
|
||||
CREATE TABLE qrtz_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
JOB_NAME VARCHAR(200) NOT NULL,
|
||||
JOB_GROUP VARCHAR(200) NOT NULL,
|
||||
DESCRIPTION VARCHAR(250) NULL,
|
||||
NEXT_FIRE_TIME BIGINT NULL,
|
||||
PREV_FIRE_TIME BIGINT NULL,
|
||||
PRIORITY INTEGER NULL,
|
||||
TRIGGER_STATE VARCHAR(16) NOT NULL,
|
||||
TRIGGER_TYPE VARCHAR(8) NOT NULL,
|
||||
START_TIME BIGINT NOT NULL,
|
||||
END_TIME BIGINT NULL,
|
||||
CALENDAR_NAME VARCHAR(200) NULL,
|
||||
MISFIRE_INSTR SMALLINT NULL,
|
||||
JOB_DATA BYTEA NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
|
||||
REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
|
||||
);
|
||||
|
||||
CREATE TABLE qrtz_simple_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
REPEAT_COUNT BIGINT NOT NULL,
|
||||
REPEAT_INTERVAL BIGINT NOT NULL,
|
||||
TIMES_TRIGGERED BIGINT NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
|
||||
CREATE TABLE qrtz_cron_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
CRON_EXPRESSION VARCHAR(120) NOT NULL,
|
||||
TIME_ZONE_ID VARCHAR(80),
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
|
||||
CREATE TABLE qrtz_simprop_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
STR_PROP_1 VARCHAR(512) NULL,
|
||||
STR_PROP_2 VARCHAR(512) NULL,
|
||||
STR_PROP_3 VARCHAR(512) NULL,
|
||||
INT_PROP_1 INT NULL,
|
||||
INT_PROP_2 INT NULL,
|
||||
LONG_PROP_1 BIGINT NULL,
|
||||
LONG_PROP_2 BIGINT NULL,
|
||||
DEC_PROP_1 NUMERIC(13,4) NULL,
|
||||
DEC_PROP_2 NUMERIC(13,4) NULL,
|
||||
BOOL_PROP_1 BOOL NULL,
|
||||
BOOL_PROP_2 BOOL NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
|
||||
CREATE TABLE qrtz_blob_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
BLOB_DATA BYTEA NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
|
||||
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
|
||||
CREATE TABLE qrtz_calendars
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
CALENDAR_NAME VARCHAR(200) NOT NULL,
|
||||
CALENDAR BYTEA NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE qrtz_paused_trigger_grps
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
|
||||
);
|
||||
|
||||
CREATE TABLE qrtz_fired_triggers
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
ENTRY_ID VARCHAR(95) NOT NULL,
|
||||
TRIGGER_NAME VARCHAR(200) NOT NULL,
|
||||
TRIGGER_GROUP VARCHAR(200) NOT NULL,
|
||||
INSTANCE_NAME VARCHAR(200) NOT NULL,
|
||||
FIRED_TIME BIGINT NOT NULL,
|
||||
SCHED_TIME BIGINT NOT NULL,
|
||||
PRIORITY INTEGER NOT NULL,
|
||||
STATE VARCHAR(16) NOT NULL,
|
||||
JOB_NAME VARCHAR(200) NULL,
|
||||
JOB_GROUP VARCHAR(200) NULL,
|
||||
IS_NONCONCURRENT BOOL NULL,
|
||||
REQUESTS_RECOVERY BOOL NULL,
|
||||
PRIMARY KEY (SCHED_NAME,ENTRY_ID)
|
||||
);
|
||||
|
||||
CREATE TABLE qrtz_scheduler_state
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
INSTANCE_NAME VARCHAR(200) NOT NULL,
|
||||
LAST_CHECKIN_TIME BIGINT NOT NULL,
|
||||
CHECKIN_INTERVAL BIGINT NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
|
||||
);
|
||||
|
||||
CREATE TABLE qrtz_locks
|
||||
(
|
||||
SCHED_NAME VARCHAR(120) NOT NULL,
|
||||
LOCK_NAME VARCHAR(40) NOT NULL,
|
||||
PRIMARY KEY (SCHED_NAME,LOCK_NAME)
|
||||
);
|
||||
|
||||
create index idx_qrtz_j_req_recovery on qrtz_job_details(SCHED_NAME,REQUESTS_RECOVERY);
|
||||
create index idx_qrtz_j_grp on qrtz_job_details(SCHED_NAME,JOB_GROUP);
|
||||
|
||||
create index idx_qrtz_t_j on qrtz_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
|
||||
create index idx_qrtz_t_jg on qrtz_triggers(SCHED_NAME,JOB_GROUP);
|
||||
create index idx_qrtz_t_c on qrtz_triggers(SCHED_NAME,CALENDAR_NAME);
|
||||
create index idx_qrtz_t_g on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP);
|
||||
create index idx_qrtz_t_state on qrtz_triggers(SCHED_NAME,TRIGGER_STATE);
|
||||
create index idx_qrtz_t_n_state on qrtz_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE);
|
||||
create index idx_qrtz_t_n_g_state on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE);
|
||||
create index idx_qrtz_t_next_fire_time on qrtz_triggers(SCHED_NAME,NEXT_FIRE_TIME);
|
||||
create index idx_qrtz_t_nft_st on qrtz_triggers(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME);
|
||||
create index idx_qrtz_t_nft_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME);
|
||||
create index idx_qrtz_t_nft_st_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE);
|
||||
create index idx_qrtz_t_nft_st_misfire_grp on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);
|
||||
|
||||
create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME);
|
||||
create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY);
|
||||
create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
|
||||
create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP);
|
||||
create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
|
||||
create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP);
|
||||
|
||||
|
||||
commit;
|
||||
674
system-admin/db/sqlserver.sql
Normal file
674
system-admin/db/sqlserver.sql
Normal file
@ -0,0 +1,674 @@
|
||||
CREATE TABLE sys_user (
|
||||
id bigint NOT NULL,
|
||||
username varchar(50) NOT NULL,
|
||||
password varchar(100),
|
||||
real_name varchar(50),
|
||||
head_url varchar(200),
|
||||
gender int,
|
||||
email varchar(100),
|
||||
mobile varchar(100),
|
||||
dept_id bigint,
|
||||
super_admin int,
|
||||
status int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uk_sys_user_username on sys_user(username);
|
||||
CREATE INDEX idx_sys_user_create_date on sys_user(create_date);
|
||||
|
||||
|
||||
CREATE TABLE sys_dept (
|
||||
id bigint NOT NULL,
|
||||
pid bigint,
|
||||
pids varchar(500),
|
||||
name varchar(50),
|
||||
sort int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_dept_pid on sys_dept(pid);
|
||||
CREATE INDEX idx_sys_dept_idx_sort on sys_dept(sort);
|
||||
|
||||
|
||||
create table sys_role
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
name varchar(50),
|
||||
remark varchar(100),
|
||||
dept_id bigint,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_dept_id on sys_role(dept_id);
|
||||
|
||||
|
||||
create table sys_menu
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
pid bigint,
|
||||
name varchar(200),
|
||||
url varchar(200),
|
||||
permissions varchar(500),
|
||||
menu_type int,
|
||||
icon varchar(50),
|
||||
sort int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_menu_pid on sys_menu(pid);
|
||||
CREATE INDEX idx_sys_menu_sort on sys_menu(sort);
|
||||
|
||||
|
||||
create table sys_role_user
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
role_id bigint,
|
||||
user_id bigint,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_user_role_id on sys_role_user(role_id);
|
||||
CREATE INDEX idx_sys_role_user_user_id on sys_role_user(user_id);
|
||||
|
||||
|
||||
create table sys_role_menu
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
role_id bigint,
|
||||
menu_id bigint,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_sys_role_menu_role_id on sys_role_menu(role_id);
|
||||
CREATE INDEX idx_sys_role_menu_menu_id on sys_role_menu(menu_id);
|
||||
|
||||
|
||||
create table sys_role_data_scope
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
role_id bigint,
|
||||
dept_id bigint,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_data_scope_role_id on sys_role_data_scope(role_id);
|
||||
|
||||
|
||||
create table sys_params
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
param_code varchar(32),
|
||||
param_value varchar(2000),
|
||||
param_type int DEFAULT 1 NOT NULL,
|
||||
remark varchar(200),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX uk_sys_params_param_code on sys_params(param_code);
|
||||
CREATE INDEX idx_sys_params_create_date on sys_params(create_date);
|
||||
|
||||
|
||||
create table sys_dict_type
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
dict_type varchar(100),
|
||||
dict_name varchar(255),
|
||||
remark varchar(255),
|
||||
sort int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE UNIQUE INDEX uk_sys_dict_type_dict_type on sys_dict_type(dict_type);
|
||||
|
||||
|
||||
create table sys_dict_data
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
dict_type_id bigint NOT NULL,
|
||||
dict_label varchar(255),
|
||||
dict_value varchar(255),
|
||||
remark varchar(255),
|
||||
sort int,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_dict_data_sort on sys_dict_data(sort);
|
||||
CREATE UNIQUE INDEX uk_dict_type_value on sys_dict_data(dict_type_id, dict_value);
|
||||
|
||||
|
||||
create table sys_log_login
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
operation int,
|
||||
status int,
|
||||
user_agent varchar(500),
|
||||
ip varchar(32),
|
||||
creator_name varchar(50),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_login_status on sys_log_login(status);
|
||||
CREATE INDEX idx_login_create_date on sys_log_login(create_date);
|
||||
|
||||
|
||||
create table sys_log_operation
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
operation varchar(50),
|
||||
request_uri varchar(200),
|
||||
request_method varchar(20),
|
||||
request_params text,
|
||||
request_time int,
|
||||
user_agent varchar(500),
|
||||
ip varchar(32),
|
||||
status int,
|
||||
creator_name varchar(50),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_operation_create_date on sys_log_operation(create_date);
|
||||
|
||||
|
||||
create table sys_log_error
|
||||
(
|
||||
id bigint NOT NULL,
|
||||
request_uri varchar(200),
|
||||
request_method varchar(20),
|
||||
request_params text,
|
||||
user_agent varchar(500),
|
||||
ip varchar(32),
|
||||
error_info text,
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
primary key (id)
|
||||
);
|
||||
CREATE INDEX idx_error_create_date on sys_log_error(create_date);
|
||||
|
||||
|
||||
CREATE TABLE sys_oss (
|
||||
id bigint NOT NULL,
|
||||
url varchar(200),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
CREATE INDEX idx_sys_oss_create_date on sys_oss(create_date);
|
||||
|
||||
|
||||
CREATE TABLE schedule_job (
|
||||
id bigint NOT NULL,
|
||||
bean_name varchar(200),
|
||||
params varchar(2000),
|
||||
cron_expression varchar(100),
|
||||
status int,
|
||||
remark varchar(255),
|
||||
creator bigint,
|
||||
create_date datetime,
|
||||
updater bigint,
|
||||
update_date datetime,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_schedule_job_create_date on schedule_job(create_date);
|
||||
|
||||
|
||||
CREATE TABLE schedule_job_log (
|
||||
id bigint NOT NULL,
|
||||
job_id bigint NOT NULL,
|
||||
bean_name varchar(200),
|
||||
params varchar(2000),
|
||||
status int,
|
||||
error varchar(2000),
|
||||
times int,
|
||||
create_date datetime,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_job_log_job_id on schedule_job_log(job_id);
|
||||
CREATE INDEX idx_job_log_create_date on schedule_job_log(create_date);
|
||||
|
||||
|
||||
CREATE TABLE sys_user_token (
|
||||
id bigint NOT NULL,
|
||||
user_id bigint,
|
||||
token varchar(100),
|
||||
expire_date datetime,
|
||||
update_date datetime,
|
||||
create_date datetime,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX uk_sys_user_token_user_id on sys_user_token(user_id);
|
||||
CREATE UNIQUE INDEX uk_sys_user_token on sys_user_token(token);
|
||||
|
||||
|
||||
|
||||
-- 初始数据
|
||||
INSERT INTO sys_user(id, username, password, real_name, gender, email, mobile, status, dept_id, super_admin, creator, create_date, updater, update_date) VALUES (1067246875800000001, 'admin', '$2a$10$012Kx2ba5jzqr9gLlG4MX.bnQJTD9UWqF57XDo2N3.fPtLne02u/m', '管理员', 0, 'root@weather.io', '13612345678', 1, null, 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000002, 0, '权限管理', NULL, NULL, 0, 'icon-safetycertificate', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000003, 1067246875800000055, '新增', NULL, 'sys:user:save,sys:dept:list,sys:role:list', 1, NULL, 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000004, 1067246875800000055, '修改', NULL, 'sys:user:update,sys:dept:list,sys:role:list', 1, NULL, 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000005, 1067246875800000055, '删除', NULL, 'sys:user:delete', 1, NULL, 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000006, 1067246875800000055, '导出', NULL, 'sys:user:export', 1, NULL, 4, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000007, 1067246875800000002, '角色管理', 'sys/role', NULL, 0, 'icon-team', 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000008, 1067246875800000007, '查看', NULL, 'sys:role:page,sys:role:info', 1, NULL, 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000009, 1067246875800000007, '新增', NULL, 'sys:role:save,sys:menu:select,sys:dept:list', 1, NULL, 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000010, 1067246875800000007, '修改', NULL, 'sys:role:update,sys:menu:select,sys:dept:list', 1, NULL, 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000011, 1067246875800000007, '删除', NULL, 'sys:role:delete', 1, NULL, 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000012, 1067246875800000002, '部门管理', 'sys/dept', NULL, 0, 'icon-apartment', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000014, 1067246875800000012, '查看', NULL, 'sys:dept:list,sys:dept:info', 1, NULL, 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000015, 1067246875800000012, '新增', NULL, 'sys:dept:save', 1, NULL, 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000016, 1067246875800000012, '修改', NULL, 'sys:dept:update', 1, NULL, 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000017, 1067246875800000012, '删除', NULL, 'sys:dept:delete', 1, NULL, 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000025, 1067246875800000035, '菜单管理', 'sys/menu', NULL, 0, 'icon-unorderedlist', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000026, 1067246875800000025, '查看', NULL, 'sys:menu:list,sys:menu:info', 1, NULL, 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000027, 1067246875800000025, '新增', NULL, 'sys:menu:save', 1, NULL, 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000028, 1067246875800000025, '修改', NULL, 'sys:menu:update', 1, NULL, 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000029, 1067246875800000025, '删除', NULL, 'sys:menu:delete', 1, NULL, 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000030, 1067246875800000035, '定时任务', 'job/schedule', NULL, 0, 'icon-dashboard', 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000031, 1067246875800000030, '查看', NULL, 'sys:schedule:page,sys:schedule:info', 1, NULL, 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000032, 1067246875800000030, '新增', NULL, 'sys:schedule:save', 1, NULL, 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000033, 1067246875800000030, '修改', NULL, 'sys:schedule:update', 1, NULL, 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000034, 1067246875800000030, '删除', NULL, 'sys:schedule:delete', 1, NULL, 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000035, 0, '系统设置', NULL, NULL, 0, 'icon-setting', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000036, 1067246875800000030, '暂停', NULL, 'sys:schedule:pause', 1, NULL, 4, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000037, 1067246875800000030, '恢复', NULL, 'sys:schedule:resume', 1, NULL, 5, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000038, 1067246875800000030, '立即执行', NULL, 'sys:schedule:run', 1, NULL, 6, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000039, 1067246875800000030, '日志列表', NULL, 'sys:schedule:log', 1, NULL, 7, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000040, 1067246875800000035, '参数管理', 'sys/params', '', 0, 'icon-fileprotect', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000041, 1067246875800000035, '字典管理', 'sys/dict-type', NULL, 0, 'icon-golden-fill', 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000042, 1067246875800000041, '查看', NULL, 'sys:dict:page,sys:dict:info', 1, NULL, 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000043, 1067246875800000041, '新增', NULL, 'sys:dict:save', 1, NULL, 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000044, 1067246875800000041, '修改', NULL, 'sys:dict:update', 1, NULL, 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000045, 1067246875800000041, '删除', NULL, 'sys:dict:delete', 1, NULL, 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000046, 0, '日志管理', NULL, NULL, 0, 'icon-container', 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000047, 1067246875800000035, '文件上传', 'oss/oss', 'sys:oss:all', 0, 'icon-upload', 4, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000048, 1067246875800000046, '登录日志', 'sys/log-login', 'sys:log:login', 0, 'icon-filedone', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000049, 1067246875800000046, '操作日志', 'sys/log-operation', 'sys:log:operation', 0, 'icon-solution', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000050, 1067246875800000046, '异常日志', 'sys/log-error', 'sys:log:error', 0, 'icon-file-exception', 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000051, 1067246875800000053, 'SQL监控', '{{ApiUrl}}/druid/sql.html', NULL, 0, 'icon-database', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000053, 0, '系统监控', NULL, NULL, 0, 'icon-desktop', 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000055, 1067246875800000002, '用户管理', 'sys/user', NULL, 0, 'icon-user', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000056, 1067246875800000055, '查看', NULL, 'sys:user:page,sys:user:info', 1, NULL, 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000057, 1067246875800000040, '新增', NULL, 'sys:params:save', 1, NULL, 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000058, 1067246875800000040, '导出', NULL, 'sys:params:export', 1, NULL, 4, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000059, 1067246875800000040, '查看', '', 'sys:params:page,sys:params:info', 1, NULL, 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000060, 1067246875800000040, '修改', NULL, 'sys:params:update', 1, NULL, 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1067246875800000061, 1067246875800000040, '删除', '', 'sys:params:delete', 1, '', 3, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_menu (id, pid, name, url, permissions, menu_type, icon, sort, creator, create_date, updater, update_date) VALUES (1156748733921165314, 1067246875800000053, '接口文档', '{{ApiUrl}}/doc.html', '', 0, 'icon-file-word', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
|
||||
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000062, 1067246875800000063, '1067246875800000066,1067246875800000063', '技术部', 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000063, 1067246875800000066, '1067246875800000066', '长沙分公司', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000064, 1067246875800000066, '1067246875800000066', '上海分公司', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000065, 1067246875800000064, '1067246875800000066,1067246875800000064', '市场部', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000066, 0, '0', '人人开源集团', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000067, 1067246875800000064, '1067246875800000066,1067246875800000064', '销售部', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dept(id, pid, pids, name, sort, creator, create_date, updater, update_date) VALUES (1067246875800000068, 1067246875800000063, '1067246875800000066,1067246875800000063', '产品部', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1160061077912858625, 'gender', '性别', '', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061112075464705, 1160061077912858625, '男', '0', '', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061146967879681, 1160061077912858625, '女', '1', '', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1160061190127267841, 1160061077912858625, '保密', '2', '', 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dict_type(id, dict_type, dict_name, remark, sort, creator, create_date, updater, update_date) VALUES (1225813644059140097, 'notice_type', '站内通知-类型', '', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814069634195457, 1225813644059140097, '公告', '0', '', 0, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814107559092225, 1225813644059140097, '会议', '1', '', 1, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
INSERT INTO sys_dict_data(id, dict_type_id, dict_label, dict_value, remark, sort, creator, create_date, updater, update_date) VALUES (1225814271879340034, 1225813644059140097, '其他', '2', '', 2, 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
|
||||
INSERT INTO sys_params(id, param_code, param_value, param_type, remark, creator, create_date, updater, update_date) VALUES (1067246875800000073, 'CLOUD_STORAGE_CONFIG_KEY', '{"type":1,"qiniuDomain":"http://test.oss.weather.io","qiniuPrefix":"upload","qiniuAccessKey":"NrgMfABZxWLo5B-YYSjoE8-AZ1EISdi1Z3ubLOeZ","qiniuSecretKey":"uIwJHevMRWU0VLxFvgy0tAcOdGqasdtVlJkdy6vV","qiniuBucketName":"weather-oss","aliyunDomain":"","aliyunPrefix":"","aliyunEndPoint":"","aliyunAccessKeyId":"","aliyunAccessKeySecret":"","aliyunBucketName":"","qcloudDomain":"","qcloudPrefix":"","qcloudSecretId":"","qcloudSecretKey":"","qcloudBucketName":""}', '0', '云存储配置信息', 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
|
||||
INSERT INTO schedule_job (id, bean_name, params, cron_expression, status, remark, creator, create_date, updater, update_date) VALUES (1067246875800000076, 'testTask', 'weather', '0 0/30 * * * ?', 0, '有参测试,多个参数使用json', 1067246875800000001, getdate(), 1067246875800000001, getdate());
|
||||
|
||||
|
||||
-- quartz自带表结构
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1)
|
||||
ALTER TABLE [dbo].[QRTZ_TRIGGERS] DROP CONSTRAINT FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1)
|
||||
ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] DROP CONSTRAINT FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1)
|
||||
ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] DROP CONSTRAINT FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISFOREIGNKEY') = 1)
|
||||
ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] DROP CONSTRAINT FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_CALENDARS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_CALENDARS]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_CRON_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_CRON_TRIGGERS]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_BLOB_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_BLOB_TRIGGERS]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_FIRED_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_FIRED_TRIGGERS]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_PAUSED_TRIGGER_GRPS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_SCHEDULER_STATE]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_SCHEDULER_STATE]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_LOCKS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_LOCKS]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_JOB_DETAILS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_JOB_DETAILS]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_SIMPLE_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_SIMPROP_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS]
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[QRTZ_TRIGGERS]') AND OBJECTPROPERTY(id, N'ISUSERTABLE') = 1)
|
||||
DROP TABLE [dbo].[QRTZ_TRIGGERS]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_CALENDARS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[CALENDAR_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[CALENDAR] [IMAGE] NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_CRON_TRIGGERS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[TRIGGER_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[TRIGGER_GROUP] [VARCHAR] (200) NOT NULL ,
|
||||
[CRON_EXPRESSION] [VARCHAR] (120) NOT NULL ,
|
||||
[TIME_ZONE_ID] [VARCHAR] (80)
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_FIRED_TRIGGERS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[ENTRY_ID] [VARCHAR] (95) NOT NULL ,
|
||||
[TRIGGER_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[TRIGGER_GROUP] [VARCHAR] (200) NOT NULL ,
|
||||
[INSTANCE_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[FIRED_TIME] [BIGINT] NOT NULL ,
|
||||
[SCHED_TIME] [BIGINT] NOT NULL ,
|
||||
[PRIORITY] [INTEGER] NOT NULL ,
|
||||
[STATE] [VARCHAR] (16) NOT NULL,
|
||||
[JOB_NAME] [VARCHAR] (200) NULL ,
|
||||
[JOB_GROUP] [VARCHAR] (200) NULL ,
|
||||
[IS_NONCONCURRENT] [VARCHAR] (1) NULL ,
|
||||
[REQUESTS_RECOVERY] [VARCHAR] (1) NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[TRIGGER_GROUP] [VARCHAR] (200) NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_SCHEDULER_STATE] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[INSTANCE_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[LAST_CHECKIN_TIME] [BIGINT] NOT NULL ,
|
||||
[CHECKIN_INTERVAL] [BIGINT] NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_LOCKS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[LOCK_NAME] [VARCHAR] (40) NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_JOB_DETAILS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[JOB_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[JOB_GROUP] [VARCHAR] (200) NOT NULL ,
|
||||
[DESCRIPTION] [VARCHAR] (250) NULL ,
|
||||
[JOB_CLASS_NAME] [VARCHAR] (250) NOT NULL ,
|
||||
[IS_DURABLE] [VARCHAR] (1) NOT NULL ,
|
||||
[IS_NONCONCURRENT] [VARCHAR] (1) NOT NULL ,
|
||||
[IS_UPDATE_DATA] [VARCHAR] (1) NOT NULL ,
|
||||
[REQUESTS_RECOVERY] [VARCHAR] (1) NOT NULL ,
|
||||
[JOB_DATA] [IMAGE] NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[TRIGGER_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[TRIGGER_GROUP] [VARCHAR] (200) NOT NULL ,
|
||||
[REPEAT_COUNT] [BIGINT] NOT NULL ,
|
||||
[REPEAT_INTERVAL] [BIGINT] NOT NULL ,
|
||||
[TIMES_TRIGGERED] [BIGINT] NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[TRIGGER_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[TRIGGER_GROUP] [VARCHAR] (200) NOT NULL ,
|
||||
[STR_PROP_1] [VARCHAR] (512) NULL,
|
||||
[STR_PROP_2] [VARCHAR] (512) NULL,
|
||||
[STR_PROP_3] [VARCHAR] (512) NULL,
|
||||
[INT_PROP_1] [INT] NULL,
|
||||
[INT_PROP_2] [INT] NULL,
|
||||
[LONG_PROP_1] [BIGINT] NULL,
|
||||
[LONG_PROP_2] [BIGINT] NULL,
|
||||
[DEC_PROP_1] [NUMERIC] (13,4) NULL,
|
||||
[DEC_PROP_2] [NUMERIC] (13,4) NULL,
|
||||
[BOOL_PROP_1] [VARCHAR] (1) NULL,
|
||||
[BOOL_PROP_2] [VARCHAR] (1) NULL,
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_BLOB_TRIGGERS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[TRIGGER_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[TRIGGER_GROUP] [VARCHAR] (200) NOT NULL ,
|
||||
[BLOB_DATA] [IMAGE] NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[QRTZ_TRIGGERS] (
|
||||
[SCHED_NAME] [VARCHAR] (120) NOT NULL ,
|
||||
[TRIGGER_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[TRIGGER_GROUP] [VARCHAR] (200) NOT NULL ,
|
||||
[JOB_NAME] [VARCHAR] (200) NOT NULL ,
|
||||
[JOB_GROUP] [VARCHAR] (200) NOT NULL ,
|
||||
[DESCRIPTION] [VARCHAR] (250) NULL ,
|
||||
[NEXT_FIRE_TIME] [BIGINT] NULL ,
|
||||
[PREV_FIRE_TIME] [BIGINT] NULL ,
|
||||
[PRIORITY] [INTEGER] NULL ,
|
||||
[TRIGGER_STATE] [VARCHAR] (16) NOT NULL ,
|
||||
[TRIGGER_TYPE] [VARCHAR] (8) NOT NULL ,
|
||||
[START_TIME] [BIGINT] NOT NULL ,
|
||||
[END_TIME] [BIGINT] NULL ,
|
||||
[CALENDAR_NAME] [VARCHAR] (200) NULL ,
|
||||
[MISFIRE_INSTR] [SMALLINT] NULL ,
|
||||
[JOB_DATA] [IMAGE] NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_CALENDARS] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_CALENDARS] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[CALENDAR_NAME]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_CRON_TRIGGERS] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_FIRED_TRIGGERS] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_FIRED_TRIGGERS] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[ENTRY_ID]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_PAUSED_TRIGGER_GRPS] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_SCHEDULER_STATE] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_SCHEDULER_STATE] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[INSTANCE_NAME]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_LOCKS] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_LOCKS] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[LOCK_NAME]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_JOB_DETAILS] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_JOB_DETAILS] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[JOB_NAME],
|
||||
[JOB_GROUP]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_SIMPLE_TRIGGERS] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_SIMPROP_TRIGGERS] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_TRIGGERS] WITH NOCHECK ADD
|
||||
CONSTRAINT [PK_QRTZ_TRIGGERS] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] ADD
|
||||
CONSTRAINT [FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) REFERENCES [dbo].[QRTZ_TRIGGERS] (
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] ADD
|
||||
CONSTRAINT [FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) REFERENCES [dbo].[QRTZ_TRIGGERS] (
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_SIMPROP_TRIGGERS] ADD
|
||||
CONSTRAINT [FK_QRTZ_SIMPROP_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) REFERENCES [dbo].[QRTZ_TRIGGERS] (
|
||||
[SCHED_NAME],
|
||||
[TRIGGER_NAME],
|
||||
[TRIGGER_GROUP]
|
||||
) ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[QRTZ_TRIGGERS] ADD
|
||||
CONSTRAINT [FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS] FOREIGN KEY
|
||||
(
|
||||
[SCHED_NAME],
|
||||
[JOB_NAME],
|
||||
[JOB_GROUP]
|
||||
) REFERENCES [dbo].[QRTZ_JOB_DETAILS] (
|
||||
[SCHED_NAME],
|
||||
[JOB_NAME],
|
||||
[JOB_GROUP]
|
||||
)
|
||||
GO
|
||||
139
system-admin/pom.xml
Normal file
139
system-admin/pom.xml
Normal file
@ -0,0 +1,139 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.weather</groupId>
|
||||
<artifactId>weather-data</artifactId>
|
||||
<version>5.5.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>system-admin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<description>system-admin</description>
|
||||
|
||||
<properties>
|
||||
<quartz.version>2.3.2</quartz.version>
|
||||
<shiro.version>1.12.0</shiro.version>
|
||||
<captcha.version>1.6.2</captcha.version>
|
||||
<easyexcel.version>3.2.1</easyexcel.version>
|
||||
<qiniu.version>7.2.27</qiniu.version>
|
||||
<aliyun.oss.version>2.8.3</aliyun.oss.version>
|
||||
<aliyun.core.version>3.2.2</aliyun.core.version>
|
||||
<qcloud.cos.version>5.4.4</qcloud.cos.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.weather</groupId>
|
||||
<artifactId>system-common</artifactId>
|
||||
<version>5.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.weather</groupId>
|
||||
<artifactId>system-dynamic-datasource</artifactId>
|
||||
<version>5.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>${quartz.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.mchange</groupId>
|
||||
<artifactId>c3p0</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP-java6</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<classifier>jakarta</classifier>
|
||||
<version>${shiro.version}</version>
|
||||
<!-- 排除仍使用了javax.servlet的依赖 -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-web</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- 引入适配jakarta的依赖包 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<classifier>jakarta</classifier>
|
||||
<version>${shiro.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-web</artifactId>
|
||||
<classifier>jakarta</classifier>
|
||||
<version>${shiro.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.whvcse</groupId>
|
||||
<artifactId>easy-captcha</artifactId>
|
||||
<version>${captcha.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>${easyexcel.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>${qiniu.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>${aliyun.oss.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>${aliyun.core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>cos_api</artifactId>
|
||||
<version>${qcloud.cos.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
27
system-admin/src/main/java/com/weather/AdminApplication.java
Normal file
27
system-admin/src/main/java/com/weather/AdminApplication.java
Normal file
@ -0,0 +1,27 @@
|
||||
package com.weather;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
|
||||
/**
|
||||
* weather-admin
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableAsync
|
||||
public class AdminApplication extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AdminApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(AdminApplication.class);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
package com.weather.common.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数据过滤注解
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface DataFilter {
|
||||
/**
|
||||
* 表的别名
|
||||
*/
|
||||
String tableAlias() default "";
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
String userId() default "creator";
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
String deptId() default "dept_id";
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
package com.weather.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 操作日志注解
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface LogOperation {
|
||||
|
||||
String value() default "";
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
|
||||
package com.weather.common.aspect;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.qiniu.util.StringUtils;
|
||||
import com.weather.common.annotation.DataFilter;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.exception.ErrorCode;
|
||||
import com.weather.common.exception.CommonException;
|
||||
import com.weather.common.interceptor.DataScope;
|
||||
import com.weather.modules.security.user.SecurityUser;
|
||||
import com.weather.modules.security.user.UserDetail;
|
||||
import com.weather.modules.sys.enums.SuperAdminEnum;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据过滤,切面处理类
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class DataFilterAspect {
|
||||
|
||||
@Pointcut("@annotation(com.weather.common.annotation.DataFilter)")
|
||||
public void dataFilterCut() {
|
||||
|
||||
}
|
||||
|
||||
@Before("dataFilterCut()")
|
||||
public void dataFilter(JoinPoint point) {
|
||||
Object params = point.getArgs()[0];
|
||||
if (params != null && params instanceof Map) {
|
||||
UserDetail user = SecurityUser.getUser();
|
||||
|
||||
//如果是超级管理员,则不进行数据过滤
|
||||
if (user.getSuperAdmin() == SuperAdminEnum.YES.value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
//否则进行数据过滤
|
||||
Map map = (Map) params;
|
||||
String sqlFilter = getSqlFilter(user, point);
|
||||
map.put(Constant.SQL_FILTER, new DataScope(sqlFilter));
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
throw new CommonException(ErrorCode.DATA_SCOPE_PARAMS_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据过滤的SQL
|
||||
*/
|
||||
private String getSqlFilter(UserDetail user, JoinPoint point) throws Exception {
|
||||
MethodSignature signature = (MethodSignature) point.getSignature();
|
||||
Method method = point.getTarget().getClass().getDeclaredMethod(signature.getName(), signature.getParameterTypes());
|
||||
DataFilter dataFilter = method.getAnnotation(DataFilter.class);
|
||||
|
||||
//获取表的别名
|
||||
String tableAlias = dataFilter.tableAlias();
|
||||
if (StrUtil.isNotBlank(tableAlias)) {
|
||||
tableAlias += ".";
|
||||
}
|
||||
|
||||
StringBuilder sqlFilter = new StringBuilder();
|
||||
sqlFilter.append(" (");
|
||||
|
||||
//部门ID列表
|
||||
List<Long> deptIdList = user.getDeptIdList();
|
||||
if (CollUtil.isNotEmpty(deptIdList)) {
|
||||
sqlFilter.append(tableAlias).append(dataFilter.deptId());
|
||||
|
||||
sqlFilter.append(" in(").append(StringUtils.join(deptIdList, ",")).append(")");
|
||||
}
|
||||
|
||||
//查询本人数据
|
||||
if (CollUtil.isNotEmpty(deptIdList)) {
|
||||
sqlFilter.append(" or ");
|
||||
}
|
||||
sqlFilter.append(tableAlias).append(dataFilter.userId()).append("=").append(user.getId());
|
||||
|
||||
sqlFilter.append(")");
|
||||
|
||||
return sqlFilter.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
|
||||
package com.weather.common.aspect;
|
||||
|
||||
import com.weather.common.annotation.LogOperation;
|
||||
import com.weather.common.utils.HttpContextUtils;
|
||||
import com.weather.common.utils.IpUtils;
|
||||
import com.weather.common.utils.JsonUtils;
|
||||
import com.weather.modules.log.entity.SysLogOperationEntity;
|
||||
import com.weather.modules.log.enums.OperationStatusEnum;
|
||||
import com.weather.modules.log.service.SysLogOperationService;
|
||||
import com.weather.modules.security.user.SecurityUser;
|
||||
import com.weather.modules.security.user.UserDetail;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 操作日志,切面处理类
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class LogOperationAspect {
|
||||
private final SysLogOperationService sysLogOperationService;
|
||||
|
||||
@Pointcut("@annotation(com.weather.common.annotation.LogOperation)")
|
||||
public void logPointCut() {
|
||||
|
||||
}
|
||||
|
||||
@Around("logPointCut()")
|
||||
public Object around(ProceedingJoinPoint point) throws Throwable {
|
||||
long beginTime = System.currentTimeMillis();
|
||||
try {
|
||||
//执行方法
|
||||
Object result = point.proceed();
|
||||
|
||||
//执行时长(毫秒)
|
||||
long time = System.currentTimeMillis() - beginTime;
|
||||
//保存日志
|
||||
saveLog(point, time, OperationStatusEnum.SUCCESS.value());
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
//执行时长(毫秒)
|
||||
long time = System.currentTimeMillis() - beginTime;
|
||||
//保存日志
|
||||
saveLog(point, time, OperationStatusEnum.FAIL.value());
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status) throws Exception {
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = joinPoint.getTarget().getClass().getDeclaredMethod(signature.getName(), signature.getParameterTypes());
|
||||
LogOperation annotation = method.getAnnotation(LogOperation.class);
|
||||
|
||||
SysLogOperationEntity log = new SysLogOperationEntity();
|
||||
if (annotation != null) {
|
||||
//注解上的描述
|
||||
log.setOperation(annotation.value());
|
||||
}
|
||||
|
||||
//登录用户信息
|
||||
UserDetail user = SecurityUser.getUser();
|
||||
if (user != null) {
|
||||
log.setCreatorName(user.getUsername());
|
||||
}
|
||||
|
||||
log.setStatus(status);
|
||||
log.setRequestTime((int) time);
|
||||
|
||||
//请求相关信息
|
||||
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
||||
log.setIp(IpUtils.getIpAddr(request));
|
||||
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
|
||||
log.setRequestUri(request.getRequestURI());
|
||||
log.setRequestMethod(request.getMethod());
|
||||
|
||||
//请求参数
|
||||
Object[] args = joinPoint.getArgs();
|
||||
try {
|
||||
String params = JsonUtils.toJsonString(args[0]);
|
||||
log.setRequestParams(params);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
//保存到DB
|
||||
sysLogOperationService.save(log);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.weather.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class FileServerConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
// 文件访问通过 FileDownloadController 提供,支持 Shiro 权限控制
|
||||
// 如需直接静态资源映射,可在此配置
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.weather.common.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Jackson 配置
|
||||
* <p>
|
||||
* 全局 Long → String 序列化,解决 Snowflake 19位ID 在 JavaScript 端精度丢失问题。
|
||||
* JS Number 安全整数上限为 2^53-1 (约16位),Snowflake ASSIGN_ID 为19位,超出精度范围。
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Configuration
|
||||
public class JacksonConfig {
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jacksonLongToStringCustomizer() {
|
||||
return builder -> {
|
||||
builder.serializerByType(Long.class, ToStringSerializer.instance);
|
||||
builder.serializerByType(long.class, ToStringSerializer.instance);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
package com.weather.common.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import com.weather.common.interceptor.DataFilterInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* mybatis-plus配置
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
||||
// 数据权限
|
||||
mybatisPlusInterceptor.addInnerInterceptor(new DataFilterInterceptor());
|
||||
// 分页插件
|
||||
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
||||
// 乐观锁
|
||||
mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
||||
// 防止全表更新与删除
|
||||
mybatisPlusInterceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
|
||||
|
||||
return mybatisPlusInterceptor;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
|
||||
package com.weather.common.config;
|
||||
|
||||
import com.weather.common.constant.Constant;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Swagger配置
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
public OpenAPI createRestApi() {
|
||||
return new OpenAPI()
|
||||
.info(apiInfo())
|
||||
.security(security());
|
||||
}
|
||||
|
||||
private Info apiInfo() {
|
||||
return new Info()
|
||||
.title("weather")
|
||||
.description("weather-admin文档")
|
||||
.version("5.x");
|
||||
}
|
||||
|
||||
private List<SecurityRequirement> security() {
|
||||
SecurityRequirement key = new SecurityRequirement();
|
||||
key.addList(Constant.TOKEN_HEADER, Constant.TOKEN_HEADER);
|
||||
|
||||
List<SecurityRequirement> list = new ArrayList<>();
|
||||
list.add(key);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
|
||||
package com.weather.common.exception;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.weather.common.utils.HttpContextUtils;
|
||||
import com.weather.common.utils.IpUtils;
|
||||
import com.weather.common.utils.JsonUtils;
|
||||
import com.weather.common.utils.Result;
|
||||
import com.weather.modules.log.entity.SysLogErrorEntity;
|
||||
import com.weather.modules.log.service.SysLogErrorService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 异常处理器
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
@AllArgsConstructor
|
||||
public class CustomExceptionHandler {
|
||||
private final SysLogErrorService sysLogErrorService;
|
||||
|
||||
/**
|
||||
* 处理自定义异常
|
||||
*/
|
||||
@ExceptionHandler(CommonException.class)
|
||||
public Result handleRenException(CommonException ex) {
|
||||
Result result = new Result();
|
||||
result.error(ex.getCode(), ex.getMsg());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ExceptionHandler(DuplicateKeyException.class)
|
||||
public Result handleDuplicateKeyException(DuplicateKeyException ex) {
|
||||
Result result = new Result();
|
||||
result.error(ErrorCode.DB_RECORD_EXISTS);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ExceptionHandler(UnauthorizedException.class)
|
||||
public Result handleUnauthorizedException(UnauthorizedException ex) {
|
||||
return new Result().error(ErrorCode.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Result handleException(Exception ex) {
|
||||
log.error(ex.getMessage(), ex);
|
||||
|
||||
saveLog(ex);
|
||||
|
||||
return new Result().error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存异常日志
|
||||
*/
|
||||
private void saveLog(Exception ex) {
|
||||
SysLogErrorEntity log = new SysLogErrorEntity();
|
||||
|
||||
//请求相关信息
|
||||
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
||||
log.setIp(IpUtils.getIpAddr(request));
|
||||
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
|
||||
log.setRequestUri(request.getRequestURI());
|
||||
log.setRequestMethod(request.getMethod());
|
||||
Map<String, String> params = HttpContextUtils.getParameterMap(request);
|
||||
if (MapUtil.isNotEmpty(params)) {
|
||||
log.setRequestParams(JsonUtils.toJsonString(params));
|
||||
}
|
||||
|
||||
//异常信息
|
||||
log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex));
|
||||
|
||||
//保存
|
||||
sysLogErrorService.save(log);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
|
||||
|
||||
package com.weather.common.handler;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.weather.modules.security.user.SecurityUser;
|
||||
import com.weather.modules.security.user.UserDetail;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 公共字段,自动填充值
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Component
|
||||
public class FieldMetaObjectHandler implements MetaObjectHandler {
|
||||
private final static String CREATE_DATE = "createDate";
|
||||
private final static String CREATOR = "creator";
|
||||
private final static String UPDATE_DATE = "updateDate";
|
||||
private final static String UPDATER = "updater";
|
||||
private final static String DEPT_ID = "deptId";
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
UserDetail user = SecurityUser.getUser();
|
||||
Date date = new Date();
|
||||
|
||||
//创建者
|
||||
strictInsertFill(metaObject, CREATOR, Long.class, user.getId());
|
||||
//创建时间
|
||||
strictInsertFill(metaObject, CREATE_DATE, Date.class, date);
|
||||
|
||||
//创建者所属部门
|
||||
strictInsertFill(metaObject, DEPT_ID, Long.class, user.getDeptId());
|
||||
|
||||
//更新者
|
||||
strictInsertFill(metaObject, UPDATER, Long.class, user.getId());
|
||||
//更新时间
|
||||
strictInsertFill(metaObject, UPDATE_DATE, Date.class, date);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
//更新者
|
||||
strictUpdateFill(metaObject, UPDATER, Long.class, SecurityUser.getUserId());
|
||||
//更新时间
|
||||
strictUpdateFill(metaObject, UPDATE_DATE, Date.class, new Date());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
|
||||
|
||||
package com.weather.common.interceptor;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
|
||||
import net.sf.jsqlparser.JSQLParserException;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.StringValue;
|
||||
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
|
||||
import net.sf.jsqlparser.statement.select.PlainSelect;
|
||||
import net.sf.jsqlparser.statement.select.Select;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.BoundSql;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.session.ResultHandler;
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据过滤
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public class DataFilterInterceptor implements InnerInterceptor {
|
||||
|
||||
@Override
|
||||
public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) {
|
||||
DataScope scope = getDataScope(parameter);
|
||||
// 不进行数据过滤
|
||||
if(scope == null || StrUtil.isBlank(scope.getSqlFilter())){
|
||||
return;
|
||||
}
|
||||
|
||||
// 拼接新SQL
|
||||
String buildSql = getSelect(boundSql.getSql(), scope);
|
||||
|
||||
// 重写SQL
|
||||
PluginUtils.mpBoundSql(boundSql).sql(buildSql);
|
||||
}
|
||||
|
||||
private DataScope getDataScope(Object parameter){
|
||||
if (parameter == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
// 判断参数里是否有DataScope对象
|
||||
if (parameter instanceof Map) {
|
||||
Map<?, ?> parameterMap = (Map<?, ?>) parameter;
|
||||
for (Map.Entry entry : parameterMap.entrySet()) {
|
||||
if (entry.getValue() != null && entry.getValue() instanceof DataScope) {
|
||||
return (DataScope) entry.getValue();
|
||||
}
|
||||
}
|
||||
} else if (parameter instanceof DataScope) {
|
||||
return (DataScope) parameter;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getSelect(String buildSql, DataScope scope){
|
||||
try {
|
||||
Select select = (Select) CCJSqlParserUtil.parse(buildSql);
|
||||
PlainSelect plainSelect = (PlainSelect) select.getSelectBody();
|
||||
|
||||
Expression expression = plainSelect.getWhere();
|
||||
if(expression == null){
|
||||
plainSelect.setWhere(new StringValue(scope.getSqlFilter()));
|
||||
}else{
|
||||
AndExpression andExpression = new AndExpression(expression, new StringValue(scope.getSqlFilter()));
|
||||
plainSelect.setWhere(andExpression);
|
||||
}
|
||||
|
||||
return select.toString().replaceAll("'", "");
|
||||
}catch (JSQLParserException e){
|
||||
return buildSql;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
package com.weather.common.interceptor;
|
||||
|
||||
/**
|
||||
* 数据范围
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class DataScope {
|
||||
private String sqlFilter;
|
||||
|
||||
public DataScope(String sqlFilter) {
|
||||
this.sqlFilter = sqlFilter;
|
||||
}
|
||||
|
||||
public String getSqlFilter() {
|
||||
return sqlFilter;
|
||||
}
|
||||
|
||||
public void setSqlFilter(String sqlFilter) {
|
||||
this.sqlFilter = sqlFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.sqlFilter;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
|
||||
package com.weather.common.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.converters.longconverter.LongStringConverter;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* excel工具类
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public class ExcelUtils {
|
||||
|
||||
/**
|
||||
* Excel导出
|
||||
*
|
||||
* @param response response
|
||||
* @param fileName 文件名
|
||||
* @param sheetName sheetName
|
||||
* @param list 数据List
|
||||
* @param pojoClass 对象Class
|
||||
*/
|
||||
public static void exportExcel(HttpServletResponse response, String fileName, String sheetName, List<?> list,
|
||||
Class<?> pojoClass) throws IOException {
|
||||
if (StrUtil.isBlank(fileName)) {
|
||||
//当前日期
|
||||
fileName = DateUtils.format(new Date());
|
||||
}
|
||||
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
fileName = URLUtil.encode(fileName, StandardCharsets.UTF_8);
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
EasyExcel.write(response.getOutputStream(), pojoClass).registerConverter(new LongStringConverter()).sheet(sheetName).doWrite(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Excel导出,先sourceList转换成List<targetClass>,再导出
|
||||
*
|
||||
* @param response response
|
||||
* @param fileName 文件名
|
||||
* @param sheetName sheetName
|
||||
* @param sourceList 原数据List
|
||||
* @param targetClass 目标对象Class
|
||||
*/
|
||||
public static void exportExcelToTarget(HttpServletResponse response, String fileName, String sheetName, List<?> sourceList,
|
||||
Class<?> targetClass) throws Exception {
|
||||
List targetList = new ArrayList<>(sourceList.size());
|
||||
for (Object source : sourceList) {
|
||||
Object target = targetClass.newInstance();
|
||||
BeanUtils.copyProperties(source, target);
|
||||
targetList.add(target);
|
||||
}
|
||||
|
||||
exportExcel(response, fileName, sheetName, targetList, targetClass);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.weather.common.utils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
|
||||
public class TimeUtils {
|
||||
|
||||
public static LocalDate convertToLocalDateTime(Date date) {
|
||||
return date.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
package com.weather.common.validator.group;
|
||||
|
||||
/**
|
||||
* 阿里云
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public interface AliyunGroup {
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
package com.weather.common.validator.group;
|
||||
|
||||
/**
|
||||
* 腾讯云
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public interface QcloudGroup {
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
package com.weather.common.validator.group;
|
||||
|
||||
/**
|
||||
* 七牛
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public interface QiniuGroup {
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
///**
|
||||
// * Copyright (c) 2018 人人开源 All rights reserved.
|
||||
// *
|
||||
// * https://www.renren.io
|
||||
// *
|
||||
// * 版权所有,侵权必究!
|
||||
// */
|
||||
//
|
||||
//package io.weather.modules.job.config;
|
||||
//
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
//
|
||||
//import javax.sql.DataSource;
|
||||
//import java.util.Properties;
|
||||
//
|
||||
///**
|
||||
// * 定时任务配置(备注:集群需要打开注释)
|
||||
// *
|
||||
// * @author 123
|
||||
// */
|
||||
//@Configuration
|
||||
//public class ScheduleConfig {
|
||||
//
|
||||
// @Bean
|
||||
// public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
|
||||
// SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
||||
// factory.setDataSource(dataSource);
|
||||
//
|
||||
// //quartz参数
|
||||
// Properties prop = new Properties();
|
||||
// prop.put("org.quartz.scheduler.instanceName", "RenrenScheduler");
|
||||
// prop.put("org.quartz.scheduler.instanceId", "AUTO");
|
||||
// //线程池配置
|
||||
// prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
|
||||
// prop.put("org.quartz.threadPool.threadCount", "20");
|
||||
// prop.put("org.quartz.threadPool.threadPriority", "5");
|
||||
// //JobStore配置
|
||||
// prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore");
|
||||
// //集群配置
|
||||
// prop.put("org.quartz.jobStore.isClustered", "true");
|
||||
// prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
|
||||
// prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
|
||||
//
|
||||
// prop.put("org.quartz.jobStore.misfireThreshold", "12000");
|
||||
// prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
|
||||
// prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
|
||||
//
|
||||
// //PostgreSQL数据库,需要打开此注释
|
||||
// //prop.put("org.quartz.jobStore.driverDelegateClass", "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate");
|
||||
//
|
||||
// factory.setQuartzProperties(prop);
|
||||
//
|
||||
// factory.setSchedulerName("RenrenScheduler");
|
||||
// //延时启动
|
||||
// factory.setStartupDelay(30);
|
||||
// factory.setApplicationContextSchedulerContextKey("applicationContextKey");
|
||||
// //可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
|
||||
// factory.setOverwriteExistingJobs(true);
|
||||
// //设置自动启动,默认为true
|
||||
// factory.setAutoStartup(true);
|
||||
//
|
||||
// return factory;
|
||||
// }
|
||||
//}
|
||||
@ -0,0 +1,126 @@
|
||||
|
||||
package com.weather.modules.job.controller;
|
||||
|
||||
import com.weather.common.annotation.LogOperation;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.utils.Result;
|
||||
import com.weather.common.validator.ValidatorUtils;
|
||||
import com.weather.common.validator.group.AddGroup;
|
||||
import com.weather.common.validator.group.DefaultGroup;
|
||||
import com.weather.common.validator.group.UpdateGroup;
|
||||
import com.weather.modules.job.dto.ScheduleJobDTO;
|
||||
import com.weather.modules.job.service.ScheduleJobService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/schedule")
|
||||
@Tag(name = "定时任务")
|
||||
@AllArgsConstructor
|
||||
public class ScheduleJobController {
|
||||
private final ScheduleJobService scheduleJobService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
@Parameters({
|
||||
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = "beanName", description = "beanName", in = ParameterIn.QUERY, ref = "String")
|
||||
})
|
||||
@RequiresPermissions("sys:schedule:page")
|
||||
public Result<PageData<ScheduleJobDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||
PageData<ScheduleJobDTO> page = scheduleJobService.page(params);
|
||||
|
||||
return new Result<PageData<ScheduleJobDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
@RequiresPermissions("sys:schedule:info")
|
||||
public Result<ScheduleJobDTO> info(@PathVariable("id") Long id) {
|
||||
ScheduleJobDTO schedule = scheduleJobService.get(id);
|
||||
|
||||
return new Result<ScheduleJobDTO>().ok(schedule);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
@LogOperation("保存")
|
||||
@RequiresPermissions("sys:schedule:save")
|
||||
public Result save(@RequestBody ScheduleJobDTO dto) {
|
||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||
|
||||
scheduleJobService.save(dto);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
@LogOperation("修改")
|
||||
@RequiresPermissions("sys:schedule:update")
|
||||
public Result update(@RequestBody ScheduleJobDTO dto) {
|
||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||
|
||||
scheduleJobService.update(dto);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@LogOperation("删除")
|
||||
@RequiresPermissions("sys:schedule:delete")
|
||||
public Result delete(@RequestBody Long[] ids) {
|
||||
scheduleJobService.deleteBatch(ids);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@PutMapping("/run")
|
||||
@Operation(summary = "立即执行")
|
||||
@LogOperation("立即执行")
|
||||
@RequiresPermissions("sys:schedule:run")
|
||||
public Result run(@RequestBody Long[] ids) {
|
||||
scheduleJobService.run(ids);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@PutMapping("/pause")
|
||||
@Operation(summary = "暂停")
|
||||
@LogOperation("暂停")
|
||||
@RequiresPermissions("sys:schedule:pause")
|
||||
public Result pause(@RequestBody Long[] ids) {
|
||||
scheduleJobService.pause(ids);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@PutMapping("/resume")
|
||||
@Operation(summary = "恢复")
|
||||
@LogOperation("恢复")
|
||||
@RequiresPermissions("sys:schedule:resume")
|
||||
public Result resume(@RequestBody Long[] ids) {
|
||||
scheduleJobService.resume(ids);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
|
||||
package com.weather.modules.job.controller;
|
||||
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.utils.Result;
|
||||
import com.weather.modules.job.dto.ScheduleJobLogDTO;
|
||||
import com.weather.modules.job.service.ScheduleJobLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 定时任务日志
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/scheduleLog")
|
||||
@Tag(name = "定时任务日志")
|
||||
@AllArgsConstructor
|
||||
public class ScheduleJobLogController {
|
||||
private final ScheduleJobLogService scheduleJobLogService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
@Parameters({
|
||||
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = "jobId", description = "jobId", in = ParameterIn.QUERY, ref = "String")
|
||||
})
|
||||
@RequiresPermissions("sys:schedule:log")
|
||||
public Result<PageData<ScheduleJobLogDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||
PageData<ScheduleJobLogDTO> page = scheduleJobLogService.page(params);
|
||||
|
||||
return new Result<PageData<ScheduleJobLogDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
@RequiresPermissions("sys:schedule:log")
|
||||
public Result<ScheduleJobLogDTO> info(@PathVariable("id") Long id) {
|
||||
ScheduleJobLogDTO log = scheduleJobLogService.get(id);
|
||||
|
||||
return new Result<ScheduleJobLogDTO>().ok(log);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.dao;
|
||||
|
||||
import com.weather.common.dao.BaseDao;
|
||||
import com.weather.modules.job.entity.ScheduleJobEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleJobDao extends BaseDao<ScheduleJobEntity> {
|
||||
|
||||
/**
|
||||
* 批量更新状态
|
||||
*/
|
||||
int updateBatch(Map<String, Object> map);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.dao;
|
||||
|
||||
import com.weather.common.dao.BaseDao;
|
||||
import com.weather.modules.job.entity.ScheduleJobLogEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 定时任务日志
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleJobLogDao extends BaseDao<ScheduleJobLogEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.weather.common.validator.group.AddGroup;
|
||||
import com.weather.common.validator.group.DefaultGroup;
|
||||
import com.weather.common.validator.group.UpdateGroup;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Null;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "定时任务")
|
||||
public class ScheduleJobDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "id")
|
||||
@Null(message="{id.null}", groups = AddGroup.class)
|
||||
@NotNull(message="{id.require}", groups = UpdateGroup.class)
|
||||
private Long id;
|
||||
|
||||
@Schema(title = "spring bean名称")
|
||||
@NotBlank(message = "{schedule.bean.require}", groups = DefaultGroup.class)
|
||||
private String beanName;
|
||||
|
||||
@Schema(title = "参数")
|
||||
private String params;
|
||||
|
||||
@Schema(title = "cron表达式")
|
||||
@NotBlank(message = "{schedule.cron.require}", groups = DefaultGroup.class)
|
||||
private String cronExpression;
|
||||
|
||||
@Schema(title = "任务状态 0:暂停 1:正常")
|
||||
@Range(min=0, max=1, message = "{schedule.status.range}", groups = DefaultGroup.class)
|
||||
private Integer status;
|
||||
|
||||
@Schema(title = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(title = "创建时间")
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
private Date createDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 定时任务日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "定时任务日志")
|
||||
public class ScheduleJobLogDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(title = "任务id")
|
||||
private Long jobId;
|
||||
|
||||
@Schema(title = "spring bean名称")
|
||||
private String beanName;
|
||||
|
||||
@Schema(title = "参数")
|
||||
private String params;
|
||||
|
||||
@Schema(title = "任务状态 0:失败 1:成功")
|
||||
private Integer status;
|
||||
|
||||
@Schema(title = "失败信息")
|
||||
private String error;
|
||||
|
||||
@Schema(title = "耗时(单位:毫秒)")
|
||||
private Integer times;
|
||||
|
||||
@Schema(title = "创建时间")
|
||||
private Date createDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.weather.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("schedule_job")
|
||||
public class ScheduleJobEntity extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* spring bean名称
|
||||
*/
|
||||
private String beanName;
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
private String params;
|
||||
/**
|
||||
* cron表达式
|
||||
*/
|
||||
private String cronExpression;
|
||||
/**
|
||||
* 任务状态 0:暂停 1:正常
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long updater;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateDate;
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 定时任务日志
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Data
|
||||
@TableName("schedule_job_log")
|
||||
public class ScheduleJobLogEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
private Long jobId;
|
||||
/**
|
||||
* spring bean名称
|
||||
*/
|
||||
private String beanName;
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
private String params;
|
||||
/**
|
||||
* 任务状态 0:失败 1:成功
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 失败信息
|
||||
*/
|
||||
private String error;
|
||||
/**
|
||||
* 耗时(单位:毫秒)
|
||||
*/
|
||||
private Integer times;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
|
||||
package com.weather.modules.job.init;
|
||||
|
||||
import com.weather.modules.job.dao.ScheduleJobDao;
|
||||
import com.weather.modules.job.entity.ScheduleJobEntity;
|
||||
import com.weather.modules.job.utils.ScheduleUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.Scheduler;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 初始化定时任务数据
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class JobCommandLineRunner implements CommandLineRunner {
|
||||
private final Scheduler scheduler;
|
||||
private final ScheduleJobDao scheduleJobDao;
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
List<ScheduleJobEntity> scheduleJobList = scheduleJobDao.selectList(null);
|
||||
for (ScheduleJobEntity scheduleJob : scheduleJobList) {
|
||||
CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getId());
|
||||
//如果不存在,则创建
|
||||
if (cronTrigger == null) {
|
||||
ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
|
||||
} else {
|
||||
ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.service;
|
||||
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.BaseService;
|
||||
import com.weather.modules.job.dto.ScheduleJobLogDTO;
|
||||
import com.weather.modules.job.entity.ScheduleJobLogEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 定时任务日志
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public interface ScheduleJobLogService extends BaseService<ScheduleJobLogEntity> {
|
||||
|
||||
PageData<ScheduleJobLogDTO> page(Map<String, Object> params);
|
||||
|
||||
ScheduleJobLogDTO get(Long id);
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.service;
|
||||
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.BaseService;
|
||||
import com.weather.modules.job.dto.ScheduleJobDTO;
|
||||
import com.weather.modules.job.entity.ScheduleJobEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public interface ScheduleJobService extends BaseService<ScheduleJobEntity> {
|
||||
|
||||
PageData<ScheduleJobDTO> page(Map<String, Object> params);
|
||||
|
||||
ScheduleJobDTO get(Long id);
|
||||
|
||||
/**
|
||||
* 保存定时任务
|
||||
*/
|
||||
void save(ScheduleJobDTO dto);
|
||||
|
||||
/**
|
||||
* 更新定时任务
|
||||
*/
|
||||
void update(ScheduleJobDTO dto);
|
||||
|
||||
/**
|
||||
* 批量删除定时任务
|
||||
*/
|
||||
void deleteBatch(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量更新定时任务状态
|
||||
*/
|
||||
int updateBatch(Long[] ids, int status);
|
||||
|
||||
/**
|
||||
* 立即执行
|
||||
*/
|
||||
void run(Long[] ids);
|
||||
|
||||
/**
|
||||
* 暂停运行
|
||||
*/
|
||||
void pause(Long[] ids);
|
||||
|
||||
/**
|
||||
* 恢复运行
|
||||
*/
|
||||
void resume(Long[] ids);
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.impl.BaseServiceImpl;
|
||||
import com.weather.common.utils.ConvertUtils;
|
||||
import com.weather.modules.job.dao.ScheduleJobLogDao;
|
||||
import com.weather.modules.job.dto.ScheduleJobLogDTO;
|
||||
import com.weather.modules.job.entity.ScheduleJobLogEntity;
|
||||
import com.weather.modules.job.service.ScheduleJobLogService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ScheduleJobLogServiceImpl extends BaseServiceImpl<ScheduleJobLogDao, ScheduleJobLogEntity> implements ScheduleJobLogService {
|
||||
|
||||
@Override
|
||||
public PageData<ScheduleJobLogDTO> page(Map<String, Object> params) {
|
||||
IPage<ScheduleJobLogEntity> page = baseDao.selectPage(
|
||||
getPage(params, Constant.CREATE_DATE, false),
|
||||
getWrapper(params)
|
||||
);
|
||||
return getPageData(page, ScheduleJobLogDTO.class);
|
||||
}
|
||||
|
||||
private QueryWrapper<ScheduleJobLogEntity> getWrapper(Map<String, Object> params){
|
||||
String jobId = (String)params.get("jobId");
|
||||
|
||||
QueryWrapper<ScheduleJobLogEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StrUtil.isNotBlank(jobId), "job_id", jobId);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduleJobLogDTO get(Long id) {
|
||||
ScheduleJobLogEntity entity = baseDao.selectById(id);
|
||||
|
||||
return ConvertUtils.sourceToTarget(entity, ScheduleJobLogDTO.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,123 @@
|
||||
|
||||
package com.weather.modules.job.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.impl.BaseServiceImpl;
|
||||
import com.weather.common.utils.ConvertUtils;
|
||||
import com.weather.modules.job.dao.ScheduleJobDao;
|
||||
import com.weather.modules.job.dto.ScheduleJobDTO;
|
||||
import com.weather.modules.job.entity.ScheduleJobEntity;
|
||||
import com.weather.modules.job.service.ScheduleJobService;
|
||||
import com.weather.modules.job.utils.ScheduleUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.quartz.Scheduler;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ScheduleJobServiceImpl extends BaseServiceImpl<ScheduleJobDao, ScheduleJobEntity> implements ScheduleJobService {
|
||||
private final Scheduler scheduler;
|
||||
|
||||
@Override
|
||||
public PageData<ScheduleJobDTO> page(Map<String, Object> params) {
|
||||
IPage<ScheduleJobEntity> page = baseDao.selectPage(
|
||||
getPage(params, Constant.CREATE_DATE, false),
|
||||
getWrapper(params)
|
||||
);
|
||||
return getPageData(page, ScheduleJobDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduleJobDTO get(Long id) {
|
||||
ScheduleJobEntity entity = baseDao.selectById(id);
|
||||
|
||||
return ConvertUtils.sourceToTarget(entity, ScheduleJobDTO.class);
|
||||
}
|
||||
|
||||
private QueryWrapper<ScheduleJobEntity> getWrapper(Map<String, Object> params) {
|
||||
String beanName = (String) params.get("beanName");
|
||||
|
||||
QueryWrapper<ScheduleJobEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.like(StrUtil.isNotBlank(beanName), "bean_name", beanName);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(ScheduleJobDTO dto) {
|
||||
ScheduleJobEntity entity = ConvertUtils.sourceToTarget(dto, ScheduleJobEntity.class);
|
||||
|
||||
entity.setStatus(Constant.ScheduleStatus.NORMAL.getValue());
|
||||
this.insert(entity);
|
||||
|
||||
ScheduleUtils.createScheduleJob(scheduler, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(ScheduleJobDTO dto) {
|
||||
ScheduleJobEntity entity = ConvertUtils.sourceToTarget(dto, ScheduleJobEntity.class);
|
||||
|
||||
ScheduleUtils.updateScheduleJob(scheduler, entity);
|
||||
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteBatch(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
ScheduleUtils.deleteScheduleJob(scheduler, id);
|
||||
}
|
||||
|
||||
//删除数据
|
||||
this.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBatch(Long[] ids, int status) {
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("ids", ids);
|
||||
map.put("status", status);
|
||||
return baseDao.updateBatch(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void run(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
ScheduleUtils.run(scheduler, this.selectById(id));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void pause(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
ScheduleUtils.pauseJob(scheduler, id);
|
||||
}
|
||||
|
||||
updateBatch(ids, Constant.ScheduleStatus.PAUSE.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void resume(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
ScheduleUtils.resumeJob(scheduler, id);
|
||||
}
|
||||
|
||||
updateBatch(ids, Constant.ScheduleStatus.NORMAL.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.task;
|
||||
|
||||
/**
|
||||
* 定时任务接口,所有定时任务都要实现该接口
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public interface ITask {
|
||||
|
||||
/**
|
||||
* 执行定时任务接口
|
||||
*
|
||||
* @param params 参数,多参数使用JSON数据
|
||||
*/
|
||||
void run(String params);
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.task;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 测试定时任务(演示Demo,可删除)
|
||||
*
|
||||
* testTask为spring bean的名称
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Component("testTask")
|
||||
public class TestTask implements ITask{
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public void run(String params){
|
||||
logger.debug("TestTask定时任务正在执行,参数为:{}", params);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.utils;
|
||||
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.exception.ExceptionUtils;
|
||||
import com.weather.common.utils.SpringContextUtils;
|
||||
import com.weather.modules.job.entity.ScheduleJobEntity;
|
||||
import com.weather.modules.job.entity.ScheduleJobLogEntity;
|
||||
import com.weather.modules.job.service.ScheduleJobLogService;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public class ScheduleJob extends QuartzJobBean {
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext context) {
|
||||
ScheduleJobEntity scheduleJob = (ScheduleJobEntity) context.getMergedJobDataMap().
|
||||
get(ScheduleUtils.JOB_PARAM_KEY);
|
||||
|
||||
//数据库保存执行记录
|
||||
ScheduleJobLogEntity log = new ScheduleJobLogEntity();
|
||||
log.setJobId(scheduleJob.getId());
|
||||
log.setBeanName(scheduleJob.getBeanName());
|
||||
log.setParams(scheduleJob.getParams());
|
||||
log.setCreateDate(new Date());
|
||||
|
||||
//任务开始时间
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
//执行任务
|
||||
logger.info("任务准备执行,任务ID:{}", scheduleJob.getId());
|
||||
Object target = SpringContextUtils.getBean(scheduleJob.getBeanName());
|
||||
Method method = target.getClass().getDeclaredMethod("run", String.class);
|
||||
method.invoke(target, scheduleJob.getParams());
|
||||
|
||||
//任务执行总时长
|
||||
long times = System.currentTimeMillis() - startTime;
|
||||
log.setTimes((int)times);
|
||||
//任务状态
|
||||
log.setStatus(Constant.SUCCESS);
|
||||
|
||||
logger.info("任务执行完毕,任务ID:{} 总共耗时:{} 毫秒", scheduleJob.getId(), times);
|
||||
} catch (Exception e) {
|
||||
logger.error("任务执行失败,任务ID:{}", scheduleJob.getId(), e);
|
||||
|
||||
//任务执行总时长
|
||||
long times = System.currentTimeMillis() - startTime;
|
||||
log.setTimes((int)times);
|
||||
|
||||
//任务状态
|
||||
log.setStatus(Constant.FAIL);
|
||||
log.setError(ExceptionUtils.getErrorStackTrace(e));
|
||||
}finally {
|
||||
//获取spring bean
|
||||
ScheduleJobLogService scheduleJobLogService = SpringContextUtils.getBean(ScheduleJobLogService.class);
|
||||
scheduleJobLogService.insert(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,155 @@
|
||||
|
||||
|
||||
package com.weather.modules.job.utils;
|
||||
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.exception.ErrorCode;
|
||||
import com.weather.common.exception.CommonException;
|
||||
import com.weather.modules.job.entity.ScheduleJobEntity;
|
||||
import org.quartz.*;
|
||||
|
||||
/**
|
||||
* 定时任务工具类
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public class ScheduleUtils {
|
||||
private final static String JOB_NAME = "TASK_";
|
||||
/**
|
||||
* 任务调度参数key
|
||||
*/
|
||||
public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";
|
||||
|
||||
/**
|
||||
* 获取触发器key
|
||||
*/
|
||||
public static TriggerKey getTriggerKey(Long jobId) {
|
||||
return TriggerKey.triggerKey(JOB_NAME + jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取jobKey
|
||||
*/
|
||||
public static JobKey getJobKey(Long jobId) {
|
||||
return JobKey.jobKey(JOB_NAME + jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表达式触发器
|
||||
*/
|
||||
public static CronTrigger getCronTrigger(Scheduler scheduler, Long jobId) {
|
||||
try {
|
||||
return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId));
|
||||
} catch (SchedulerException e) {
|
||||
throw new CommonException(ErrorCode.JOB_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建定时任务
|
||||
*/
|
||||
public static void createScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
|
||||
try {
|
||||
//构建job信息
|
||||
JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(scheduleJob.getId())).build();
|
||||
|
||||
//表达式调度构建器
|
||||
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression())
|
||||
.withMisfireHandlingInstructionDoNothing();
|
||||
|
||||
//按新的cronExpression表达式构建一个新的trigger
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(scheduleJob.getId())).withSchedule(scheduleBuilder).build();
|
||||
|
||||
//放入参数,运行时的方法可以获取
|
||||
jobDetail.getJobDataMap().put(JOB_PARAM_KEY, scheduleJob);
|
||||
|
||||
scheduler.scheduleJob(jobDetail, trigger);
|
||||
|
||||
//暂停任务
|
||||
if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
|
||||
pauseJob(scheduler, scheduleJob.getId());
|
||||
}
|
||||
} catch (SchedulerException e) {
|
||||
throw new CommonException(ErrorCode.JOB_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新定时任务
|
||||
*/
|
||||
public static void updateScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
|
||||
try {
|
||||
TriggerKey triggerKey = getTriggerKey(scheduleJob.getId());
|
||||
|
||||
//表达式调度构建器
|
||||
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression())
|
||||
.withMisfireHandlingInstructionDoNothing();
|
||||
|
||||
CronTrigger trigger = getCronTrigger(scheduler, scheduleJob.getId());
|
||||
|
||||
//按新的cronExpression表达式重新构建trigger
|
||||
trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
|
||||
|
||||
//参数
|
||||
trigger.getJobDataMap().put(JOB_PARAM_KEY, scheduleJob);
|
||||
|
||||
scheduler.rescheduleJob(triggerKey, trigger);
|
||||
|
||||
//暂停任务
|
||||
if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
|
||||
pauseJob(scheduler, scheduleJob.getId());
|
||||
}
|
||||
|
||||
} catch (SchedulerException e) {
|
||||
throw new CommonException(ErrorCode.JOB_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 立即执行任务
|
||||
*/
|
||||
public static void run(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
|
||||
try {
|
||||
//参数
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
dataMap.put(JOB_PARAM_KEY, scheduleJob);
|
||||
|
||||
scheduler.triggerJob(getJobKey(scheduleJob.getId()), dataMap);
|
||||
} catch (SchedulerException e) {
|
||||
throw new CommonException(ErrorCode.JOB_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停任务
|
||||
*/
|
||||
public static void pauseJob(Scheduler scheduler, Long jobId) {
|
||||
try {
|
||||
scheduler.pauseJob(getJobKey(jobId));
|
||||
} catch (SchedulerException e) {
|
||||
throw new CommonException(ErrorCode.JOB_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复任务
|
||||
*/
|
||||
public static void resumeJob(Scheduler scheduler, Long jobId) {
|
||||
try {
|
||||
scheduler.resumeJob(getJobKey(jobId));
|
||||
} catch (SchedulerException e) {
|
||||
throw new CommonException(ErrorCode.JOB_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时任务
|
||||
*/
|
||||
public static void deleteScheduleJob(Scheduler scheduler, Long jobId) {
|
||||
try {
|
||||
scheduler.deleteJob(getJobKey(jobId));
|
||||
} catch (SchedulerException e) {
|
||||
throw new CommonException(ErrorCode.JOB_ERROR, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
|
||||
package com.weather.modules.log.controller;
|
||||
|
||||
import com.weather.common.annotation.LogOperation;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.utils.ExcelUtils;
|
||||
import com.weather.common.utils.Result;
|
||||
import com.weather.modules.log.dto.SysLogErrorDTO;
|
||||
import com.weather.modules.log.excel.SysLogErrorExcel;
|
||||
import com.weather.modules.log.service.SysLogErrorService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 异常日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("sys/log/error")
|
||||
@Tag(name = "异常日志")
|
||||
@AllArgsConstructor
|
||||
public class SysLogErrorController {
|
||||
private final SysLogErrorService sysLogErrorService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
@Parameters({
|
||||
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)", in = ParameterIn.QUERY, ref = "String")
|
||||
})
|
||||
@RequiresPermissions("sys:log:error")
|
||||
public Result<PageData<SysLogErrorDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||
PageData<SysLogErrorDTO> page = sysLogErrorService.page(params);
|
||||
|
||||
return new Result<PageData<SysLogErrorDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("export")
|
||||
@Operation(summary = "导出")
|
||||
@LogOperation("导出")
|
||||
@RequiresPermissions("sys:log:error")
|
||||
public void export(@Parameter(hidden = true) @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
||||
List<SysLogErrorDTO> list = sysLogErrorService.list(params);
|
||||
|
||||
ExcelUtils.exportExcelToTarget(response, null, "异常日志", list, SysLogErrorExcel.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
|
||||
package com.weather.modules.log.controller;
|
||||
|
||||
import com.weather.common.annotation.LogOperation;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.utils.ExcelUtils;
|
||||
import com.weather.common.utils.Result;
|
||||
import com.weather.modules.log.dto.SysLogLoginDTO;
|
||||
import com.weather.modules.log.excel.SysLogLoginExcel;
|
||||
import com.weather.modules.log.service.SysLogLoginService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 登录日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("sys/log/login")
|
||||
@Tag(name = "登录日志")
|
||||
@AllArgsConstructor
|
||||
public class SysLogLoginController {
|
||||
private final SysLogLoginService sysLogLoginService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
@Parameters({
|
||||
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = "status", description = "状态 0:失败 1:成功 2:账号已锁定", in = ParameterIn.QUERY, ref = "int"),
|
||||
@Parameter(name = "creatorName", description = "用户名", in = ParameterIn.QUERY, ref = "String")
|
||||
})
|
||||
@RequiresPermissions("sys:log:login")
|
||||
public Result<PageData<SysLogLoginDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||
PageData<SysLogLoginDTO> page = sysLogLoginService.page(params);
|
||||
|
||||
return new Result<PageData<SysLogLoginDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("export")
|
||||
@Operation(summary = "导出")
|
||||
@LogOperation("导出")
|
||||
@Parameters({
|
||||
@Parameter(name = "status", description = "状态 0:失败 1:成功 2:账号已锁定", in = ParameterIn.QUERY, ref = "int"),
|
||||
@Parameter(name = "creatorName", description = "用户名", in = ParameterIn.QUERY, ref = "String")
|
||||
})
|
||||
@RequiresPermissions("sys:log:login")
|
||||
public void export(@Parameter(hidden = true) @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
||||
List<SysLogLoginDTO> list = sysLogLoginService.list(params);
|
||||
|
||||
ExcelUtils.exportExcelToTarget(response, null, "登录日志", list, SysLogLoginExcel.class);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
|
||||
package com.weather.modules.log.controller;
|
||||
|
||||
import com.weather.common.annotation.LogOperation;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.utils.ExcelUtils;
|
||||
import com.weather.common.utils.Result;
|
||||
import com.weather.modules.log.dto.SysLogOperationDTO;
|
||||
import com.weather.modules.log.excel.SysLogOperationExcel;
|
||||
import com.weather.modules.log.service.SysLogOperationService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("sys/log/operation")
|
||||
@Tag(name = "操作日志")
|
||||
@AllArgsConstructor
|
||||
public class SysLogOperationController {
|
||||
private final SysLogOperationService sysLogOperationService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
@Parameters({
|
||||
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", in = ParameterIn.QUERY, required = true, ref = "int"),
|
||||
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)", in = ParameterIn.QUERY, ref = "String"),
|
||||
@Parameter(name = "status", description = "状态 0:失败 1:成功", in = ParameterIn.QUERY, ref = "int")
|
||||
})
|
||||
@RequiresPermissions("sys:log:operation")
|
||||
public Result<PageData<SysLogOperationDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||
PageData<SysLogOperationDTO> page = sysLogOperationService.page(params);
|
||||
|
||||
return new Result<PageData<SysLogOperationDTO>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("export")
|
||||
@Operation(summary = "导出")
|
||||
@LogOperation("导出")
|
||||
@RequiresPermissions("sys:log:operation")
|
||||
public void export(@Parameter(hidden = true) @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
||||
List<SysLogOperationDTO> list = sysLogOperationService.list(params);
|
||||
|
||||
ExcelUtils.exportExcelToTarget(response, null, "操作日志", list, SysLogOperationExcel.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.dao;
|
||||
|
||||
import com.weather.common.dao.BaseDao;
|
||||
import com.weather.modules.log.entity.SysLogErrorEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 异常日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysLogErrorDao extends BaseDao<SysLogErrorEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.dao;
|
||||
|
||||
import com.weather.common.dao.BaseDao;
|
||||
import com.weather.modules.log.entity.SysLogLoginEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 登录日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysLogLoginDao extends BaseDao<SysLogLoginEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.dao;
|
||||
|
||||
import com.weather.common.dao.BaseDao;
|
||||
import com.weather.modules.log.entity.SysLogOperationEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysLogOperationDao extends BaseDao<SysLogOperationEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 异常日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "异常日志")
|
||||
public class SysLogErrorDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "id")
|
||||
private Long id;
|
||||
@Schema(title = "请求URI")
|
||||
private String requestUri;
|
||||
@Schema(title = "请求方式")
|
||||
private String requestMethod;
|
||||
@Schema(title = "请求参数")
|
||||
private String requestParams;
|
||||
@Schema(title = "用户代理")
|
||||
private String userAgent;
|
||||
@Schema(title = "操作IP")
|
||||
private String ip;
|
||||
@Schema(title = "异常信息")
|
||||
private String errorInfo;
|
||||
@Schema(title = "创建时间")
|
||||
private Date createDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 登录日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "登录日志")
|
||||
public class SysLogLoginDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(title = "用户操作 0:用户登录 1:用户退出")
|
||||
private Integer operation;
|
||||
|
||||
@Schema(title = "状态 0:失败 1:成功 2:账号已锁定")
|
||||
private Integer status;
|
||||
|
||||
@Schema(title = "用户代理")
|
||||
private String userAgent;
|
||||
|
||||
@Schema(title = "操作IP")
|
||||
private String ip;
|
||||
|
||||
@Schema(title = "用户名")
|
||||
private String creatorName;
|
||||
|
||||
@Schema(title = "创建时间")
|
||||
private Date createDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "操作日志")
|
||||
public class SysLogOperationDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(title = "用户操作")
|
||||
private String operation;
|
||||
|
||||
@Schema(title = "请求URI")
|
||||
private String requestUri;
|
||||
|
||||
@Schema(title = "请求方式")
|
||||
private String requestMethod;
|
||||
|
||||
@Schema(title = "请求参数")
|
||||
private String requestParams;
|
||||
|
||||
@Schema(title = "请求时长(毫秒)")
|
||||
private Integer requestTime;
|
||||
|
||||
@Schema(title = "用户代理")
|
||||
private String userAgent;
|
||||
|
||||
@Schema(title = "操作IP")
|
||||
private String ip;
|
||||
|
||||
@Schema(title = "状态 0:失败 1:成功")
|
||||
private Integer status;
|
||||
|
||||
@Schema(title = "用户名")
|
||||
private String creatorName;
|
||||
|
||||
@Schema(title = "创建时间")
|
||||
private Date createDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.weather.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 异常日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("sys_log_error")
|
||||
public class SysLogErrorEntity extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 请求URI
|
||||
*/
|
||||
private String requestUri;
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
private String requestMethod;
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private String requestParams;
|
||||
/**
|
||||
* 用户代理
|
||||
*/
|
||||
private String userAgent;
|
||||
/**
|
||||
* 操作IP
|
||||
*/
|
||||
private String ip;
|
||||
/**
|
||||
* 异常信息
|
||||
*/
|
||||
private String errorInfo;
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.weather.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 登录日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("sys_log_login")
|
||||
public class SysLogLoginEntity extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户操作 0:用户登录 1:用户退出
|
||||
*/
|
||||
private Integer operation;
|
||||
/**
|
||||
* 状态 0:失败 1:成功 2:账号已锁定
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 用户代理
|
||||
*/
|
||||
private String userAgent;
|
||||
/**
|
||||
* 操作IP
|
||||
*/
|
||||
private String ip;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String creatorName;
|
||||
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.weather.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("sys_log_operation")
|
||||
public class SysLogOperationEntity extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户操作
|
||||
*/
|
||||
private String operation;
|
||||
/**
|
||||
* 请求URI
|
||||
*/
|
||||
private String requestUri;
|
||||
/**
|
||||
* 请求方式
|
||||
*/
|
||||
private String requestMethod;
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
private String requestParams;
|
||||
/**
|
||||
* 请求时长(毫秒)
|
||||
*/
|
||||
private Integer requestTime;
|
||||
/**
|
||||
* 用户代理
|
||||
*/
|
||||
private String userAgent;
|
||||
/**
|
||||
* 操作IP
|
||||
*/
|
||||
private String ip;
|
||||
/**
|
||||
* 状态 0:失败 1:成功
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String creatorName;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.enums;
|
||||
|
||||
/**
|
||||
* 登录操作枚举
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public enum LoginOperationEnum {
|
||||
/**
|
||||
* 用户登录
|
||||
*/
|
||||
LOGIN(0),
|
||||
/**
|
||||
* 用户退出
|
||||
*/
|
||||
LOGOUT(1);
|
||||
|
||||
private int value;
|
||||
|
||||
LoginOperationEnum(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.enums;
|
||||
|
||||
/**
|
||||
* 登录状态枚举
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public enum LoginStatusEnum {
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAIL(0),
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS(1),
|
||||
/**
|
||||
* 账号已锁定
|
||||
*/
|
||||
LOCK(2);
|
||||
|
||||
private int value;
|
||||
|
||||
LoginStatusEnum(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.enums;
|
||||
|
||||
/**
|
||||
* 操作状态枚举
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public enum OperationStatusEnum {
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAIL(0),
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS(1);
|
||||
|
||||
private int value;
|
||||
|
||||
OperationStatusEnum(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 异常日志
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Data
|
||||
@ContentRowHeight(20)
|
||||
@HeadRowHeight(20)
|
||||
@ColumnWidth(25)
|
||||
public class SysLogErrorExcel {
|
||||
@ExcelProperty("请求URI")
|
||||
private String requestUri;
|
||||
|
||||
@ExcelProperty("请求方式")
|
||||
private String requestMethod;
|
||||
|
||||
@ExcelProperty("请求参数")
|
||||
private String requestParams;
|
||||
|
||||
@ExcelProperty("User-Agent")
|
||||
private String userAgent;
|
||||
|
||||
@ExcelProperty("操作IP")
|
||||
private String ip;
|
||||
|
||||
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||
@ExcelProperty("创建时间")
|
||||
private Date createDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import com.weather.modules.log.excel.converter.SysLogOperationConverter;
|
||||
import com.weather.modules.log.excel.converter.SysLogStatusConverter;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 登录日志
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Data
|
||||
@ContentRowHeight(20)
|
||||
@HeadRowHeight(20)
|
||||
@ColumnWidth(25)
|
||||
public class SysLogLoginExcel {
|
||||
@ExcelProperty(value = "操作类型", converter = SysLogOperationConverter.class)
|
||||
private Integer operation;
|
||||
|
||||
@ExcelProperty(value = "状态", converter = SysLogStatusConverter.class)
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("User-Agent")
|
||||
private String userAgent;
|
||||
|
||||
@ExcelProperty("操作IP")
|
||||
private String ip;
|
||||
|
||||
@ExcelProperty("用户名")
|
||||
private String creatorName;
|
||||
|
||||
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||
@ExcelProperty("创建时间")
|
||||
private Date createDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
|
||||
package com.weather.modules.log.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Data
|
||||
@ContentRowHeight(20)
|
||||
@HeadRowHeight(20)
|
||||
@ColumnWidth(25)
|
||||
public class SysLogOperationExcel {
|
||||
@ExcelProperty("用户操作")
|
||||
private String operation;
|
||||
|
||||
@ExcelProperty("请求URI")
|
||||
private String requestUri;
|
||||
|
||||
@ExcelProperty("请求方式")
|
||||
private String requestMethod;
|
||||
|
||||
@ExcelProperty("请求参数")
|
||||
private String requestParams;
|
||||
|
||||
@ExcelProperty("请求时长(毫秒)")
|
||||
private Integer requestTime;
|
||||
|
||||
@ExcelProperty("User-Agent")
|
||||
private String userAgent;
|
||||
|
||||
@ExcelProperty("操作IP")
|
||||
private String ip;
|
||||
|
||||
@ExcelProperty("状态")
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("用户名")
|
||||
private String creatorName;
|
||||
|
||||
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||
@ExcelProperty("创建时间")
|
||||
private Date createDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.weather.modules.log.excel.converter;
|
||||
|
||||
import com.alibaba.excel.converters.Converter;
|
||||
import com.alibaba.excel.enums.CellDataTypeEnum;
|
||||
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||
import com.alibaba.excel.metadata.data.ReadCellData;
|
||||
import com.alibaba.excel.metadata.data.WriteCellData;
|
||||
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||
|
||||
public class SysLogOperationConverter implements Converter<Integer> {
|
||||
|
||||
@Override
|
||||
public Class<Integer> supportJavaTypeKey() {
|
||||
return Integer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellDataTypeEnum supportExcelTypeKey() {
|
||||
return CellDataTypeEnum.STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||
if(cellData.getStringValue().equals("用户登录")){
|
||||
return 0;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||
if(value == 0){
|
||||
return new WriteCellData<>("用户登录");
|
||||
}else{
|
||||
return new WriteCellData<>("用户退出");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.weather.modules.log.excel.converter;
|
||||
|
||||
import com.alibaba.excel.converters.Converter;
|
||||
import com.alibaba.excel.enums.CellDataTypeEnum;
|
||||
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||
import com.alibaba.excel.metadata.data.ReadCellData;
|
||||
import com.alibaba.excel.metadata.data.WriteCellData;
|
||||
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||
|
||||
public class SysLogStatusConverter implements Converter<Integer> {
|
||||
|
||||
@Override
|
||||
public Class<Integer> supportJavaTypeKey() {
|
||||
return Integer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellDataTypeEnum supportExcelTypeKey() {
|
||||
return CellDataTypeEnum.STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||
if(cellData.getStringValue().equals("失败")){
|
||||
return 0;
|
||||
}else if(cellData.getStringValue().equals("成功")){
|
||||
return 1;
|
||||
}else if(cellData.getStringValue().equals("账号已锁定")){
|
||||
return 2;
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||
if(value == 0){
|
||||
return new WriteCellData<>("失败");
|
||||
}else if(value == 1){
|
||||
return new WriteCellData<>("成功");
|
||||
}else if(value == 2){
|
||||
return new WriteCellData<>("账号已锁定");
|
||||
}else{
|
||||
return new WriteCellData<>("未知");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.service;
|
||||
|
||||
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.BaseService;
|
||||
import com.weather.modules.log.dto.SysLogErrorDTO;
|
||||
import com.weather.modules.log.entity.SysLogErrorEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 异常日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public interface SysLogErrorService extends BaseService<SysLogErrorEntity> {
|
||||
|
||||
PageData<SysLogErrorDTO> page(Map<String, Object> params);
|
||||
|
||||
List<SysLogErrorDTO> list(Map<String, Object> params);
|
||||
|
||||
void save(SysLogErrorEntity entity);
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.service;
|
||||
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.BaseService;
|
||||
import com.weather.modules.log.dto.SysLogLoginDTO;
|
||||
import com.weather.modules.log.entity.SysLogLoginEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 登录日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public interface SysLogLoginService extends BaseService<SysLogLoginEntity> {
|
||||
|
||||
PageData<SysLogLoginDTO> page(Map<String, Object> params);
|
||||
|
||||
List<SysLogLoginDTO> list(Map<String, Object> params);
|
||||
|
||||
void save(SysLogLoginEntity entity);
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.service;
|
||||
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.BaseService;
|
||||
import com.weather.modules.log.dto.SysLogOperationDTO;
|
||||
import com.weather.modules.log.entity.SysLogOperationEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public interface SysLogOperationService extends BaseService<SysLogOperationEntity> {
|
||||
|
||||
PageData<SysLogOperationDTO> page(Map<String, Object> params);
|
||||
|
||||
List<SysLogOperationDTO> list(Map<String, Object> params);
|
||||
|
||||
void save(SysLogOperationEntity entity);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.impl.BaseServiceImpl;
|
||||
import com.weather.common.utils.ConvertUtils;
|
||||
import com.weather.modules.log.dao.SysLogErrorDao;
|
||||
import com.weather.modules.log.dto.SysLogErrorDTO;
|
||||
import com.weather.modules.log.entity.SysLogErrorEntity;
|
||||
import com.weather.modules.log.service.SysLogErrorService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 异常日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class SysLogErrorServiceImpl extends BaseServiceImpl<SysLogErrorDao, SysLogErrorEntity> implements SysLogErrorService {
|
||||
|
||||
@Override
|
||||
public PageData<SysLogErrorDTO> page(Map<String, Object> params) {
|
||||
IPage<SysLogErrorEntity> page = baseDao.selectPage(
|
||||
getPage(params, Constant.CREATE_DATE, false),
|
||||
getWrapper(params)
|
||||
);
|
||||
|
||||
return getPageData(page, SysLogErrorDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysLogErrorDTO> list(Map<String, Object> params) {
|
||||
List<SysLogErrorEntity> entityList = baseDao.selectList(getWrapper(params));
|
||||
|
||||
return ConvertUtils.sourceToTarget(entityList, SysLogErrorDTO.class);
|
||||
}
|
||||
|
||||
private QueryWrapper<SysLogErrorEntity> getWrapper(Map<String, Object> params){
|
||||
QueryWrapper<SysLogErrorEntity> wrapper = new QueryWrapper<>();
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(SysLogErrorEntity entity) {
|
||||
insert(entity);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.impl.BaseServiceImpl;
|
||||
import com.weather.common.utils.ConvertUtils;
|
||||
import com.weather.modules.log.dao.SysLogLoginDao;
|
||||
import com.weather.modules.log.dto.SysLogLoginDTO;
|
||||
import com.weather.modules.log.entity.SysLogLoginEntity;
|
||||
import com.weather.modules.log.service.SysLogLoginService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 登录日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class SysLogLoginServiceImpl extends BaseServiceImpl<SysLogLoginDao, SysLogLoginEntity> implements SysLogLoginService {
|
||||
|
||||
@Override
|
||||
public PageData<SysLogLoginDTO> page(Map<String, Object> params) {
|
||||
IPage<SysLogLoginEntity> page = baseDao.selectPage(
|
||||
getPage(params, Constant.CREATE_DATE, false),
|
||||
getWrapper(params)
|
||||
);
|
||||
|
||||
return getPageData(page, SysLogLoginDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysLogLoginDTO> list(Map<String, Object> params) {
|
||||
List<SysLogLoginEntity> entityList = baseDao.selectList(getWrapper(params));
|
||||
|
||||
return ConvertUtils.sourceToTarget(entityList, SysLogLoginDTO.class);
|
||||
}
|
||||
|
||||
private QueryWrapper<SysLogLoginEntity> getWrapper(Map<String, Object> params){
|
||||
String status = (String) params.get("status");
|
||||
String creatorName = (String) params.get("creatorName");
|
||||
|
||||
QueryWrapper<SysLogLoginEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StrUtil.isNotBlank(status), "status", status);
|
||||
wrapper.like(StrUtil.isNotBlank(creatorName), "creator_name", creatorName);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(SysLogLoginEntity entity) {
|
||||
insert(entity);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
|
||||
|
||||
package com.weather.modules.log.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.impl.BaseServiceImpl;
|
||||
import com.weather.common.utils.ConvertUtils;
|
||||
import com.weather.modules.log.dao.SysLogOperationDao;
|
||||
import com.weather.modules.log.dto.SysLogOperationDTO;
|
||||
import com.weather.modules.log.entity.SysLogOperationEntity;
|
||||
import com.weather.modules.log.service.SysLogOperationService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 操作日志
|
||||
*
|
||||
* @author 123
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class SysLogOperationServiceImpl extends BaseServiceImpl<SysLogOperationDao, SysLogOperationEntity> implements SysLogOperationService {
|
||||
|
||||
@Override
|
||||
public PageData<SysLogOperationDTO> page(Map<String, Object> params) {
|
||||
IPage<SysLogOperationEntity> page = baseDao.selectPage(
|
||||
getPage(params, Constant.CREATE_DATE, false),
|
||||
getWrapper(params)
|
||||
);
|
||||
|
||||
return getPageData(page, SysLogOperationDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysLogOperationDTO> list(Map<String, Object> params) {
|
||||
List<SysLogOperationEntity> entityList = baseDao.selectList(getWrapper(params));
|
||||
|
||||
return ConvertUtils.sourceToTarget(entityList, SysLogOperationDTO.class);
|
||||
}
|
||||
|
||||
private QueryWrapper<SysLogOperationEntity> getWrapper(Map<String, Object> params){
|
||||
String status = (String) params.get("status");
|
||||
|
||||
QueryWrapper<SysLogOperationEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StrUtil.isNotBlank(status), "status", status);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(SysLogOperationEntity entity) {
|
||||
insert(entity);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
|
||||
|
||||
package com.weather.modules.oss.cloud;
|
||||
|
||||
import com.weather.common.utils.DateUtils;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 云存储(支持七牛、阿里云、腾讯云)
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public abstract class AbstractCloudStorageService {
|
||||
/** 云存储配置信息 */
|
||||
CloudStorageConfig config;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
* @param prefix 前缀
|
||||
* @param suffix 后缀
|
||||
* @return 返回上传路径
|
||||
*/
|
||||
public String getPath(String prefix, String suffix) {
|
||||
//生成uuid
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
//文件路径
|
||||
String path = DateUtils.format(new Date(), "yyyyMMdd") + "/" + uuid;
|
||||
|
||||
if(StrUtil.isNotBlank(prefix)){
|
||||
path = prefix + "/" + path;
|
||||
}
|
||||
|
||||
return path + "." + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param data 文件字节数组
|
||||
* @param path 文件路径,包含文件名
|
||||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String upload(byte[] data, String path);
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param data 文件字节数组
|
||||
* @param suffix 后缀
|
||||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String uploadSuffix(byte[] data, String suffix);
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param inputStream 字节流
|
||||
* @param path 文件路径,包含文件名
|
||||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String upload(InputStream inputStream, String path);
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param inputStream 字节流
|
||||
* @param suffix 后缀
|
||||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String uploadSuffix(InputStream inputStream, String suffix);
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
package com.weather.modules.oss.cloud;
|
||||
|
||||
import com.aliyun.oss.OSSClient;
|
||||
import com.weather.common.exception.ErrorCode;
|
||||
import com.weather.common.exception.CommonException;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 阿里云存储
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public class AliyunCloudStorageService extends AbstractCloudStorageService {
|
||||
|
||||
public AliyunCloudStorageService(CloudStorageConfig config){
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(byte[] data, String path) {
|
||||
return upload(new ByteArrayInputStream(data), path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(InputStream inputStream, String path) {
|
||||
OSSClient client = new OSSClient(config.getAliyunEndPoint(), config.getAliyunAccessKeyId(),
|
||||
config.getAliyunAccessKeySecret());
|
||||
try {
|
||||
client.putObject(config.getAliyunBucketName(), path, inputStream);
|
||||
client.shutdown();
|
||||
} catch (Exception e){
|
||||
throw new CommonException(ErrorCode.OSS_UPLOAD_FILE_ERROR, e, "");
|
||||
}
|
||||
|
||||
return config.getAliyunDomain() + "/" + path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(byte[] data, String suffix) {
|
||||
return upload(data, getPath(config.getAliyunPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix) {
|
||||
return upload(inputStream, getPath(config.getAliyunPrefix(), suffix));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
|
||||
package com.weather.modules.oss.cloud;
|
||||
|
||||
import com.weather.common.validator.group.AliyunGroup;
|
||||
import com.weather.common.validator.group.QcloudGroup;
|
||||
import com.weather.common.validator.group.QiniuGroup;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 云存储配置信息
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "云存储配置信息")
|
||||
public class CloudStorageConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "类型 1:七牛 2:阿里云 3:腾讯云 ")
|
||||
@Range(min = 1, max = 6, message = "{oss.type.range}")
|
||||
private Integer type;
|
||||
|
||||
@Schema(title = "七牛绑定的域名")
|
||||
@NotBlank(message = "{qiniu.domain.require}", groups = QiniuGroup.class)
|
||||
@URL(message = "{qiniu.domain.url}", groups = QiniuGroup.class)
|
||||
private String qiniuDomain;
|
||||
|
||||
@Schema(title = "七牛路径前缀")
|
||||
private String qiniuPrefix;
|
||||
|
||||
@Schema(title = "七牛ACCESS_KEY")
|
||||
@NotBlank(message = "{qiniu.accesskey.require}", groups = QiniuGroup.class)
|
||||
private String qiniuAccessKey;
|
||||
|
||||
@Schema(title = "七牛SECRET_KEY")
|
||||
@NotBlank(message = "{qiniu.secretkey.require}", groups = QiniuGroup.class)
|
||||
private String qiniuSecretKey;
|
||||
|
||||
@Schema(title = "七牛存储空间名")
|
||||
@NotBlank(message = "{qiniu.bucketName.require}", groups = QiniuGroup.class)
|
||||
private String qiniuBucketName;
|
||||
|
||||
@Schema(title = "阿里云绑定的域名")
|
||||
@NotBlank(message = "{aliyun.domain.require}", groups = AliyunGroup.class)
|
||||
@URL(message = "{aliyun.domain.url}", groups = AliyunGroup.class)
|
||||
private String aliyunDomain;
|
||||
|
||||
@Schema(title = "阿里云路径前缀")
|
||||
private String aliyunPrefix;
|
||||
|
||||
@Schema(title = "阿里云EndPoint")
|
||||
@NotBlank(message = "{aliyun.endPoint.require}", groups = AliyunGroup.class)
|
||||
private String aliyunEndPoint;
|
||||
|
||||
@Schema(title = "阿里云AccessKeyId")
|
||||
@NotBlank(message = "{aliyun.accesskeyid.require}", groups = AliyunGroup.class)
|
||||
private String aliyunAccessKeyId;
|
||||
|
||||
@Schema(title = "阿里云AccessKeySecret")
|
||||
@NotBlank(message = "{aliyun.accesskeysecret.require}", groups = AliyunGroup.class)
|
||||
private String aliyunAccessKeySecret;
|
||||
|
||||
@Schema(title = "阿里云BucketName")
|
||||
@NotBlank(message = "{aliyun.bucketName.require}", groups = AliyunGroup.class)
|
||||
private String aliyunBucketName;
|
||||
|
||||
@Schema(title = "腾讯云绑定的域名")
|
||||
@NotBlank(message = "{qcloud.domain.require}", groups = QcloudGroup.class)
|
||||
@URL(message = "{qcloud.domain.url}", groups = QcloudGroup.class)
|
||||
private String qcloudDomain;
|
||||
|
||||
@Schema(title = "腾讯云路径前缀")
|
||||
private String qcloudPrefix;
|
||||
|
||||
@Schema(title = "腾讯云AppId")
|
||||
@NotNull(message = "{qcloud.appid.require}", groups = QcloudGroup.class)
|
||||
private Integer qcloudAppId;
|
||||
|
||||
@Schema(title = "腾讯云SecretId")
|
||||
@NotBlank(message = "{qcloud.secretId.require}", groups = QcloudGroup.class)
|
||||
private String qcloudSecretId;
|
||||
|
||||
@Schema(title = "腾讯云SecretKey")
|
||||
@NotBlank(message = "{qcloud.secretkey.require}", groups = QcloudGroup.class)
|
||||
private String qcloudSecretKey;
|
||||
|
||||
@Schema(title = "腾讯云BucketName")
|
||||
@NotBlank(message = "{qcloud.bucketName.require}", groups = QcloudGroup.class)
|
||||
private String qcloudBucketName;
|
||||
|
||||
@Schema(title = "腾讯云COS所属地区")
|
||||
@NotBlank(message = "{qcloud.region.require}", groups = QcloudGroup.class)
|
||||
private String qcloudRegion;
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
package com.weather.modules.oss.cloud;
|
||||
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.utils.SpringContextUtils;
|
||||
import com.weather.modules.sys.service.SysParamsService;
|
||||
|
||||
/**
|
||||
* 文件上传Factory
|
||||
* @author 123
|
||||
*/
|
||||
public final class OSSFactory {
|
||||
private static SysParamsService sysParamsService;
|
||||
|
||||
static {
|
||||
OSSFactory.sysParamsService = SpringContextUtils.getBean(SysParamsService.class);
|
||||
}
|
||||
|
||||
public static AbstractCloudStorageService build(){
|
||||
//获取云存储配置信息
|
||||
CloudStorageConfig config = sysParamsService.getValueObject(Constant.CLOUD_STORAGE_CONFIG_KEY, CloudStorageConfig.class);
|
||||
|
||||
if(config.getType() == Constant.CloudService.QINIU.getValue()){
|
||||
return new QiniuCloudStorageService(config);
|
||||
}else if(config.getType() == Constant.CloudService.ALIYUN.getValue()){
|
||||
return new AliyunCloudStorageService(config);
|
||||
}else if(config.getType() == Constant.CloudService.QCLOUD.getValue()){
|
||||
return new QcloudCloudStorageService(config);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
|
||||
|
||||
package com.weather.modules.oss.cloud;
|
||||
|
||||
import com.qcloud.cos.COSClient;
|
||||
import com.qcloud.cos.ClientConfig;
|
||||
import com.qcloud.cos.auth.BasicCOSCredentials;
|
||||
import com.qcloud.cos.auth.COSCredentials;
|
||||
import com.qcloud.cos.model.ObjectMetadata;
|
||||
import com.qcloud.cos.model.PutObjectRequest;
|
||||
import com.qcloud.cos.model.PutObjectResult;
|
||||
import com.qcloud.cos.region.Region;
|
||||
import com.weather.common.exception.ErrorCode;
|
||||
import com.weather.common.exception.CommonException;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 腾讯云存储
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public class QcloudCloudStorageService extends AbstractCloudStorageService {
|
||||
private COSCredentials credentials;
|
||||
private ClientConfig clientConfig;
|
||||
|
||||
public QcloudCloudStorageService(CloudStorageConfig config){
|
||||
this.config = config;
|
||||
|
||||
//初始化
|
||||
init();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
//1、初始化用户身份信息(secretId, secretKey)
|
||||
credentials = new BasicCOSCredentials(config.getQcloudSecretId(), config.getQcloudSecretKey());
|
||||
|
||||
//2、设置bucket的区域, COS地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
|
||||
clientConfig = new ClientConfig(new Region(config.getQcloudRegion()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(byte[] data, String path) {
|
||||
return upload(new ByteArrayInputStream(data), path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(InputStream inputStream, String path) {
|
||||
try {
|
||||
COSClient client = new COSClient(credentials, clientConfig);
|
||||
|
||||
ObjectMetadata metadata = new ObjectMetadata();
|
||||
metadata.setContentLength(inputStream.available());
|
||||
String bucketName = config.getQcloudBucketName() +"-"+ config.getQcloudAppId();
|
||||
PutObjectRequest request = new PutObjectRequest(bucketName, path, inputStream, metadata);
|
||||
PutObjectResult result = client.putObject(request);
|
||||
|
||||
client.shutdown();
|
||||
if(result.getETag() == null){
|
||||
throw new CommonException(ErrorCode.OSS_UPLOAD_FILE_ERROR, "");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new CommonException(ErrorCode.OSS_UPLOAD_FILE_ERROR, e, "");
|
||||
}
|
||||
|
||||
return config.getQcloudDomain() + "/" + path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(byte[] data, String suffix) {
|
||||
return upload(data, getPath(config.getQcloudPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix) {
|
||||
return upload(inputStream, getPath(config.getQcloudPrefix(), suffix));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
|
||||
package com.weather.modules.oss.cloud;
|
||||
|
||||
import com.qiniu.http.Response;
|
||||
import com.qiniu.storage.Configuration;
|
||||
import com.qiniu.storage.Region;
|
||||
import com.qiniu.storage.UploadManager;
|
||||
import com.qiniu.util.Auth;
|
||||
import com.qiniu.util.IOUtils;
|
||||
import com.weather.common.exception.ErrorCode;
|
||||
import com.weather.common.exception.CommonException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 七牛云存储
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public class QiniuCloudStorageService extends AbstractCloudStorageService {
|
||||
private UploadManager uploadManager;
|
||||
private String token;
|
||||
|
||||
public QiniuCloudStorageService(CloudStorageConfig config) {
|
||||
this.config = config;
|
||||
|
||||
//初始化
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
uploadManager = new UploadManager(new Configuration(Region.autoRegion()));
|
||||
token = Auth.create(config.getQiniuAccessKey(), config.getQiniuSecretKey()).
|
||||
uploadToken(config.getQiniuBucketName());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(byte[] data, String path) {
|
||||
try {
|
||||
Response res = uploadManager.put(data, path, token);
|
||||
if (!res.isOK()) {
|
||||
throw new CommonException(ErrorCode.OSS_UPLOAD_FILE_ERROR, res.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new CommonException(ErrorCode.OSS_UPLOAD_FILE_ERROR, e, "");
|
||||
}
|
||||
|
||||
return config.getQiniuDomain() + "/" + path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(InputStream inputStream, String path) {
|
||||
try {
|
||||
byte[] data = IOUtils.toByteArray(inputStream);
|
||||
return this.upload(data, path);
|
||||
} catch (IOException e) {
|
||||
throw new CommonException(ErrorCode.OSS_UPLOAD_FILE_ERROR, e, "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(byte[] data, String suffix) {
|
||||
return upload(data, getPath(config.getQiniuPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix) {
|
||||
return upload(inputStream, getPath(config.getQiniuPrefix(), suffix));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
|
||||
package com.weather.modules.oss.controller;
|
||||
|
||||
import cn.hutool.core.io.file.FileNameUtil;
|
||||
import com.weather.common.annotation.LogOperation;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.exception.ErrorCode;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.utils.JsonUtils;
|
||||
import com.weather.common.utils.Result;
|
||||
import com.weather.common.validator.ValidatorUtils;
|
||||
import com.weather.common.validator.group.AliyunGroup;
|
||||
import com.weather.common.validator.group.QcloudGroup;
|
||||
import com.weather.common.validator.group.QiniuGroup;
|
||||
import com.weather.modules.oss.cloud.CloudStorageConfig;
|
||||
import com.weather.modules.oss.cloud.OSSFactory;
|
||||
import com.weather.modules.oss.entity.SysOssEntity;
|
||||
import com.weather.modules.oss.service.SysOssService;
|
||||
import com.weather.modules.sys.service.SysParamsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("sys/oss")
|
||||
@Tag(name = "文件上传")
|
||||
@AllArgsConstructor
|
||||
public class SysOssController {
|
||||
private final SysOssService sysOssService;
|
||||
private final SysParamsService sysParamsService;
|
||||
|
||||
private final static String KEY = Constant.CLOUD_STORAGE_CONFIG_KEY;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
public Result<PageData<SysOssEntity>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||
PageData<SysOssEntity> page = sysOssService.page(params);
|
||||
|
||||
return new Result<PageData<SysOssEntity>>().ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("info")
|
||||
@Operation(summary = "云存储配置信息")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
public Result<CloudStorageConfig> info() {
|
||||
CloudStorageConfig config = sysParamsService.getValueObject(KEY, CloudStorageConfig.class);
|
||||
|
||||
return new Result<CloudStorageConfig>().ok(config);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存云存储配置信息")
|
||||
@LogOperation("保存云存储配置信息")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
public Result saveConfig(@RequestBody CloudStorageConfig config) {
|
||||
//校验类型
|
||||
ValidatorUtils.validateEntity(config);
|
||||
|
||||
if (config.getType() == Constant.CloudService.QINIU.getValue()) {
|
||||
//校验七牛数据
|
||||
ValidatorUtils.validateEntity(config, QiniuGroup.class);
|
||||
} else if (config.getType() == Constant.CloudService.ALIYUN.getValue()) {
|
||||
//校验阿里云数据
|
||||
ValidatorUtils.validateEntity(config, AliyunGroup.class);
|
||||
} else if (config.getType() == Constant.CloudService.QCLOUD.getValue()) {
|
||||
//校验腾讯云数据
|
||||
ValidatorUtils.validateEntity(config, QcloudGroup.class);
|
||||
}
|
||||
|
||||
sysParamsService.updateValueByCode(KEY, JsonUtils.toJsonString(config));
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@PostMapping("upload")
|
||||
@Operation(summary = "上传文件")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
public Result<Map<String, Object>> upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
if (file.isEmpty()) {
|
||||
return new Result<Map<String, Object>>().error(ErrorCode.UPLOAD_FILE_EMPTY);
|
||||
}
|
||||
|
||||
//上传文件
|
||||
String suffix = FileNameUtil.getSuffix(file.getOriginalFilename());
|
||||
String url = OSSFactory.build().uploadSuffix(file.getBytes(), suffix);
|
||||
|
||||
//保存文件信息
|
||||
SysOssEntity ossEntity = new SysOssEntity();
|
||||
ossEntity.setUrl(url);
|
||||
ossEntity.setCreateDate(new Date());
|
||||
sysOssService.insert(ossEntity);
|
||||
|
||||
Map<String, Object> data = new HashMap<>(1);
|
||||
data.put("src", url);
|
||||
|
||||
return new Result<Map<String, Object>>().ok(data);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@LogOperation("删除")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
public Result delete(@RequestBody Long[] ids) {
|
||||
sysOssService.deleteBatchIds(Arrays.asList(ids));
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
package com.weather.modules.oss.dao;
|
||||
|
||||
import com.weather.common.dao.BaseDao;
|
||||
import com.weather.modules.oss.entity.SysOssEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysOssDao extends BaseDao<SysOssEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
package com.weather.modules.oss.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.weather.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("sys_oss")
|
||||
public class SysOssEntity extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* URL地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
package com.weather.modules.oss.service;
|
||||
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.BaseService;
|
||||
import com.weather.modules.oss.entity.SysOssEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
public interface SysOssService extends BaseService<SysOssEntity> {
|
||||
|
||||
PageData<SysOssEntity> page(Map<String, Object> params);
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
|
||||
|
||||
package com.weather.modules.oss.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.service.impl.BaseServiceImpl;
|
||||
import com.weather.modules.oss.dao.SysOssDao;
|
||||
import com.weather.modules.oss.entity.SysOssEntity;
|
||||
import com.weather.modules.oss.service.SysOssService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysOssServiceImpl extends BaseServiceImpl<SysOssDao, SysOssEntity> implements SysOssService {
|
||||
|
||||
@Override
|
||||
public PageData<SysOssEntity> page(Map<String, Object> params) {
|
||||
IPage<SysOssEntity> page = baseDao.selectPage(
|
||||
getPage(params, Constant.CREATE_DATE, false),
|
||||
new QueryWrapper<>()
|
||||
);
|
||||
return getPageData(page, SysOssEntity.class);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.weather.modules.region.controller;
|
||||
|
||||
import com.weather.common.annotation.LogOperation;
|
||||
import com.weather.common.constant.Constant;
|
||||
import com.weather.common.page.PageData;
|
||||
import com.weather.common.utils.ExcelUtils;
|
||||
import com.weather.common.utils.Result;
|
||||
import com.weather.common.validator.AssertUtils;
|
||||
import com.weather.common.validator.ValidatorUtils;
|
||||
import com.weather.common.validator.group.AddGroup;
|
||||
import com.weather.common.validator.group.DefaultGroup;
|
||||
import com.weather.common.validator.group.UpdateGroup;
|
||||
import com.weather.modules.region.dto.SysRegionDTO;
|
||||
import com.weather.modules.region.excel.SysRegionExcel;
|
||||
import com.weather.modules.region.service.SysRegionService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 行政区划表
|
||||
*
|
||||
* @author Mark 123
|
||||
* @since 1.0.0 2026-03-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("region/sysregion")
|
||||
@Tag(name="行政区划表")
|
||||
public class SysRegionController {
|
||||
|
||||
@Autowired
|
||||
private SysRegionService sysRegionService;
|
||||
|
||||
@GetMapping("parent/{id}")
|
||||
@Operation(summary = "信息")
|
||||
@RequiresPermissions("region:sysregion:info")
|
||||
public Result<List<SysRegionDTO>> get(@PathVariable Long id){
|
||||
List<SysRegionDTO> data = sysRegionService.getByParentId(id);
|
||||
return new Result<List<SysRegionDTO>>().ok(data);
|
||||
}
|
||||
|
||||
@GetMapping("export")
|
||||
@Operation(summary = "导出")
|
||||
@LogOperation("导出")
|
||||
@RequiresPermissions("region:sysregion:export")
|
||||
public void export(@Parameter(hidden = true) @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
|
||||
List<SysRegionDTO> list = sysRegionService.list(params);
|
||||
|
||||
ExcelUtils.exportExcelToTarget(response, null, "行政区划表", list, SysRegionExcel.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.weather.modules.region.dao;
|
||||
|
||||
import com.weather.common.dao.BaseDao;
|
||||
import com.weather.modules.region.entity.SysRegionEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 行政区划表
|
||||
*
|
||||
* @author Mark 123
|
||||
* @since 1.0.0 2026-03-05
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRegionDao extends BaseDao<SysRegionEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.weather.modules.region.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.SchemaProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 行政区划表
|
||||
*
|
||||
* @author Mark 123
|
||||
* @since 1.0.0 2026-03-05
|
||||
*/
|
||||
@Data
|
||||
@Schema(name = "行政区划表")
|
||||
public class SysRegionDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@SchemaProperty(name = "行政区编码")
|
||||
private Long id;
|
||||
|
||||
@SchemaProperty(name = "名称")
|
||||
private String name;
|
||||
|
||||
@SchemaProperty(name = "层级 0国家 1省 2市 3区县")
|
||||
private Integer level;
|
||||
|
||||
@SchemaProperty(name = "父级行政区")
|
||||
private Long parentId;
|
||||
|
||||
@SchemaProperty(name = "经度")
|
||||
private BigDecimal lon;
|
||||
|
||||
@SchemaProperty(name = "纬度")
|
||||
private BigDecimal lat;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.weather.modules.region.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 行政区划表
|
||||
*
|
||||
* @author Mark 123
|
||||
* @since 1.0.0 2026-03-05
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_region")
|
||||
public class SysRegionEntity {
|
||||
|
||||
/**
|
||||
* 行政区编码
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 层级 0国家 1省 2市 3区县
|
||||
*/
|
||||
private Integer level;
|
||||
/**
|
||||
* 父级行政区
|
||||
*/
|
||||
private Long parentId;
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private BigDecimal lon;
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private BigDecimal lat;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.weather.modules.region.excel;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 行政区划表
|
||||
*
|
||||
* @author Mark 123
|
||||
* @since 1.0.0 2026-03-05
|
||||
*/
|
||||
@Data
|
||||
public class SysRegionExcel {
|
||||
@ExcelProperty(value = "行政区编码")
|
||||
private Long id;
|
||||
@ExcelProperty(value = "名称")
|
||||
private String name;
|
||||
@ExcelProperty(value = "层级 0国家 1省 2市 3区县")
|
||||
private Integer level;
|
||||
@ExcelProperty(value = "父级行政区")
|
||||
private Long parentId;
|
||||
@ExcelProperty(value = "经度")
|
||||
private BigDecimal lon;
|
||||
@ExcelProperty(value = "纬度")
|
||||
private BigDecimal lat;
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.weather.modules.region.service;
|
||||
|
||||
import com.weather.common.service.CrudService;
|
||||
import com.weather.modules.region.dto.SysRegionDTO;
|
||||
import com.weather.modules.region.entity.SysRegionEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 行政区划表
|
||||
*
|
||||
* @author Mark 123
|
||||
* @since 1.0.0 2026-03-05
|
||||
*/
|
||||
public interface SysRegionService extends CrudService<SysRegionEntity, SysRegionDTO> {
|
||||
/**
|
||||
* 获取子一级地区信息
|
||||
* @param id 地区 id
|
||||
* @return 地区信息
|
||||
*/
|
||||
List<SysRegionDTO> getByParentId(Long id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.weather.modules.region.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.weather.common.service.impl.CrudServiceImpl;
|
||||
import com.weather.common.utils.ConvertUtils;
|
||||
import com.weather.modules.region.dao.SysRegionDao;
|
||||
import com.weather.modules.region.dto.SysRegionDTO;
|
||||
import com.weather.modules.region.entity.SysRegionEntity;
|
||||
import com.weather.modules.region.service.SysRegionService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 行政区划表
|
||||
*
|
||||
* @author Mark 123
|
||||
* @since 1.0.0 2026-03-05
|
||||
*/
|
||||
@Service
|
||||
public class SysRegionServiceImpl extends CrudServiceImpl<SysRegionDao, SysRegionEntity, SysRegionDTO> implements SysRegionService {
|
||||
|
||||
@Override
|
||||
public QueryWrapper<SysRegionEntity> getWrapper(Map<String, Object> params) {
|
||||
String id = (String) params.get("id");
|
||||
|
||||
QueryWrapper<SysRegionEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq(StrUtil.isNotBlank(id), "id", id);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取子一级地区信息
|
||||
*
|
||||
* @param id 地区 id
|
||||
* @return 地区信息
|
||||
*/
|
||||
@Override
|
||||
public List<SysRegionDTO> getByParentId(Long id) {
|
||||
QueryWrapper<SysRegionEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("parent_id", id);
|
||||
List<SysRegionEntity> sysRegionEntities = baseDao.selectList(wrapper);
|
||||
return ConvertUtils.sourceToTarget(sysRegionEntities, SysRegionDTO.class);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
package com.weather.modules.security.config;
|
||||
|
||||
import com.weather.common.xss.XssFilter;
|
||||
import jakarta.servlet.DispatcherType;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.filter.DelegatingFilterProxy;
|
||||
|
||||
|
||||
/**
|
||||
* Filter配置
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Configuration
|
||||
public class FilterConfig {
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean shiroFilterRegistration() {
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
||||
registration.setFilter(new DelegatingFilterProxy("shiroFilter"));
|
||||
//该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理
|
||||
registration.addInitParameter("targetFilterLifecycle", "true");
|
||||
registration.setEnabled(true);
|
||||
registration.setOrder(Integer.MAX_VALUE - 1);
|
||||
registration.addUrlPatterns("/*");
|
||||
return registration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean xssFilterRegistration() {
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
||||
registration.setDispatcherTypes(DispatcherType.REQUEST);
|
||||
registration.setFilter(new XssFilter());
|
||||
registration.addUrlPatterns("/*");
|
||||
registration.setName("xssFilter");
|
||||
registration.setOrder(Integer.MAX_VALUE);
|
||||
return registration;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
|
||||
|
||||
package com.weather.modules.security.config;
|
||||
|
||||
import com.weather.modules.security.oauth2.Oauth2Filter;
|
||||
import com.weather.modules.security.oauth2.Oauth2Realm;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
import org.apache.shiro.session.mgt.SessionManager;
|
||||
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
||||
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import jakarta.servlet.Filter;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Shiro的配置文件
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Configuration
|
||||
public class ShiroConfig {
|
||||
|
||||
@Bean
|
||||
public DefaultWebSessionManager sessionManager(){
|
||||
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
|
||||
sessionManager.setSessionValidationSchedulerEnabled(false);
|
||||
sessionManager.setSessionIdUrlRewritingEnabled(false);
|
||||
|
||||
return sessionManager;
|
||||
}
|
||||
|
||||
@Bean("securityManager")
|
||||
public SecurityManager securityManager(Oauth2Realm oAuth2Realm, SessionManager sessionManager) {
|
||||
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
|
||||
securityManager.setRealm(oAuth2Realm);
|
||||
securityManager.setSessionManager(sessionManager);
|
||||
securityManager.setRememberMeManager(null);
|
||||
return securityManager;
|
||||
}
|
||||
|
||||
@Bean("shiroFilter")
|
||||
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
|
||||
ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
|
||||
shiroFilter.setSecurityManager(securityManager);
|
||||
|
||||
//oauth过滤
|
||||
Map<String, Filter> filters = new HashMap<>();
|
||||
filters.put("oauth2", new Oauth2Filter());
|
||||
shiroFilter.setFilters(filters);
|
||||
|
||||
Map<String, String> filterMap = new LinkedHashMap<>();
|
||||
filterMap.put("/webjars/**", "anon");
|
||||
filterMap.put("/druid/**", "anon");
|
||||
filterMap.put("/login", "anon");
|
||||
filterMap.put("/swagger/**", "anon");
|
||||
filterMap.put("/v3/api-docs/**", "anon");
|
||||
filterMap.put("/doc.html", "anon");
|
||||
filterMap.put("/swagger-resources/**", "anon");
|
||||
filterMap.put("/captcha", "anon");
|
||||
filterMap.put("/favicon.ico", "anon");
|
||||
filterMap.put("/", "anon");
|
||||
filterMap.put("/**", "oauth2");
|
||||
shiroFilter.setFilterChainDefinitionMap(filterMap);
|
||||
|
||||
return shiroFilter;
|
||||
}
|
||||
|
||||
@Bean("lifecycleBeanPostProcessor")
|
||||
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
|
||||
return new LifecycleBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
|
||||
AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
|
||||
advisor.setSecurityManager(securityManager);
|
||||
return advisor;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
|
||||
|
||||
package com.weather.modules.security.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.weather.common.utils.DateUtils;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.ResourceHttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOriginPatterns("*")
|
||||
.allowCredentials(true)
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||
.maxAge(3600);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
converters.add(new ByteArrayHttpMessageConverter());
|
||||
converters.add(new StringHttpMessageConverter());
|
||||
converters.add(new ResourceHttpMessageConverter());
|
||||
converters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
converters.add(new StringHttpMessageConverter());
|
||||
converters.add(jackson2HttpMessageConverter());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MappingJackson2HttpMessageConverter jackson2HttpMessageConverter() {
|
||||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
//日期格式转换
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.setDateFormat(new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN));
|
||||
mapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
|
||||
//Long类型转String类型
|
||||
SimpleModule simpleModule = new SimpleModule();
|
||||
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
|
||||
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
|
||||
mapper.registerModule(simpleModule);
|
||||
|
||||
converter.setObjectMapper(mapper);
|
||||
return converter;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
|
||||
package com.weather.modules.security.controller;
|
||||
|
||||
import com.weather.common.exception.ErrorCode;
|
||||
import com.weather.common.exception.CommonException;
|
||||
import com.weather.common.utils.IpUtils;
|
||||
import com.weather.common.utils.Result;
|
||||
import com.weather.common.validator.AssertUtils;
|
||||
import com.weather.common.validator.ValidatorUtils;
|
||||
import com.weather.modules.log.entity.SysLogLoginEntity;
|
||||
import com.weather.modules.log.enums.LoginOperationEnum;
|
||||
import com.weather.modules.log.enums.LoginStatusEnum;
|
||||
import com.weather.modules.log.service.SysLogLoginService;
|
||||
import com.weather.modules.security.dto.LoginDTO;
|
||||
import com.weather.modules.security.password.PasswordUtils;
|
||||
import com.weather.modules.security.service.CaptchaService;
|
||||
import com.weather.modules.security.service.SysUserTokenService;
|
||||
import com.weather.modules.security.user.SecurityUser;
|
||||
import com.weather.modules.security.user.UserDetail;
|
||||
import com.weather.modules.sys.dto.SysUserDTO;
|
||||
import com.weather.modules.sys.enums.UserStatusEnum;
|
||||
import com.weather.modules.sys.service.SysUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@RestController
|
||||
@Tag(name = "登录管理")
|
||||
@AllArgsConstructor
|
||||
public class LoginController {
|
||||
private final SysUserService sysUserService;
|
||||
private final SysUserTokenService sysUserTokenService;
|
||||
private final CaptchaService captchaService;
|
||||
private final SysLogLoginService sysLogLoginService;
|
||||
|
||||
@GetMapping("captcha")
|
||||
@Operation(summary = "验证码")
|
||||
@Parameter(in = ParameterIn.QUERY, ref = "string", name = "uuid", required = true)
|
||||
public void captcha(HttpServletResponse response, String uuid) throws IOException {
|
||||
//uuid不能为空
|
||||
AssertUtils.isBlank(uuid, ErrorCode.IDENTIFIER_NOT_NULL);
|
||||
|
||||
//生成验证码
|
||||
captchaService.create(response, uuid);
|
||||
}
|
||||
|
||||
@PostMapping("login")
|
||||
@Operation(summary = "登录")
|
||||
public Result login(HttpServletRequest request,
|
||||
@RequestBody LoginDTO login) {
|
||||
// 参数校验
|
||||
ValidatorUtils.validateEntity(login);
|
||||
if (!captchaService.validate(login.getUuid(), login.getCaptcha())) {
|
||||
return new Result().error(ErrorCode.CAPTCHA_ERROR);
|
||||
}
|
||||
SysUserDTO user = sysUserService.getByUsername(login.getUsername());
|
||||
SysLogLoginEntity log = new SysLogLoginEntity();
|
||||
log.setOperation(LoginOperationEnum.LOGIN.value());
|
||||
log.setCreateDate(new Date());
|
||||
log.setIp(IpUtils.getIpAddr(request));
|
||||
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
|
||||
// 用户真实性
|
||||
if (user != null) {
|
||||
log.setCreator(user.getId());
|
||||
log.setCreatorName(user.getUsername());
|
||||
} else {
|
||||
log.setCreatorName(login.getUsername());
|
||||
}
|
||||
LoginStatusEnum status = null;
|
||||
Integer error = 0;
|
||||
// 判断密码和账户有效性
|
||||
if (user == null ||!PasswordUtils.matches(login.getPassword(), user.getPassword())) {
|
||||
status = LoginStatusEnum.FAIL;
|
||||
error = ErrorCode.ACCOUNT_PASSWORD_ERROR;
|
||||
} else if (user.getStatus() == UserStatusEnum.DISABLE.value()) {
|
||||
status = LoginStatusEnum.LOCK;
|
||||
error = ErrorCode.ACCOUNT_DISABLE;
|
||||
}
|
||||
// 统一设置异常信息
|
||||
log.setStatus(status == null? LoginStatusEnum.SUCCESS.value(): status.value());
|
||||
sysLogLoginService.save(log);
|
||||
if (error > 0) {
|
||||
throw new CommonException(error);
|
||||
}
|
||||
return sysUserTokenService.createToken(user.getId());
|
||||
}
|
||||
|
||||
@PostMapping("logout")
|
||||
@Operation(summary = "退出")
|
||||
public Result logout(HttpServletRequest request) {
|
||||
UserDetail user = SecurityUser.getUser();
|
||||
|
||||
//退出
|
||||
sysUserTokenService.logout(user.getId());
|
||||
|
||||
//用户信息
|
||||
SysLogLoginEntity log = new SysLogLoginEntity();
|
||||
log.setOperation(LoginOperationEnum.LOGOUT.value());
|
||||
log.setIp(IpUtils.getIpAddr(request));
|
||||
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
|
||||
log.setIp(IpUtils.getIpAddr(request));
|
||||
log.setStatus(LoginStatusEnum.SUCCESS.value());
|
||||
log.setCreator(user.getId());
|
||||
log.setCreatorName(user.getUsername());
|
||||
log.setCreateDate(new Date());
|
||||
sysLogLoginService.save(log);
|
||||
|
||||
return new Result();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
package com.weather.modules.security.dao;
|
||||
|
||||
import com.weather.common.dao.BaseDao;
|
||||
import com.weather.modules.security.entity.SysUserTokenEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 系统用户Token
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserTokenDao extends BaseDao<SysUserTokenEntity> {
|
||||
|
||||
SysUserTokenEntity getByToken(String token);
|
||||
|
||||
SysUserTokenEntity getByUserId(Long userId);
|
||||
|
||||
void updateToken(@Param("userId") Long userId, @Param("token") String token);
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
package com.weather.modules.security.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 登录表单
|
||||
*
|
||||
* @author 123
|
||||
*/
|
||||
@Data
|
||||
@Schema(title = "登录表单")
|
||||
public class LoginDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(title = "用户名", required = true)
|
||||
@NotBlank(message="{sysuser.username.require}")
|
||||
private String username;
|
||||
|
||||
@Schema(title = "密码")
|
||||
@NotBlank(message="{sysuser.password.require}")
|
||||
private String password;
|
||||
|
||||
@Schema(title = "验证码")
|
||||
@NotBlank(message="{sysuser.captcha.require}")
|
||||
private String captcha;
|
||||
|
||||
@Schema(title = "唯一标识")
|
||||
@NotBlank(message="{sysuser.uuid.require}")
|
||||
private String uuid;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user