diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index e28a3ad4ceb433c33833f455292bb7dd865f50a5..0000000000000000000000000000000000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // 使用 IntelliSense 了解相关属性。 - // 悬停以查看现有属性的描述。 - // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "java", - "name": "RuoYiApplication", - "request": "launch", - "mainClass": "com.ruoyi.RuoYiApplication", - "projectName": "ruoyi-admin" - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 38674ba3ee31895267f0d9be735d3530591ea8fc..0000000000000000000000000000000000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "java.configuration.updateBuildConfiguration": "interactive", - "java.compile.nullAnalysis.mode": "disabled", - "maven.view": "hierarchical", - "maven.executable.options": "-T 4", - "maven.pomfile.autoUpdateEffectivePOM": true, - "java.debug.settings.hotCodeReplace": "auto", - "spring-boot.ls.java.home": "", - "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=9 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms4G -Xlog:disable", - "maven.excludedFolders": [ - "**/.vscode", - "**/.idea", - "**/target", - "**/.*", - "**/node_modules", - "**/target", - "**/bin", - "**/archetype-resources" - ], - "boot-java.rewrite.refactorings.on": true, - "maven.executable.preferMavenWrapper": true, - "java.import.maven.enabled": true, - "java.dependency.packagePresentation": "hierarchical", - "dbcode.connections": [ - { - "connectionId": "btr-_nFe7R0oOvCj0mMun", - "name": "ry-mysql", - "driver": "mysql", - "connectionType": "host", - "host": "127.0.0.1", - "port": 3306, - "ssl": false, - "username": "root", - "password": "123456", - "savePassword": "secretStorage", - "database": "ry", - "connectionTimeout": 30, - "driverOptions": { - "retrievePublickey": true - } - }, - { - "connectionId": "7NX2UhXl__9t3Ca6TzEsB", - "name": "ry-postgres", - "driver": "postgres", - "connectionType": "host", - "host": "127.0.0.1", - "port": 5432, - "ssl": false, - "username": "postgres", - "password": "123456", - "savePassword": "secretStorage", - "connectionTimeout": 30 - }, - { - "connectionId": "fNsY4HlOb21w_5TnIGy_d", - "name": "localhost", - "driver": "redis", - "connectionType": "host", - "host": "127.0.0.1", - "port": 6379, - "ssl": false, - "savePassword": "na", - "readOnly": false, - "connectionTimeout": 30 - } - ], -} \ No newline at end of file diff --git a/doc/image/code-edit.png b/doc/image/code-edit.png deleted file mode 100644 index 5fc972bb8efea327416eead31b463e99b540670e..0000000000000000000000000000000000000000 Binary files a/doc/image/code-edit.png and /dev/null differ diff --git a/doc/image/code-show.png b/doc/image/code-show.png deleted file mode 100644 index 24378e8ef0c97f396bf52716fef2fdd11f5be9a5..0000000000000000000000000000000000000000 Binary files a/doc/image/code-show.png and /dev/null differ diff --git a/doc/image/form-edit.png b/doc/image/form-edit.png deleted file mode 100644 index 4054d34309a656fb8cd553fcc173bd872da66648..0000000000000000000000000000000000000000 Binary files a/doc/image/form-edit.png and /dev/null differ diff --git a/doc/image/logo.png b/doc/image/logo.png deleted file mode 100644 index dab35ca83c55015dbdb3d29a4df296c3c2ffb5f3..0000000000000000000000000000000000000000 Binary files a/doc/image/logo.png and /dev/null differ diff --git a/doc/image/online-mb-code.png b/doc/image/online-mb-code.png deleted file mode 100644 index 45a4973f560a076ab8335fd7b30dcb28b54fdbf8..0000000000000000000000000000000000000000 Binary files a/doc/image/online-mb-code.png and /dev/null differ diff --git a/doc/image/online-mb-edit.png b/doc/image/online-mb-edit.png deleted file mode 100644 index 6f3b3782323c451c31fcc7ba526f0363d6302763..0000000000000000000000000000000000000000 Binary files a/doc/image/online-mb-edit.png and /dev/null differ diff --git a/doc/image/online-mb-list.png b/doc/image/online-mb-list.png deleted file mode 100644 index 0e1c03201a15e9f1cbfb243cbd5db8a6fd1cb196..0000000000000000000000000000000000000000 Binary files a/doc/image/online-mb-list.png and /dev/null differ diff --git "a/doc/\344\273\243\347\240\201\347\224\237\346\210\220.drawio" "b/doc/\344\273\243\347\240\201\347\224\237\346\210\220.drawio" deleted file mode 100644 index c892fbe7a5978110a7fd17ceca32afa79a9d61c2..0000000000000000000000000000000000000000 --- "a/doc/\344\273\243\347\240\201\347\224\237\346\210\220.drawio" +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/doc/\345\205\263\344\272\216\345\244\232\346\225\260\346\215\256\346\272\220\344\270\216\345\210\206\345\270\203\345\274\217\344\272\213\345\212\241.drawio" "b/doc/\345\205\263\344\272\216\345\244\232\346\225\260\346\215\256\346\272\220\344\270\216\345\210\206\345\270\203\345\274\217\344\272\213\345\212\241.drawio" deleted file mode 100644 index 54ac7041a3410589c746183f4f87c9ad6cfce5a2..0000000000000000000000000000000000000000 --- "a/doc/\345\205\263\344\272\216\345\244\232\346\225\260\346\215\256\346\272\220\344\270\216\345\210\206\345\270\203\345\274\217\344\272\213\345\212\241.drawio" +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/doc/\345\276\256\344\277\241\347\231\273\345\275\225.drawio" "b/doc/\345\276\256\344\277\241\347\231\273\345\275\225.drawio" deleted file mode 100644 index 509b1959e0d4565a1a386657e18631dd85016ca0..0000000000000000000000000000000000000000 --- "a/doc/\345\276\256\344\277\241\347\231\273\345\275\225.drawio" +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/doc/\346\224\257\344\273\230\346\265\201\347\250\213\345\233\276.drawio" "b/doc/\346\224\257\344\273\230\346\265\201\347\250\213\345\233\276.drawio" deleted file mode 100644 index 184cb9f4b3d78e2e1c26f8c4aae1623fca2e932c..0000000000000000000000000000000000000000 --- "a/doc/\346\224\257\344\273\230\346\265\201\347\250\213\345\233\276.drawio" +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/doc/\346\224\257\344\273\230\347\263\273\347\273\237\350\256\242\345\215\225\347\212\266\346\200\201\345\233\276.drawio" "b/doc/\346\224\257\344\273\230\347\263\273\347\273\237\350\256\242\345\215\225\347\212\266\346\200\201\345\233\276.drawio" deleted file mode 100644 index ce41fa8fa895a27b8baed944860d905292ff6c52..0000000000000000000000000000000000000000 --- "a/doc/\346\224\257\344\273\230\347\263\273\347\273\237\350\256\242\345\215\225\347\212\266\346\200\201\345\233\276.drawio" +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/doc/\346\235\203\351\231\220\346\216\247\345\210\266.md" "b/doc/\346\235\203\351\231\220\346\216\247\345\210\266.md" deleted file mode 100644 index be6d0a79d475e2cdbafc7023722ff14f736b08b2..0000000000000000000000000000000000000000 --- "a/doc/\346\235\203\351\231\220\346\216\247\345\210\266.md" +++ /dev/null @@ -1,68 +0,0 @@ -### 与权限有关的注解 - -`@Anonymous`注解用于配置公开接口 - -`@PreAuthorize`注解用于配置接口要求用户拥有某些权限才可访问,它拥有如下方法 - -| 方法 | 参数 | 描述 | -| ----------- | ------ | ---------------------------------------------- | -| hasPermi | String | 验证用户是否具备某权限 | -| lacksPermi | String | 验证用户是否不具备某权限,与 hasPermi逻辑相反 | -| hasAnyPermi | String | 验证用户是否具有以下任意一个权限 | -| hasRole | String | 判断用户是否拥有某个角色 | -| lacksRole | String | 验证用户是否不具备某角色,与 isRole逻辑相反 | -| hasAnyRoles | String | 验证用户是否具有以下任意一个角色,多个逗号分隔 | - -```java -@PreAuthorize("@ss.hasPermi('system:user:list')") -@PreAuthorize("@ss.lacksPermi('system:user:list')") -@PreAuthorize("@ss.hasAnyPermi('system:user:add,system:user:edit')") -``` - -`@DataScope`注解用于配置接口数据权限 - -* `deptAlias`用于指定部门表的别名; -* `userAlias`用于指定用户表的别名; -* 实体需要继承BaseEntity类; -* `全部数据权限`、`自定数据权限`、`部门数据权限`、`部门及以下数据权限`、`仅本人数据权限`五种权限模式在后台角色管理界面配置数据权限 - -```java -// 部门数据权限注解 -@DataScope(deptAlias = "d") -// 部门及用户权限注解 -@DataScope(deptAlias = "d", userAlias = "u") -``` - -1. 使用注解 - -```java - -@DataScope(deptAlias = "d", userAlias = "u") -public List<...> select(...) -{ - return mapper.select(...); -} -``` - -2. 配置mybatis的xml - -```xml - -``` - -### 安全工具类 - -com.ruoyi.common.utils.SecurityUtils - -| 方法 | 参数 | 返回 | 描述 | -| ------------ | ------ | ---------- | ------------------------ | -| getUserId | 无 | Long | 获取当前用户ID | -| getDeptId | 无 | Long | 获取当前部门ID | -| getUsername | 无 | String | 获取当前用户账户 | -| getLoginUser | 无 | LonginUser | 获取当前登录用户代理 | -| hasPermi | String | boolean | 验证用户是否具备某权限 | -| hasRole | String | boolean | 验证用户是否拥有某个角色 | diff --git "a/doc/\346\250\241\345\235\227\344\276\235\350\265\226\345\205\263\347\263\273.drawio" "b/doc/\346\250\241\345\235\227\344\276\235\350\265\226\345\205\263\347\263\273.drawio" deleted file mode 100644 index 6b2ebacbc55c49b7b52b1602958f63ddf76c5b94..0000000000000000000000000000000000000000 --- "a/doc/\346\250\241\345\235\227\344\276\235\350\265\226\345\205\263\347\263\273.drawio" +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/doc/\347\231\273\345\275\225+JWT\351\200\273\350\276\221.drawio" "b/doc/\347\231\273\345\275\225+JWT\351\200\273\350\276\221.drawio" deleted file mode 100644 index 9d05d20498c3a72b19918c6910ab6d89a8292769..0000000000000000000000000000000000000000 --- "a/doc/\347\231\273\345\275\225+JWT\351\200\273\350\276\221.drawio" +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/doc/\350\213\245\344\276\235\347\216\257\345\242\203\344\275\277\347\224\250\346\211\213\345\206\214.docx" "b/doc/\350\213\245\344\276\235\347\216\257\345\242\203\344\275\277\347\224\250\346\211\213\345\206\214.docx" deleted file mode 100644 index 9e4daef4d9be2e445419109a02eaf321cd4d537e..0000000000000000000000000000000000000000 Binary files "a/doc/\350\213\245\344\276\235\347\216\257\345\242\203\344\275\277\347\224\250\346\211\213\345\206\214.docx" and /dev/null differ diff --git "a/doc/\351\202\256\347\256\261\346\210\226\347\237\255\344\277\241\351\252\214\350\257\201\347\240\201\347\231\273\345\275\225\346\263\250\345\206\214\351\207\215\347\275\256\346\265\201\347\250\213\345\233\276.drawio" "b/doc/\351\202\256\347\256\261\346\210\226\347\237\255\344\277\241\351\252\214\350\257\201\347\240\201\347\231\273\345\275\225\346\263\250\345\206\214\351\207\215\347\275\256\346\265\201\347\250\213\345\233\276.drawio" deleted file mode 100644 index 7e623e9aeb80fb11aaaa29ea18b9a6e8656ece19..0000000000000000000000000000000000000000 --- "a/doc/\351\202\256\347\256\261\346\210\226\347\237\255\344\277\241\351\252\214\350\257\201\347\240\201\347\231\273\345\275\225\346\263\250\345\206\214\351\207\215\347\275\256\346\265\201\347\250\213\345\233\276.drawio" +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/doc/\351\231\220\346\265\201\351\200\273\350\276\221.drawio" "b/doc/\351\231\220\346\265\201\351\200\273\350\276\221.drawio" deleted file mode 100644 index 7ad47d0cd00af719e7fafad7d5f6d1b5c7219ad0..0000000000000000000000000000000000000000 --- "a/doc/\351\231\220\346\265\201\351\200\273\350\276\221.drawio" +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 26b898ba8175a8c41cbdcc4bad40591426736ddc..ab6997ad9aa800a87437bb28f46635b4a080ab98 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ UTF-8 17 3.1.1 - 3.4.4 + 3.4.3 1.2.24 1.1 1.21 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index b0610df75658a98e97207a373169dbf0790f6aab..f90e8a658b4e3db6e945616fcf576f427dc0b526 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -2,7 +2,6 @@ package com.ruoyi; import java.net.InetAddress; import java.net.UnknownHostException; - import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; @@ -11,10 +10,10 @@ import org.springframework.core.env.Environment; /** * 启动程序 - * + * * @author ruoyi */ -@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) public class RuoYiApplication { public static void main(String[] args) throws UnknownHostException { // System.setProperty("spring.devtools.restart.enabled", "false"); @@ -40,5 +39,7 @@ public class RuoYiApplication { " Swagger文档: http://" + ip + ":" + port + "/swagger-ui/index.html\n" + " Knife4j文档: http://" + ip + ":" + port + "/doc.html" + "" + "\n" + "----------------------------------------------------------"); + + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index f2f7cba94bdabaa5e80d5c49bef5dfd22f0a73ca..44c8e144aaa5e94f0291cdddad2a200ac86f05b8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -1,8 +1,6 @@ package com.ruoyi.web.controller.monitor; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -16,7 +14,6 @@ import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; @@ -84,22 +81,4 @@ public class SysOperlogController extends BaseController operLogService.cleanOperLog(); return success(); } - - @Operation(summary = "业务监控") - @GetMapping("/business") - public R> business(SysOperLog operLog) { - // 查询并获取统计数据 - List> successStats = operLogService.getSuccessOperationStats(operLog); - List> failureStats = operLogService.getFailureOperationStats(operLog); - List> statusStats = operLogService.getStatusStats(operLog); - List> moduleOperationStats = operLogService.getModuleOperationStats(operLog); - // 创建一个新的 Map 来组织数据 - Map result = new LinkedHashMap<>(); - result.put("successStats", successStats); - result.put("failureStats", failureStats); - result.put("statusStats", statusStats); - result.put("moduleOperationStats", moduleOperationStats); - result.put("total", successStats.size() + failureStats.size() + statusStats.size() + moduleOperationStats.size()); - return R.ok(result); - } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/AppLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/AppLoginController.java new file mode 100644 index 0000000000000000000000000000000000000000..91a0179bf4db560f78874dba928e357a0871a5dd --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/AppLoginController.java @@ -0,0 +1,133 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import java.util.Set; + +import jakarta.servlet.http.HttpServletRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.web.bind.annotation.*; + +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.entity.SysMenu; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.AppLoginBody; +import com.ruoyi.common.core.domain.model.AppLoginUser; +import com.ruoyi.common.core.domain.model.LoginBody; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.AppSecurityUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.framework.web.service.AppLoginService; +import com.ruoyi.framework.web.service.AppPermissionService; +import com.ruoyi.framework.web.service.AppTokenService; +import com.ruoyi.system.service.ISysMenuService; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; + +/** + * 登录验证 + * + * @author ruoyi + */ +@Tag(name = "登录验证") +@RestController +@RequestMapping("/app") +public class AppLoginController { + private static final Logger log = LoggerFactory.getLogger(AppLoginController.class); + + @Autowired +// private SysLoginService appLoginService; + private AppLoginService appLoginService; + + @Autowired + private ISysMenuService menuService; + + @Autowired + private AppPermissionService permissionService; + + @Autowired + private AppTokenService appTokenService; + + /** + * 登录方法 + * + * @param appLoginBody 登录信息 + * @return 结果 + */ + @Operation(summary = "登录方法") + @PostMapping("/login") + public AjaxResult login(@RequestBody AppLoginBody appLoginBody) { + AjaxResult ajax = AjaxResult.success(); + // 生成令牌 + String token = appLoginService.login(appLoginBody.getUsername(), appLoginBody.getPassword(), appLoginBody.getCode(), + appLoginBody.getUuid()); + ajax.put(Constants.TOKEN, token); + return ajax; + } + + + /** + * 获取用户信息 + * + * @return 用户信息 + */ + @Operation(summary = "获取用户信息") + @GetMapping("getInfo") + public AjaxResult getInfo() { + try { + log.info("App获取用户信息请求"); + + // 从SecurityContext获取用户信息 + AppLoginUser appLoginUser = AppSecurityUtils.getLoginUser(); +// log.info("成功获取到App用户: {}", appLoginUser.getUsername()); + + AppUser appUser = appLoginUser.getUser(); +// log.info("成功获取到App用户信息: {}", appUser.getUserName()); + + // 角色集合 +// Set roles = permissionService.getRolePermission(appUser); +// // 权限集合 +// Set permissions = permissionService.getMenuPermission(appUser); + + // 更新用户权限信息 +// if (appLoginUser.getPermissions() == null || !appLoginUser.getPermissions().equals(permissions)) { +// log.info("更新用户权限信息"); +// appLoginUser.setPermissions(permissions); +// appTokenService.refreshToken(appLoginUser); +// } +// appTokenService.refreshToken(appLoginUser); + AjaxResult ajax = AjaxResult.success(); + ajax.put("user", appUser); +// ajax.put("roles", roles); +// ajax.put("permissions", permissions); + return ajax; + } catch (Exception e) { + log.error("获取用户信息失败: {}", e.getMessage(), e); + return AjaxResult.error("获取用户信息失败: " + e.getMessage()); + } + } + + + /** + * 获取路由信息 + * + * @return 路由信息 + */ + @Operation(summary = "获取路由信息") + @GetMapping("/getRouters") + public AjaxResult getRouters() { + Long userId = AppSecurityUtils.getUserId(); + List menus = menuService.selectMenuTreeByUserId(userId); + return AjaxResult.success(menuService.buildMenus(menus)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/AppRegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/AppRegisterController.java new file mode 100644 index 0000000000000000000000000000000000000000..8e93dfbd53ada60f823621b74ec178fac7d4e6fa --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/AppRegisterController.java @@ -0,0 +1,44 @@ +package com.ruoyi.web.controller.system; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.AppRegisterBody; +import com.ruoyi.common.core.domain.model.RegisterBody; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.web.service.AppRegisterService; +import com.ruoyi.framework.web.service.SysRegisterService; +import com.ruoyi.system.service.ISysConfigService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +/** + * 注册验证 + * + * @author ruoyi + */ +@Tag(name = "注册验证") +@RestController +public class AppRegisterController extends BaseController +{ + @Autowired + private AppRegisterService registerService; + + @Autowired + private ISysConfigService configService; + + @Operation(summary = "注册方法") + @PostMapping("/app/register") + public AjaxResult register(@RequestBody AppRegisterBody user) + { + if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) + { + return error("当前系统没有开启注册功能!"); + } + String msg = registerService.register(user); + return StringUtils.isEmpty(msg) ? success() : error(msg); + } +} diff --git a/ruoyi-admin/src/main/resources/application-auth.yml b/ruoyi-admin/src/main/resources/application-auth.yml index c9109b719e7a914233704d228e2778bf50776281..c56f24f0e2e53731f5e658b3e80df46cf2110442 100644 --- a/ruoyi-admin/src/main/resources/application-auth.yml +++ b/ruoyi-admin/src/main/resources/application-auth.yml @@ -13,20 +13,10 @@ oauth: tfa: phone: dysms: - # 阿里云 AccessKey ID - accessKeyId: appId - # 阿里云 AccessKey Secret - accessKeySecret: appSecret - # 短信模板 - template: - VerificationCode: - # 短信模板编码 - templateCode: SMS_123456789 - # 短信签名 - signName: 阿里云短信测试 - # 短信模板必需的数据名称,多个key以逗号分隔,此处配置作为校验 - keys: code - + # 阿里云短信 AccessKey ID + appId: appId + # 阿里云短信 AccessKey Secret + appSecret: appSecret spring: mail: diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index b154c59df6e353ee917e6b821f20cd8359fc29c2..a6fe014fff0d321c2b62a87a5e213334b447112d 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -9,7 +9,7 @@ spring: datasource: # 主库数据源 MASTER: - url: jdbc:mysql://127.0.0.1/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://127.0.0.1/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: 123456 # MASTER: diff --git a/ruoyi-admin/src/main/resources/application-middleware.yml b/ruoyi-admin/src/main/resources/application-middleware.yml index b118f7c283041a7d035fbfde9c4ea627db51a8fe..49a83203d82e0e204b0e757396df459be748e170 100644 --- a/ruoyi-admin/src/main/resources/application-middleware.yml +++ b/ruoyi-admin/src/main/resources/application-middleware.yml @@ -3,7 +3,7 @@ spring: # redis 配置 redis: # 地址 - host: localhost + host: 127.0.0.1 # 端口,默认为6379 port: 6379 # 数据库索引 diff --git a/ruoyi-admin/src/main/resources/application-oss.yml b/ruoyi-admin/src/main/resources/application-oss.yml index 6e1223b83a623aed3e0949f26064a8843567da35..579c36bf39a60a3cf02cee9323cdcc5cd3d3f704 100644 --- a/ruoyi-admin/src/main/resources/application-oss.yml +++ b/ruoyi-admin/src/main/resources/application-oss.yml @@ -1,10 +1,10 @@ # oss配置 oss: - enable: false - primary: MASTER - client: - MASTER: - accessKeyId: - accessKeySecret: - bucketName: - endpoint: + enable: false + primary: MASTER + client: + MASTER: + accessKeyId: + accessKeySecret: + bucketName: + endpoint: diff --git a/ruoyi-admin/src/main/resources/application-pay.yml b/ruoyi-admin/src/main/resources/application-pay.yml index 58a297edf57ee58f728a9ff05849f1cdd6a4d712..6b9930f131a14ee92565977e4c8ce50ec05b9a92 100644 --- a/ruoyi-admin/src/main/resources/application-pay.yml +++ b/ruoyi-admin/src/main/resources/application-pay.yml @@ -1,7 +1,4 @@ -# 当前支付模块写的并不完善,请根据自己的业务需求进行修改 -# 回调地址使用的内网穿透http://e2vca6.natappfree.cc pay: - # https://doc.shouqianba.com/zh-cn/ sqb: enabled: false appId: "appId" @@ -10,16 +7,14 @@ pay: terminalKey: "terminalKey" vendorSn: "vendorSn" vendorKey: "vendorKey" - publicKey: classpath:pay/sqb/sqb_public_key.pem - notifyUrl: http://e2vca6.natappfree.cc/pay/sqb/notify - # https://opendocs.alipay.com/open/02np95 alipay: enabled: false appId: appid + # 应用私钥 appPrivateKey: classpath:pay/alipay/alipay_private_key.pem + # 支付宝公钥 alipayPublicKey: classpath:pay/alipay/alipay_public_key.pem notifyUrl: http://e2vca6.natappfree.cc/alipay/notify - # https://github.com/wechatpay-apiv3/wechatpay-java wechat: enabled: false appId: appid @@ -27,4 +22,5 @@ pay: privateKeyPath: classpath:pay/wx/apiclient_key.pem merchantId: merchantId merchantSerialNumber: merchantSerialNumber + # 回调地址,此处使用的内网穿透http://e2vca6.natappfree.cc notifyUrl: http://e2vca6.natappfree.cc/pay/wechat/notify diff --git a/ruoyi-auth/ruoyi-auth-starter/src/main/java/com/ruoyi/auth/controller/OauthUserController.java b/ruoyi-auth/ruoyi-auth-common/src/main/java/com/ruoyi/auth/common/controller/OauthUserController.java similarity index 88% rename from ruoyi-auth/ruoyi-auth-starter/src/main/java/com/ruoyi/auth/controller/OauthUserController.java rename to ruoyi-auth/ruoyi-auth-common/src/main/java/com/ruoyi/auth/common/controller/OauthUserController.java index cefe56e5dff9f86d2723592aa55cc838a33f95ef..f48234572a1fb2e4de14ad6e1007159b043d4a2a 100644 --- a/ruoyi-auth/ruoyi-auth-starter/src/main/java/com/ruoyi/auth/controller/OauthUserController.java +++ b/ruoyi-auth/ruoyi-auth-common/src/main/java/com/ruoyi/auth/common/controller/OauthUserController.java @@ -1,4 +1,4 @@ -package com.ruoyi.auth.controller; +package com.ruoyi.auth.common.controller; import java.util.List; @@ -35,7 +35,8 @@ import jakarta.servlet.http.HttpServletResponse; @RestController @RequestMapping("/system/oauth") @Tag(name = "【第三方认证】管理") -public class OauthUserController extends BaseController { +public class OauthUserController extends BaseController +{ @Autowired private IOauthUserService oauthUserService; @@ -45,7 +46,8 @@ public class OauthUserController extends BaseController { @Operation(summary = "查询第三方认证列表") @PreAuthorize("@ss.hasPermi('system:oauth:list')") @GetMapping("/list") - public TableDataInfo list(OauthUser oauthUser) { + public TableDataInfo list(OauthUser oauthUser) + { startPage(); List list = oauthUserService.selectOauthUserList(oauthUser); return getDataTable(list); @@ -58,7 +60,8 @@ public class OauthUserController extends BaseController { @PreAuthorize("@ss.hasPermi('system:oauth:export')") @Log(title = "第三方认证", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, OauthUser oauthUser) { + public void export(HttpServletResponse response, OauthUser oauthUser) + { List list = oauthUserService.selectOauthUserList(oauthUser); ExcelUtil util = new ExcelUtil(OauthUser.class); util.exportExcel(response, list, "第三方认证数据"); @@ -70,7 +73,8 @@ public class OauthUserController extends BaseController { @Operation(summary = "获取第三方认证详细信息") @PreAuthorize("@ss.hasPermi('system:oauth:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { + public AjaxResult getInfo(@PathVariable("id") Long id) + { return success(oauthUserService.selectOauthUserById(id)); } @@ -81,7 +85,8 @@ public class OauthUserController extends BaseController { @PreAuthorize("@ss.hasPermi('system:oauth:add')") @Log(title = "第三方认证", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody OauthUser oauthUser) { + public AjaxResult add(@RequestBody OauthUser oauthUser) + { return toAjax(oauthUserService.insertOauthUser(oauthUser)); } @@ -92,7 +97,8 @@ public class OauthUserController extends BaseController { @PreAuthorize("@ss.hasPermi('system:oauth:edit')") @Log(title = "第三方认证", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody OauthUser oauthUser) { + public AjaxResult edit(@RequestBody OauthUser oauthUser) + { return toAjax(oauthUserService.updateOauthUser(oauthUser)); } @@ -102,8 +108,9 @@ public class OauthUserController extends BaseController { @Operation(summary = "删除第三方认证") @PreAuthorize("@ss.hasPermi('system:oauth:remove')") @Log(title = "第三方认证", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable(name = "ids") Long[] ids) { + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable( name = "ids" ) Long[] ids) + { return toAjax(oauthUserService.deleteOauthUserByIds(ids)); } } diff --git a/ruoyi-auth/ruoyi-auth-common/src/main/java/com/ruoyi/auth/common/service/TfaService.java b/ruoyi-auth/ruoyi-auth-common/src/main/java/com/ruoyi/auth/common/service/TfaService.java deleted file mode 100644 index be672f326b2cf73f560f9499af2bcc6e23844b2a..0000000000000000000000000000000000000000 --- a/ruoyi-auth/ruoyi-auth-common/src/main/java/com/ruoyi/auth/common/service/TfaService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ruoyi.auth.common.service; - -import com.ruoyi.common.core.domain.model.LoginBody; -import com.ruoyi.common.core.domain.model.RegisterBody; - -public interface TfaService { - public void doBind(LoginBody loginBody); - - public void doBindVerify(LoginBody loginBody); - - public void doRegister(RegisterBody registerBody); - - public void doRegisterVerify(RegisterBody registerBody); - - public void doLogin(LoginBody loginBody); - - public String doLoginVerify(LoginBody loginBody); -} diff --git a/ruoyi-auth/ruoyi-auth-starter/src/main/java/com/ruoyi/auth/controller/TfaController.java b/ruoyi-auth/ruoyi-auth-starter/src/main/java/com/ruoyi/auth/controller/TfaController.java deleted file mode 100644 index 0f8ee36541a69af93f168eab754ca7752c5fd712..0000000000000000000000000000000000000000 --- a/ruoyi-auth/ruoyi-auth-starter/src/main/java/com/ruoyi/auth/controller/TfaController.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ruoyi.auth.controller; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.ruoyi.auth.common.service.TfaService; -import com.ruoyi.common.annotation.Anonymous; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.model.LoginBody; -import com.ruoyi.common.core.domain.model.RegisterBody; - -import jakarta.annotation.PostConstruct; - -@RestController -@RequestMapping("/auth/{channel}") // dySms mail -public class TfaController extends BaseController { - - @Autowired(required = false) - Map tfaServiceMap; - - @PostConstruct - public void init() { - if (tfaServiceMap == null) { - tfaServiceMap = new HashMap<>(); - logger.warn("请注意,没有加载任何双认证服务"); - } else { - tfaServiceMap.forEach((k, v) -> { - logger.info("已加载双认证服务 {}", k); - }); - } - } - - @PostMapping("/send/bind") - public AjaxResult send(@PathVariable String channel, @RequestBody LoginBody loginBody) { - TfaService tfaService = tfaServiceMap.get(channel + "AuthService"); - tfaService.doBind(loginBody); - return success(); - } - - @PostMapping("/verify/bind") // 发送验证码 - public AjaxResult verify(@PathVariable String channel, @RequestBody LoginBody loginBody) { - TfaService tfaService = tfaServiceMap.get(channel + "AuthService"); - tfaService.doBindVerify(loginBody); - return success(); - } - - @PostMapping("/send/register") - @Anonymous - public AjaxResult sendRegister(@PathVariable String channel, @RequestBody RegisterBody registerBody) { - TfaService tfaService = tfaServiceMap.get(channel + "AuthService"); - tfaService.doRegister(registerBody); - return success(); - } - - @PostMapping("/verify/register") - @Anonymous - public AjaxResult verifyRegister(@PathVariable String channel, @RequestBody RegisterBody registerBody) { - TfaService tfaService = tfaServiceMap.get(channel + "AuthService"); - tfaService.doRegisterVerify(registerBody); - return success(); - } - - @PostMapping("/send/login") - @Anonymous - public AjaxResult sendLogin(@PathVariable String channel, @RequestBody LoginBody loginBody) { - TfaService tfaService = tfaServiceMap.get(channel + "AuthService"); - tfaService.doLogin(loginBody); - return success(); - } - - @PostMapping("/verify/login") - @Anonymous - public AjaxResult verifyLogin(@PathVariable String channel, @RequestBody LoginBody loginBody) { - TfaService tfaService = tfaServiceMap.get(channel + "AuthService"); - return success(tfaService.doLoginVerify(loginBody)); - } -} diff --git a/ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/controller/SysAuthController.java b/ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/controller/SysAuthController.java index 2673ea8374cd9f52788aacbb192ff6327659be70..8652222516dd8088b56fb4d1a1366e589db22f8d 100644 --- a/ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/controller/SysAuthController.java +++ b/ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/controller/SysAuthController.java @@ -13,8 +13,6 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.alibaba.fastjson2.JSONObject; -import com.ruoyi.auth.common.domain.OauthUser; -import com.ruoyi.auth.common.service.IOauthUserService; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.controller.BaseController; @@ -27,7 +25,9 @@ import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.web.service.SysPermissionService; import com.ruoyi.framework.web.service.TokenService; -import com.ruoyi.oauth.justauth.utils.JustAuthUtils; +import com.ruoyi.auth.common.domain.OauthUser; +import com.ruoyi.auth.common.service.IOauthUserService; +import com.ruoyi.oauth.justauth.utils.AuthUtils; import com.ruoyi.system.service.ISysUserService; import jakarta.servlet.http.HttpServletRequest; @@ -91,7 +91,7 @@ public class SysAuthController extends BaseController return error(source + "平台账号暂不支持"); } JSONObject json = JSONObject.parseObject(obj); - AuthRequest authRequest = JustAuthUtils.getAuthRequest(source, json.getString("clientId"), json.getString("clientSecret"), json.getString("redirectUri"), authStateCache); + AuthRequest authRequest = AuthUtils.getAuthRequest(source, json.getString("clientId"), json.getString("clientSecret"), json.getString("redirectUri"), authStateCache); String authorizeUrl = authRequest.authorize(AuthStateUtils.createState()); return success(authorizeUrl); } @@ -114,7 +114,7 @@ public class SysAuthController extends BaseController return AjaxResult.error(10002, "第三方平台系统不支持或未提供来源"); } JSONObject json = JSONObject.parseObject(obj); - AuthRequest authRequest = JustAuthUtils.getAuthRequest(source, json.getString("clientId"), json.getString("clientSecret"), json.getString("redirectUri"), authStateCache); + AuthRequest authRequest = AuthUtils.getAuthRequest(source, json.getString("clientId"), json.getString("clientSecret"), json.getString("redirectUri"), authStateCache); AuthResponse response = authRequest.login(callback); if (response.ok()) { diff --git a/ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/utils/JustAuthUtils.java b/ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/utils/AuthUtils.java similarity index 99% rename from ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/utils/JustAuthUtils.java rename to ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/utils/AuthUtils.java index a421ad66e53aae1b7423c7ad803a3de53baf5a59..69799bfc212213188a887173063ecbb72b718d18 100644 --- a/ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/utils/JustAuthUtils.java +++ b/ruoyi-auth/ruoyi-oauth-justauth/src/main/java/com/ruoyi/oauth/justauth/utils/AuthUtils.java @@ -38,7 +38,7 @@ import me.zhyd.oauth.request.AuthWeiboRequest; * * @author ruoyi */ -public class JustAuthUtils +public class AuthUtils { @SuppressWarnings("deprecation") public static AuthRequest getAuthRequest(String source, String clientId, String clientSecret, String redirectUri, diff --git a/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/controller/WxLoginController.java b/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/controller/WxLoginController.java index 28f03b6c5d09f8816aac8ffc43edbaf52aad7d09..1b2be2930b9e5c7b0d3c3cc12086f33735e5a6f7 100644 --- a/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/controller/WxLoginController.java +++ b/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/controller/WxLoginController.java @@ -13,21 +13,24 @@ import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.oauth.wx.service.Impl.WxMiniAppLoginServiceImpl; -import com.ruoyi.oauth.wx.service.Impl.WxPubLoginServiceImpl; +import com.ruoyi.oauth.wx.constant.WxMiniAppConstant; +import com.ruoyi.oauth.wx.constant.WxPubConstant; +import com.ruoyi.oauth.wx.service.Impl.WxLoginServiceImpl; @RestController @RequestMapping("/oauth/wx") public class WxLoginController extends BaseController { + @Autowired + public WxPubConstant wxH5AppConstant; @Autowired - private WxMiniAppLoginServiceImpl wxMiniAppLoginServiceImpl; + public WxMiniAppConstant wxMiniAppConstant; @Autowired - private IOauthUserService oauthUserService; + private WxLoginServiceImpl wxLoginServiceImpl; @Autowired - private WxPubLoginServiceImpl wxPubLoginServiceImpl; + private IOauthUserService oauthUserService; @Anonymous @PostMapping("/login/{source}/{code}") @@ -35,9 +38,10 @@ public class WxLoginController extends BaseController { String token = null; AjaxResult ajax = AjaxResult.success(); if ("miniapp".equals(source)) { - token = wxMiniAppLoginServiceImpl.doLogin(code); + token = wxLoginServiceImpl.doLoginMiniApp(code); + } else if ("pub".equals(source)) { - token = wxPubLoginServiceImpl.doLogin(code); + token = wxLoginServiceImpl.doLoginPub(code); } else { return error("错误的登录方式"); } @@ -56,9 +60,9 @@ public class WxLoginController extends BaseController { oauthUser.setUserId(getUserId()); oauthUser.setCode(code); if ("miniapp".equals(source)) { - msg = wxMiniAppLoginServiceImpl.doRegister(oauthUser); + msg = wxLoginServiceImpl.doRegisterMiniApp(oauthUser); } else if ("pub".equals(source)) { - msg = wxPubLoginServiceImpl.doRegister(oauthUser); + msg = wxLoginServiceImpl.doRegisterPub(oauthUser); } else { return error("错误的注册方式"); } diff --git a/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/Impl/WxMiniAppLoginServiceImpl.java b/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/Impl/WxLoginServiceImpl.java similarity index 45% rename from ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/Impl/WxMiniAppLoginServiceImpl.java rename to ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/Impl/WxLoginServiceImpl.java index ebea34ef2a0c2fc7dc71b3596604f88ec20b8584..0a2879946376c1fa2b1b71580309c48307234564 100644 --- a/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/Impl/WxMiniAppLoginServiceImpl.java +++ b/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/Impl/WxLoginServiceImpl.java @@ -1,8 +1,12 @@ package com.ruoyi.oauth.wx.service.Impl; +import java.util.HashMap; +import java.util.Map; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.auth.common.domain.OauthUser; import com.ruoyi.auth.common.service.IOauthUserService; @@ -10,17 +14,22 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.http.HttpClientUtil; import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.framework.web.service.UserDetailsServiceImpl; import com.ruoyi.oauth.wx.constant.WxMiniAppConstant; +import com.ruoyi.oauth.wx.constant.WxPubConstant; import com.ruoyi.oauth.wx.service.WxLoginService; import com.ruoyi.system.service.ISysUserService; @Service -public class WxMiniAppLoginServiceImpl implements WxLoginService { +public class WxLoginServiceImpl implements WxLoginService { @Autowired private WxMiniAppConstant wxAppConstant; + @Autowired + private WxPubConstant wxH5Constant; + @Autowired private TokenService tokenService; @@ -29,17 +38,30 @@ public class WxMiniAppLoginServiceImpl implements WxLoginService { @Autowired private ISysUserService userService; - + @Autowired private IOauthUserService oauthUserService; - @Override - public String doLogin(String code) { - String openid = doAuth( - wxAppConstant.getUrl(), - wxAppConstant.getAppId(), - wxAppConstant.getAppSecret(), - code).getString("openid"); + public Map doAuth(String url, String appid, String secret, String code) { + String getMessageUrl = url + "?appid=" + appid + "&secret=" + secret + "&js_code=" + code + + "&grant_type=authorization_code"; + String result = HttpClientUtil.sendHttpGet(getMessageUrl); + JSONObject jsonObject = JSON.parseObject(result); + if (jsonObject.containsKey("openid")) { + String openid = jsonObject.getString("openid"); + String sessionKey = jsonObject.getString("session_key"); + return new HashMap() { + { + put("openid", openid); + put("sessionKey", sessionKey); + } + }; + } else { + throw new ServiceException(jsonObject.getString("errmsg"), jsonObject.getIntValue("errcode")); + } + } + + public String doLogin(String openid) { OauthUser selectOauthUser = oauthUserService.selectOauthUserByUUID(openid); if (selectOauthUser == null) { return null; @@ -53,22 +75,63 @@ public class WxMiniAppLoginServiceImpl implements WxLoginService { } @Override - public String doRegister(OauthUser oauthUser) { + public String doLoginPub(String code) { + String openid = doAuth( + wxH5Constant.getUrl(), + wxH5Constant.getAppId(), + wxH5Constant.getAppSecret(), + code).get("openid"); + return doLogin(openid); + } + + @Override + public String doLoginMiniApp(String code) { + String openid = doAuth( + wxAppConstant.getUrl(), + wxAppConstant.getAppId(), + wxAppConstant.getAppSecret(), + code).get("openid"); + return doLogin(openid); + } + + @Override + public String doRegisterPub(OauthUser oauthUser) { + if (StringUtils.isEmpty(oauthUser.getCode())) { + return "没有凭证"; + } + if (oauthUser.getUserId() == null) { + return "请先注册账号"; + } + Map doAuth = doAuth( + wxH5Constant.getUrl(), + wxH5Constant.getAppId(), + wxH5Constant.getAppSecret(), + oauthUser.getCode()); + oauthUser.setOpenId(doAuth.get("openid")); + oauthUser.setUuid(doAuth.get("openid")); + oauthUser.setSource("WXPub"); + oauthUser.setAccessToken(doAuth.get("sessionKey")); + oauthUserService.insertOauthUser(oauthUser); + return ""; + } + + @Override + public String doRegisterMiniApp(OauthUser oauthUser) { if (StringUtils.isEmpty(oauthUser.getCode())) { return "没有凭证"; } if (oauthUser.getUserId() == null) { return "请先注册账号"; } - JSONObject doAuth = doAuth( + Map doAuth = doAuth( wxAppConstant.getUrl(), wxAppConstant.getAppId(), wxAppConstant.getAppSecret(), oauthUser.getCode()); - oauthUser.setOpenId(doAuth.getString("openid")); - oauthUser.setUuid(doAuth.getString("openid")); + oauthUser.setOpenId(doAuth.get("openid")); + oauthUser.setUuid(doAuth.get("openid")); oauthUser.setSource("WXMiniApp"); - oauthUser.setAccessToken(doAuth.getString("sessionKey")); + oauthUser.setAccessToken(doAuth.get("sessionKey")); oauthUserService.insertOauthUser(oauthUser); return ""; } diff --git a/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/Impl/WxPubLoginServiceImpl.java b/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/Impl/WxPubLoginServiceImpl.java deleted file mode 100644 index 350fee148f7ec560384b274daef253dae919dd88..0000000000000000000000000000000000000000 --- a/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/Impl/WxPubLoginServiceImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ruoyi.oauth.wx.service.Impl; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.alibaba.fastjson2.JSONObject; -import com.ruoyi.auth.common.domain.OauthUser; -import com.ruoyi.auth.common.service.IOauthUserService; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.web.service.TokenService; -import com.ruoyi.framework.web.service.UserDetailsServiceImpl; -import com.ruoyi.oauth.wx.constant.WxPubConstant; -import com.ruoyi.oauth.wx.service.WxLoginService; -import com.ruoyi.system.service.ISysUserService; - -@Service -public class WxPubLoginServiceImpl implements WxLoginService { - - @Autowired - private WxPubConstant wxH5Constant; - - @Autowired - private TokenService tokenService; - - @Autowired - private UserDetailsServiceImpl userDetailsServiceImpl; - - @Autowired - private ISysUserService userService; - - @Autowired - private IOauthUserService oauthUserService; - - @Override - public String doLogin(String code) { - String openid = doAuth( - wxH5Constant.getUrl(), - wxH5Constant.getAppId(), - wxH5Constant.getAppSecret(), - code).getString("openid"); - OauthUser selectOauthUser = oauthUserService.selectOauthUserByUUID(openid); - if (selectOauthUser == null) { - return null; - } - SysUser sysUser = userService.selectUserById(selectOauthUser.getUserId()); - if (sysUser == null) { - throw new ServiceException("该微信未绑定用户"); - } - LoginUser loginUser = (LoginUser) userDetailsServiceImpl.createLoginUser(sysUser); - return tokenService.createToken(loginUser); - } - - @Override - public String doRegister(OauthUser oauthUser) { - if (StringUtils.isEmpty(oauthUser.getCode())) { - return "没有凭证"; - } - if (oauthUser.getUserId() == null) { - return "请先注册账号"; - } - JSONObject doAuth = doAuth( - wxH5Constant.getUrl(), - wxH5Constant.getAppId(), - wxH5Constant.getAppSecret(), - oauthUser.getCode()); - oauthUser.setOpenId(doAuth.getString("openid")); - oauthUser.setUuid(doAuth.getString("openid")); - oauthUser.setSource("WXPub"); - oauthUser.setAccessToken(doAuth.getString("sessionKey")); - oauthUserService.insertOauthUser(oauthUser); - return ""; - } - -} diff --git a/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/WxLoginService.java b/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/WxLoginService.java index 08b94552f264732a808492f99d1964a3ca7590cb..21718807613aac6af3434ebd7374809da76b6900 100644 --- a/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/WxLoginService.java +++ b/ruoyi-auth/ruoyi-oauth-wx/src/main/java/com/ruoyi/oauth/wx/service/WxLoginService.java @@ -1,34 +1,14 @@ package com.ruoyi.oauth.wx.service; -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONObject; import com.ruoyi.auth.common.domain.OauthUser; -import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.http.HttpClientUtil; public interface WxLoginService { + public String doLoginMiniApp(String code); - public String doLogin(String code); + public String doLoginPub(String code); - public String doRegister(OauthUser oauthUser); - public default JSONObject doAuth(String url, String appid, String secret, String code) { - StringBuilder builder = new StringBuilder(url); - builder.append("?appid=").append(appid) - .append("&secret=").append(secret) - .append("&js_code=").append(code) - .append("&grant_type=").append("authorization_code"); - String getMessageUrl = builder.toString(); - String result = HttpClientUtil.sendHttpGet(getMessageUrl); - JSONObject jsonObject = JSON.parseObject(result); - if (jsonObject.containsKey("openid")) { - String openid = jsonObject.getString("openid"); - String sessionKey = jsonObject.getString("session_key"); - System.out.println("openid:" + openid); - System.out.println("sessionKey:" + sessionKey); - return jsonObject; - } else { - throw new ServiceException(jsonObject.getString("errmsg"), jsonObject.getIntValue("errcode")); - } - } + public String doRegisterPub(OauthUser oauthUser); + + public String doRegisterMiniApp(OauthUser oauthUser); } diff --git a/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/config/EmailConfig.java b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/config/EmailConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..46babbc03c0e6afc7680251af41d57ff3b471bb7 --- /dev/null +++ b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/config/EmailConfig.java @@ -0,0 +1,18 @@ +package com.ruoyi.tfa.email.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class EmailConfig { + @Value("${spring.mail.username}") + private String from; + + public String getFrom() { + return from; + } + + public void setFrom(String from) { + this.from = from; + } +} diff --git a/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/controller/MailAuthController.java b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/controller/MailAuthController.java new file mode 100644 index 0000000000000000000000000000000000000000..b50577b04e6472298af6a54fca209856f9c994b4 --- /dev/null +++ b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/controller/MailAuthController.java @@ -0,0 +1,48 @@ +package com.ruoyi.tfa.email.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.LoginBody; +import com.ruoyi.common.core.domain.model.RegisterBody; +import com.ruoyi.tfa.email.service.impl.MailServiceImpl; + +@RestController +@RequestMapping("/auth/mail") +public class MailAuthController extends BaseController { + + @Autowired + MailServiceImpl serviceImpl; + + @PostMapping("/send/bind") // 发送验证码 + public AjaxResult send(@RequestBody LoginBody loginBody) { + serviceImpl.doBind(loginBody); + return success(); + } + + @PostMapping("/verify/bind") // 发送验证码 + public AjaxResult verify(@RequestBody LoginBody loginBody) { + serviceImpl.doBindVerify(loginBody); + return success(); + } + + @PostMapping("/send/register") + @Anonymous + public AjaxResult sendRegister(@RequestBody RegisterBody registerBody) { + serviceImpl.doRegister(registerBody); + return success(); + } + + @PostMapping("/verify/register") + @Anonymous + public AjaxResult verifyRegister(@RequestBody RegisterBody registerBody) { + serviceImpl.doRegisterVerify(registerBody); + return success(); + } +} diff --git a/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/service/IMailService.java b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/service/IMailService.java index 3660a62a9888dfdd5bbe63ac82a63eb2e8c993ff..7fed0bf0a4d7c222ed15428559c3c29cb4f2f8b4 100644 --- a/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/service/IMailService.java +++ b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/service/IMailService.java @@ -1,7 +1,6 @@ package com.ruoyi.tfa.email.service; import com.ruoyi.auth.common.service.OauthVerificationCodeService; -import com.ruoyi.auth.common.service.TfaService; -public interface IMailService extends OauthVerificationCodeService,TfaService { +public interface IMailService extends OauthVerificationCodeService { } diff --git a/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/service/impl/MailServiceImpl.java b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/service/impl/MailServiceImpl.java index 062b7cb3822e190b296433ec1b10831e34964ae6..5b8a0a6da0486154b62b47e68d7035bb19e83197 100644 --- a/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/service/impl/MailServiceImpl.java +++ b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/service/impl/MailServiceImpl.java @@ -10,26 +10,21 @@ import org.springframework.stereotype.Service; import com.ruoyi.auth.common.enums.OauthVerificationUse; import com.ruoyi.auth.common.utils.RandomCodeUtil; import com.ruoyi.common.constant.CacheConstants; -import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginBody; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.RegisterBody; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.CacheUtils; -import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.framework.web.service.SysLoginService; import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.framework.web.service.UserDetailsServiceImpl; import com.ruoyi.system.service.ISysUserService; import com.ruoyi.tfa.email.service.IMailService; import com.ruoyi.tfa.email.utils.EmailUtil; -@Service("mailAuthService") +@Service public class MailServiceImpl implements IMailService { @Autowired @@ -38,8 +33,6 @@ public class MailServiceImpl implements IMailService { private TokenService tokenService; @Autowired private UserDetailsServiceImpl userDetailsServiceImpl; - @Autowired - private SysLoginService sysLoginService; private static final Logger log = LoggerFactory.getLogger(MailServiceImpl.class); @@ -72,25 +65,30 @@ public class MailServiceImpl implements IMailService { return isValid; } - public void doLogin(LoginBody loginBody) { + public void doLogin(LoginBody loginBody, boolean isRegister) { SysUser sysUser = userService.selectUserByEmail(loginBody.getEmail()); - if (sysUser == null) { + if (sysUser == null && !isRegister) { throw new ServiceException("该邮箱未绑定用户"); } else { sendCode(loginBody.getEmail(), RandomCodeUtil.numberCode(6), OauthVerificationUse.LOGIN); } } - public String doLoginVerify(LoginBody loginBody) { + public String doLoginVerify(LoginBody loginBody, boolean isRegister) { if (checkCode(loginBody.getEmail(), loginBody.getCode(), OauthVerificationUse.LOGIN)) { SysUser sysUser = userService.selectUserByEmail(loginBody.getEmail()); if (sysUser == null) { - throw new ServiceException("该邮箱未绑定用户"); + if (isRegister) { + sysUser = new SysUser(); + sysUser.setUserName(loginBody.getEmail()); + sysUser.setPassword(SecurityUtils.encryptPassword(RandomCodeUtil.code(16))); + sysUser.setEmail(loginBody.getEmail()); + userService.registerUser(sysUser); + } else { + throw new ServiceException("该邮箱未绑定用户"); + } } - AsyncManager.me().execute(AsyncFactory.recordLogininfor(sysUser.getUserName(), Constants.LOGIN_SUCCESS, - MessageUtils.message("user.login.success"))); LoginUser loginUser = (LoginUser) userDetailsServiceImpl.createLoginUser(sysUser); - sysLoginService.recordLoginInfo(loginUser.getUserId()); return tokenService.createToken(loginUser); } else { throw new ServiceException("验证码错误"); @@ -114,8 +112,6 @@ public class MailServiceImpl implements IMailService { sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword())); sysUser.setEmail(registerBody.getEmail()); userService.registerUser(sysUser); - AsyncManager.me().execute(AsyncFactory.recordLogininfor(sysUser.getUserName(), Constants.REGISTER, - MessageUtils.message("user.register.success"))); } else { throw new ServiceException("验证码错误"); } diff --git a/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/utils/EmailUtil.java b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/utils/EmailUtil.java index 065e28cefa947a309e4f09f4a8e42d59d34a43ad..f1f34d9cec0c70d11f737ff0dc205ad72671a16c 100644 --- a/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/utils/EmailUtil.java +++ b/ruoyi-auth/ruoyi-tfa-email/src/main/java/com/ruoyi/tfa/email/utils/EmailUtil.java @@ -1,19 +1,19 @@ package com.ruoyi.tfa.email.utils; -import org.springframework.boot.autoconfigure.mail.MailProperties; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSenderImpl; import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.tfa.email.config.EmailConfig; public class EmailUtil { public static void sendMessage(String email, String title, String message) { - MailProperties mailProperties = SpringUtils.getBean(MailProperties.class); + EmailConfig emailConfig = SpringUtils.getBean(EmailConfig.class); JavaMailSenderImpl mailSender = SpringUtils.getBean(JavaMailSenderImpl.class); SimpleMailMessage simpleMailMessage = new SimpleMailMessage(); simpleMailMessage.setSubject(title); simpleMailMessage.setText(message); - simpleMailMessage.setFrom(mailProperties.getUsername()); + simpleMailMessage.setFrom(emailConfig.getFrom()); simpleMailMessage.setTo(email); mailSender.send(simpleMailMessage); } diff --git a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/config/DySmsConfig.java b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/config/DySmsConfig.java index cd738093f5c154826899fe34e453d27b1ad4d2ce..5cfeec7e2faa9ad4dd152da9df0101947c266d09 100644 --- a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/config/DySmsConfig.java +++ b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/config/DySmsConfig.java @@ -1,12 +1,8 @@ package com.ruoyi.tfa.phone.config; -import java.util.Map; - -import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; -import com.ruoyi.tfa.phone.domain.DySmsTemplate; - /** * 手机号认证数据 * @@ -14,11 +10,11 @@ import com.ruoyi.tfa.phone.domain.DySmsTemplate; * @date 2024-04-16 */ @Configuration -@ConfigurationProperties("tfa.phone.dysms") public class DySmsConfig { + @Value("${tfa.phone.dysms.appId}") private String accessKeyId; + @Value("${tfa.phone.dysms.appSecret}") private String accessKeySecret; - private Map template; public String getAccessKeyId() { return accessKeyId; @@ -36,12 +32,4 @@ public class DySmsConfig { this.accessKeySecret = accessKeySecret; } - public Map getTemplate() { - return template; - } - - public void setTemplate(Map template) { - this.template = template; - } - -} \ No newline at end of file +} diff --git a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/controller/DySmsAuthController.java b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/controller/DySmsAuthController.java new file mode 100644 index 0000000000000000000000000000000000000000..113469316e08eb07e12108957e9db26b4cb6804c --- /dev/null +++ b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/controller/DySmsAuthController.java @@ -0,0 +1,53 @@ +package com.ruoyi.tfa.phone.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.LoginBody; +import com.ruoyi.common.core.domain.model.RegisterBody; +import com.ruoyi.tfa.phone.service.Impl.DySmsServiceImpl; + +/** + * 手机号认证Controller + * + * @author zlh + * @date 2024-04-16 + */ +@RestController +@RequestMapping("/auth/phone") +public class DySmsAuthController extends BaseController { + @Autowired + public DySmsServiceImpl dySmsService; + + @PostMapping("/send/bind") // 发送验证码 + public AjaxResult send(@RequestBody LoginBody loginBody) { + dySmsService.doBind(loginBody); + return success(); + } + + @PostMapping("/verify/bind") // 发送验证码 + public AjaxResult verify(@RequestBody LoginBody loginBody) { + dySmsService.doBindVerify(loginBody); + return success(); + } + + @PostMapping("/send/register") + @Anonymous + public AjaxResult sendRegister(@RequestBody RegisterBody registerBody) { + dySmsService.doRegister(registerBody); + return success(); + } + + @PostMapping("/verify/register") + @Anonymous + public AjaxResult verifyRegister(@RequestBody RegisterBody registerBody) { + dySmsService.doRegisterVerify(registerBody); + return success(); + } +} diff --git a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/domain/DySmsTemplate.java b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/enums/DySmsTemplate.java similarity index 52% rename from ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/domain/DySmsTemplate.java rename to ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/enums/DySmsTemplate.java index fb5acdf870a6f7ed67bda2549e7a8cd9093ca8d3..29ec64656fa0664956109c199a47fd5fa700ff1e 100644 --- a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/domain/DySmsTemplate.java +++ b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/enums/DySmsTemplate.java @@ -1,4 +1,6 @@ -package com.ruoyi.tfa.phone.domain; +package com.ruoyi.tfa.phone.enums; + +import com.ruoyi.common.utils.StringUtils; /** * 手机号认证短信模板 @@ -6,7 +8,14 @@ package com.ruoyi.tfa.phone.domain; * @author Dftre * @date 2024-04-16 */ -public class DySmsTemplate { +public enum DySmsTemplate { + /** 登录短信模板编码 */ + LOGIN_TEMPLATE_CODE("SMS_175435174", "Ruoyi", "code"), + /** 忘记密码短信模板编码 */ + FORGET_PASSWORD_TEMPLATE_CODE("SMS_175435174", "Ruoyi", "code"), + /** 测试 */ + Test_TEMPLATE_CODE("SMS_154950909", "阿里云短信测试", "code"); + /** * 短信模板编码 */ @@ -20,7 +29,7 @@ public class DySmsTemplate { */ private String keys; - public DySmsTemplate(String templateCode, String signName, String keys) { + private DySmsTemplate(String templateCode, String signName, String keys) { this.templateCode = templateCode; this.signName = signName; this.keys = keys; @@ -49,4 +58,16 @@ public class DySmsTemplate { public void setKeys(String keys) { this.keys = keys; } + + public static DySmsTemplate toEnum(String templateCode) { + if (StringUtils.isEmpty(templateCode)) { + return null; + } + for (DySmsTemplate item : DySmsTemplate.values()) { + if (item.getTemplateCode().equals(templateCode)) { + return item; + } + } + return null; + } } diff --git a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/service/DySmsService.java b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/service/DySmsService.java index cbcf9305c7d785423ed595f1e6b14a6c6140995b..27d58da7a7cf245b30b54226c7e022e47d36ea2e 100644 --- a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/service/DySmsService.java +++ b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/service/DySmsService.java @@ -1,7 +1,6 @@ package com.ruoyi.tfa.phone.service; import com.ruoyi.auth.common.service.OauthVerificationCodeService; -import com.ruoyi.auth.common.service.TfaService; /** * 手机号认证Servcie @@ -9,6 +8,6 @@ import com.ruoyi.auth.common.service.TfaService; * @author zlh * @date 2024-04-16 */ -public interface DySmsService extends OauthVerificationCodeService, TfaService { +public interface DySmsService extends OauthVerificationCodeService { } diff --git a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/service/Impl/DySmsServiceImpl.java b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/service/Impl/DySmsServiceImpl.java index 5c20ad257ac1c8b55fb7f2da5ad052ee222456e3..720bd27aad117da8d5e21a06c3359666e4ac7344 100644 --- a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/service/Impl/DySmsServiceImpl.java +++ b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/service/Impl/DySmsServiceImpl.java @@ -11,23 +11,18 @@ import com.alibaba.fastjson2.JSONObject; import com.ruoyi.auth.common.enums.OauthVerificationUse; import com.ruoyi.auth.common.utils.RandomCodeUtil; import com.ruoyi.common.constant.CacheConstants; -import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginBody; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.RegisterBody; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.CacheUtils; -import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.framework.web.service.SysLoginService; import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.framework.web.service.UserDetailsServiceImpl; import com.ruoyi.system.service.ISysUserService; -import com.ruoyi.tfa.phone.config.DySmsConfig; +import com.ruoyi.tfa.phone.enums.DySmsTemplate; import com.ruoyi.tfa.phone.service.DySmsService; import com.ruoyi.tfa.phone.utils.DySmsUtil; @@ -37,7 +32,7 @@ import com.ruoyi.tfa.phone.utils.DySmsUtil; * @author zlh * @date 2024-04-16 */ -@Service("dySmsAuthService") +@Service public class DySmsServiceImpl implements DySmsService { @Autowired @@ -46,10 +41,6 @@ public class DySmsServiceImpl implements DySmsService { private UserDetailsServiceImpl userDetailsServiceImpl; @Autowired private TokenService tokenService; - @Autowired - private SysLoginService sysLoginService; - @Autowired - private DySmsConfig dySmsConfig; private static final Logger log = LoggerFactory.getLogger(DySmsServiceImpl.class); @@ -62,7 +53,7 @@ public class DySmsServiceImpl implements DySmsService { try { JSONObject templateParams = new JSONObject(); templateParams.put("code", code); - DySmsUtil.sendSms(dySmsConfig.getTemplate().get("VerificationCode"), templateParams, phone); + DySmsUtil.sendSms(DySmsTemplate.Test_TEMPLATE_CODE, templateParams, phone); CacheUtils.put(CacheConstants.PHONE_CODES, use.getValue() + phone, code, 1, TimeUnit.MINUTES); log.info("发送手机验证码成功:{ phone: " + phone + " code:" + code + "}"); return true; @@ -84,25 +75,30 @@ public class DySmsServiceImpl implements DySmsService { return isValid; } - public void doLogin(LoginBody loginBody) { + public void doLogin(LoginBody loginBody, boolean isRegister) { SysUser sysUser = userService.selectUserByPhone(loginBody.getPhonenumber()); - if (sysUser == null) { + if (sysUser == null && !isRegister) { throw new ServiceException("该手机号未绑定用户"); } else { sendCode(loginBody.getPhonenumber(), RandomCodeUtil.numberCode(6), OauthVerificationUse.LOGIN); } } - public String doLoginVerify(LoginBody loginBody) { + public String doLoginVerify(LoginBody loginBody, boolean isRegister) { if (checkCode(loginBody.getPhonenumber(), loginBody.getCode(), OauthVerificationUse.LOGIN)) { SysUser sysUser = userService.selectUserByPhone(loginBody.getPhonenumber()); if (sysUser == null) { - throw new ServiceException("该手机号未绑定用户"); + if (isRegister) { + sysUser = new SysUser(); + sysUser.setUserName(loginBody.getPhonenumber()); + sysUser.setPassword(SecurityUtils.encryptPassword(RandomCodeUtil.code(16))); + sysUser.setPhonenumber(loginBody.getPhonenumber()); + userService.registerUser(sysUser); + } else { + throw new ServiceException("该手机号未绑定用户"); + } } - AsyncManager.me().execute(AsyncFactory.recordLogininfor(sysUser.getUserName(), Constants.LOGIN_SUCCESS, - MessageUtils.message("user.login.success"))); LoginUser loginUser = (LoginUser) userDetailsServiceImpl.createLoginUser(sysUser); - sysLoginService.recordLoginInfo(loginUser.getUserId()); return tokenService.createToken(loginUser); } else { throw new ServiceException("验证码错误"); @@ -118,16 +114,14 @@ public class DySmsServiceImpl implements DySmsService { } } - public void doRegisterVerify(RegisterBody registerBody) { + public boolean doRegisterVerify(RegisterBody registerBody) { if (checkCode(registerBody.getPhonenumber(), registerBody.getCode(), OauthVerificationUse.REGISTER)) { SysUser sysUser = new SysUser(); sysUser.setUserName(registerBody.getPhonenumber()); sysUser.setNickName(registerBody.getUsername()); sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword())); sysUser.setPhonenumber(registerBody.getPhonenumber()); - userService.registerUser(sysUser); - AsyncManager.me().execute(AsyncFactory.recordLogininfor(sysUser.getUserName(), Constants.REGISTER, - MessageUtils.message("user.register.success"))); + return userService.registerUser(sysUser); } else { throw new ServiceException("验证码错误"); } @@ -164,14 +158,14 @@ public class DySmsServiceImpl implements DySmsService { sendCode(loginBody.getPhonenumber(), RandomCodeUtil.numberCode(6), OauthVerificationUse.BIND); } - public void doBindVerify(LoginBody loginBody) { + public int doBindVerify(LoginBody loginBody) { if (checkCode(loginBody.getPhonenumber(), loginBody.getCode(), OauthVerificationUse.BIND)) { SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId()); if (!SecurityUtils.matchesPassword(loginBody.getPassword(), sysUser.getPassword())) { throw new ServiceException("密码错误"); } sysUser.setPhonenumber(loginBody.getPhonenumber()); - userService.updateUser(sysUser); + return userService.updateUser(sysUser); } else { throw new ServiceException("验证码错误"); } diff --git a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/utils/DySmsUtil.java b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/utils/DySmsUtil.java index 7c4d0d6e5322229936680ee2fe2462b137d45193..3f70063795583b10077e01567fc30fd1efc567d9 100644 --- a/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/utils/DySmsUtil.java +++ b/ruoyi-auth/ruoyi-tfa-phone/src/main/java/com/ruoyi/tfa/phone/utils/DySmsUtil.java @@ -14,7 +14,7 @@ import com.aliyun.teautil.models.RuntimeOptions; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.tfa.phone.config.DySmsConfig; -import com.ruoyi.tfa.phone.domain.DySmsTemplate; +import com.ruoyi.tfa.phone.enums.DySmsTemplate; public class DySmsUtil { protected final static Logger logger = LoggerFactory.getLogger(DySmsUtil.class); diff --git a/ruoyi-auth/ruoyi-tfa-phone/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/ruoyi-auth/ruoyi-tfa-phone/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 794fc0e1f47f126b21644a583fd82bf660f2ebdd..e2a786b653aa169c8a7f2e5e58fce0408318f16c 100644 --- a/ruoyi-auth/ruoyi-tfa-phone/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/ruoyi-auth/ruoyi-tfa-phone/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,19 +1,14 @@ { "properties": [ { - "name": "tfa.phone.dysms.access-key-id", + "name": "tfa.phone.dysms.app-id", "type": "java.lang.String", "description": "阿里云短信 AccessKey ID" }, { - "name": "tfa.phone.dysms.access-key-secret", + "name": "tfa.phone.dysms.app-secret", "type": "java.lang.String", "description": "阿里云短信 AccessKey Secret" - }, - { - "name": "tfa.phone.dysms.template", - "type": "java.util.Map", - "description": "短信模板" } ] } \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index 8b7d60ab5f1f83c667ceb8b150699837990ec985..c63f26b9edc4efde857b8969694b00be635aa159 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -11,6 +11,11 @@ public class CacheConstants { */ public static final String LOGIN_TOKEN_KEY = "login_tokens"; + /** + * APP登录用户 redis key + */ + public static final String APP_LOGIN_TOKEN_KEY = "app_login_tokens"; + /** * 验证码 redis key */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index f8e802a85e841bdfc93c0517786cd06c5f51f0b8..ba8ffc01aa325750698eb02950c25593c55f1320 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -110,6 +110,11 @@ public class Constants { */ public static final String LOGIN_USER_KEY = "login_user_key"; + /** + * APP登录用户key + */ + public static final String APP_LOGIN_USER_KEY = "app_login_user_key"; + /** * 用户ID */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/AppUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/AppUser.java new file mode 100644 index 0000000000000000000000000000000000000000..3469d639808ff859f4e6dd2f5814e8b0cc3eec18 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/AppUser.java @@ -0,0 +1,300 @@ +package com.ruoyi.common.core.domain.entity; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.annotation.Excel.Type; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.xss.Xss; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; +import java.util.List; + +/** + * 用户对象 app_user + * + * @author ruoyi + */ +@Schema(title = "用户") +public class AppUser extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 用户ID */ + @Schema(title = "用户序号") + @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") + private Long userId; + + /** 用户账号 */ + @Schema(title = "登录名称") + @Excel(name = "登录名称") + @Xss(message = "用户账号不能包含脚本字符") + @NotBlank(message = "用户账号不能为空") + @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") + private String userName; + + /** 用户昵称 */ + @Schema(title = "用户名称") + @Excel(name = "用户名称") + @Xss(message = "用户昵称不能包含脚本字符") + @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") + private String nickName; + + /** 用户类型(00系统用户) */ + @Schema(title = "用户类型") + @Excel(name = "用户类型", readConverterExp = "00=系统用户") + private String userType; + + /** 用户邮箱 */ + @Schema(title = "用户邮箱") + @Excel(name = "用户邮箱") + @Email(message = "邮箱格式不正确") + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") + private String email; + + /** 手机号码 */ + @Schema(title = "手机号码") + @Excel(name = "手机号码") + @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") + private String phonenumber; + + /** 用户性别(0男 1女 2未知) */ + @Schema(title = "用户性别", description = "0=男,1=女,2=未知") + @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") + private String sex; + + /** 头像地址 */ + @Schema(title = "用户头像") + private String avatar; + + /** 密码 */ + @Schema(title = "密码") + private String password; + + /** 帐号状态(0正常 1停用) */ + @Schema(title = "帐号状态", description = "0正常 1停用") + @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + @Schema(title = "删除标志", description = "0代表存在 2代表删除") + private String delFlag; + + /** 最后登录IP */ + @Schema(title = "最后登录IP") + @Excel(name = "最后登录IP", type = Type.EXPORT) + private String loginIp; + + /** 最后登录时间 */ + @Schema(title = "最后登录时间") + @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) + private Date loginDate; + + /** 备注 */ + @Schema(title = "备注") + @Excel(name = "备注") + private String remark; + + /** 角色对象 */ + @Schema(title = "角色对象") + private List roles; + + /** 角色组 */ + @Schema(title = "角色组") + private Long[] roleIds; + + /** 岗位组 */ + @Schema(title = "岗位组") + private Long[] postIds; + + /** 角色ID */ + @Schema(title = "角色ID") + private Long roleId; + + public AppUser() { + } + + public AppUser(Long userId) { + this.userId = userId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public boolean isAdmin() { + return isAdmin(this.userId); + } + + public static boolean isAdmin(Long userId) { + return userId != null && 1L == userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getUserType() { + return userType; + } + + public void setUserType(String userType) { + this.userType = userType; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPhonenumber() { + return phonenumber; + } + + public void setPhonenumber(String phonenumber) { + this.phonenumber = phonenumber; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getLoginIp() { + return loginIp; + } + + public void setLoginIp(String loginIp) { + this.loginIp = loginIp; + } + + public Date getLoginDate() { + return loginDate; + } + + public void setLoginDate(Date loginDate) { + this.loginDate = loginDate; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public List getRoles() { + return roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + public Long[] getRoleIds() { + return roleIds; + } + + public void setRoleIds(Long[] roleIds) { + this.roleIds = roleIds; + } + + public Long[] getPostIds() { + return postIds; + } + + public void setPostIds(Long[] postIds) { + this.postIds = postIds; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("userName", getUserName()) + .append("nickName", getNickName()) + .append("userType", getUserType()) + .append("email", getEmail()) + .append("phonenumber", getPhonenumber()) + .append("sex", getSex()) + .append("avatar", getAvatar()) + .append("password", getPassword()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("loginIp", getLoginIp()) + .append("loginDate", getLoginDate()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/AppLoginBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/AppLoginBody.java new file mode 100644 index 0000000000000000000000000000000000000000..1c9160287441cf93e93c3d72b7d8f9c44d9890be --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/AppLoginBody.java @@ -0,0 +1,101 @@ +package com.ruoyi.common.core.domain.model; + +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import org.springframework.security.core.userdetails.UserDetails; + +/** + * 用户登录对象 + * + * @author ruoyi + */ +@Schema(title = "用户登录对象") +public class AppLoginBody extends BaseEntity { + /** + * 用户名 + */ + @Schema(title = "用户名") + private String username; + + /** + * 用户密码 + */ + @Schema(title = "用户密码") + private String password; + + /** + * 手机号码 + */ + @Schema(title = "手机号码") + private String phonenumber; + + /** + * 邮箱 + */ + @Schema(title = "邮箱") + private String email; + + /** + * 验证码 + */ + @Schema(title = "验证码") + private String code; + public void login(UserDetails userDetails) { + String username = userDetails.getUsername(); + System.out.println("User " + username + " logged in."); + // 其他处理逻辑 + } + /** + * 唯一标识 + */ + @Schema(title = "唯一标识") + private String uuid; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getPhonenumber() { + return phonenumber; + } + + public void setPhonenumber(String phonenumber) { + this.phonenumber = phonenumber; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/AppLoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/AppLoginUser.java new file mode 100644 index 0000000000000000000000000000000000000000..a8cf0aaa3e1db00f4de264ef75436f46172f123f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/AppLoginUser.java @@ -0,0 +1,272 @@ +package com.ruoyi.common.core.domain.model; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.ruoyi.common.core.domain.entity.AppUser; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.authority.SimpleGrantedAuthority; + +import java.util.Collection; +import java.util.Collections; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 登录用户身份权限 + * + * @author ruoyi + */ +public class AppLoginUser implements UserDetails +{ + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private Long userId; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 用户唯一标识 + */ + private String token; + + /** + * 登录时间 + */ + private Long loginTime; + + /** + * 过期时间 + */ + private Long expireTime; + + /** + * 登录IP地址 + */ + private String ipaddr; + + /** + * 登录地点 + */ + private String loginLocation; + + /** + * 浏览器类型 + */ + private String browser; + + /** + * 操作系统 + */ + private String os; + + /** + * 权限列表 + */ + private Set permissions; + + /** + * 用户信息 + */ + private AppUser user; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public String getToken() + { + return token; + } + + public void setToken(String token) + { + this.token = token; + } + + public AppLoginUser() + { + } + + public AppLoginUser(AppUser user) + { + this.user = user; + } + + public AppLoginUser(Long userId, AppUser user) + { + this.userId = userId; + this.user = user; + } + + @JSONField(serialize = false) + @Override + public String getPassword() + { + return user.getPassword(); + } + + @Override + public String getUsername() + { + System.out.println(user.getUserName()); + return user.getUserName(); + } + + /** + * 账户是否未过期,过期无法验证 + */ + @JSONField(serialize = false) + @Override + public boolean isAccountNonExpired() + { + return true; + } + + /** + * 指定用户是否解锁,锁定的用户无法进行身份验证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isAccountNonLocked() + { + return true; + } + + /** + * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isCredentialsNonExpired() + { + return true; + } + + /** + * 是否可用 ,禁用的用户不能身份验证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isEnabled() + { + return true; + } + + public Long getLoginTime() + { + return loginTime; + } + + public void setLoginTime(Long loginTime) + { + this.loginTime = loginTime; + } + + public String getIpaddr() + { + return ipaddr; + } + + public void setIpaddr(String ipaddr) + { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() + { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) + { + this.loginLocation = loginLocation; + } + + public String getBrowser() + { + return browser; + } + + public void setBrowser(String browser) + { + this.browser = browser; + } + + public String getOs() + { + return os; + } + + public void setOs(String os) + { + this.os = os; + } + + public Long getExpireTime() + { + return expireTime; + } + + public void setExpireTime(Long expireTime) + { + this.expireTime = expireTime; + } + + public Set getPermissions() + { + return permissions; + } + + public void setPermissions(Set permissions) + { + this.permissions = permissions; + } + + public AppUser getUser() + { + return user; + } + + public void setUser(AppUser user) + { + this.user = user; + } + + @JSONField(serialize = false) + @Override + public Collection getAuthorities() + { + if (permissions == null || permissions.isEmpty()) { + return Collections.emptyList(); + } + return permissions.stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList()); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/AppRegisterBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/AppRegisterBody.java new file mode 100644 index 0000000000000000000000000000000000000000..a211d1ba7124256fe805763d92097c9fbc9b9f25 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/AppRegisterBody.java @@ -0,0 +1,14 @@ +package com.ruoyi.common.core.domain.model; + +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * 用户注册对象 + * + * @author ruoyi + */ +@Schema(title = "用户注册对象") +public class AppRegisterBody extends AppLoginBody +{ + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java index e4853841732181b95e5653a9b5e92239c0867b25..ba3bf99df647fea0532cec44125f2e15ab8a2ea4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java @@ -9,7 +9,7 @@ import com.ruoyi.common.core.domain.entity.SysUser; /** * 登录用户身份权限 - * + * * @author ruoyi */ public class LoginUser implements UserDetails @@ -69,6 +69,8 @@ public class LoginUser implements UserDetails /** * 用户信息 */ + + private SysUser user; public Long getUserId() @@ -144,7 +146,7 @@ public class LoginUser implements UserDetails /** * 指定用户是否解锁,锁定的用户无法进行身份验证 - * + * * @return */ @JSONField(serialize = false) @@ -156,7 +158,7 @@ public class LoginUser implements UserDetails /** * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 - * + * * @return */ @JSONField(serialize = false) @@ -168,7 +170,7 @@ public class LoginUser implements UserDetails /** * 是否可用 ,禁用的用户不能身份验证 - * + * * @return */ @JSONField(serialize = false) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/AppSecurityUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/AppSecurityUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..9bfdc5468861e52bce1295048558c16be8e79a96 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/AppSecurityUtils.java @@ -0,0 +1,237 @@ +package com.ruoyi.common.utils; + +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.AppLoginUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.exception.ServiceException; +import jakarta.servlet.http.HttpServletRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.Authentication; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.util.PatternMatchUtils; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 安全服务工具类 + * + * @author ruoyi + */ +public class AppSecurityUtils +{ + private static final Logger log = LoggerFactory.getLogger(AppSecurityUtils.class); + + /** + * 用户ID + **/ + public static Long getUserId() + { + try + { + return getLoginUser().getUserId(); + } + catch (Exception e) + { + log.error("获取用户ID异常", e); + throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取部门ID + **/ + public static Long getDeptId() + { + try + { + return getLoginUser().getDeptId(); + } + catch (Exception e) + { + throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户账户 + **/ + public static String getUsername() + { + try + { + return getLoginUser().getUsername(); + } + catch (Exception e) + { + throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户 + **/ + public static AppLoginUser getLoginUser() + { + try + { + Authentication authentication = getAuthentication(); + if (authentication == null) { + log.error("获取认证信息为空"); + throw new ServiceException("获取认证信息为空", HttpStatus.UNAUTHORIZED); + } + + Object principal = authentication.getPrincipal(); + if (principal == null) { + log.error("获取用户主体为空"); + throw new ServiceException("获取用户主体为空", HttpStatus.UNAUTHORIZED); + } + + // 如果主体是AppLoginUser类型,直接返回 + if (principal instanceof AppLoginUser) { + log.info("从SecurityContext获取到AppLoginUser类型用户主体: {}", ((AppLoginUser) principal).getUsername()); + return (AppLoginUser) principal; + } + // 如果主体是String类型(可能是用户名),尝试从当前请求获取AppLoginUser + else if (principal instanceof String) { + log.info("从SecurityContext获取到String类型用户主体: {}", principal); + HttpServletRequest request = ServletUtils.getRequest(); + + // 尝试从缓存获取用户信息 + String token = request.getHeader("Authorization"); + if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) { + token = token.replace(Constants.TOKEN_PREFIX, ""); + } + + if (StringUtils.isNotEmpty(token)) { + try { + // 直接从请求属性中获取 + Object appLoginUserAttr = request.getAttribute("APP_LOGIN_USER"); + if (appLoginUserAttr instanceof AppLoginUser) { + log.info("从请求属性中获取到AppLoginUser: {}", ((AppLoginUser) appLoginUserAttr).getUsername()); + return (AppLoginUser) appLoginUserAttr; + } + } catch (Exception e) { + log.error("尝试从Token获取用户失败: {}", e.getMessage()); + } + } + + log.error("无法从String类型用户主体[{}]转换为AppLoginUser", principal); + throw new ServiceException("用户主体类型错误", HttpStatus.UNAUTHORIZED); + } + // 其他类型的主体 + else { + log.error("用户主体类型错误,需要AppLoginUser类型,但实际是: {}", principal.getClass().getName()); + throw new ServiceException("用户主体类型错误", HttpStatus.UNAUTHORIZED); + } + } + catch (Exception e) + { + log.error("获取用户信息异常", e); + throw new ServiceException("获取用户信息异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取Authentication + */ + public static Authentication getAuthentication() + { + return SecurityContextHolder.getContext().getAuthentication(); + } + + /** + * 生成BCryptPasswordEncoder密码 + * + * @param password 密码 + * @return 加密字符串 + */ + public static String encryptPassword(String password) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.encode(password); + } + + /** + * 判断密码是否相同 + * + * @param rawPassword 真实密码 + * @param encodedPassword 加密后字符 + * @return 结果 + */ + public static boolean matchesPassword(String rawPassword, String encodedPassword) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.matches(rawPassword, encodedPassword); + } + + /** + * 是否为管理员 + * + * @param userId 用户ID + * @return 结果 + */ + public static boolean isAdmin(Long userId) + { + return userId != null && 1L == userId; + } + + /** + * 验证用户是否具备某权限 + * + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + public static boolean hasPermi(String permission) + { + return hasPermi(getLoginUser().getPermissions(), permission); + } + + /** + * 判断是否包含权限 + * + * @param authorities 权限列表 + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + public static boolean hasPermi(Collection authorities, String permission) + { + return authorities.stream().filter(StringUtils::hasText) + .anyMatch(x -> Constants.ALL_PERMISSION.equals(x) || PatternMatchUtils.simpleMatch(x, permission)); + } + + /** + * 验证用户是否拥有某个角色 + * + * @param role 角色标识 + * @return 用户是否具备某角色 + */ + public static boolean hasRole(String role) + { + List roleList = getLoginUser().getUser().getRoles(); + Collection roles = roleList.stream().map(SysRole::getRoleKey).collect(Collectors.toSet()); + return hasRole(roles, role); + } + + /** + * 判断是否包含角色 + * + * @param roles 角色列表 + * @param role 角色 + * @return 用户是否具备某角色权限 + */ + public static boolean hasRole(Collection roles, String role) + { + return roles.stream().filter(StringUtils::hasText) + .anyMatch(x -> Constants.SUPER_ADMIN.equals(x) || PatternMatchUtils.simpleMatch(x, role)); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 02e14a7c70c838e6e3d57bed59b3c580029aad42..fccd1f3e24c9dc6f05aa2b096d2264f0759378e6 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -1150,7 +1150,6 @@ public class ExcelUtil String dictType = attr.dictType(); if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) { - cell.getCellStyle().setDataFormat(this.wb.getCreationHelper().createDataFormat().getFormat(dateFormat)); cell.setCellValue(parseDateToStr(dateFormat, value)); } else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index 0b95aeb59754186389a9742d8acb51dc8aaa7846..23fd2a5ac96b638ba41a463c2c5b4879366b179c 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -20,11 +20,9 @@ import com.alibaba.fastjson2.JSON; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.BusinessStatus; import com.ruoyi.common.enums.HttpMethod; import com.ruoyi.common.filter.PropertyPreExcludeFilter; -import com.ruoyi.common.utils.ExceptionUtil; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; @@ -103,7 +101,7 @@ public class LogAspect { if (e != null) { operLog.setStatus(BusinessStatus.FAIL.ordinal()); - operLog.setErrorMsg(StringUtils.substring(Convert.toStr(e.getMessage(), ExceptionUtil.getExceptionMessage(e)), 0, 2000)); + operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000)); } // 设置方法名称 String className = joinPoint.getTarget().getClass().getName(); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 3f7cd641e7730a098d5676d05ffca542be341708..f6328c61029437222e24d4be57dedabb020345e8 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -1,16 +1,21 @@ package com.ruoyi.framework.config; - import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; import org.springframework.http.HttpMethod; import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.AuthenticationManagerResolver; import org.springframework.security.authentication.ProviderManager; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; +import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; @@ -19,8 +24,10 @@ import org.springframework.web.filter.CorsFilter; import com.ruoyi.framework.config.properties.PermitAllUrlProperties; import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; +import com.ruoyi.framework.security.filter.AppJwtAuthenticationTokenFilter; import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl; import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; +import jakarta.servlet.http.HttpServletRequest; /** * spring security配置 @@ -30,17 +37,26 @@ import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; @EnableMethodSecurity(prePostEnabled = true, securedEnabled = true) @Configuration public class SecurityConfig { + /** - * 自定义用户认证逻辑 + * 认证失败处理类 */ @Autowired - private UserDetailsService userDetailsService; + private AuthenticationEntryPointImpl unauthorizedHandler; /** - * 认证失败处理类 + * 第一个用户认证逻辑 */ @Autowired - private AuthenticationEntryPointImpl unauthorizedHandler; + @Qualifier("userDetailsServiceImpl") + private UserDetailsService userDetailsServiceImpl; + + /** + * 第二个用户认证逻辑 + */ + @Autowired + @Qualifier("anotherUserDetailsServiceImpl") + private UserDetailsService anotherUserDetailsServiceImpl; /** * 退出处理类 @@ -54,6 +70,12 @@ public class SecurityConfig { @Autowired private JwtAuthenticationTokenFilter authenticationTokenFilter; + /** + * App token认证过滤器 + */ + @Autowired + private AppJwtAuthenticationTokenFilter appAuthenticationTokenFilter; + /** * 跨域过滤器 */ @@ -66,36 +88,50 @@ public class SecurityConfig { @Autowired private PermitAllUrlProperties permitAllUrl; - /** - * @return - * @throws Exception - */ - @Bean - AuthenticationManager authenticationManager() { + @Bean(name = "firstAuthenticationManager") + @Primary // 标记为主要的 AuthenticationManager + public AuthenticationManager firstAuthenticationManager() { DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider(); // 身份认证接口 - daoAuthenticationProvider.setUserDetailsService(userDetailsService); + daoAuthenticationProvider.setUserDetailsService(userDetailsServiceImpl); daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder()); return new ProviderManager(daoAuthenticationProvider); } + @Bean(name = "secondAuthenticationManager") + public AuthenticationManager secondAuthenticationManager() { + DaoAuthenticationProvider anotherDaoAuthenticationProvider = new DaoAuthenticationProvider(); + anotherDaoAuthenticationProvider.setUserDetailsService(anotherUserDetailsServiceImpl); + anotherDaoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder()); + return new ProviderManager(anotherDaoAuthenticationProvider); + } + /** - * anyRequest | 匹配所有请求路径 - * access | SpringEl表达式结果为true时可以访问 - * anonymous | 匿名可以访问 - * denyAll | 用户不能访问 - * fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录) - * hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问 - * hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问 - * hasAuthority | 如果有参数,参数表示权限,则其权限可以访问 - * hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问 - * hasRole | 如果有参数,参数表示角色,则其角色可以访问 - * permitAll | 用户可以任意访问 - * rememberMe | 允许通过remember-me登录的用户访问 - * authenticated | 用户登录后可访问 + * AuthenticationManager 解析器 + * @return */ @Bean - SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { + public AuthenticationManagerResolver authenticationManagerResolver() { + return request -> { + // 根据请求的路径或其他条件选择使用哪个 AuthenticationManager + if (request.getRequestURI().startsWith("/api/first")) { + return firstAuthenticationManager(); + } else if (request.getRequestURI().startsWith("/api/second") || request.getRequestURI().startsWith("/app")) { + // app相关的请求使用secondAuthenticationManager + return secondAuthenticationManager(); + } + // 默认返回第一个 AuthenticationManager + return firstAuthenticationManager(); + }; + } + + @Bean + public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { + return authenticationConfiguration.getAuthenticationManager(); + } + + @Bean + SecurityFilterChain filterChain(HttpSecurity httpSecurity, @Qualifier("firstAuthenticationManager") AuthenticationManager authenticationManager) throws Exception { return httpSecurity // CSRF禁用,因为不使用session .csrf(csrf -> csrf.disable()) @@ -112,7 +148,7 @@ public class SecurityConfig { .authorizeHttpRequests((requests) -> { permitAllUrl.getUrls().forEach(url -> requests.requestMatchers(url).permitAll()); // 对于登录login 注册register 验证码captchaImage 允许匿名访问 - requests.requestMatchers("/login", "/register", "/captchaImage").permitAll() + requests.requestMatchers("/login", "/app/**", "/register", "/captchaImage").permitAll() // 静态资源,可匿名访问 .requestMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**") @@ -126,11 +162,12 @@ public class SecurityConfig { }) // 添加Logout filter .logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler)) + // 添加CORS filter + .addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class) + // 添加App JWT filter,必须在JwtAuthenticationTokenFilter之前 + .addFilterBefore(appAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class) // 添加JWT filter .addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class) - // 添加CORS filter - .addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class) - .addFilterBefore(corsFilter, LogoutFilter.class) .build(); } @@ -141,4 +178,4 @@ public class SecurityConfig { public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } -} +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/AppJwtAuthenticationTokenFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/AppJwtAuthenticationTokenFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..472e49c81e9dbfdc98c5364f85d29fa9bb4b025e --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/AppJwtAuthenticationTokenFilter.java @@ -0,0 +1,112 @@ +package com.ruoyi.framework.security.filter; + +import java.io.IOException; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.Ordered; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; +import com.ruoyi.common.core.domain.model.AppLoginUser; +import com.ruoyi.common.utils.AppSecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.web.service.AppTokenService; +import java.util.Collection; +import org.springframework.security.core.Authentication; + +/** + * App token过滤器 验证token有效性 + * + * @author ruoyi + */ +@Component +public class AppJwtAuthenticationTokenFilter extends OncePerRequestFilter implements Ordered +{ + private static final Logger log = LoggerFactory.getLogger(AppJwtAuthenticationTokenFilter.class); + + @Autowired + private AppTokenService appTokenService; + + @Override + public int getOrder() { + // 确保比JwtAuthenticationTokenFilter更早执行 + return Ordered.HIGHEST_PRECEDENCE + 30; + } + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException + { + // 判断请求路径是否为App相关 + String requestURI = request.getRequestURI(); + if (!requestURI.startsWith("/app")) { + // 不是App相关的请求,直接放行 + chain.doFilter(request, response); + return; + } + + log.info("处理App请求: {}", requestURI); + + // 根据请求获取token + String token = request.getHeader("Authorization"); + log.info("App请求token: {}", token); + + try { + // 获取App登录用户信息 + AppLoginUser appLoginUser = appTokenService.getLoginUser(request); + if (StringUtils.isNotNull(appLoginUser)) { + log.info("找到App用户: {}, userId: {}, userName: {}", + appLoginUser.getUsername(), appLoginUser.getUserId(), + appLoginUser.getUser() != null ? appLoginUser.getUser().getUserName() : "用户对象为空"); + + // 将AppLoginUser保存在请求属性中,供AppSecurityUtils使用 + request.setAttribute("APP_LOGIN_USER", appLoginUser); + + // 验证token有效期并刷新 + appTokenService.verifyToken(appLoginUser); + + // 检查用户权限 + Collection authorities = appLoginUser.getAuthorities(); + log.info("用户权限: {}", authorities != null ? authorities.toString() : "权限为空"); + + // 确保清除之前的SecurityContext + SecurityContextHolder.clearContext(); + + // 创建认证信息并设置到安全上下文 + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken( + appLoginUser, null, appLoginUser.getAuthorities()); + authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); + + // 设置到SecurityContext + SecurityContextHolder.getContext().setAuthentication(authenticationToken); + log.info("已成功设置App用户认证信息到SecurityContext"); + + // 验证设置是否成功 + Authentication auth = SecurityContextHolder.getContext().getAuthentication(); + if (auth != null && auth.getPrincipal() instanceof AppLoginUser) { + log.info("验证成功: SecurityContext中的用户类型正确"); + } else if (auth != null) { + log.warn("验证失败: SecurityContext中的用户类型错误: {}", + auth.getPrincipal() != null ? auth.getPrincipal().getClass().getName() : "null"); + } + } else { + log.warn("未找到App用户,请检查token是否有效: {}", token); + // 清除SecurityContext,防止可能的错误认证 + SecurityContextHolder.clearContext(); + } + } catch (Exception e) { + log.error("处理App认证时发生异常: {}", e.getMessage(), e); + // 发生异常时,清除SecurityContext + SecurityContextHolder.clearContext(); + } + + chain.doFilter(request, response); + } +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java index 9d2f494d4dd9942fae8072d9eede7a7e34a43209..b1fcf18d34f214710759e7fbe6ec9a2350465539 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java @@ -6,6 +6,7 @@ import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.Ordered; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; @@ -22,15 +23,27 @@ import com.ruoyi.framework.web.service.TokenService; * @author ruoyi */ @Component -public class JwtAuthenticationTokenFilter extends OncePerRequestFilter +public class JwtAuthenticationTokenFilter extends OncePerRequestFilter implements Ordered { @Autowired private TokenService tokenService; + + @Override + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE + 100; + } @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { + // 不处理/app开头的请求,这些请求由AppJwtAuthenticationTokenFilter处理 + String requestURI = request.getRequestURI(); + if (requestURI.startsWith("/app")) { + chain.doFilter(request, response); + return; + } + LoginUser loginUser = tokenService.getLoginUser(request); if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) { diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AnotherUserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AnotherUserDetailsServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ac6dfab262ea505657828c6dee8fad508c2b0d97 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AnotherUserDetailsServiceImpl.java @@ -0,0 +1,77 @@ +package com.ruoyi.framework.web.service; + +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.model.AppLoginUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.web.domain.server.Sys; +import com.ruoyi.system.service.IAppUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import java.util.Set; + +@Service +public class AnotherUserDetailsServiceImpl implements UserDetailsService { + + + private static final Logger log = LoggerFactory.getLogger(AnotherUserDetailsServiceImpl.class); + + @Autowired + private IAppUserService userService; + + @Autowired + private AppPasswordService passwordService; + + @Autowired + private AppPermissionService permissionService; + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { + // 根据用户名从数据库中查询用户信息 + AppUser user = userService.selectUserByUserName(username); + // 检查用户是否存在 + if (StringUtils.isNull(user)) { + log.info("登录用户:{} 不存在.", username); + throw new ServiceException("登录用户:" + username + " 不存在"); + } + // 检查用户是否已被删除 + else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) { + log.info("登录用户:{} 已被删除.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); + } + // 检查用户是否已被停用 + else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { + log.info("登录用户:{} 已被停用.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已停用"); + } + + // 验证用户密码 + passwordService.validate(user); + + // 创建并返回登录用户对象 + return createAppLoginUser(user); + } + + /** + * 创建 App 登录用户对象 + * + * @param user 用户实体对象 + * @return 登录用户对象 + */ + public UserDetails createAppLoginUser(AppUser user) { + // 获取用户权限列表 + Set permissions = permissionService.getMenuPermission(user); + log.info("为用户{}创建AppLoginUser对象,权限信息: {}", user.getUserName(), permissions); + AppLoginUser appLoginUser = new AppLoginUser(user.getUserId(), user); + appLoginUser.setPermissions(permissions); + return appLoginUser; + } +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppLoginService.java new file mode 100644 index 0000000000000000000000000000000000000000..beb85866b1d70bb6285c301177d9e6c9e8752713 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppLoginService.java @@ -0,0 +1,166 @@ +package com.ruoyi.framework.web.service; + +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.model.AppLoginUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.exception.user.*; +import com.ruoyi.common.utils.CacheUtils; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.framework.security.context.AuthenticationContextHolder; +import com.ruoyi.system.service.IAppConfigService; +import com.ruoyi.system.service.IAppUserService; +import jakarta.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Component +public class AppLoginService { + private static final Logger log = LoggerFactory.getLogger(AppLoginService.class); + + @Autowired + private AppTokenService tokenService; + + @Resource + @Qualifier("secondAuthenticationManager") // 使用第二个 AuthenticationManager + private AuthenticationManager authenticationManager; + + @Autowired + private IAppUserService userService; + + @Autowired + private IAppConfigService configService; + + @Autowired + private AppPasswordService passwordService; + + /** + * 登录验证 + * + * @param username 用户名 + * @param password 密码 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public String login(String username, String password, String code, String uuid) { + log.info("App用户登录: {}", username); + // 验证码校验 + validateCaptcha(username, code, uuid); + // 登录前置校验 + loginPreCheck(username, password); + String ip = IpUtils.getIpAddr(); + // 验证 IP 是否被封锁 + passwordService.validateIp(ip); + // 用户验证 + Authentication authentication = null; + try { + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password); + AuthenticationContextHolder.setContext(authenticationToken); + // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername + authentication = authenticationManager.authenticate(authenticationToken); + log.info("App用户认证成功: {}", username); + } catch (Exception e) { + log.error("App用户认证失败: {}, 原因: {}", username, e.getMessage()); + if (e instanceof BadCredentialsException) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } else { + passwordService.incrementIpFailCount(ip); + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage())); + throw new ServiceException(e.getMessage()); + } + } finally { + AuthenticationContextHolder.clearContext(); + } + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); + AppLoginUser appLoginUser = (AppLoginUser) authentication.getPrincipal(); + recordLoginInfo(appLoginUser.getUserId()); + // 生成token + String token = tokenService.createToken(appLoginUser); + log.info("App用户{}登录成功,生成token: {}", username, token); + return token; + } + + /** + * 校验验证码 + * + * @param username 用户名 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public void validateCaptcha(String username, String code, String uuid) { + boolean captchaEnabled = configService.selectCaptchaEnabled(); + if (captchaEnabled) { + String captcha = CacheUtils.get(CacheConstants.CAPTCHA_CODE_KEY, StringUtils.nvl(uuid, ""), String.class); + CacheUtils.removeIfPresent(CacheConstants.CAPTCHA_CODE_KEY, StringUtils.nvl(uuid, "")); + if (captcha == null) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); + throw new CaptchaExpireException(); + } + if (!code.equalsIgnoreCase(captcha)) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); + throw new CaptchaException(); + } + } + } + + /** + * 登录前置校验 + * + * @param username 用户名 + * @param password 用户密码 + */ + public void loginPreCheck(String username, String password) { + // 用户名或密码为空 错误 + if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null"))); + throw new UserNotExistsException(); + } + // 密码如果不在指定范围内 错误 + if (password.length() < UserConstants.PASSWORD_MIN_LENGTH || password.length() > UserConstants.PASSWORD_MAX_LENGTH) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } + // 用户名不在指定范围内 错误 + if (username.length() < UserConstants.USERNAME_MIN_LENGTH || username.length() > UserConstants.USERNAME_MAX_LENGTH) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } + // IP黑名单校验 + String blackStr = configService.selectConfigByKey("sys.login.blackIPList"); + if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("login.blocked"))); + throw new BlackListException(); + } + } + + /** + * 记录登录信息 + * + * @param userId 用户ID + */ + public void recordLoginInfo(Long userId) { + AppUser appUser = new AppUser(); + appUser.setUserId(userId); + appUser.setLoginIp(IpUtils.getIpAddr()); + appUser.setLoginDate(DateUtils.getNowDate()); + userService.updateUserProfile(appUser); + } +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppPasswordService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppPasswordService.java new file mode 100644 index 0000000000000000000000000000000000000000..a1675dc08d8da9e246b22fe58e3ee409ab5b15d4 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppPasswordService.java @@ -0,0 +1,124 @@ +package com.ruoyi.framework.web.service; + +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.exception.user.IpRetryLimitExceedException; +import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; +import com.ruoyi.common.utils.CacheUtils; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.framework.security.context.AuthenticationContextHolder; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cache.Cache; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +/** + * 登录密码方法 + * + * @author ruoyi + */ +@Component +public class AppPasswordService +{ + + @Value(value = "${user.password.maxRetryCount}") + private int maxRetryCount; + + @Value(value = "${user.password.lockTime}") + private int lockTime; + + @Value(value = "${user.ip.maxRetryCount:15}") + public int maxIpRetryCount; + + @Value(value = "${user.ip.lockTime:15}") + public int ipLockTime; + /** + * 登录账户密码错误次数缓存键名 + * + * @return 缓存Cache + */ + private Cache getCache() + { + return CacheUtils.getCache(CacheConstants.PWD_ERR_CNT_KEY); + } + + private Cache getIpCache() { + return CacheUtils.getCache(CacheConstants.IP_ERR_CNT_KEY); + } + + public void validate(AppUser user) + { + Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext(); + String username = usernamePasswordAuthenticationToken.getName(); + String password = usernamePasswordAuthenticationToken.getCredentials().toString(); + + String ip = IpUtils.getIpAddr(); + validateIp(ip); + Integer retryCount = getCache().get(username, Integer.class); + if (retryCount == null) + { + retryCount = 0; + } + if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, + MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount, lockTime))); + throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime); + } + if (!matches(user, password)) + { + retryCount = retryCount + 1; + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, + MessageUtils.message("user.password.retry.limit.count", retryCount))); + CacheUtils.put(CacheConstants.PWD_ERR_CNT_KEY,username,retryCount,lockTime,TimeUnit.MINUTES); + throw new UserPasswordNotMatchException(); + } + else + { + clearLoginRecordCache(username); + } + } + + public void validateIp(String ip) + { + Integer ipRetryCount = getIpCache().get(ip, Integer.class); + if (ipRetryCount == null) + { + ipRetryCount = 0; + } + + if (ipRetryCount >= maxIpRetryCount) + { + throw new IpRetryLimitExceedException(maxIpRetryCount, ipLockTime); + } + } + + public void incrementIpFailCount(String ip) + { + Integer ipRetryCount = getIpCache().get(ip, Integer.class); + if (ipRetryCount == null) + { + ipRetryCount = 0; + } + ipRetryCount += 1; + CacheUtils.put(CacheConstants.IP_ERR_CNT_KEY,ip,ipRetryCount,ipLockTime,TimeUnit.MINUTES); + } + + public boolean matches(AppUser user, String rawPassword) + { + return SecurityUtils.matchesPassword(rawPassword, user.getPassword()); + } + + public void clearLoginRecordCache(String loginName) + { + getCache().evictIfPresent(loginName); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppPermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppPermissionService.java new file mode 100644 index 0000000000000000000000000000000000000000..a52d5b3e9163c27b4e8b530ab765cab0ab0d0bd8 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppPermissionService.java @@ -0,0 +1,75 @@ +package com.ruoyi.framework.web.service; + +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysMenuService; +import com.ruoyi.system.service.ISysRoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * 用户权限处理 + * + * @author ruoyi + */ +@Component +public class AppPermissionService { + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysMenuService menuService; + + /** + * 获取角色数据权限 + * + * @param user 用户信息 + * @return 角色权限信息 + */ + public Set getRolePermission(AppUser user) { + Set roles = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin()) { + roles.add("admin"); + } else { + roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId())); + } + return roles; + } + + /** + * 获取菜单数据权限 + * + * @param user 用户信息 + * @return 菜单权限信息 + */ + public Set getMenuPermission(AppUser user) { + Set perms = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin()) { + perms.add("*:*:*"); + } else { + List roles = user.getRoles(); + if (!CollectionUtils.isEmpty(roles)) { + // 多角色设置permissions属性,以便数据权限匹配权限 + for (SysRole role : roles) { + if (StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL)) { + Set rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId()); + role.setPermissions(rolePerms); + perms.addAll(rolePerms); + } + } + } else { + perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); + } + } + return perms; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppRegisterService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppRegisterService.java new file mode 100644 index 0000000000000000000000000000000000000000..b7b4edfc77c020ae19ac44bc53375d3caea63071 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppRegisterService.java @@ -0,0 +1,111 @@ +package com.ruoyi.framework.web.service; + +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.model.AppLoginBody; +import com.ruoyi.common.core.domain.model.AppRegisterBody; +import com.ruoyi.common.core.domain.model.RegisterBody; +import com.ruoyi.common.exception.user.CaptchaException; +import com.ruoyi.common.exception.user.CaptchaExpireException; +import com.ruoyi.common.utils.CacheUtils; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.system.service.IAppConfigService; +import com.ruoyi.system.service.IAppUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 注册校验方法 + * + * @author ruoyi + */ +@Component +public class AppRegisterService +{ + @Autowired + private IAppUserService userService; + + @Autowired + private IAppConfigService configService; + + /** + * 注册 + */ + public String register(AppRegisterBody appRegisterBody) + { + String msg = "", username = appRegisterBody.getUsername(), password = appRegisterBody.getPassword(); + AppUser appUser = new AppUser(); + appUser.setUserName(username); + // 验证码开关 + boolean captchaEnabled = configService.selectCaptchaEnabled(); + if (captchaEnabled) + { + validateCaptcha(username, appRegisterBody.getCode(), appRegisterBody.getUuid()); + } + if (StringUtils.isEmpty(username)) + { + msg = "用户名不能为空"; + } + else if (StringUtils.isEmpty(password)) + { + msg = "用户密码不能为空"; + } + else if (username.length() < UserConstants.USERNAME_MIN_LENGTH + || username.length() > UserConstants.USERNAME_MAX_LENGTH) + { + msg = "账户长度必须在2到20个字符之间"; + } + else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH + || password.length() > UserConstants.PASSWORD_MAX_LENGTH) + { + msg = "密码长度必须在5到20个字符之间"; + } + else if (!userService.checkUserNameUnique(appUser)) + { + msg = "保存用户'" + username + "'失败,注册账号已存在"; + } + else + { + appUser.setNickName(username); + appUser.setPassword(SecurityUtils.encryptPassword(password)); + boolean regFlag = userService.registerUser(appUser); + if (!regFlag) + { + msg = "注册失败,请联系系统管理人员"; + } + else + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, MessageUtils.message("user.register.success"))); + } + } + return msg; + } + + /** + * 校验验证码 + * + * @param username 用户名 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public void validateCaptcha(String username, String code, String uuid) + { + String captcha = CacheUtils.get(CacheConstants.CAPTCHA_CODE_KEY, StringUtils.nvl(uuid, ""), String.class); + CacheUtils.removeIfPresent(CacheConstants.CAPTCHA_CODE_KEY, StringUtils.nvl(uuid, "")); + if (captcha == null) + { + throw new CaptchaExpireException(); + } + if (!code.equalsIgnoreCase(captcha)) + { + throw new CaptchaException(); + } + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppTokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppTokenService.java new file mode 100644 index 0000000000000000000000000000000000000000..27d2afaa2021e0cff2466bbf19badd57b61ca673 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppTokenService.java @@ -0,0 +1,232 @@ +package com.ruoyi.framework.web.service; + +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.model.AppLoginUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.CacheUtils; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.AddressUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.common.utils.uuid.IdUtils; +import eu.bitwalker.useragentutils.UserAgent; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; +import jakarta.servlet.http.HttpServletRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cache.Cache; +import org.springframework.stereotype.Component; + +import javax.crypto.SecretKey; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * token验证处理 + * + * @author ruoyi + */ +@Component +public class AppTokenService { + private static final Logger log = LoggerFactory.getLogger(AppTokenService.class); + + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + // 令牌秘钥 + @Value("${token.secret}") + private String secret; + + // 令牌有效期(默认30分钟) + @Value("${token.expireTime}") + private int expireTime; + + protected static final long MILLIS_SECOND = 1000; + + protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; + + private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; + + /** + * 获取用户身份信息 + * + * @return 用户信息 + */ + public AppLoginUser getLoginUser(HttpServletRequest request) { + // 获取请求携带的令牌 + String token = getToken(request); + if (StringUtils.isNotEmpty(token)) { + log.info("解析token: {}", token); + try { + Claims claims = parseToken(token); + // 解析对应的权限以及用户信息 + String uuid = (String) claims.get(Constants.APP_LOGIN_USER_KEY); + log.info("获取到token的uuid: {}", uuid); + + // 从缓存中获取用户信息 + AppLoginUser appLoginUser = CacheUtils.get(CacheConstants.APP_LOGIN_TOKEN_KEY, uuid, AppLoginUser.class); + if (appLoginUser != null) { + log.info("从缓存中获取到用户: {}, userId: {}, 权限信息: {}", + appLoginUser.getUsername(), + appLoginUser.getUserId(), + appLoginUser.getPermissions() != null ? appLoginUser.getPermissions() : "权限为空"); + return appLoginUser; + } else { + log.warn("未从缓存中找到对应用户, uuid: {}, 缓存键: {}", uuid, CacheConstants.APP_LOGIN_TOKEN_KEY + ":" + uuid); + } + } catch (Exception e) { + log.error("解析token发生异常: {}", e.getMessage(), e); + } + } else { + log.warn("请求中未包含token"); + } + return null; + } + + /** + * 设置用户身份信息 + */ + public void setLoginUser(AppLoginUser appLoginUser) { + if (StringUtils.isNotNull(appLoginUser) && StringUtils.isNotEmpty(appLoginUser.getToken())) { + refreshToken(appLoginUser); + } + } + + /** + * 删除用户身份信息 + */ + public void delLoginUser(String token) { + if (StringUtils.isNotEmpty(token)) { + CacheUtils.removeIfPresent(CacheConstants.APP_LOGIN_TOKEN_KEY, token); + } + } + + /** + * 创建令牌 + * + * @param appLoginUser 用户信息 + * @return 令牌 + */ + public String createToken(AppLoginUser appLoginUser) { + String token = IdUtils.fastUUID(); + appLoginUser.setToken(token); + setUserAgent(appLoginUser); + refreshToken(appLoginUser); + Map claims = new HashMap<>(); + claims.put(Constants.APP_LOGIN_USER_KEY, token); + return createToken(claims); + } + + /** + * 验证令牌有效期,相差不足20分钟,自动刷新缓存 + * + * @param appLoginUser + * @return 令牌 + */ + public void verifyToken(AppLoginUser appLoginUser) { + long expireTime = appLoginUser.getExpireTime(); + long currentTime = System.currentTimeMillis(); + if (expireTime - currentTime <= MILLIS_MINUTE_TEN) { + refreshToken(appLoginUser); + } + } + + /** + * 刷新令牌有效期 + * + * @param appLoginUser 登录信息 + */ + public void refreshToken(AppLoginUser appLoginUser) { + appLoginUser.setLoginTime(System.currentTimeMillis()); + appLoginUser.setExpireTime(appLoginUser.getLoginTime() + expireTime * MILLIS_MINUTE); + + // 根据uuid将appLoginUser缓存 + log.info("刷新用户token: {}, 用户: {}, 过期时间: {}", + appLoginUser.getToken(), + appLoginUser.getUsername(), + appLoginUser.getExpireTime()); + + CacheUtils.put(CacheConstants.APP_LOGIN_TOKEN_KEY, appLoginUser.getToken(), appLoginUser, expireTime, TimeUnit.MINUTES); + } + + /** + * 设置用户代理信息 + * + * @param appLoginUser 登录信息 + */ + public void setUserAgent(AppLoginUser appLoginUser) { + UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); + String ip = IpUtils.getIpAddr(); + appLoginUser.setIpaddr(ip); + appLoginUser.setLoginLocation(AddressUtils.getRealAddressByIP(ip)); + appLoginUser.setBrowser(userAgent.getBrowser().getName()); + appLoginUser.setOs(userAgent.getOperatingSystem().getName()); + } + + /** + * 从数据声明生成令牌 + * + * @param claims 数据声明 + * @return 令牌 + */ + private String createToken(Map claims) { + SecretKey key = Keys.hmacShaKeyFor(Decoders.BASE64.decode(secret)); + String token = Jwts.builder() + .claims(claims) + .signWith(key) + .compact(); + return token; + } + + /** + * 从令牌中获取数据声明 + * + * @param token 令牌 + * @return 数据声明 + */ + private Claims parseToken(String token) { + SecretKey key = Keys.hmacShaKeyFor(Decoders.BASE64.decode(secret)); + return Jwts.parser() + .verifyWith(key) + .build() + .parseSignedClaims(token) + .getPayload(); + } + + /** + * 从令牌中获取用户名 + * + * @param token 令牌 + * @return 用户名 + */ + public String getUsernameFromToken(String token) { + Claims claims = parseToken(token); + return claims.getSubject(); + } + + /** + * 获取请求token + * + * @param request + * @return token + */ + private String getToken(HttpServletRequest request) { + String token = request.getHeader(header); + log.debug("原始Authorization头: {}", token); + if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) { + token = token.replace(Constants.TOKEN_PREFIX, ""); + log.debug("处理后的token: {}", token); + } else { + log.debug("未使用Bearer前缀或token为空"); + } + return token; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 7de07fd552f888b276d018ba134635d0cd9d31a3..15e6592536a8b9fdc5ab408826e78b74afae9d10 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -1,6 +1,7 @@ package com.ruoyi.framework.web.service; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -43,6 +44,7 @@ public class SysLoginService private TokenService tokenService; @Resource + @Qualifier("firstAuthenticationManager") // 使用第一个 AuthenticationManager private AuthenticationManager authenticationManager; @Autowired @@ -183,4 +185,4 @@ public class SysLoginService sysUser.setLoginDate(DateUtils.getNowDate()); userService.updateUserProfile(sysUser); } -} +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java index 84c6cdd17fa81ba3773305107ea83f929e311d41..d00ec6c33fd57438f966ac4e8bb4a756e3fc982e 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java @@ -1,5 +1,9 @@ package com.ruoyi.framework.web.service; +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.model.AppLoginUser; +import com.ruoyi.system.service.IAppUserService; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -15,6 +19,8 @@ import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysUserService; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; /** * 用户验证处理 @@ -34,32 +40,70 @@ public class UserDetailsServiceImpl implements UserDetailsService { @Autowired private SysPermissionService permissionService; + @Autowired + private IAppUserService iAppUserService; + + @Autowired + private AppPasswordService appPasswordService; + @Autowired private TokenService tokenService; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { - SysUser user = userService.selectUserByUserName(username); - if (StringUtils.isNull(user)) { - log.info("登录用户:{} 不存在.", username); - throw new ServiceException("登录用户:" + username + " 不存在"); - } else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) { - log.info("登录用户:{} 已被删除.", username); - throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); - } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { - log.info("登录用户:{} 已被停用.", username); - throw new ServiceException("对不起,您的账号:" + username + " 已停用"); - } - passwordService.validate(user); - return createLoginUser(user); + + // 根据不同的认证管理器,加载不同的用户对象 + if (isAppLogin()) { + SysUser user = userService.selectUserByUserName(username); + if (StringUtils.isNull(user)) { + log.info("登录用户:{} 不存在.", username); + throw new ServiceException("登录用户:" + username + " 不存在"); + } else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) { + log.info("登录用户:{} 已被删除.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); + } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { + log.info("登录用户:{} 已被停用.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已停用"); + } + + passwordService.validate(user); + + return createLoginUser(user); + } else { + AppUser appUser = iAppUserService.selectUserByUserName(username); + if (StringUtils.isNull(appUser)) { + log.info("登录用户:{} 不存在.", username); + throw new ServiceException("登录用户:" + username + " 不存在"); + } else if (UserStatus.DELETED.getCode().equals(appUser.getDelFlag())) { + log.info("登录用户:{} 已被删除.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); + } else if (UserStatus.DISABLE.getCode().equals(appUser.getStatus())) { + log.info("登录用户:{} 已被停用.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已停用"); + } + appPasswordService.validate(appUser); + + return createLoginUsers(appUser); + + } } + private boolean isAppLogin() { + // 获取当前请求的 HttpServletRequest 对象 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); + // 获取当前请求的 URL + String requestURI = request.getRequestURI(); + // 判断是否为 App 登录的 URL + return "/login".equals(requestURI); + } public UserDetails createLoginUser(SysUser user) { return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user)); } - + public UserDetails createLoginUsers(AppUser user) { + return new AppLoginUser(user.getUserId(), user); + } public void refreshLoginUser(Long userId) { SysUser user = userService.selectUserById(userId); LoginUser loginUser = SecurityUtils.getLoginUser(); diff --git a/ruoyi-middleware/ruoyi-middleware-minio/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/ruoyi-middleware/ruoyi-middleware-minio/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 6eb0671bbb76b1a0416f4623fe50aa1455d38f1e..6cba653e42b451ad293bdef8d56a44bdca8bd575 100644 --- a/ruoyi-middleware/ruoyi-middleware-minio/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/ruoyi-middleware/ruoyi-middleware-minio/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -12,8 +12,8 @@ }, { "name": "minio.client", - "type": "java.util.Map", - "description": "储存桶" + "type": "java.lang.Array", + "description": "默认存储名称" } ] } \ No newline at end of file diff --git a/ruoyi-models/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/vo/GenTableVo.java b/ruoyi-models/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/vo/GenTableVo.java index f9232fcfff51429e4e7098df42b458410cd8124a..a5b9eb187229a87a273901f29b49778b906fc7ba 100644 --- a/ruoyi-models/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/vo/GenTableVo.java +++ b/ruoyi-models/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/vo/GenTableVo.java @@ -28,7 +28,6 @@ public class GenTableVo extends BaseEntity { private static final long serialVersionUID = 1L; /** 业务表 */ - @Valid private GenTable table; /** 业务表的列 */ @@ -40,9 +39,11 @@ public class GenTableVo extends BaseEntity { private List joinTablesMate; /** 参与关联的表 */ + @Valid private Collection joinTables; /** 参与关联的列 */ + @Valid private List joinColumns; public List getAllGenTables() { diff --git a/ruoyi-models/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-models/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 5a9f937e4f7bc386ffeb683b36277274bffc3896..6c1c647b99f19b1e6e11cc5ef541b577510a913b 100644 --- a/ruoyi-models/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-models/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -8,8 +8,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.function.Function; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -102,29 +100,7 @@ public class GenTableServiceImpl implements IGenTableService { */ @Override public List selectDbTableListByNames(String[] tableNames) { - List genTables = genTableMapper.selectDbTableListByNames(tableNames); - genTables.forEach(i -> i.setTableAlias(generateTableAlias(i.getTableName()))); - return genTables; - } - - public static String generateTableAlias(String tableName) { - if (StringUtils.isEmpty(tableName)) { - return "t"; - } - - // 改进的正则表达式,更准确地处理所有三种情况 - Pattern pattern = Pattern.compile("([A-Z][a-z0-9]*)|([a-z0-9]+)(?=[A-Z])|([a-z0-9]+)(?=_)|([a-z0-9]+)$"); - Matcher matcher = pattern.matcher(tableName); - StringBuilder alias = new StringBuilder(); - - while (matcher.find()) { - String word = matcher.group(); - if (!word.isEmpty()) { - alias.append(word.charAt(0)); - } - } - - return alias.toString().toLowerCase(); + return genTableMapper.selectDbTableListByNames(tableNames); } /** diff --git a/ruoyi-models/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-models/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index c40b05ced0ef97eaec17de04d07cc6b271e595cb..39114aba23191df34307c28a9d6967561f3055da 100644 --- a/ruoyi-models/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-models/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select table_name, table_comment, create_time, update_time from information_schema.tables - where table_name NOT LIKE 'qrtz\_%' AND table_name NOT LIKE 'gen\_%' and table_schema = (select database()) + where table_name NOT LIKE 'qrtz\_%' and table_schema = (select database()) and table_name in #{name} diff --git a/ruoyi-models/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm b/ruoyi-models/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm index f7866f4c27406ee234ee9c3bdaf5bcfcbed7b778..cc5ead7299db140d763ca2275d44ebd2a7aaea74 100644 --- a/ruoyi-models/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm +++ b/ruoyi-models/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm @@ -87,8 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #if($table.haveSubColumn == '1') where ${pkColumn.columnName} = #{${pkColumn.javaField}} #else -#set($tableAlias=$table.tableAlias) - where ${tableAlias}.${pkColumn.columnName} = #{${pkColumn.javaField}} + where ${tableName}.${pkColumn.columnName} = #{${pkColumn.javaField}} #end #elseif($table.sub) select#foreach($column in $columns) a.$column.columnName#if($foreach.count != $columns.size()),#end#end, diff --git a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageSystemServiceImpl.java b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageSystemServiceImpl.java index 42ce82ba4359c0e5323550d742d3becbc327a0c5..0d2fea584f08f940eb2c2cd7a7b455f2fa47165c 100644 --- a/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageSystemServiceImpl.java +++ b/ruoyi-models/ruoyi-message/src/main/java/com/ruoyi/modelMessage/service/impl/MessageSystemServiceImpl.java @@ -24,8 +24,7 @@ import com.ruoyi.modelMessage.mapper.MessageSystemMapper; import com.ruoyi.modelMessage.service.IMessageSystemService; import com.ruoyi.modelMessage.utils.MessageSystemUtils; import com.ruoyi.tfa.email.utils.EmailUtil; -import com.ruoyi.tfa.phone.config.DySmsConfig; -import com.ruoyi.tfa.phone.domain.DySmsTemplate; +import com.ruoyi.tfa.phone.enums.DySmsTemplate; import com.ruoyi.tfa.phone.utils.DySmsUtil; /** @@ -37,9 +36,6 @@ public class MessageSystemServiceImpl implements IMessageSystemService { private static final Logger log = LoggerFactory.getLogger(MessageSystemServiceImpl.class); - @Autowired - private DySmsConfig dySmsConfig; - @Autowired private MessageSystemMapper messageSystemMapper; @@ -284,7 +280,7 @@ public class MessageSystemServiceImpl implements IMessageSystemService { String templateCode = (String) parsedParams.get("templateCode"); DySmsTemplate dySmsTemplate = null; if (templateCode != null) { - dySmsTemplate = dySmsConfig.getTemplate().get(templateCode); + dySmsTemplate = DySmsTemplate.toEnum(templateCode); Map params = (Map) parsedParams.get("params"); // 提取模板中的变量名并填充内置变量 List variableNames = (List) parsedParams.get("variableNames"); diff --git a/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/controller/AliPayController.java b/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/controller/AliPayController.java new file mode 100644 index 0000000000000000000000000000000000000000..fa06d990f5cf792f9a28963fb6279d1982c8e8d3 --- /dev/null +++ b/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/controller/AliPayController.java @@ -0,0 +1,93 @@ +package com.ruoyi.pay.alipay.controller; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.alipay.easysdk.factory.Factory; +import com.alipay.easysdk.payment.page.models.AlipayTradePagePayResponse; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.pay.alipay.service.IAliPayService; +import com.ruoyi.pay.domain.PayOrder; +import com.ruoyi.pay.service.IPayOrderService; + +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.tags.Tag; +import jakarta.servlet.http.HttpServletRequest; + +/** + * @author zlh + */ +@RestController +@RequestMapping("/pay/alipay") +@ConditionalOnProperty(prefix = "pay.alipay", name = "enabled", havingValue = "true") +@Tag(name = "【支付宝】管理") +public class AliPayController extends BaseController { + + @Autowired + private IPayOrderService payOrderService; + + @Autowired(required = false) + private IAliPayService aliPayService; + + @Anonymous + @Operation(summary = "支付宝支付") + @Parameters({ + @Parameter(name = "orderId", description = "订单号", required = true) + }) + @GetMapping("/url/{orderNumber}") + public AjaxResult pay(@PathVariable(name = "orderNumber") String orderNumber) { + AlipayTradePagePayResponse response; + PayOrder aliPay = payOrderService.selectPayOrderByOrderNumber(orderNumber); + try { + // 发起API调用(以创建当面付收款二维码为例) + response = Factory.Payment.Page().pay( + aliPay.getOrderContent(), + aliPay.getOrderNumber(), + aliPay.getActualAmount(), + ""); + } catch (Exception e) { + return error(e.getMessage()); + } + return success(response.getBody()); + } + + @Anonymous + @Operation(summary = "支付宝支付回调") + @Transactional + @PostMapping("/notify") + public AjaxResult notify(HttpServletRequest request) throws Exception { + if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) { + + Map params = new HashMap<>(); + Map requestParams = request.getParameterMap(); + for (String name : requestParams.keySet()) { + params.put(name, request.getParameter(name)); + } + + String orderNumber = params.get("out_trade_no"); + // 支付宝验签 + if (Factory.Payment.Common().verifyNotify(params)) { + + // // 更新订单未已支付 + payOrderService.updateStatus(orderNumber, "已支付"); + if (aliPayService != null) { + aliPayService.callback(params); + } + } + } + return success("success"); + } +} diff --git a/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/service/IAliPayService.java b/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/service/IAliPayService.java index 9d33122fb7ecc2fb6a72e9bfd65ec5e47bc96ebf..fd747a85295c758e7669faada075a44d39b5d2c2 100644 --- a/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/service/IAliPayService.java +++ b/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/service/IAliPayService.java @@ -2,8 +2,6 @@ package com.ruoyi.pay.alipay.service; import java.util.Map; -import com.ruoyi.pay.service.PayService; - -public interface IAliPayService extends PayService { +public interface IAliPayService { public void callback(Map params); } diff --git a/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/service/Impl/AliPayService.java b/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/service/Impl/AliPayService.java deleted file mode 100644 index 593e5de27c893d320290e0bcc8baf73a0afe2ded..0000000000000000000000000000000000000000 --- a/ruoyi-pay/ruoyi-pay-alipay/src/main/java/com/ruoyi/pay/alipay/service/Impl/AliPayService.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.ruoyi.pay.alipay.service.Impl; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.stereotype.Service; - -import com.alipay.easysdk.factory.Factory; -import com.alipay.easysdk.payment.common.models.AlipayTradeRefundResponse; -import com.alipay.easysdk.payment.page.models.AlipayTradePagePayResponse; -import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.pay.alipay.service.IAliPayService; -import com.ruoyi.pay.domain.PayOrder; -import com.ruoyi.pay.service.IPayOrderService; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -@Service("alipayPayService") -@ConditionalOnProperty(prefix = "pay.alipay", name = "enabled", havingValue = "true") -public class AliPayService implements IAliPayService { - public void callback(Map params) { - } - - @Autowired - private IPayOrderService payOrderService; - - public String payUrl(PayOrder payOrder) { - - try { - AlipayTradePagePayResponse response = Factory.Payment.Page().pay( - payOrder.getOrderContent(), - payOrder.getOrderNumber(), - payOrder.getActualAmount(), - ""); - return response.getBody(); - } catch (Exception e) { - throw new ServiceException("创建支付宝支付URL失败"); - } - } - - @Override - public String notify(HttpServletRequest request, HttpServletResponse response) { - if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) { - - Map params = new HashMap<>(); - Map requestParams = request.getParameterMap(); - for (String name : requestParams.keySet()) { - params.put(name, request.getParameter(name)); - } - String orderNumber = params.get("out_trade_no"); - try { - if (Factory.Payment.Common().verifyNotify(params)) { - payOrderService.updateStatus(orderNumber, "已支付"); - } - return "success"; - } catch (Exception e) { - e.printStackTrace(); - } - } - return "fail"; - } - - @Override - public PayOrder query(PayOrder payOrder) { - try { - // 使用支付宝SDK查询订单状态 - com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse response = Factory.Payment.Common() - .query(payOrder.getOrderNumber()); - - // 根据查询结果更新订单状态 - if ("10000".equals(response.code)) { - String tradeStatus = response.tradeStatus; - String orderStatus = ""; - - // 根据支付宝交易状态映射到系统订单状态 - switch (tradeStatus) { - case "TRADE_SUCCESS": - case "TRADE_FINISHED": - orderStatus = "已支付"; - break; - case "WAIT_BUYER_PAY": - orderStatus = "待支付"; - break; - case "TRADE_CLOSED": - orderStatus = "已关闭"; - break; - default: - orderStatus = "未知状态"; - } - - // 更新订单信息 - payOrderService.updateStatus(payOrder.getOrderNumber(), orderStatus); - } else { - throw new ServiceException("查询支付宝订单失败:" + response.subMsg); - } - - return payOrder; - } catch (Exception e) { - throw new ServiceException("查询支付宝订单异常:" + e.getMessage()); - } - } - - @Override - public PayOrder refund(PayOrder payOrder) { - try { - // 使用支付宝SDK进行退款 - AlipayTradeRefundResponse response = Factory.Payment.Common().refund( - payOrder.getOrderNumber(), - payOrder.getActualAmount()); - - // 处理退款结果 - if ("10000".equals(response.code)) { - payOrderService.updateStatus(payOrder.getOrderNumber(), "已退款"); - } else { - throw new ServiceException("支付宝退款失败:" + response.subMsg); - } - - return payOrder; - } catch (Exception e) { - throw new ServiceException("支付宝退款异常:" + e.getMessage()); - } - } -} diff --git a/ruoyi-pay/ruoyi-pay-alipay/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/ruoyi-pay/ruoyi-pay-alipay/src/main/resources/META-INF/additional-spring-configuration-metadata.json deleted file mode 100644 index 9d3fbe3b7421c542bf3696e3affc524e6c24798b..0000000000000000000000000000000000000000 --- a/ruoyi-pay/ruoyi-pay-alipay/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "properties": [ - { - "name": "pay.alipay.enabled", - "type": "java.lang.Boolean", - "description": "是否启用支付宝支付" - }, - { - "name": "pay.alipay.appId", - "type": "java.lang.String", - "description": "支付宝appid" - }, - { - "name": "pay.alipay.appPrivateKey", - "type": "java.lang.String", - "description": "支付宝应用私钥,可以直接用字符串,也可以是基于classpath的文件路径" - }, - { - "name": "pay.alipay.alipayPublicKey", - "type": "java.lang.String", - "description": "支付宝应用公钥,可以直接用字符串,也可以是基于classpath的文件路径" - }, - { - "name": "pay.alipay.notifyUrl", - "type": "java.lang.String", - "description": "支付宝支付回调地址" - } - ] -} \ No newline at end of file diff --git a/ruoyi-pay/ruoyi-pay-starter/src/main/java/com/ruoyi/pay/controller/PayInvoiceController.java b/ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/controller/PayInvoiceController.java similarity index 100% rename from ruoyi-pay/ruoyi-pay-starter/src/main/java/com/ruoyi/pay/controller/PayInvoiceController.java rename to ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/controller/PayInvoiceController.java diff --git a/ruoyi-pay/ruoyi-pay-starter/src/main/java/com/ruoyi/pay/controller/PayOrderController.java b/ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/controller/PayOrderController.java similarity index 100% rename from ruoyi-pay/ruoyi-pay-starter/src/main/java/com/ruoyi/pay/controller/PayOrderController.java rename to ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/controller/PayOrderController.java diff --git a/ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/domain/PayOrder.java b/ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/domain/PayOrder.java index ea4f029fda3af47154d0eac47f383f3b83c6195a..24f80bb29591aa49f102becc676fdb7ad051dbd1 100644 --- a/ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/domain/PayOrder.java +++ b/ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/domain/PayOrder.java @@ -23,15 +23,10 @@ public class PayOrder extends BaseEntity { private Long orderId; /** 订单号 */ - @Schema(title = "商户订单号") - @Excel(name = "商户订单号") + @Schema(title = "订单号") + @Excel(name = "订单号") private String orderNumber; - /** 第三方订单号 */ - @Schema(title = "第三方订单号") - @Excel(name = "第三方订单号") - private String thirdNumber; - /** 订单状态 */ @Schema(title = "订单状态") @Excel(name = "订单状态") @@ -73,14 +68,6 @@ public class PayOrder extends BaseEntity { return orderNumber; } - public void setThirdNumber(String thirdNumber) { - this.thirdNumber = thirdNumber; - } - - public String getThirdNumber() { - return thirdNumber; - } - public void setOrderStatus(String orderStatus) { this.orderStatus = orderStatus; } diff --git a/ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/service/PayService.java b/ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/service/PayService.java deleted file mode 100644 index a4f71dc26a8b2e675aa0368bd2464a77f6855754..0000000000000000000000000000000000000000 --- a/ruoyi-pay/ruoyi-pay-common/src/main/java/com/ruoyi/pay/service/PayService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.pay.service; - -import com.ruoyi.pay.domain.PayOrder; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -public interface PayService { - String payUrl(PayOrder payOrder); - - String notify(HttpServletRequest servletRequest, HttpServletResponse response); - - PayOrder query(PayOrder payOrder); - - PayOrder refund(PayOrder payOrder); -} diff --git a/ruoyi-pay/ruoyi-pay-common/src/main/resources/mapper/pay/PayOrderMapper.xml b/ruoyi-pay/ruoyi-pay-common/src/main/resources/mapper/pay/PayOrderMapper.xml index 580aedc1f29781778d0300837caf9f0b7bec6276..6083c9c5efccd74309b1484ee8e84bc352d1855b 100644 --- a/ruoyi-pay/ruoyi-pay-common/src/main/resources/mapper/pay/PayOrderMapper.xml +++ b/ruoyi-pay/ruoyi-pay-common/src/main/resources/mapper/pay/PayOrderMapper.xml @@ -3,21 +3,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - - - - - - + + + + + + + + + + + + @@ -26,9 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - - - + insert into pay_order order_number, - third_number, order_status, total_amount, actual_amount, @@ -62,10 +54,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, update_time, remark, - + #{orderNumber}, - #{thirdNumber}, #{orderStatus}, #{totalAmount}, #{actualAmount}, @@ -76,14 +67,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, #{updateTime}, #{remark}, - + update pay_order order_number = #{orderNumber}, - third_number = #{thirdNumber}, order_status = #{orderStatus}, total_amount = #{totalAmount}, actual_amount = #{actualAmount}, diff --git a/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/config/SqbConfig.java b/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/config/SqbConfig.java index b70dd7a0131b0b4de57579a18bc4f4f2b70a303e..7d4b6134335ef9a22455d793d7175f2e9f18cb5b 100644 --- a/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/config/SqbConfig.java +++ b/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/config/SqbConfig.java @@ -1,15 +1,7 @@ package com.ruoyi.pay.sqb.config; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.stream.Collectors; - -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.ApplicationContext; -import org.springframework.core.io.Resource; import org.springframework.stereotype.Component; @Component @@ -34,36 +26,36 @@ public class SqbConfig { private String vendorKey; @Value("${pay.sqb.notifyUrl}") - private String notifyUrl; + private String defaultNotifyUrl; + + @Value("${pay.sqb.notifyBaseUrl}") + private String defaultNotifyBaseUrl; - @Value("${pay.sqb.publicKey}") - private String publicKey; + @Value("${pay.sqb.proxy}") + private String proxyPath; - @Autowired - private ApplicationContext applicationContext; + public String getDefaultNotifyUrl() { + return defaultNotifyUrl; + } + + public void setDefaultNotifyUrl(String defaultNotifyUrl) { + this.defaultNotifyUrl = defaultNotifyUrl; + } - public String getPublicKey() throws Exception { - if (publicKey.startsWith("classpath")) { - Resource resource = applicationContext.getResource(publicKey); - InputStream inputStream = resource.getInputStream(); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); - String alipayPublicKeyValue = bufferedReader.lines().collect(Collectors.joining(System.lineSeparator())); - bufferedReader.close(); - publicKey = alipayPublicKeyValue; - } - return publicKey; + public String getDefaultNotifyBaseUrl() { + return defaultNotifyBaseUrl; } - public void setPublicKey(String publicKey) { - this.publicKey = publicKey; + public void setDefaultNotifyBaseUrl(String defaultNotifyBaseUrl) { + this.defaultNotifyBaseUrl = defaultNotifyBaseUrl; } - public String getNotifyUrl() { - return notifyUrl; + public String getProxyPath() { + return proxyPath; } - public void setNotifyUrl(String notifyUrl) { - this.notifyUrl = notifyUrl; + public void setProxyPath(String proxyPath) { + this.proxyPath = proxyPath; } public String getApiDomain() { diff --git a/ruoyi-pay/ruoyi-pay-starter/src/main/java/com/ruoyi/pay/controller/PayController.java b/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/controller/SQBController.java similarity index 31% rename from ruoyi-pay/ruoyi-pay-starter/src/main/java/com/ruoyi/pay/controller/PayController.java rename to ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/controller/SQBController.java index a3348d0ae136cbce78dd2a8f4ea122701fbcb278..ed44dfc488c295df2b92eb8b5862e4b81880b25e 100644 --- a/ruoyi-pay/ruoyi-pay-starter/src/main/java/com/ruoyi/pay/controller/PayController.java +++ b/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/controller/SQBController.java @@ -1,95 +1,87 @@ -package com.ruoyi.pay.controller; +package com.ruoyi.pay.sqb.controller; -import java.util.HashMap; -import java.util.Map; +import java.io.IOException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; import com.ruoyi.pay.domain.PayOrder; import com.ruoyi.pay.service.IPayOrderService; -import com.ruoyi.pay.service.PayService; +import com.ruoyi.pay.sqb.service.ISqbPayService; +import com.ruoyi.pay.sqb.service.Impl.SQBServiceImpl; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; -import jakarta.annotation.PostConstruct; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; +import io.swagger.v3.oas.annotations.tags.Tag; -@RequestMapping("/pay/{channel}") +@Tag(name = "sqb支付") @RestController -public class PayController extends BaseController { +@RequestMapping("/pay/sqb") +@ConditionalOnProperty(prefix = "pay.sqb", name = "enabled", havingValue = "true") +public class SQBController extends BaseController { + @Autowired + private SQBServiceImpl sqbServiceImpl; + @Autowired + private IPayOrderService payOrderServicer; @Autowired(required = false) - private Map payServiceMap; // alipay wechat sqb - - @PostConstruct - public void init() { - if (payServiceMap == null) { - payServiceMap = new HashMap<>(); - logger.warn("请注意,没有加载任何支付服务"); - } else { - payServiceMap.forEach((k, v) -> { - logger.info("已加载支付服务 {}", k); - }); - } - } + private ISqbPayService sqbPayService; - @Autowired - private IPayOrderService payOrderService; - - @Operation(summary = "微信支付") - @Parameters({ - @Parameter(name = "channel", description = "支付方式", required = true), + @Operation(summary = "获取支付url") + @Parameters(value = { @Parameter(name = "orderNumber", description = "订单号", required = true) }) - @GetMapping("/url/{orderNumber}") - public AjaxResult url(@PathVariable String channel, @PathVariable String orderNumber) throws Exception { - PayService payService = payServiceMap.get(channel + "PayService"); - PayOrder payOrder = payOrderService.selectPayOrderByOrderNumber(orderNumber); - return success(payService.payUrl(payOrder)); - } - + @PostMapping("/url/{orderNumber}") @Anonymous - @Operation(summary = "微信支付查询订单") - @Parameters({ - @Parameter(name = "channel", description = "支付方式", required = true) - }) - @PostMapping("/notify") - public String notify(@PathVariable String channel, HttpServletRequest request, HttpServletResponse response) - throws Exception { - PayService payService = payServiceMap.get(channel + "PayService"); - return payService.notify(request, response); + public R url(@PathVariable(name = "orderNumber") String orderNumber) throws Exception { + PayOrder payOrder = payOrderServicer.selectPayOrderByOrderNumber(orderNumber); + String url = sqbServiceImpl.payUrl(payOrder); + return R.ok(url); } @Operation(summary = "查询支付状态") - @Parameters({ - @Parameter(name = "channel", description = "支付方式", required = true), + @Parameters(value = { @Parameter(name = "orderNumber", description = "订单号", required = true) }) @PostMapping("/query/{orderNumber}") - public AjaxResult query(@PathVariable String channel, @PathVariable(name = "orderNumber") String orderNumber) - throws Exception { - PayService payService = payServiceMap.get(channel + "PayService"); - PayOrder payOrder = payOrderService.selectPayOrderByOrderNumber(orderNumber); - return success(payService.query(payOrder)); + public AjaxResult query(@PathVariable(name = "orderNumber") String orderNumber) throws Exception { + PayOrder payOrder = payOrderServicer.selectPayOrderByOrderNumber(orderNumber); + return success(sqbServiceImpl.query(payOrder)); } @PostMapping("/refund") - @Parameters({ - @Parameter(name = "channel", description = "支付方式", required = true), - }) - public AjaxResult refund(@PathVariable String channel, @RequestBody PayOrder payOrder) { - PayService payService = payServiceMap.get(channel + "PayService"); - return success(payService.refund(payOrder)); + public AjaxResult refund(@RequestBody PayOrder payOrder) { + String refund = sqbServiceImpl.refund(payOrder); + if (refund == null) { + return error("退款失败"); + } + Object parse = JSON.parse(refund); + return success(parse); } + + @PostMapping("/notify") + @Anonymous + @Operation(summary = "支付回调") + public AjaxResult notify(@RequestBody JSONObject jsonObject) throws IOException { + // 验签 + // 修改订单状态 + // 用户自定义行为 + if (sqbPayService != null) { + sqbPayService.callback(jsonObject); + } + return AjaxResult.success(); + } + } diff --git a/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/service/ISqbPayService.java b/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/service/ISqbPayService.java index 82fea2bbdca0c998611ccc0ab066ec9ba4406964..4b0c548815e6db99fd0defb56682025ae3803a93 100644 --- a/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/service/ISqbPayService.java +++ b/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/service/ISqbPayService.java @@ -1,6 +1,7 @@ package com.ruoyi.pay.sqb.service; -import com.ruoyi.pay.service.PayService; +import com.alibaba.fastjson2.JSONObject; -public interface ISqbPayService extends PayService { +public interface ISqbPayService { + public void callback(JSONObject param); } diff --git a/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/service/Impl/SQBServiceImpl.java b/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/service/Impl/SQBServiceImpl.java index 9f3c04d85b4ca3176a3adeeed1dad050066ebf6a..6d624ac335589027ea940ca1cf4b26330e71c0ff 100644 --- a/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/service/Impl/SQBServiceImpl.java +++ b/ruoyi-pay/ruoyi-pay-sqb/src/main/java/com/ruoyi/pay/sqb/service/Impl/SQBServiceImpl.java @@ -1,51 +1,33 @@ package com.ruoyi.pay.sqb.service.Impl; -import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.security.KeyFactory; import java.security.KeyManagementException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; -import java.security.PublicKey; -import java.security.Signature; import java.security.UnrecoverableKeyException; -import java.security.spec.X509EncodedKeySpec; -import java.util.Base64; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Service; -import org.springframework.util.StreamUtils; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; -import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.http.HttpClientUtil; import com.ruoyi.common.utils.sign.Md5Utils; import com.ruoyi.pay.domain.PayOrder; -import com.ruoyi.pay.service.IPayOrderService; import com.ruoyi.pay.sqb.config.SqbConfig; -import com.ruoyi.pay.sqb.service.ISqbPayService; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service("sqbPayService") +@Service @ConditionalOnProperty(prefix = "pay.sqb", name = "enabled", havingValue = "true") -public class SQBServiceImpl implements ISqbPayService { +public class SQBServiceImpl { @Autowired private SqbConfig sqbConfig; - @Autowired - private IPayOrderService payOrderService; - /** * http POST 请求 * @@ -133,12 +115,12 @@ public class SQBServiceImpl implements ISqbPayService { String result = httpPost(url, params.toString(), sign, sqbConfig.getTerminalSn()); JSONObject retObj = JSON.parseObject(result); String resCode = retObj.get("result_code").toString(); - if (!"200".equals(resCode)) { + if (!"200".equals(resCode)){ return null; } String responseStr = retObj.get("biz_response").toString(); JSONObject terminal = JSON.parseObject(responseStr); - if (terminal.get("terminal_sn") == null || terminal.get("terminal_key") == null) { + if (terminal.get("terminal_sn") == null || terminal.get("terminal_key") == null){ return null; } return terminal; @@ -152,7 +134,7 @@ public class SQBServiceImpl implements ISqbPayService { * * @return */ - public PayOrder refund(PayOrder payOrder) { + public String refund(PayOrder payOrder) { String url = sqbConfig.getApiDomain() + "/upay/v2/refund"; JSONObject params = new JSONObject(); try { @@ -164,14 +146,8 @@ public class SQBServiceImpl implements ISqbPayService { String sign = getSign(params.toString() + sqbConfig.getTerminalKey()); String result = httpPost(url, params, sign, sqbConfig.getTerminalSn()); - JSONObject retObj = JSON.parseObject(result); - JSONObject bizResponse = retObj.getJSONObject("biz_response"); - if ("REFUNDED".equals(bizResponse.getString("order_status"))) { - payOrderService.updateStatus(payOrder.getOrderNumber(), "已退款"); - } else { - log.error("退款失败"); - } - return payOrder; + + return result; } catch (Exception e) { return null; } @@ -182,8 +158,8 @@ public class SQBServiceImpl implements ISqbPayService { * * @return */ - @Override - public PayOrder query(PayOrder payOrder) { + + public JSONObject query(PayOrder payOrder) { String url = sqbConfig.getApiDomain() + "/upay/v2/query"; JSONObject params = new JSONObject(); try { @@ -194,28 +170,37 @@ public class SQBServiceImpl implements ISqbPayService { String result = httpPost(url, params, sign, sqbConfig.getTerminalSn()); JSONObject retObj = JSON.parseObject(result); String resCode = retObj.get("result_code").toString(); - if (!"200".equals(resCode)) { - throw new ServiceException("查询支付订单失败"); - } else { - JSONObject response = retObj.getJSONObject("biz_response"); - System.out.println(response); + if (!"200".equals(resCode)){ + return null; } - return payOrder; + String responseStr = retObj.get("biz_response").toString(); + return JSONObject.parseObject(responseStr); } catch (Exception e) { return null; } } - @Override - public String payUrl(PayOrder payOrder) { + public String payUrl(PayOrder payOrder) throws UnsupportedEncodingException { return payUrl(payOrder, null); } - public String payUrl(PayOrder payOrder, String notifyBaseUrl) { + public String payUrl(PayOrder payOrder, String notifyBaseUrl) throws UnsupportedEncodingException { if (payOrder.getRemark() == null) { payOrder.setRemark("支付"); } - String orderNotifyUrl = sqbConfig.getNotifyUrl(); + String orderNotifyUrl; + String defaultNotifyUrl = sqbConfig.getDefaultNotifyUrl(); + String defaultNotifyBaseUrl = sqbConfig.getDefaultNotifyBaseUrl(); + String proxyPath = sqbConfig.getProxyPath(); + if (notifyBaseUrl != null && !notifyBaseUrl.trim().equals("")) { + orderNotifyUrl = notifyBaseUrl + defaultNotifyUrl; + } else { + if (defaultNotifyBaseUrl != null && !defaultNotifyBaseUrl.trim().equals("")) { + orderNotifyUrl = defaultNotifyBaseUrl + proxyPath + defaultNotifyUrl; + } else { + orderNotifyUrl = "http://" + ServletUtils.getRequest().getServerName() + proxyPath + defaultNotifyUrl; + } + } String param = "" + "client_sn=" + payOrder.getOrderNumber() + "¬ify_url=" + orderNotifyUrl + @@ -224,22 +209,16 @@ public class SQBServiceImpl implements ISqbPayService { "&subject=" + payOrder.getRemark() + "&terminal_sn=" + sqbConfig.getTerminalSn() + "&total_amount=" + Long.valueOf(payOrder.getTotalAmount().toString()); - String urlParam; - try { - urlParam = "" + - "client_sn=" + payOrder.getOrderNumber() + - "¬ify_url=" + URLEncoder.encode(orderNotifyUrl, "UTF-8") + - "&operator=" + URLEncoder.encode(payOrder.getCreateBy(), "UTF-8") + - "&return_url=" + "https://www.shouqianba.com/" + - "&subject=" + URLEncoder.encode(payOrder.getRemark(), "UTF-8") + - "&terminal_sn=" + sqbConfig.getTerminalSn() + - "&total_amount=" + Long.valueOf(payOrder.getTotalAmount().toString()); - - String sign = getSign(param + "&key=" + sqbConfig.getTerminalKey()); - return "https://qr.shouqianba.com/gateway?" + urlParam + "&sign=" + sign.toUpperCase(); - } catch (Exception e) { - throw new ServiceException("生成收钱吧支付链接失败"); - } + String urlParam = "" + + "client_sn=" + payOrder.getOrderNumber() + + "¬ify_url=" + URLEncoder.encode(orderNotifyUrl, "UTF-8") + + "&operator=" + URLEncoder.encode(payOrder.getCreateBy(), "UTF-8") + + "&return_url=" + "https://www.shouqianba.com/" + + "&subject=" + URLEncoder.encode(payOrder.getRemark(), "UTF-8") + + "&terminal_sn=" + sqbConfig.getTerminalSn() + + "&total_amount=" + Long.valueOf(payOrder.getTotalAmount().toString()); + String sign = getSign(param + "&key=" + sqbConfig.getTerminalKey()); + return "https://qr.shouqianba.com/gateway?" + urlParam + "&sign=" + sign.toUpperCase(); } /** @@ -289,45 +268,4 @@ public class SQBServiceImpl implements ISqbPayService { } } - public boolean validateSign(String data, String sign) { - try { - // 使用SHA256WithRSA算法 - Signature signature = Signature.getInstance("SHA256WithRSA"); - - // 获取公钥 - KeyFactory keyFactory = KeyFactory.getInstance("RSA"); - PublicKey localPublicKey = keyFactory - .generatePublic(new X509EncodedKeySpec(Base64.getDecoder().decode(sqbConfig.getPublicKey()))); - // 初始化验证过程 - signature.initVerify(localPublicKey); - signature.update(data.getBytes()); - - // 解码签名 - byte[] bytesSign = Base64.getDecoder().decode(sign); - - // 验证签名 - return signature.verify(bytesSign); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - @Override - public String notify(HttpServletRequest request, HttpServletResponse response) { - try { - String requestBody = StreamUtils.copyToString(request.getInputStream(), StandardCharsets.UTF_8); - JSONObject jsonObject = JSONObject.parseObject(requestBody); - String sign = request.getHeader("Authorization"); - if (!validateSign(requestBody, sign)) { - throw new ServiceException("收钱吧支付回调验签失败"); - } - System.out.println(jsonObject); - return "success"; - } catch (IOException e) { - e.printStackTrace(); - return "fail"; - } - } - } diff --git a/ruoyi-pay/ruoyi-pay-sqb/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/ruoyi-pay/ruoyi-pay-sqb/src/main/resources/META-INF/additional-spring-configuration-metadata.json deleted file mode 100644 index cf85b111838a17a58426c231f5f1ad9405e38f79..0000000000000000000000000000000000000000 --- a/ruoyi-pay/ruoyi-pay-sqb/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "properties": [ - { - "name": "pay.sqb.enabled", - "type": "java.lang.Boolean", - "description": "启用收钱吧支付" - }, - { - "name": "pay.sqb.appId", - "type": "java.lang.String", - "description": "收钱吧appId" - }, - { - "name": "pay.sqb.apiDomain", - "type": "java.lang.String", - "description": "收钱吧apiDomain" - }, - { - "name": "pay.sqb.terminalSn", - "type": "java.lang.String", - "description": "收钱吧terminalSn" - }, - { - "name": "pay.sqb.terminalKey", - "type": "java.lang.String", - "description": "收钱吧terminalKey" - }, - { - "name": "pay.sqb.vendorSn", - "type": "java.lang.String", - "description": "收钱吧vendorSn" - }, - { - "name": "pay.sqb.vendorKey", - "type": "java.lang.String", - "description": "收钱吧vendorKey" - }, - { - "name": "pay.sqb.publicKey", - "type": "java.lang.String", - "description": "收钱吧公钥,可以直接用字符串,也可以是基于classpath的文件路径" - }, - { - "name": "pay.sqb.notifyUrl", - "type": "java.lang.String", - "description": "收钱吧支付回调地址" - } - ] -} \ No newline at end of file diff --git a/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/config/WxPayConfig.java b/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/config/WxPayConfig.java index fda8210e3164c96c162cde57d3604418f4a76faa..0b7896a2e7ca91f594100a9d0dd058162a5d7c87 100644 --- a/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/config/WxPayConfig.java +++ b/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/config/WxPayConfig.java @@ -16,7 +16,6 @@ import org.springframework.core.io.Resource; import com.wechat.pay.java.core.RSAAutoCertificateConfig; import com.wechat.pay.java.core.notification.NotificationParser; import com.wechat.pay.java.service.payments.nativepay.NativePayService; -import com.wechat.pay.java.service.refund.RefundService; /** * 配置我们自己的信息 @@ -27,79 +26,26 @@ import com.wechat.pay.java.service.refund.RefundService; @ConditionalOnProperty(prefix = "pay.wechat", name = "enabled", havingValue = "true") public class WxPayConfig { - /** 商户号 */ @Value("${pay.wechat.merchantId}") - private String merchantId; - - /** 商户证书序列号 */ + private String wxchantId; @Value("${pay.wechat.merchantSerialNumber}") - private String merchantSerialNumber; - - /** 商户APIV3密钥 */ + private String wxchantSerialNumber; @Value("${pay.wechat.apiV3Key}") - private String apiV3Key; - - /** 商户API私钥路径 */ + private String wxapiV3Key; @Value("${pay.wechat.privateKeyPath}") - private String privateKeyPath; - + private String wxcertPath; @Value("${pay.wechat.appId}") private String appId; - @Value("${pay.wechat.notifyUrl}") private String notifyUrl; - public String getMerchantId() { - return merchantId; - } - - public void setMerchantId(String merchantId) { - this.merchantId = merchantId; - } - - public String getMerchantSerialNumber() { - return merchantSerialNumber; - } - - public void setMerchantSerialNumber(String merchantSerialNumber) { - this.merchantSerialNumber = merchantSerialNumber; - } - - public String getApiV3Key() { - return apiV3Key; - } - - public void setApiV3Key(String apiV3Key) { - this.apiV3Key = apiV3Key; - } - - public void setPrivateKeyPath(String privateKeyPath) { - this.privateKeyPath = privateKeyPath; - } - - public String getAppId() { - return appId; - } - - public void setAppId(String appId) { - this.appId = appId; - } - - public String getNotifyUrl() { - return notifyUrl; - } - - public void setNotifyUrl(String notifyUrl) { - this.notifyUrl = notifyUrl; - } - @Bean public RSAAutoCertificateConfig wxpayBaseConfig() throws Exception { return new RSAAutoCertificateConfig.Builder() - .merchantId(getMerchantId()) - .privateKeyFromPath(getPrivateKeyPath()) - .merchantSerialNumber(getMerchantSerialNumber()) - .apiV3Key(getApiV3Key()) + .merchantId(getWxchantId()) + .privateKeyFromPath(getWxcertPath()) + .merchantSerialNumber(getWxchantSerialNumber()) + .apiV3Key(getWxapiV3Key()) .build(); } @@ -108,11 +54,6 @@ public class WxPayConfig { return new NativePayService.Builder().config(wxpayBaseConfig()).build(); } - @Bean - public RefundService refundService() throws Exception { - return new RefundService.Builder().config(wxpayBaseConfig()).build(); - } - @Bean public NotificationParser notificationParser() throws Exception { return new NotificationParser(wxpayBaseConfig()); @@ -121,19 +62,58 @@ public class WxPayConfig { @Autowired private ApplicationContext applicationContext; - public String getPrivateKeyPath() throws Exception { - if (privateKeyPath.startsWith("classpath:")) { - Resource resource = applicationContext.getResource(privateKeyPath); + public String getWxcertPath() throws Exception { + if (wxcertPath.startsWith("classpath:")) { + Resource resource = applicationContext.getResource(wxcertPath); String tempFilePath = System.getProperty("java.io.tmpdir") + "/temp_wxcert.pem"; try (InputStream inputStream = resource.getInputStream()) { Files.copy(inputStream, Paths.get(tempFilePath), StandardCopyOption.REPLACE_EXISTING); - privateKeyPath = tempFilePath; + wxcertPath = tempFilePath; } catch (Exception e) { Files.deleteIfExists(Paths.get(tempFilePath)); throw new RuntimeException("微信支付证书文件读取失败", e); } } - return privateKeyPath; + return wxcertPath; + } + + public String getWxchantId() { + return wxchantId; + } + + public void setWxchantId(String wxchantId) { + this.wxchantId = wxchantId; + } + + public String getWxchantSerialNumber() { + return wxchantSerialNumber; + } + + public void setWxchantSerialNumber(String wxchantSerialNumber) { + this.wxchantSerialNumber = wxchantSerialNumber; + } + + public String getWxapiV3Key() { + return wxapiV3Key; + } + + public void setWxapiV3Key(String wxapiV3Key) { + this.wxapiV3Key = wxapiV3Key; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getNotifyUrl() { + return notifyUrl; } + public void setNotifyUrl(String notifyUrl) { + this.notifyUrl = notifyUrl; + } } diff --git a/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/service/Impl/WxPayService.java b/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/controller/WxPayController.java similarity index 35% rename from ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/service/Impl/WxPayService.java rename to ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/controller/WxPayController.java index acd105c0748491a18a6684a16d556b5facaf6a25..b94584c44cc68eccf77c4365d0c5b5268a1210ab 100644 --- a/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/service/Impl/WxPayService.java +++ b/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/controller/WxPayController.java @@ -1,76 +1,93 @@ -package com.ruoyi.pay.wx.service.Impl; +package com.ruoyi.pay.wx.controller; +import java.io.IOException; import java.nio.charset.StandardCharsets; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.stereotype.Service; import org.springframework.util.StreamUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; import com.ruoyi.pay.domain.PayOrder; import com.ruoyi.pay.service.IPayOrderService; import com.ruoyi.pay.wx.config.WxPayConfig; import com.ruoyi.pay.wx.service.IWxPayService; -import com.wechat.pay.java.core.exception.ServiceException; +import com.wechat.pay.java.core.exception.ValidationException; import com.wechat.pay.java.core.notification.NotificationParser; import com.wechat.pay.java.core.notification.RequestParam; -import com.wechat.pay.java.service.payments.model.Transaction; -import com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum; import com.wechat.pay.java.service.payments.nativepay.NativePayService; import com.wechat.pay.java.service.payments.nativepay.model.Amount; import com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest; import com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse; -import com.wechat.pay.java.service.payments.nativepay.model.QueryOrderByIdRequest; -import com.wechat.pay.java.service.refund.RefundService; -import com.wechat.pay.java.service.refund.model.CreateRequest; -import com.wechat.pay.java.service.refund.model.Refund; -import com.wechat.pay.java.service.refund.model.Status; +import com.wechat.pay.java.service.wexinpayscoreparking.model.Transaction; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -@Service("wechatPayService") +/** + * @author zlh + */ +@RestController @ConditionalOnProperty(prefix = "pay.wechat", name = "enabled", havingValue = "true") -public class WxPayService implements IWxPayService { +@RequestMapping("/pay/wechat") +public class WxPayController extends BaseController { + @Autowired + private WxPayConfig wxPayAppConfig; + + @Autowired(required = false) + private IWxPayService wxPayService; @Autowired private IPayOrderService payOrderService; @Autowired private NativePayService nativePayService; - - @Autowired - private WxPayConfig wxPayAppConfig; - @Autowired private NotificationParser notificationParser; - @Autowired - private RefundService refundService; - - @Override - public String payUrl(PayOrder payOrder) { + @Operation(summary = "微信支付") + @Parameters({ + @Parameter(name = "orderNumber", description = "订单号", required = true) + }) + @GetMapping("/url/{orderNumber}") + public R url(@PathVariable(name = "orderNumber") String orderNumber) throws Exception { + PayOrder aliPay = payOrderService.selectPayOrderByOrderNumber(orderNumber); PrepayRequest request = new PrepayRequest(); Amount amount = new Amount(); - amount.setTotal(Integer.parseInt(payOrder.getActualAmount())); + amount.setTotal(Integer.parseInt(aliPay.getActualAmount())); request.setAmount(amount); request.setAppid(wxPayAppConfig.getAppId()); - request.setMchid(wxPayAppConfig.getMerchantId()); - request.setDescription(payOrder.getOrderContent()); + request.setMchid(wxPayAppConfig.getWxchantId()); + request.setDescription(aliPay.getOrderContent()); request.setNotifyUrl(wxPayAppConfig.getNotifyUrl()); - request.setOutTradeNo(payOrder.getOrderNumber()); + request.setOutTradeNo(aliPay.getOrderNumber()); PrepayResponse response = nativePayService.prepay(request); - return response.getCodeUrl(); + return R.ok(response.getCodeUrl()); } - @Override - public String notify(HttpServletRequest request, HttpServletResponse response) { - String timeStamp = request.getHeader("Wechatpay-Timestamp"); - String nonce = request.getHeader("Wechatpay-Nonce"); - String signature = request.getHeader("Wechatpay-Signature"); - String certSn = request.getHeader("Wechatpay-Serial"); + @Anonymous + @Operation(summary = "微信支付查询订单") + @PostMapping("/notify") + public AjaxResult notify(HttpServletRequest servletRequest, HttpServletResponse response) + throws Exception { + String timeStamp = servletRequest.getHeader("Wechatpay-Timestamp"); + String nonce = servletRequest.getHeader("Wechatpay-Nonce"); + String signature = servletRequest.getHeader("Wechatpay-Signature"); + String certSn = servletRequest.getHeader("Wechatpay-Serial"); + try { - String requestBody = StreamUtils.copyToString(request.getInputStream(), StandardCharsets.UTF_8); + String requestBody = StreamUtils.copyToString(servletRequest.getInputStream(), StandardCharsets.UTF_8); RequestParam requestParam = new RequestParam.Builder() .serialNumber(certSn) .nonce(nonce) @@ -78,47 +95,19 @@ public class WxPayService implements IWxPayService { .timestamp(timeStamp) .body(requestBody) .build(); - Transaction transaction = notificationParser.parse(requestParam, Transaction.class); - String orderNumber = transaction.getOutTradeNo(); - String otherOrderNumber = transaction.getTransactionId(); - TradeStateEnum orderState = transaction.getTradeState(); - System.out.println("orderNumber: " + orderNumber); - System.out.println("otherOrderNumber: " + otherOrderNumber); - System.out.println("orderState: " + orderState); - return "success"; - } catch (Exception e) { - e.printStackTrace(); - return "fail"; - } - } - - @Override - public PayOrder query(PayOrder payOrder) { - QueryOrderByIdRequest queryRequest = new QueryOrderByIdRequest(); - queryRequest.setMchid(wxPayAppConfig.getMerchantId()); - queryRequest.setTransactionId(payOrder.getOrderNumber()); - try { - Transaction result = nativePayService.queryOrderById(queryRequest); - System.out.println(result.getTradeState()); - } catch (ServiceException e) { - System.out.printf("code=[%s], message=[%s]\n", e.getErrorCode(), e.getErrorMessage()); - System.out.printf("reponse body=[%s]\n", e.getResponseBody()); - } - return payOrder; - } - @Override - public PayOrder refund(PayOrder payOrder) { - CreateRequest request = new CreateRequest(); - request.setTransactionId(payOrder.getOrderNumber()); - request.setOutRefundNo(payOrder.getOrderNumber()); - request.setOutTradeNo(payOrder.getOrderNumber()); - Refund refund = refundService.create(request); - Status status = refund.getStatus(); - if (status.equals(Status.SUCCESS)) { - payOrderService.updateStatus(payOrder.getOrderNumber(), "已退款"); + try { + Transaction transaction = notificationParser.parse(requestParam, Transaction.class); + if (wxPayService != null) { + wxPayService.callback(transaction); + } + return success(); + } catch (ValidationException e) { + return error(); + } + } catch (IOException e) { + return error(e.getMessage()); } - return payOrder; } -} +} \ No newline at end of file diff --git a/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/service/IWxPayService.java b/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/service/IWxPayService.java index 46f653888cb9a1bee09155c10c2953d5329627e9..0d6177785ee28ccc96073b7b9cbc73b0c303e093 100644 --- a/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/service/IWxPayService.java +++ b/ruoyi-pay/ruoyi-pay-wx/src/main/java/com/ruoyi/pay/wx/service/IWxPayService.java @@ -1,6 +1,7 @@ package com.ruoyi.pay.wx.service; -import com.ruoyi.pay.service.PayService; +import com.wechat.pay.java.service.wexinpayscoreparking.model.Transaction; -public interface IWxPayService extends PayService { +public interface IWxPayService { + public void callback(Transaction transaction); } diff --git a/ruoyi-pay/ruoyi-pay-wx/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/ruoyi-pay/ruoyi-pay-wx/src/main/resources/META-INF/additional-spring-configuration-metadata.json deleted file mode 100644 index edafe824091cf5258f82d2b7a929bba1df596c2f..0000000000000000000000000000000000000000 --- a/ruoyi-pay/ruoyi-pay-wx/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "properties": [ - { - "name": "pay.wechat.enabled", - "type": "java.lang.Boolean", - "description": "是否启用微信支付" - }, - { - "name": "pay.wechat.appId", - "type": "java.lang.String", - "description": "微信支付appid" - }, - { - "name": "pay.wechat.apiV3Key", - "type": "java.lang.String", - "description": "微信支付apiV3Key" - }, - { - "name": "pay.wechat.privateKeyPath", - "type": "java.lang.String", - "description": "微信支付私钥,可以直接用字符串,也可以是基于classpath的文件路径" - }, - { - "name": "pay.wechat.merchantId", - "type": "java.lang.String", - "description": "微信支付merchantId" - }, - { - "name": "pay.wechat.merchantSerialNumber", - "type": "java.lang.String", - "description": "微信支付merchantSerialNumber" - }, - { - "name": "pay.wechat.notifyUrl", - "type": "java.lang.String", - "description": "微信支付回调地址" - } - ] -} \ No newline at end of file diff --git a/ruoyi-plugins/ruoyi-alibaba-oss/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/ruoyi-plugins/ruoyi-alibaba-oss/src/main/resources/META-INF/additional-spring-configuration-metadata.json deleted file mode 100644 index b1789b8c2fad7fad83e0d029dce371a2ba27ec71..0000000000000000000000000000000000000000 --- a/ruoyi-plugins/ruoyi-alibaba-oss/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "properties": [ - { - "name": "oss.enable", - "type": "java.lang.Boolean", - "description": "是否开启oss" - }, - { - "name": "oss.primary", - "type": "java.lang.String", - "description": "默认存储名称" - }, - { - "name": "oss.client", - "type": "java.util.Map", - "description": "储存桶" - } - ] -} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/AppUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/AppUserMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..29d51f596a255b66ca94fc4594874d0b4d6db29e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/AppUserMapper.java @@ -0,0 +1,144 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.entity.AppUser; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户表 数据层 + * + * @author ruoyi + */ +public interface AppUserMapper { + /** + * 根据条件分页查询用户列表 + * + * @param AppUser 用户信息 + * @return 用户信息集合信息 + */ + public List selectUserList(AppUser AppUser); + + /** + * 根据条件分页查询已配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectAllocatedList(AppUser user); + + /** + * 根据条件分页查询未分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUnallocatedList(AppUser user); + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public AppUser selectUserByUserName(String userName); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + public AppUser selectUserById(Long userId); + + /** + * 通过手机号查询用户 + * + * @param phone 手机号 + * @return 用户对象信息 + */ + public AppUser selectUserByPhone(String phone); + + /** + * 通过邮箱查询用户 + * + * @param email 邮箱 + * @return 用户对象信息 + */ + public AppUser selectUserByEmail(String email); + + /** + * 新增用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int insertUser(AppUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(AppUser user); + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + public int resetUserPwd(@Param("userName") String userName, @Param("password") String password); + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserById(Long userId); + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + public int deleteUserByIds(Long[] userIds); + + /** + * 校验用户名称是否唯一 + * + * @param userName 用户名称 + * @return 结果 + */ + public AppUser checkUserNameUnique(String userName); + + /** + * 校验手机号码是否唯一 + * + * @param phonenumber 手机号码 + * @return 结果 + */ + public AppUser checkPhoneUnique(String phonenumber); + + /** + * 校验email是否唯一 + * + * @param email 用户邮箱 + * @return 结果 + */ + public AppUser checkEmailUnique(String email); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java index 16d3ca1cbc638e398c67337f7293426ef570c8d1..2ae6457f78ccc9f960f398342dda1714192641ac 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java @@ -1,8 +1,6 @@ package com.ruoyi.system.mapper; import java.util.List; -import java.util.Map; - import com.ruoyi.system.domain.SysOperLog; /** @@ -47,24 +45,4 @@ public interface SysOperLogMapper * 清空操作日志 */ public void cleanOperLog(); - - /** - * 获取成功操作的统计信息 - */ - public List> getSuccessOperationStats(SysOperLog operLog); - - /** - * 获取失败操作的统计信息 - */ - public List> getFailureOperationStats(SysOperLog operLog); - - /** - * 获取按状态分类的操作统计信息 - */ - public List> getStatusStats(SysOperLog operLog); - - /** - * 获取按模块和操作类型分类的操作统计信息 - */ - public List> getModuleOperationStats(SysOperLog operLog); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IAppConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IAppConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..f4d064948141a24881bb900d861ede5371302584 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IAppConfigService.java @@ -0,0 +1,90 @@ +package com.ruoyi.system.service; + +import com.ruoyi.system.domain.SysConfig; + +import java.util.List; + +/** + * 参数配置 服务层 + * + * @author ruoyi + */ +public interface IAppConfigService +{ + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + public SysConfig selectConfigById(Long configId); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数键值 + */ + public String selectConfigByKey(String configKey); + + /** + * 获取验证码开关 + * + * @return true开启,false关闭 + */ + public boolean selectCaptchaEnabled(); + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + public List selectConfigList(SysConfig config); + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int insertConfig(SysConfig config); + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int updateConfig(SysConfig config); + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + */ + public void deleteConfigByIds(Long[] configIds); + + /** + * 加载参数缓存数据 + */ + public void loadingConfigCache(); + + /** + * 清空参数缓存数据 + */ + public void clearConfigCache(); + + /** + * 重置参数缓存数据 + */ + public void resetConfigCache(); + + /** + * 校验参数键名是否唯一 + * + * @param config 参数信息 + * @return 结果 + */ + public boolean checkConfigKeyUnique(SysConfig config); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IAppUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IAppUserService.java new file mode 100644 index 0000000000000000000000000000000000000000..25a74220076b5e8e46caef3cf0e17ccd56ef9fe4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IAppUserService.java @@ -0,0 +1,223 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.entity.AppUser; + +import java.util.List; + +/** + * 用户 业务层 + * + * @author ruoyi + */ +public interface IAppUserService { + /** + * 根据条件分页查询用户列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUserList(AppUser user); + + /** + * 根据条件分页查询已分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectAllocatedList(AppUser user); + + /** + * 根据条件分页查询未分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUnallocatedList(AppUser user); + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public AppUser selectUserByUserName(String userName); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + public AppUser selectUserById(Long userId); + + /** + * 通过手机号查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public AppUser selectUserByPhone(String phone); + + /** + * 通过邮箱查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public AppUser selectUserByEmail(String email); + + /** + * 根据用户ID查询用户所属角色组 + * + * @param userName 用户名 + * @return 结果 + */ + public String selectUserRoleGroup(String userName); + + /** + * 根据用户ID查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + public String selectUserPostGroup(String userName); + + /** + * 校验用户名称是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + public boolean checkUserNameUnique(AppUser user); + + /** + * 校验手机号码是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + public boolean checkPhoneUnique(AppUser user); + + /** + * 校验email是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + public boolean checkEmailUnique(AppUser user); + + /** + * 校验用户是否允许操作 + * + * @param user 用户信息 + */ + public void checkUserAllowed(AppUser user); + + /** + * 校验用户是否有数据权限 + * + * @param userId 用户id + */ + public void checkUserDataScope(Long userId); + + /** + * 新增用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int insertUser(AppUser user); + + /** + * 注册用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public boolean registerUser(AppUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(AppUser user); + + /** + * 用户授权角色 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + public void insertUserAuth(Long userId, Long[] roleIds); + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserStatus(AppUser user); + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserProfile(AppUser user); + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + public boolean updateUserAvatar(String userName, String avatar); + + /** + * 重置用户密码 + * + * @param user 用户信息 + * @return 结果 + */ + public int resetPwd(AppUser user); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + public int resetUserPwd(String userName, String password); + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserById(Long userId); + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + public int deleteUserByIds(Long[] userIds); + + /** + * 导入用户数据 + * + * @param userList 用户数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + public String importUser(List userList, Boolean isUpdateSupport, String operName); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java index 686abc8f6f60ebccc189e55d8faa515460f766d4..4fd8e5a851cbfe51b6536bb9e90068223f382bdc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java @@ -1,8 +1,6 @@ package com.ruoyi.system.service; import java.util.List; -import java.util.Map; - import com.ruoyi.system.domain.SysOperLog; /** @@ -47,24 +45,4 @@ public interface ISysOperLogService * 清空操作日志 */ public void cleanOperLog(); - - /** - * 获取成功操作的统计信息 - */ - List> getSuccessOperationStats(SysOperLog operLog); - - /** - * 获取失败操作的统计信息 - */ - List> getFailureOperationStats(SysOperLog operLog); - - /** - * 获取按状态分类的操作统计信息 - */ - List> getStatusStats(SysOperLog operLog); - - /** - * 获取按模块和操作类型分类的操作统计信息 - */ - List> getModuleOperationStats(SysOperLog operLog); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppConfigServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..405f63dce60a4362fdb6b559ce646d0c5fe2e1db --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppConfigServiceImpl.java @@ -0,0 +1,225 @@ +package com.ruoyi.system.service.impl; + +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.CacheUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysConfig; +import com.ruoyi.system.mapper.SysConfigMapper; +import com.ruoyi.system.service.IAppConfigService; +import com.ruoyi.system.service.ISysConfigService; +import jakarta.annotation.PostConstruct; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.Cache; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 参数配置 服务层实现 + * + * @author ruoyi + */ +@Service +public class AppConfigServiceImpl implements IAppConfigService +{ + @Autowired + private SysConfigMapper configMapper; + + /** + * 项目启动时,初始化参数到缓存 + */ + @PostConstruct + public void init() + { + loadingConfigCache(); + } + + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + @Override + @DataSource(DataSourceType.MASTER) + public SysConfig selectConfigById(Long configId) + { + SysConfig config = new SysConfig(); + config.setConfigId(configId); + return configMapper.selectConfig(config); + } + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数key + * @return 参数键值 + */ + @Override + public String selectConfigByKey(String configKey) + { + String configValue = Convert.toStr(getCache().get(configKey, String.class)); + if (StringUtils.isNotEmpty(configValue)) + { + return configValue; + } + SysConfig config = new SysConfig(); + config.setConfigKey(configKey); + SysConfig retConfig = configMapper.selectConfig(config); + if (StringUtils.isNotNull(retConfig)) + { + CacheUtils.put(CacheConstants.SYS_CONFIG_KEY, configKey, retConfig.getConfigValue()); + return retConfig.getConfigValue(); + } + return StringUtils.EMPTY; + } + + /** + * 获取验证码开关 + * + * @return true开启,false关闭 + */ + @Override + public boolean selectCaptchaEnabled() + { + String captchaEnabled = selectConfigByKey("sys.account.captchaEnabled"); + return Convert.toBool(captchaEnabled,true); + } + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + @Override + public List selectConfigList(SysConfig config) + { + return configMapper.selectConfigList(config); + } + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int insertConfig(SysConfig config) + { + int row = configMapper.insertConfig(config); + if (row > 0) + { + CacheUtils.put(CacheConstants.SYS_CONFIG_KEY, config.getConfigKey(), config.getConfigValue()); + } + return row; + } + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int updateConfig(SysConfig config) + { + SysConfig temp = configMapper.selectConfigById(config.getConfigId()); + if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) + { + CacheUtils.removeIfPresent(CacheConstants.SYS_CONFIG_KEY, temp.getConfigKey()); + } + + int row = configMapper.updateConfig(config); + if (row > 0) + { + CacheUtils.put(CacheConstants.SYS_CONFIG_KEY, config.getConfigKey(), config.getConfigValue()); + } + return row; + } + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + */ + @Override + public void deleteConfigByIds(Long[] configIds) + { + for (Long configId : configIds) + { + SysConfig config = selectConfigById(configId); + if (StringUtils.equals(UserConstants.YES, config.getConfigType())) + { + throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); + } + configMapper.deleteConfigById(configId); + getCache().evict(config.getConfigKey()); + } + } + + /** + * 加载参数缓存数据 + */ + @Override + public void loadingConfigCache() + { + List configsList = configMapper.selectConfigList(new SysConfig()); + for (SysConfig config : configsList) + { + getCache().put(config.getConfigKey(), config.getConfigValue()); + } + } + + /** + * 清空参数缓存数据 + */ + @Override + public void clearConfigCache() + { + CacheUtils.getCache(CacheConstants.SYS_CONFIG_KEY).clear(); + } + + /** + * 重置参数缓存数据 + */ + @Override + public void resetConfigCache() + { + clearConfigCache(); + loadingConfigCache(); + } + + /** + * 校验参数键名是否唯一 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public boolean checkConfigKeyUnique(SysConfig config) + { + Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); + SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); + if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 获取config缓存 + * + * @return + */ + private Cache getCache() + { + return CacheUtils.getCache(CacheConstants.SYS_CONFIG_KEY); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppUserServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a5ddb6d23a2c75e9fecad48556330fac6fed85d8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/AppUserServiceImpl.java @@ -0,0 +1,511 @@ +package com.ruoyi.system.service.impl; + +import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.AppUser; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanValidators; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.system.domain.SysPost; +import com.ruoyi.system.domain.SysUserPost; +import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.mapper.*; +import com.ruoyi.system.service.IAppUserService; +import com.ruoyi.system.service.ISysConfigService; +import com.ruoyi.system.service.ISysUserService; +import jakarta.validation.Validator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 用户 业务层处理 + * + * @author ruoyi + */ +@Service +public class AppUserServiceImpl implements IAppUserService { + private static final Logger log = LoggerFactory.getLogger(AppUserServiceImpl.class); + + @Autowired + private AppUserMapper appUserMapper; + + @Autowired + private SysRoleMapper roleMapper; + + @Autowired + private SysPostMapper postMapper; + + @Autowired + private SysUserRoleMapper userRoleMapper; + + @Autowired + private SysUserPostMapper userPostMapper; + + @Autowired + private ISysConfigService configService; + + @Autowired + protected Validator validator; + + /** + * 根据条件分页查询用户列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectUserList(AppUser user) { + return appUserMapper.selectUserList(user); + } + + /** + * 根据条件分页查询已分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectAllocatedList(AppUser user) { + return appUserMapper.selectAllocatedList(user); + } + + /** + * 根据条件分页查询未分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectUnallocatedList(AppUser user) { + return appUserMapper.selectUnallocatedList(user); + } + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + @Override + public AppUser selectUserByUserName(String userName) { + return appUserMapper.selectUserByUserName(userName); + } + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + @Override + public AppUser selectUserById(Long userId) { + return appUserMapper.selectUserById(userId); + } + + /** + * 通过手机号查询用户 + * + * @param phone 用户ID + * @return 用户对象信息 + */ + @Override + public AppUser selectUserByPhone(String phone) { + return appUserMapper.selectUserByPhone(phone); + } + + /** + * 通过邮箱查询用户 + * + * @param email 用户名 + * @return 用户对象信息 + */ + @Override + public AppUser selectUserByEmail(String email){ + return appUserMapper.selectUserByEmail(email); + } + + /** + * 查询用户所属角色组 + * + * @param userName 用户名 + * @return 结果 + */ + @Override + public String selectUserRoleGroup(String userName) { + List list = roleMapper.selectRolesByUserName(userName); + if (CollectionUtils.isEmpty(list)) { + return StringUtils.EMPTY; + } + return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(",")); + } + + /** + * 查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + @Override + public String selectUserPostGroup(String userName) { + List list = postMapper.selectPostsByUserName(userName); + if (CollectionUtils.isEmpty(list)) { + return StringUtils.EMPTY; + } + return list.stream().map(SysPost::getPostName).collect(Collectors.joining(",")); + } + + /** + * 校验用户名称是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public boolean checkUserNameUnique(AppUser user) { + Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); + AppUser info = appUserMapper.checkUserNameUnique(user.getUserName()); + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验手机号码是否唯一 + * + * @param user 用户信息 + * @return + */ + @Override + public boolean checkPhoneUnique(AppUser user) { + Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); + AppUser info = appUserMapper.checkPhoneUnique(user.getPhonenumber()); + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验email是否唯一 + * + * @param user 用户信息 + * @return + */ + @Override + public boolean checkEmailUnique(AppUser user) { + Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); + AppUser info = appUserMapper.checkEmailUnique(user.getEmail()); + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验用户是否允许操作 + * + * @param user 用户信息 + */ + @Override + public void checkUserAllowed(AppUser user) { + if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) { + throw new ServiceException("不允许操作超级管理员用户"); + } + } + + /** + * 校验用户是否有数据权限 + * + * @param userId 用户id + */ + @Override + public void checkUserDataScope(Long userId) { + if (!AppUser.isAdmin(SecurityUtils.getUserId())) { + AppUser user = new AppUser(); + user.setUserId(userId); + List users = SpringUtils.getAopProxy(this).selectUserList(user); + if (StringUtils.isEmpty(users)) { + throw new ServiceException("没有权限访问用户数据!"); + } + } + } + + /** + * 新增保存用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + @Transactional + public int insertUser(AppUser user) { + // 新增用户信息 + int rows = appUserMapper.insertUser(user); + // 新增用户岗位关联 + insertUserPost(user); + // 新增用户与角色管理 + insertUserRole(user); + return rows; + } + + /** + * 注册用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public boolean registerUser(AppUser user) { + return appUserMapper.insertUser(user) > 0; + } + + /** + * 修改保存用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + @Transactional + public int updateUser(AppUser user) { + Long userId = user.getUserId(); + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 新增用户与角色管理 + insertUserRole(user); + // 删除用户与岗位关联 + userPostMapper.deleteUserPostByUserId(userId); + // 新增用户与岗位管理 + insertUserPost(user); + return appUserMapper.updateUser(user); + } + + /** + * 用户授权角色 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + @Override + @Transactional + public void insertUserAuth(Long userId, Long[] roleIds) { + userRoleMapper.deleteUserRoleByUserId(userId); + insertUserRole(userId, roleIds); + } + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int updateUserStatus(AppUser user) { + return appUserMapper.updateUser(user); + } + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int updateUserProfile(AppUser user) { + return appUserMapper.updateUser(user); + } + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + @Override + public boolean updateUserAvatar(String userName, String avatar) { + return appUserMapper.updateUserAvatar(userName, avatar) > 0; + } + + /** + * 重置用户密码 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int resetPwd(AppUser user) { + return appUserMapper.updateUser(user); + } + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + @Override + public int resetUserPwd(String userName, String password) { + return appUserMapper.resetUserPwd(userName, password); + } + + /** + * 新增用户角色信息 + * + * @param user 用户对象 + */ + public void insertUserRole(AppUser user) { + this.insertUserRole(user.getUserId(), user.getRoleIds()); + } + + /** + * 新增用户岗位信息 + * + * @param user 用户对象 + */ + public void insertUserPost(AppUser user) { + Long[] posts = user.getPostIds(); + if (StringUtils.isNotEmpty(posts)) { + // 新增用户与岗位管理 + List list = new ArrayList(posts.length); + for (Long postId : posts) { + SysUserPost up = new SysUserPost(); + up.setUserId(user.getUserId()); + up.setPostId(postId); + list.add(up); + } + userPostMapper.batchUserPost(list); + } + } + + /** + * 新增用户角色信息 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + public void insertUserRole(Long userId, Long[] roleIds) { + if (StringUtils.isNotEmpty(roleIds)) { + // 新增用户与角色管理 + List list = new ArrayList(roleIds.length); + for (Long roleId : roleIds) { + SysUserRole ur = new SysUserRole(); + ur.setUserId(userId); + ur.setRoleId(roleId); + list.add(ur); + } + userRoleMapper.batchUserRole(list); + } + } + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + @Override + @Transactional + public int deleteUserById(Long userId) { + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 删除用户与岗位表 + userPostMapper.deleteUserPostByUserId(userId); + return appUserMapper.deleteUserById(userId); + } + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + @Override + @Transactional + public int deleteUserByIds(Long[] userIds) { + for (Long userId : userIds) { + checkUserAllowed(new AppUser(userId)); + checkUserDataScope(userId); + } + // 删除用户与角色关联 + userRoleMapper.deleteUserRole(userIds); + // 删除用户与岗位关联 + userPostMapper.deleteUserPost(userIds); + return appUserMapper.deleteUserByIds(userIds); + } + + /** + * 导入用户数据 + * + * @param userList 用户数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + @Override + public String importUser(List userList, Boolean isUpdateSupport, String operName) { + if (StringUtils.isNull(userList) || userList.size() == 0) { + throw new ServiceException("导入用户数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + String password = configService.selectConfigByKey("sys.user.initPassword"); + for (AppUser user : userList) { + try { + // 验证是否存在这个用户 + AppUser u = appUserMapper.selectUserByUserName(user.getUserName()); + if (StringUtils.isNull(u)) { + BeanValidators.validateWithException(validator, user); + user.setPassword(SecurityUtils.encryptPassword(password)); + user.setCreateBy(operName); + appUserMapper.insertUser(user); + successNum++; + successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 导入成功"); + } else if (isUpdateSupport) { + BeanValidators.validateWithException(validator, user); + checkUserAllowed(u); + checkUserDataScope(u.getUserId()); + user.setUserId(u.getUserId()); + user.setUpdateBy(operName); + appUserMapper.updateUser(user); + successNum++; + successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 更新成功"); + } else { + failureNum++; + failureMsg.append("
" + failureNum + "、账号 " + user.getUserName() + " 已存在"); + } + } catch (Exception e) { + failureNum++; + String msg = "
" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + log.error(msg, e); + } + } + if (failureNum > 0) { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } else { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + } + return successMsg.toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java index 748924240999368332d056fd8c071657daaedfc5..54898152e3dc4557121e3b1044f662853f9ea701 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java @@ -1,11 +1,8 @@ package com.ruoyi.system.service.impl; import java.util.List; -import java.util.Map; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.mapper.SysOperLogMapper; import com.ruoyi.system.service.ISysOperLogService; @@ -76,24 +73,4 @@ public class SysOperLogServiceImpl implements ISysOperLogService { operLogMapper.cleanOperLog(); } - - @Override - public List> getSuccessOperationStats(SysOperLog operLog) { - return operLogMapper.getSuccessOperationStats(operLog); - } - - @Override - public List> getFailureOperationStats(SysOperLog operLog) { - return operLogMapper.getFailureOperationStats(operLog); - } - - @Override - public List> getStatusStats(SysOperLog operLog) { - return operLogMapper.getStatusStats(operLog); - } - - @Override - public List> getModuleOperationStats(SysOperLog operLog) { - return operLogMapper.getModuleOperationStats(operLog); - } } diff --git a/ruoyi-system/src/main/resources/mapper/system/AppUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/AppUserMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..0750c2d6ca806aeeff8dea04e390452a4f74207a --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/AppUserMapper.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select user_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark + from app_user + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into app_user( + user_name, + nick_name, + user_type, + email, + phonenumber, + sex, + avatar, + password, + status, + create_by, + remark, + create_time + ) values ( + #{userName}, + #{nickName}, + #{userType}, + #{email}, + #{phonenumber}, + #{sex}, + #{avatar}, + #{password}, + #{status}, + #{createBy}, + #{remark}, + sysdate() + ) + + + + + update app_user + + user_name = #{userName}, + nick_name = #{nickName}, + user_type = #{userType}, + email = #{email}, + phonenumber = #{phonenumber}, + sex = #{sex}, + avatar = #{avatar}, + password = #{password}, + status = #{status}, + login_ip = #{loginIp}, + login_date = #{loginDate}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + where user_id = #{userId} + + + + + update app_user set status = #{status} where user_id = #{userId} + + + + + update app_user set avatar = #{avatar} where user_name = #{userName} + + + + + update app_user set password = #{password} where user_name = #{userName} + + + + + update app_user set del_flag = '2' where user_id = #{userId} + + + + + update app_user set del_flag = '2' where user_id in + + #{userId} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml index a4f3922aad1e7a3726ea8c038ce29f9ab1b820f6..96bc6218aeeb8eac44a9eb92c481dda71834307b 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -43,9 +43,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND business_type = #{businessType} - - AND request_method = #{requestMethod} - AND business_type in @@ -84,74 +81,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" truncate table sys_oper_log
- - - - AND title like concat('%', #{title}, '%') - - - AND business_type = #{businessType} - - - AND request_method = #{requestMethod} - - - AND business_type in - - #{businessType} - - - - AND status = #{status} - - - AND oper_time >= #{params.beginTime} - - - AND oper_time <= #{params.endTime} - - - - - - - - - - - - -
\ No newline at end of file diff --git a/ruoyi.sql b/ruoyi.sql new file mode 100644 index 0000000000000000000000000000000000000000..1fda383485c31784f3c4b90a666e4e71af620d68 --- /dev/null +++ b/ruoyi.sql @@ -0,0 +1,1234 @@ +/* + Navicat Premium Data Transfer + + Source Server : 127.0.0.1 + Source Server Type : MySQL + Source Server Version : 80012 + Source Host : localhost:3306 + Source Schema : ruoyi + + Target Server Type : MySQL + Target Server Version : 80012 + File Encoding : 65001 + + Date: 01/03/2025 16:03:58 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for app_user +-- ---------------------------- +DROP TABLE IF EXISTS `app_user`; +CREATE TABLE `app_user` ( + `user_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID', + `user_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户账号', + `nick_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户昵称', + `user_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '00' COMMENT '用户类型(00系统用户)', + `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户邮箱', + `phonenumber` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '手机号码', + `sex` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '用户性别(0男 1女 2未知)', + `avatar` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '头像地址', + `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '密码', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态(0正常 1停用)', + `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', + `login_ip` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '最后登录IP', + `login_date` datetime NULL DEFAULT NULL COMMENT '最后登录时间', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`user_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of app_user +-- ---------------------------- +INSERT INTO `app_user` VALUES (100, 'admin123', 'admin123', '00', '', '', '0', '', '$2a$10$yXwwyWKhsIPC1Axjd9Nymuk8UMfOyC12mDLZR4cSUm5KXNcqwfGX.', '0', '0', '127.0.0.1', '2025-03-01 15:40:18', '', '2025-03-01 13:57:22', '', '2025-03-01 15:40:18', NULL); + +-- ---------------------------- +-- Table structure for gen_join_table +-- ---------------------------- +DROP TABLE IF EXISTS `gen_join_table`; +CREATE TABLE `gen_join_table` ( + `table_id` bigint(20) NOT NULL COMMENT '表编号', + `left_table_id` bigint(20) NOT NULL COMMENT '主表名称', + `right_table_id` bigint(20) NOT NULL COMMENT '关联表编号', + `left_table_alias` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主表别名', + `right_table_alias` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联表别名', + `left_table_fk` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主表别名', + `right_table_fk` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联表别名', + `join_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联类型', + `join_columns` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '关联字段', + `order_num` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '序号', + `new_table_id` bigint(20) NOT NULL COMMENT '新表编号', + PRIMARY KEY (`table_id`, `right_table_id`, `left_table_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of gen_join_table +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_table +-- ---------------------------- +DROP TABLE IF EXISTS `gen_table`; +CREATE TABLE `gen_table` ( + `table_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', + `table_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '表名称', + `table_alias` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '表名称', + `table_comment` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '表描述', + `have_sub_column` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是否含有关联字段', + `sub_table_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联子表的表名', + `sub_table_fk_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '子表关联的外键名', + `class_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '实体类名称', + `tpl_category` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'crud' COMMENT '使用的模板(crud单表操作 tree树表操作)', + `tpl_web_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'element-plus' COMMENT '使用的模板类型', + `package_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成包路径', + `module_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成模块名', + `business_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成业务名', + `function_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成功能名', + `function_author` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生成功能作者', + `gen_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '生成代码方式(0zip压缩包 1自定义路径)', + `gen_path` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '/' COMMENT '生成路径(不填默认项目路径)', + `options` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '其它生成选项', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`table_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of gen_table +-- ---------------------------- + +-- ---------------------------- +-- Table structure for gen_table_column +-- ---------------------------- +DROP TABLE IF EXISTS `gen_table_column`; +CREATE TABLE `gen_table_column` ( + `column_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', + `table_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '归属表编号', + `column_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列名称', + `column_comment` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列描述', + `column_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列类型', + `java_type` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'JAVA类型', + `java_field` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'JAVA字段名', + `is_pk` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否主键(1是)', + `is_increment` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否自增(1是)', + `is_required` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否必填(1是)', + `is_insert` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否为插入字段(1是)', + `is_edit` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否编辑字段(1是)', + `is_list` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否列表字段(1是)', + `is_query` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否查询字段(1是)', + `query_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'EQ' COMMENT '查询方式(等于、不等于、大于、小于、范围)', + `html_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)', + `dict_type` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典类型', + `sort` int(11) NULL DEFAULT NULL COMMENT '排序', + `sub_column_table_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联表名称', + `sub_column_fk_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联字段名称', + `sub_column_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '映射字段名称', + `sub_column_java_field` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '映射字段JAVA字段名', + `sub_column_java_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '映射字段JAVA类型', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`column_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '代码生成业务表字段' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of gen_table_column +-- ---------------------------- + +-- ---------------------------- +-- Table structure for message_system +-- ---------------------------- +DROP TABLE IF EXISTS `message_system`; +CREATE TABLE `message_system` ( + `message_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `message_title` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `send_mode` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发送方式(0平台 1手机号 2 邮箱)', + `code` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '号码', + `message_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '消息内容', + `message_recipient` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收人', + `message_status` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息状态(0未读 1已读)', + `message_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息类型', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`message_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '消息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of message_system +-- ---------------------------- + +-- ---------------------------- +-- Table structure for message_template +-- ---------------------------- +DROP TABLE IF EXISTS `message_template`; +CREATE TABLE `message_template` ( + `template_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `template_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模版名称', + `template_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模版CODE', + `template_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模版类型', + `template_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '模版内容', + `template_variable` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '变量属性', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`template_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '模版表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of message_template +-- ---------------------------- + +-- ---------------------------- +-- Table structure for message_variable +-- ---------------------------- +DROP TABLE IF EXISTS `message_variable`; +CREATE TABLE `message_variable` ( + `variable_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `variable_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '变量名称', + `variable_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '变量类型', + `variable_content` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '变量内容', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`variable_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '变量表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of message_variable +-- ---------------------------- + +-- ---------------------------- +-- Table structure for oauth_user +-- ---------------------------- +DROP TABLE IF EXISTS `oauth_user`; +CREATE TABLE `oauth_user` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', + `uuid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '第三方系统的唯一ID,详细解释请参考:名词解释', + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `source` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '第三方用户来源,可选值:GITHUB、GITEE、QQ,更多请参考:AuthDefaultSource.java(opens new window)', + `access_token` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户的授权令牌', + `expire_in` int(11) NULL DEFAULT NULL COMMENT '第三方用户的授权令牌的有效期,部分平台可能没有', + `refresh_token` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '刷新令牌,部分平台可能没有', + `open_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方用户的 open id,部分平台可能没有', + `uid` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方用户的 ID,部分平台可能没有', + `access_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '个别平台的授权信息,部分平台可能没有', + `union_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方用户的 union id,部分平台可能没有', + `scope` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '第三方用户授予的权限,部分平台可能没有', + `token_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '个别平台的授权信息,部分平台可能没有', + `id_token` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'id token,部分平台可能没有', + `mac_algorithm` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '小米平台用户的附带属性,部分平台可能没有', + `mac_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '小米平台用户的附带属性,部分平台可能没有', + `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户的授权code,部分平台可能没有', + `oauth_token` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Twitter平台用户的附带属性,部分平台可能没有', + `oauth_token_secret` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Twitter平台用户的附带属性,部分平台可能没有', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '第三方登录' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of oauth_user +-- ---------------------------- + +-- ---------------------------- +-- Table structure for online_mb +-- ---------------------------- +DROP TABLE IF EXISTS `online_mb`; +CREATE TABLE `online_mb` ( + `mb_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `tag` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标签名', + `tag_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标签id', + `parameter_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '参数类型', + `result_map` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '结果类型', + `sql_text` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'sql语句', + `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '请求路径', + `method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '请求方式', + `result_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '响应类型', + `actuator` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '执行器', + `user_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否需要userId', + `dept_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否需要deptId', + `permission_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '许可类型', + `permission_value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '许可值', + `del_flag` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)', + PRIMARY KEY (`mb_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '在线接口' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of online_mb +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_invoice +-- ---------------------------- +DROP TABLE IF EXISTS `pay_invoice`; +CREATE TABLE `pay_invoice` ( + `invoice_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '发票id', + `order_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '订单号', + `invoice_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发票类型', + `invoice_header` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发票抬头', + `invoice_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '纳税人识别号', + `invoice_phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收票人手机号', + `invoice_email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收票人邮箱', + `invoice_remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发票备注', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`invoice_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '发票' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of pay_invoice +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pay_order +-- ---------------------------- +DROP TABLE IF EXISTS `pay_order`; +CREATE TABLE `pay_order` ( + `order_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单id', + `order_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '订单号', + `order_status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '订单状态', + `total_amount` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '订单总金额', + `actual_amount` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '实际支付金额', + `order_content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '订单内容', + `order_message` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '负载信息', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`order_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '订单' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of pay_order +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_blob_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_blob_triggers`; +CREATE TABLE `qrtz_blob_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_name的外键', + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_group的外键', + `blob_data` blob NULL COMMENT '存放持久化Trigger对象', + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'Blob类型的触发器表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_blob_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_calendars +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_calendars`; +CREATE TABLE `qrtz_calendars` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `calendar_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '日历名称', + `calendar` blob NOT NULL COMMENT '存放持久化calendar对象', + PRIMARY KEY (`sched_name`, `calendar_name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日历信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_calendars +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_cron_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_cron_triggers`; +CREATE TABLE `qrtz_cron_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_name的外键', + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_group的外键', + `cron_expression` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'cron表达式', + `time_zone_id` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '时区', + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'Cron类型的触发器表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_cron_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_fired_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_fired_triggers`; +CREATE TABLE `qrtz_fired_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `entry_id` varchar(95) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度器实例id', + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_name的外键', + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_group的外键', + `instance_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度器实例名', + `fired_time` bigint(13) NOT NULL COMMENT '触发的时间', + `sched_time` bigint(13) NOT NULL COMMENT '定时器制定的时间', + `priority` int(11) NOT NULL COMMENT '优先级', + `state` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态', + `job_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务名称', + `job_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务组名', + `is_nonconcurrent` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否并发', + `requests_recovery` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否接受恢复执行', + PRIMARY KEY (`sched_name`, `entry_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '已触发的触发器表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_fired_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_job_details +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_job_details`; +CREATE TABLE `qrtz_job_details` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `job_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务名称', + `job_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务组名', + `description` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '相关介绍', + `job_class_name` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '执行任务类名称', + `is_durable` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '是否持久化', + `is_nonconcurrent` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '是否并发', + `is_update_data` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '是否更新数据', + `requests_recovery` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '是否接受恢复执行', + `job_data` blob NULL COMMENT '存放持久化job对象', + PRIMARY KEY (`sched_name`, `job_name`, `job_group`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务详细信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_job_details +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_locks +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_locks`; +CREATE TABLE `qrtz_locks` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `lock_name` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '悲观锁名称', + PRIMARY KEY (`sched_name`, `lock_name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '存储的悲观锁信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_locks +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_paused_trigger_grps +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`; +CREATE TABLE `qrtz_paused_trigger_grps` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_group的外键', + PRIMARY KEY (`sched_name`, `trigger_group`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '暂停的触发器表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_paused_trigger_grps +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_scheduler_state +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_scheduler_state`; +CREATE TABLE `qrtz_scheduler_state` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `instance_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '实例名称', + `last_checkin_time` bigint(13) NOT NULL COMMENT '上次检查时间', + `checkin_interval` bigint(13) NOT NULL COMMENT '检查间隔时间', + PRIMARY KEY (`sched_name`, `instance_name`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '调度器状态表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_scheduler_state +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_simple_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simple_triggers`; +CREATE TABLE `qrtz_simple_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_name的外键', + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_group的外键', + `repeat_count` bigint(7) NOT NULL COMMENT '重复的次数统计', + `repeat_interval` bigint(12) NOT NULL COMMENT '重复的间隔时间', + `times_triggered` bigint(10) NOT NULL COMMENT '已经触发的次数', + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '简单触发器的信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_simple_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_simprop_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_simprop_triggers`; +CREATE TABLE `qrtz_simprop_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_name的外键', + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_triggers表trigger_group的外键', + `str_prop_1` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'String类型的trigger的第一个参数', + `str_prop_2` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'String类型的trigger的第二个参数', + `str_prop_3` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'String类型的trigger的第三个参数', + `int_prop_1` int(11) NULL DEFAULT NULL COMMENT 'int类型的trigger的第一个参数', + `int_prop_2` int(11) NULL DEFAULT NULL COMMENT 'int类型的trigger的第二个参数', + `long_prop_1` bigint(20) NULL DEFAULT NULL COMMENT 'long类型的trigger的第一个参数', + `long_prop_2` bigint(20) NULL DEFAULT NULL COMMENT 'long类型的trigger的第二个参数', + `dec_prop_1` decimal(13, 4) NULL DEFAULT NULL COMMENT 'decimal类型的trigger的第一个参数', + `dec_prop_2` decimal(13, 4) NULL DEFAULT NULL COMMENT 'decimal类型的trigger的第二个参数', + `bool_prop_1` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Boolean类型的trigger的第一个参数', + `bool_prop_2` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'Boolean类型的trigger的第二个参数', + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `trigger_name`, `trigger_group`) REFERENCES `qrtz_triggers` (`sched_name`, `trigger_name`, `trigger_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '同步机制的行锁表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_simprop_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for qrtz_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `qrtz_triggers`; +CREATE TABLE `qrtz_triggers` ( + `sched_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调度名称', + `trigger_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '触发器的名字', + `trigger_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '触发器所属组的名字', + `job_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_job_details表job_name的外键', + `job_group` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'qrtz_job_details表job_group的外键', + `description` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '相关介绍', + `next_fire_time` bigint(13) NULL DEFAULT NULL COMMENT '上一次触发时间(毫秒)', + `prev_fire_time` bigint(13) NULL DEFAULT NULL COMMENT '下一次触发时间(默认为-1表示不触发)', + `priority` int(11) NULL DEFAULT NULL COMMENT '优先级', + `trigger_state` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '触发器状态', + `trigger_type` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '触发器的类型', + `start_time` bigint(13) NOT NULL COMMENT '开始时间', + `end_time` bigint(13) NULL DEFAULT NULL COMMENT '结束时间', + `calendar_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '日程表名称', + `misfire_instr` smallint(2) NULL DEFAULT NULL COMMENT '补偿执行的策略', + `job_data` blob NULL COMMENT '存放持久化job对象', + PRIMARY KEY (`sched_name`, `trigger_name`, `trigger_group`) USING BTREE, + INDEX `sched_name`(`sched_name` ASC, `job_name` ASC, `job_group` ASC) USING BTREE, + CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`sched_name`, `job_name`, `job_group`) REFERENCES `qrtz_job_details` (`sched_name`, `job_name`, `job_group`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '触发器详细信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of qrtz_triggers +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_config +-- ---------------------------- +DROP TABLE IF EXISTS `sys_config`; +CREATE TABLE `sys_config` ( + `config_id` int(5) NOT NULL AUTO_INCREMENT COMMENT '参数主键', + `config_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '参数名称', + `config_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '参数键名', + `config_value` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '参数键值', + `config_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'N' COMMENT '系统内置(Y是 N否)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`config_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 106 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '参数配置表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_config +-- ---------------------------- +INSERT INTO `sys_config` VALUES (1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-green', 'Y', 'admin', '2023-04-13 20:46:20', 'admin', '2023-04-22 00:45:19', '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow'); +INSERT INTO `sys_config` VALUES (2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', '2023-04-13 20:46:20', '', NULL, '初始化密码 123456'); +INSERT INTO `sys_config` VALUES (3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-light', 'Y', 'admin', '2023-04-13 20:46:20', 'admin', '2023-04-22 00:45:25', '深色主题theme-dark,浅色主题theme-light'); +INSERT INTO `sys_config` VALUES (4, '账号自助-验证码开关', 'sys.account.captchaEnabled', 'true', 'Y', 'admin', '2023-04-13 20:46:20', '', NULL, '是否开启验证码功能(true开启,false关闭)'); +INSERT INTO `sys_config` VALUES (5, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'true', 'Y', 'admin', '2023-04-13 20:46:20', 'admin', '2023-04-22 00:41:41', '是否开启注册用户功能(true开启,false关闭)'); +INSERT INTO `sys_config` VALUES (100, '主题颜色', 'sys.index.theme', '#11A983', 'Y', 'admin', '2023-04-22 00:57:18', 'admin', '2023-04-22 00:58:23', NULL); +INSERT INTO `sys_config` VALUES (101, '开启TopNav', 'sys.index.topNav', 'true', 'Y', 'admin', '2023-04-22 00:58:59', '', NULL, NULL); +INSERT INTO `sys_config` VALUES (102, '开启Tags-Views', 'sys.index.tagsView', 'true', 'Y', 'admin', '2023-04-22 00:59:40', '', NULL, NULL); +INSERT INTO `sys_config` VALUES (103, '显示Logo', 'sys.index.sidebarLogo', 'true', 'Y', 'admin', '2023-04-22 01:00:20', '', NULL, NULL); +INSERT INTO `sys_config` VALUES (104, '固定Header', 'sys.index.fixedHeader', 'true', 'Y', 'admin', '2023-04-22 01:00:53', '', NULL, NULL); +INSERT INTO `sys_config` VALUES (105, '动态标题', 'sys.index.dynamicTitle', 'true', 'Y', 'admin', '2023-04-22 01:01:26', 'admin', '2023-04-22 01:01:41', NULL); + +-- ---------------------------- +-- Table structure for sys_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dept`; +CREATE TABLE `sys_dept` ( + `dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '部门id', + `parent_id` bigint(20) NULL DEFAULT 0 COMMENT '父部门id', + `ancestors` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '祖级列表', + `dept_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '部门名称', + `order_num` int(4) NULL DEFAULT 0 COMMENT '显示顺序', + `leader` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '负责人', + `phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系电话', + `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '部门状态(0正常 1停用)', + `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`dept_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 109 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_dept +-- ---------------------------- +INSERT INTO `sys_dept` VALUES (100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); +INSERT INTO `sys_dept` VALUES (101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); +INSERT INTO `sys_dept` VALUES (102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); +INSERT INTO `sys_dept` VALUES (103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); +INSERT INTO `sys_dept` VALUES (104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); +INSERT INTO `sys_dept` VALUES (105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); +INSERT INTO `sys_dept` VALUES (106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); +INSERT INTO `sys_dept` VALUES (107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); +INSERT INTO `sys_dept` VALUES (108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); +INSERT INTO `sys_dept` VALUES (109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL); + +-- ---------------------------- +-- Table structure for sys_dict_data +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dict_data`; +CREATE TABLE `sys_dict_data` ( + `dict_code` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字典编码', + `dict_sort` int(4) NULL DEFAULT 0 COMMENT '字典排序', + `dict_label` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典标签', + `dict_value` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典键值', + `dict_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典类型', + `css_class` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '样式属性(其他样式扩展)', + `list_class` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '表格回显样式', + `is_default` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'N' COMMENT '是否默认(Y是 N否)', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`dict_code`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '字典数据表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_dict_data +-- ---------------------------- +INSERT INTO `sys_dict_data` VALUES (1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '性别男'); +INSERT INTO `sys_dict_data` VALUES (2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '性别女'); +INSERT INTO `sys_dict_data` VALUES (3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '性别未知'); +INSERT INTO `sys_dict_data` VALUES (4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '显示菜单'); +INSERT INTO `sys_dict_data` VALUES (5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '隐藏菜单'); +INSERT INTO `sys_dict_data` VALUES (6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '停用状态'); +INSERT INTO `sys_dict_data` VALUES (8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '停用状态'); +INSERT INTO `sys_dict_data` VALUES (10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '默认分组'); +INSERT INTO `sys_dict_data` VALUES (11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '系统分组'); +INSERT INTO `sys_dict_data` VALUES (12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '系统默认是'); +INSERT INTO `sys_dict_data` VALUES (13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '系统默认否'); +INSERT INTO `sys_dict_data` VALUES (14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '通知'); +INSERT INTO `sys_dict_data` VALUES (15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '公告'); +INSERT INTO `sys_dict_data` VALUES (16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '关闭状态'); +INSERT INTO `sys_dict_data` VALUES (18, 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '其他操作'); +INSERT INTO `sys_dict_data` VALUES (19, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '新增操作'); +INSERT INTO `sys_dict_data` VALUES (20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '修改操作'); +INSERT INTO `sys_dict_data` VALUES (21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '删除操作'); +INSERT INTO `sys_dict_data` VALUES (22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '授权操作'); +INSERT INTO `sys_dict_data` VALUES (23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '导出操作'); +INSERT INTO `sys_dict_data` VALUES (24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '导入操作'); +INSERT INTO `sys_dict_data` VALUES (25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '强退操作'); +INSERT INTO `sys_dict_data` VALUES (26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '生成操作'); +INSERT INTO `sys_dict_data` VALUES (27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '清空操作'); +INSERT INTO `sys_dict_data` VALUES (28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '正常状态'); +INSERT INTO `sys_dict_data` VALUES (29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '停用状态'); + +-- ---------------------------- +-- Table structure for sys_dict_type +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dict_type`; +CREATE TABLE `sys_dict_type` ( + `dict_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字典主键', + `dict_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典名称', + `dict_type` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '字典类型', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`dict_id`) USING BTREE, + UNIQUE INDEX `dict_type`(`dict_type` ASC) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '字典类型表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_dict_type +-- ---------------------------- +INSERT INTO `sys_dict_type` VALUES (1, '用户性别', 'sys_user_sex', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '用户性别列表'); +INSERT INTO `sys_dict_type` VALUES (2, '菜单状态', 'sys_show_hide', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '菜单状态列表'); +INSERT INTO `sys_dict_type` VALUES (3, '系统开关', 'sys_normal_disable', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '系统开关列表'); +INSERT INTO `sys_dict_type` VALUES (4, '任务状态', 'sys_job_status', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '任务状态列表'); +INSERT INTO `sys_dict_type` VALUES (5, '任务分组', 'sys_job_group', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '任务分组列表'); +INSERT INTO `sys_dict_type` VALUES (6, '系统是否', 'sys_yes_no', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '系统是否列表'); +INSERT INTO `sys_dict_type` VALUES (7, '通知类型', 'sys_notice_type', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '通知类型列表'); +INSERT INTO `sys_dict_type` VALUES (8, '通知状态', 'sys_notice_status', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '通知状态列表'); +INSERT INTO `sys_dict_type` VALUES (9, '操作类型', 'sys_oper_type', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '操作类型列表'); +INSERT INTO `sys_dict_type` VALUES (10, '系统状态', 'sys_common_status', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '登录状态列表'); + +-- ---------------------------- +-- Table structure for sys_job +-- ---------------------------- +DROP TABLE IF EXISTS `sys_job`; +CREATE TABLE `sys_job` ( + `job_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务ID', + `job_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '任务名称', + `job_group` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'DEFAULT' COMMENT '任务组名', + `invoke_target` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调用目标字符串', + `cron_expression` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT 'cron执行表达式', + `misfire_policy` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '3' COMMENT '计划执行错误策略(1立即执行 2执行一次 3放弃执行)', + `concurrent` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '是否并发执行(0允许 1禁止)', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '状态(0正常 1暂停)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '备注信息', + PRIMARY KEY (`job_id`, `job_name`, `job_group`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '定时任务调度表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_job +-- ---------------------------- +INSERT INTO `sys_job` VALUES (1, '系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_job` VALUES (2, '系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(\'ry\')', '0/15 * * * * ?', '3', '1', '1', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_job` VALUES (3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', '2025-02-28 14:17:12', '', NULL, ''); + +-- ---------------------------- +-- Table structure for sys_job_log +-- ---------------------------- +DROP TABLE IF EXISTS `sys_job_log`; +CREATE TABLE `sys_job_log` ( + `job_log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务日志ID', + `job_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务名称', + `job_group` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务组名', + `invoke_target` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '调用目标字符串', + `job_message` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '日志信息', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '执行状态(0正常 1失败)', + `exception_info` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '异常信息', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`job_log_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '定时任务调度日志表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_job_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_logininfor +-- ---------------------------- +DROP TABLE IF EXISTS `sys_logininfor`; +CREATE TABLE `sys_logininfor` ( + `info_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '访问ID', + `user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户账号', + `ipaddr` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '登录IP地址', + `login_location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '登录地点', + `browser` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '浏览器类型', + `os` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '操作系统', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '登录状态(0成功 1失败)', + `msg` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '提示消息', + `login_time` datetime NULL DEFAULT NULL COMMENT '访问时间', + PRIMARY KEY (`info_id`) USING BTREE, + INDEX `idx_sys_logininfor_s`(`status` ASC) USING BTREE, + INDEX `idx_sys_logininfor_lt`(`login_time` ASC) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 152 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统访问记录' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_logininfor +-- ---------------------------- +INSERT INTO `sys_logininfor` VALUES (100, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-02-28 16:16:54'); +INSERT INTO `sys_logininfor` VALUES (101, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-02-28 16:49:40'); +INSERT INTO `sys_logininfor` VALUES (102, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 08:40:08'); +INSERT INTO `sys_logininfor` VALUES (103, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', 'UserDetailsService returned null, which is an interface contract violation', '2025-03-01 09:28:02'); +INSERT INTO `sys_logininfor` VALUES (104, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', 'UserDetailsService returned null, which is an interface contract violation', '2025-03-01 09:28:49'); +INSERT INTO `sys_logininfor` VALUES (105, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', 'UserDetailsService returned null, which is an interface contract violation', '2025-03-01 09:33:39'); +INSERT INTO `sys_logininfor` VALUES (106, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', 'UserDetailsService returned null, which is an interface contract violation', '2025-03-01 09:48:02'); +INSERT INTO `sys_logininfor` VALUES (107, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', 'UserDetailsService returned null, which is an interface contract violation', '2025-03-01 10:46:00'); +INSERT INTO `sys_logininfor` VALUES (108, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 10:46:13'); +INSERT INTO `sys_logininfor` VALUES (109, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 10:46:13'); +INSERT INTO `sys_logininfor` VALUES (110, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 10:46:24'); +INSERT INTO `sys_logininfor` VALUES (111, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 10:46:24'); +INSERT INTO `sys_logininfor` VALUES (112, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 12:17:39'); +INSERT INTO `sys_logininfor` VALUES (113, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 12:17:39'); +INSERT INTO `sys_logininfor` VALUES (114, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 12:20:20'); +INSERT INTO `sys_logininfor` VALUES (115, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 12:20:20'); +INSERT INTO `sys_logininfor` VALUES (116, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 12:22:54'); +INSERT INTO `sys_logininfor` VALUES (117, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 12:22:55'); +INSERT INTO `sys_logininfor` VALUES (118, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 12:25:02'); +INSERT INTO `sys_logininfor` VALUES (119, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 12:48:33'); +INSERT INTO `sys_logininfor` VALUES (120, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 12:48:37'); +INSERT INTO `sys_logininfor` VALUES (121, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 12:52:06'); +INSERT INTO `sys_logininfor` VALUES (122, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 12:52:15'); +INSERT INTO `sys_logininfor` VALUES (123, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '验证码错误', '2025-03-01 12:52:21'); +INSERT INTO `sys_logininfor` VALUES (124, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '验证码错误', '2025-03-01 12:52:25'); +INSERT INTO `sys_logininfor` VALUES (125, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 12:52:31'); +INSERT INTO `sys_logininfor` VALUES (126, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 13:00:27'); +INSERT INTO `sys_logininfor` VALUES (127, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 13:00:30'); +INSERT INTO `sys_logininfor` VALUES (128, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 13:00:30'); +INSERT INTO `sys_logininfor` VALUES (129, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '登录用户:admin 不存在', '2025-03-01 13:10:59'); +INSERT INTO `sys_logininfor` VALUES (130, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '密码输入错误1次', '2025-03-01 13:11:51'); +INSERT INTO `sys_logininfor` VALUES (131, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '用户不存在/密码错误', '2025-03-01 13:11:51'); +INSERT INTO `sys_logininfor` VALUES (132, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '登录用户:admin 不存在', '2025-03-01 13:39:34'); +INSERT INTO `sys_logininfor` VALUES (133, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '注册成功', '2025-03-01 13:44:07'); +INSERT INTO `sys_logininfor` VALUES (134, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '登录用户:admin123 不存在', '2025-03-01 13:44:16'); +INSERT INTO `sys_logininfor` VALUES (135, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '注册成功', '2025-03-01 13:57:22'); +INSERT INTO `sys_logininfor` VALUES (136, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 13:57:43'); +INSERT INTO `sys_logininfor` VALUES (137, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '验证码错误', '2025-03-01 13:57:49'); +INSERT INTO `sys_logininfor` VALUES (138, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 13:57:54'); +INSERT INTO `sys_logininfor` VALUES (139, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 14:18:40'); +INSERT INTO `sys_logininfor` VALUES (140, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '验证码已失效', '2025-03-01 14:21:02'); +INSERT INTO `sys_logininfor` VALUES (141, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 14:21:08'); +INSERT INTO `sys_logininfor` VALUES (142, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 14:50:15'); +INSERT INTO `sys_logininfor` VALUES (143, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 14:52:16'); +INSERT INTO `sys_logininfor` VALUES (144, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 14:57:53'); +INSERT INTO `sys_logininfor` VALUES (145, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 14:59:52'); +INSERT INTO `sys_logininfor` VALUES (146, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '登录用户:admin 不存在', '2025-03-01 15:06:13'); +INSERT INTO `sys_logininfor` VALUES (147, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '密码输入错误1次', '2025-03-01 15:06:19'); +INSERT INTO `sys_logininfor` VALUES (148, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '用户不存在/密码错误', '2025-03-01 15:06:19'); +INSERT INTO `sys_logininfor` VALUES (149, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:06:24'); +INSERT INTO `sys_logininfor` VALUES (150, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '登录用户:admin 不存在', '2025-03-01 15:14:54'); +INSERT INTO `sys_logininfor` VALUES (151, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:15:02'); +INSERT INTO `sys_logininfor` VALUES (152, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '登录用户:admin 不存在', '2025-03-01 15:34:35'); +INSERT INTO `sys_logininfor` VALUES (153, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:34:41'); +INSERT INTO `sys_logininfor` VALUES (154, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:34:59'); +INSERT INTO `sys_logininfor` VALUES (155, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '1', '验证码错误', '2025-03-01 15:36:07'); +INSERT INTO `sys_logininfor` VALUES (156, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:36:11'); +INSERT INTO `sys_logininfor` VALUES (157, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:39:05'); +INSERT INTO `sys_logininfor` VALUES (158, 'admin123', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:40:18'); +INSERT INTO `sys_logininfor` VALUES (159, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:47:31'); +INSERT INTO `sys_logininfor` VALUES (160, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:50:34'); +INSERT INTO `sys_logininfor` VALUES (161, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 15:57:36'); +INSERT INTO `sys_logininfor` VALUES (162, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:57:40'); +INSERT INTO `sys_logininfor` VALUES (163, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '退出成功', '2025-03-01 15:59:42'); +INSERT INTO `sys_logininfor` VALUES (164, 'admin', '127.0.0.1', '内网IP', 'Chrome 13', 'Windows 10', '0', '登录成功', '2025-03-01 15:59:45'); + +-- ---------------------------- +-- Table structure for sys_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_menu`; +CREATE TABLE `sys_menu` ( + `menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '菜单ID', + `menu_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单名称', + `parent_id` bigint(20) NULL DEFAULT 0 COMMENT '父菜单ID', + `order_num` int(4) NULL DEFAULT 0 COMMENT '显示顺序', + `path` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '路由地址', + `component` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '组件路径', + `query` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路由参数', + `route_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '路由名称', + `is_frame` int(1) NULL DEFAULT 1 COMMENT '是否为外链(0是 1否)', + `is_cache` int(1) NULL DEFAULT 0 COMMENT '是否缓存(0缓存 1不缓存)', + `menu_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)', + `visible` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0显示 1隐藏)', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0正常 1停用)', + `perms` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限标识', + `icon` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '#' COMMENT '菜单图标', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '备注', + PRIMARY KEY (`menu_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2000 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '菜单权限表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_menu +-- ---------------------------- +INSERT INTO `sys_menu` VALUES (1, '系统管理', 0, 1, 'system', NULL, '', '', 1, 0, 'M', '0', '0', '', 'system', 'admin', '2025-02-28 14:17:12', '', NULL, '系统管理目录'); +INSERT INTO `sys_menu` VALUES (2, '系统监控', 0, 2, 'monitor', NULL, '', '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', '2025-02-28 14:17:12', '', NULL, '系统监控目录'); +INSERT INTO `sys_menu` VALUES (3, '系统工具', 0, 3, 'tool', NULL, '', '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', '2025-02-28 14:17:12', '', NULL, '系统工具目录'); +INSERT INTO `sys_menu` VALUES (100, '用户管理', 1, 1, 'user', 'system/user/index', '', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', '2025-02-28 14:17:12', '', NULL, '用户管理菜单'); +INSERT INTO `sys_menu` VALUES (101, '角色管理', 1, 2, 'role', 'system/role/index', '', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', '2025-02-28 14:17:12', '', NULL, '角色管理菜单'); +INSERT INTO `sys_menu` VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/index', '', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', '2025-02-28 14:17:12', '', NULL, '菜单管理菜单'); +INSERT INTO `sys_menu` VALUES (103, '部门管理', 1, 4, 'dept', 'system/dept/index', '', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', '2025-02-28 14:17:12', '', NULL, '部门管理菜单'); +INSERT INTO `sys_menu` VALUES (104, '岗位管理', 1, 5, 'post', 'system/post/index', '', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', '2025-02-28 14:17:12', '', NULL, '岗位管理菜单'); +INSERT INTO `sys_menu` VALUES (105, '字典管理', 1, 6, 'dict', 'system/dict/index', '', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', '2025-02-28 14:17:12', '', NULL, '字典管理菜单'); +INSERT INTO `sys_menu` VALUES (106, '参数设置', 1, 7, 'config', 'system/config/index', '', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', '2025-02-28 14:17:12', '', NULL, '参数设置菜单'); +INSERT INTO `sys_menu` VALUES (107, '通知公告', 1, 8, 'notice', 'system/notice/index', '', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', '2025-02-28 14:17:12', '', NULL, '通知公告菜单'); +INSERT INTO `sys_menu` VALUES (108, '日志管理', 1, 9, 'log', '', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', '2025-02-28 14:17:12', '', NULL, '日志管理菜单'); +INSERT INTO `sys_menu` VALUES (109, '在线用户', 2, 1, 'online', 'monitor/online/index', '', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', '2025-02-28 14:17:12', '', NULL, '在线用户菜单'); +INSERT INTO `sys_menu` VALUES (110, '定时任务', 2, 2, 'job', 'monitor/job/index', '', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', '2025-02-28 14:17:12', '', NULL, '定时任务菜单'); +INSERT INTO `sys_menu` VALUES (111, '数据监控', 2, 3, 'druid', 'monitor/druid/index', '', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', '2025-02-28 14:17:12', '', NULL, '数据监控菜单'); +INSERT INTO `sys_menu` VALUES (112, '服务监控', 2, 4, 'server', 'monitor/server/index', '', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', '2025-02-28 14:17:12', '', NULL, '服务监控菜单'); +INSERT INTO `sys_menu` VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', '2025-02-28 14:17:12', '', NULL, '缓存监控菜单'); +INSERT INTO `sys_menu` VALUES (114, '缓存列表', 2, 6, 'cacheList', 'monitor/cache/list', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis-list', 'admin', '2025-02-28 14:17:12', '', NULL, '缓存列表菜单'); +INSERT INTO `sys_menu` VALUES (115, '表单构建', 3, 1, 'build', 'tool/build/index', '', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', '2025-02-28 14:17:12', '', NULL, '表单构建菜单'); +INSERT INTO `sys_menu` VALUES (116, '代码生成', 3, 2, 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', '2025-03-01 16:02:30', '', NULL, '代码生成菜单'); +INSERT INTO `sys_menu` VALUES (117, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', '', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', '2025-02-28 14:17:12', '', NULL, '系统接口菜单'); +INSERT INTO `sys_menu` VALUES (500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', '', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', '2025-02-28 14:17:12', '', NULL, '操作日志菜单'); +INSERT INTO `sys_menu` VALUES (501, '登录日志', 108, 2, 'logininfor', 'monitor/logininfor/index', '', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', '2025-02-28 14:17:12', '', NULL, '登录日志菜单'); +INSERT INTO `sys_menu` VALUES (1000, '用户查询', 100, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1001, '用户新增', 100, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1002, '用户修改', 100, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1003, '用户删除', 100, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1004, '用户导出', 100, 5, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1005, '用户导入', 100, 6, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1006, '重置密码', 100, 7, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1007, '角色查询', 101, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1008, '角色新增', 101, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1009, '角色修改', 101, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1010, '角色删除', 101, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1011, '角色导出', 101, 5, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1012, '菜单查询', 102, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1013, '菜单新增', 102, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1014, '菜单修改', 102, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1015, '菜单删除', 102, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1016, '部门查询', 103, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1017, '部门新增', 103, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1018, '部门修改', 103, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1019, '部门删除', 103, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1020, '岗位查询', 104, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1021, '岗位新增', 104, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1022, '岗位修改', 104, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1023, '岗位删除', 104, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1024, '岗位导出', 104, 5, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1025, '字典查询', 105, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1026, '字典新增', 105, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1027, '字典修改', 105, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1028, '字典删除', 105, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1029, '字典导出', 105, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1030, '参数查询', 106, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1031, '参数新增', 106, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1032, '参数修改', 106, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1033, '参数删除', 106, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1034, '参数导出', 106, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1035, '公告查询', 107, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1036, '公告新增', 107, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1037, '公告修改', 107, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1038, '公告删除', 107, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1039, '操作查询', 500, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1040, '操作删除', 500, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1041, '日志导出', 500, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1042, '登录查询', 501, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1043, '登录删除', 501, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1044, '日志导出', 501, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1045, '账户解锁', 501, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1046, '在线查询', 109, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1047, '批量强退', 109, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1048, '单条强退', 109, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1049, '任务查询', 110, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1050, '任务新增', 110, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1051, '任务修改', 110, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1052, '任务删除', 110, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1053, '状态修改', 110, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_menu` VALUES (1054, '任务导出', 110, 6, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', '2025-02-28 14:17:12', '', NULL, ''); + +-- ---------------------------- +-- Table structure for sys_notice +-- ---------------------------- +DROP TABLE IF EXISTS `sys_notice`; +CREATE TABLE `sys_notice` ( + `notice_id` int(4) NOT NULL AUTO_INCREMENT COMMENT '公告ID', + `notice_title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '公告标题', + `notice_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '公告类型(1通知 2公告)', + `notice_content` longblob NULL COMMENT '公告内容', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '公告状态(0正常 1关闭)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`notice_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '通知公告表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_notice +-- ---------------------------- +INSERT INTO `sys_notice` VALUES (1, '温馨提醒:2018-07-01 若依新版本发布啦', '2', 0xE696B0E78988E69CACE58685E5AEB9, '0', 'admin', '2025-02-28 14:17:12', '', NULL, '管理员'); +INSERT INTO `sys_notice` VALUES (2, '维护通知:2018-07-01 若依系统凌晨维护', '1', 0xE7BBB4E68AA4E58685E5AEB9, '0', 'admin', '2025-02-28 14:17:12', '', NULL, '管理员'); + +-- ---------------------------- +-- Table structure for sys_oper_log +-- ---------------------------- +DROP TABLE IF EXISTS `sys_oper_log`; +CREATE TABLE `sys_oper_log` ( + `oper_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '日志主键', + `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '模块标题', + `business_type` int(2) NULL DEFAULT 0 COMMENT '业务类型(0其它 1新增 2修改 3删除)', + `method` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '方法名称', + `request_method` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '请求方式', + `operator_type` int(1) NULL DEFAULT 0 COMMENT '操作类别(0其它 1后台用户 2手机端用户)', + `oper_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '操作人员', + `dept_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '部门名称', + `oper_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '请求URL', + `oper_ip` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '主机地址', + `oper_location` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '操作地点', + `oper_param` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '请求参数', + `json_result` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '返回参数', + `status` int(1) NULL DEFAULT 0 COMMENT '操作状态(0正常 1异常)', + `error_msg` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '错误消息', + `oper_time` datetime NULL DEFAULT NULL COMMENT '操作时间', + `cost_time` bigint(20) NULL DEFAULT 0 COMMENT '消耗时间', + PRIMARY KEY (`oper_id`) USING BTREE, + INDEX `idx_sys_oper_log_bt`(`business_type` ASC) USING BTREE, + INDEX `idx_sys_oper_log_s`(`status` ASC) USING BTREE, + INDEX `idx_sys_oper_log_ot`(`oper_time` ASC) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作日志记录' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_oper_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for sys_post +-- ---------------------------- +DROP TABLE IF EXISTS `sys_post`; +CREATE TABLE `sys_post` ( + `post_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '岗位ID', + `post_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '岗位编码', + `post_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '岗位名称', + `post_sort` int(4) NOT NULL COMMENT '显示顺序', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态(0正常 1停用)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`post_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '岗位信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_post +-- ---------------------------- +INSERT INTO `sys_post` VALUES (1, 'ceo', '董事长', 1, '0', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_post` VALUES (2, 'se', '项目经理', 2, '0', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_post` VALUES (3, 'hr', '人力资源', 3, '0', 'admin', '2025-02-28 14:17:12', '', NULL, ''); +INSERT INTO `sys_post` VALUES (4, 'user', '普通员工', 4, '0', 'admin', '2025-02-28 14:17:12', '', NULL, ''); + +-- ---------------------------- +-- Table structure for sys_role +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role`; +CREATE TABLE `sys_role` ( + `role_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色ID', + `role_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色名称', + `role_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色权限字符串', + `role_sort` int(4) NOT NULL COMMENT '显示顺序', + `data_scope` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', + `menu_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '菜单树选择项是否关联显示', + `dept_check_strictly` tinyint(1) NULL DEFAULT 1 COMMENT '部门树选择项是否关联显示', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色状态(0正常 1停用)', + `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`role_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_role +-- ---------------------------- +INSERT INTO `sys_role` VALUES (1, '超级管理员', 'admin', 1, '1', 1, 1, '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '超级管理员'); +INSERT INTO `sys_role` VALUES (2, '普通角色', 'common', 2, '2', 1, 1, '0', '0', 'admin', '2025-02-28 14:17:12', '', NULL, '普通角色'); + +-- ---------------------------- +-- Table structure for sys_role_dept +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role_dept`; +CREATE TABLE `sys_role_dept` ( + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + `dept_id` bigint(20) NOT NULL COMMENT '部门ID', + PRIMARY KEY (`role_id`, `dept_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色和部门关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_role_dept +-- ---------------------------- +INSERT INTO `sys_role_dept` VALUES (2, 100); +INSERT INTO `sys_role_dept` VALUES (2, 101); +INSERT INTO `sys_role_dept` VALUES (2, 105); + +-- ---------------------------- +-- Table structure for sys_role_menu +-- ---------------------------- +DROP TABLE IF EXISTS `sys_role_menu`; +CREATE TABLE `sys_role_menu` ( + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + `menu_id` bigint(20) NOT NULL COMMENT '菜单ID', + PRIMARY KEY (`role_id`, `menu_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色和菜单关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_role_menu +-- ---------------------------- +INSERT INTO `sys_role_menu` VALUES (2, 1); +INSERT INTO `sys_role_menu` VALUES (2, 2); +INSERT INTO `sys_role_menu` VALUES (2, 3); +INSERT INTO `sys_role_menu` VALUES (2, 4); +INSERT INTO `sys_role_menu` VALUES (2, 100); +INSERT INTO `sys_role_menu` VALUES (2, 101); +INSERT INTO `sys_role_menu` VALUES (2, 102); +INSERT INTO `sys_role_menu` VALUES (2, 103); +INSERT INTO `sys_role_menu` VALUES (2, 104); +INSERT INTO `sys_role_menu` VALUES (2, 105); +INSERT INTO `sys_role_menu` VALUES (2, 106); +INSERT INTO `sys_role_menu` VALUES (2, 107); +INSERT INTO `sys_role_menu` VALUES (2, 108); +INSERT INTO `sys_role_menu` VALUES (2, 109); +INSERT INTO `sys_role_menu` VALUES (2, 110); +INSERT INTO `sys_role_menu` VALUES (2, 111); +INSERT INTO `sys_role_menu` VALUES (2, 112); +INSERT INTO `sys_role_menu` VALUES (2, 113); +INSERT INTO `sys_role_menu` VALUES (2, 114); +INSERT INTO `sys_role_menu` VALUES (2, 115); +INSERT INTO `sys_role_menu` VALUES (2, 116); +INSERT INTO `sys_role_menu` VALUES (2, 117); +INSERT INTO `sys_role_menu` VALUES (2, 500); +INSERT INTO `sys_role_menu` VALUES (2, 501); +INSERT INTO `sys_role_menu` VALUES (2, 1000); +INSERT INTO `sys_role_menu` VALUES (2, 1001); +INSERT INTO `sys_role_menu` VALUES (2, 1002); +INSERT INTO `sys_role_menu` VALUES (2, 1003); +INSERT INTO `sys_role_menu` VALUES (2, 1004); +INSERT INTO `sys_role_menu` VALUES (2, 1005); +INSERT INTO `sys_role_menu` VALUES (2, 1006); +INSERT INTO `sys_role_menu` VALUES (2, 1007); +INSERT INTO `sys_role_menu` VALUES (2, 1008); +INSERT INTO `sys_role_menu` VALUES (2, 1009); +INSERT INTO `sys_role_menu` VALUES (2, 1010); +INSERT INTO `sys_role_menu` VALUES (2, 1011); +INSERT INTO `sys_role_menu` VALUES (2, 1012); +INSERT INTO `sys_role_menu` VALUES (2, 1013); +INSERT INTO `sys_role_menu` VALUES (2, 1014); +INSERT INTO `sys_role_menu` VALUES (2, 1015); +INSERT INTO `sys_role_menu` VALUES (2, 1016); +INSERT INTO `sys_role_menu` VALUES (2, 1017); +INSERT INTO `sys_role_menu` VALUES (2, 1018); +INSERT INTO `sys_role_menu` VALUES (2, 1019); +INSERT INTO `sys_role_menu` VALUES (2, 1020); +INSERT INTO `sys_role_menu` VALUES (2, 1021); +INSERT INTO `sys_role_menu` VALUES (2, 1022); +INSERT INTO `sys_role_menu` VALUES (2, 1023); +INSERT INTO `sys_role_menu` VALUES (2, 1024); +INSERT INTO `sys_role_menu` VALUES (2, 1025); +INSERT INTO `sys_role_menu` VALUES (2, 1026); +INSERT INTO `sys_role_menu` VALUES (2, 1027); +INSERT INTO `sys_role_menu` VALUES (2, 1028); +INSERT INTO `sys_role_menu` VALUES (2, 1029); +INSERT INTO `sys_role_menu` VALUES (2, 1030); +INSERT INTO `sys_role_menu` VALUES (2, 1031); +INSERT INTO `sys_role_menu` VALUES (2, 1032); +INSERT INTO `sys_role_menu` VALUES (2, 1033); +INSERT INTO `sys_role_menu` VALUES (2, 1034); +INSERT INTO `sys_role_menu` VALUES (2, 1035); +INSERT INTO `sys_role_menu` VALUES (2, 1036); +INSERT INTO `sys_role_menu` VALUES (2, 1037); +INSERT INTO `sys_role_menu` VALUES (2, 1038); +INSERT INTO `sys_role_menu` VALUES (2, 1039); +INSERT INTO `sys_role_menu` VALUES (2, 1040); +INSERT INTO `sys_role_menu` VALUES (2, 1041); +INSERT INTO `sys_role_menu` VALUES (2, 1042); +INSERT INTO `sys_role_menu` VALUES (2, 1043); +INSERT INTO `sys_role_menu` VALUES (2, 1044); +INSERT INTO `sys_role_menu` VALUES (2, 1045); +INSERT INTO `sys_role_menu` VALUES (2, 1046); +INSERT INTO `sys_role_menu` VALUES (2, 1047); +INSERT INTO `sys_role_menu` VALUES (2, 1048); +INSERT INTO `sys_role_menu` VALUES (2, 1049); +INSERT INTO `sys_role_menu` VALUES (2, 1050); +INSERT INTO `sys_role_menu` VALUES (2, 1051); +INSERT INTO `sys_role_menu` VALUES (2, 1052); +INSERT INTO `sys_role_menu` VALUES (2, 1053); +INSERT INTO `sys_role_menu` VALUES (2, 1054); +INSERT INTO `sys_role_menu` VALUES (2, 1055); +INSERT INTO `sys_role_menu` VALUES (2, 1056); +INSERT INTO `sys_role_menu` VALUES (2, 1057); +INSERT INTO `sys_role_menu` VALUES (2, 1058); +INSERT INTO `sys_role_menu` VALUES (2, 1059); +INSERT INTO `sys_role_menu` VALUES (2, 1060); + +-- ---------------------------- +-- Table structure for sys_user +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user`; +CREATE TABLE `sys_user` ( + `user_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID', + `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '部门ID', + `user_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户账号', + `nick_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户昵称', + `user_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '00' COMMENT '用户类型(00系统用户)', + `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户邮箱', + `phonenumber` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '手机号码', + `sex` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '用户性别(0男 1女 2未知)', + `avatar` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '头像地址', + `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '密码', + `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态(0正常 1停用)', + `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', + `login_ip` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '最后登录IP', + `login_date` datetime NULL DEFAULT NULL COMMENT '最后登录时间', + `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`user_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_user +-- ---------------------------- +INSERT INTO `sys_user` VALUES (1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', '2025-03-01 15:59:46', 'admin', '2025-02-28 14:17:12', '', '2025-03-01 15:59:45', '管理员'); +INSERT INTO `sys_user` VALUES (2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', '2025-02-28 14:17:12', 'admin', '2025-02-28 14:17:12', '', NULL, '测试员'); + +-- ---------------------------- +-- Table structure for sys_user_post +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_post`; +CREATE TABLE `sys_user_post` ( + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `post_id` bigint(20) NOT NULL COMMENT '岗位ID', + PRIMARY KEY (`user_id`, `post_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户与岗位关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_user_post +-- ---------------------------- +INSERT INTO `sys_user_post` VALUES (1, 1); +INSERT INTO `sys_user_post` VALUES (2, 2); + +-- ---------------------------- +-- Table structure for sys_user_role +-- ---------------------------- +DROP TABLE IF EXISTS `sys_user_role`; +CREATE TABLE `sys_user_role` ( + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`user_id`, `role_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户和角色关联表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of sys_user_role +-- ---------------------------- +INSERT INTO `sys_user_role` VALUES (1, 1); +INSERT INTO `sys_user_role` VALUES (2, 2); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/sql/mysql/auth.sql b/sql/mysql/auth.sql deleted file mode 100644 index 6b9848dea851a981a6fd3f0b43ce966fe1dc0d80..0000000000000000000000000000000000000000 --- a/sql/mysql/auth.sql +++ /dev/null @@ -1,46 +0,0 @@ -DROP TABLE IF EXISTS oauth_user; -CREATE TABLE oauth_user ( - id INT NOT NULL AUTO_INCREMENT COMMENT '主键', - uuid VARCHAR(255) NOT NULL COMMENT '第三方系统的唯一ID,详细解释请参考:名词解释', - user_id bigint(20) NOT NULL comment '用户ID', - source VARCHAR(255) NOT NULL COMMENT '第三方用户来源,可选值:GITHUB、GITEE、QQ,更多请参考:AuthDefaultSource.java(opens new window)', - access_token VARCHAR(255) NOT NULL COMMENT '用户的授权令牌', - expire_in INT COMMENT '第三方用户的授权令牌的有效期,部分平台可能没有', - refresh_token VARCHAR(255) COMMENT '刷新令牌,部分平台可能没有', - open_id VARCHAR(255) COMMENT '第三方用户的 open id,部分平台可能没有', - uid VARCHAR(255) COMMENT '第三方用户的 ID,部分平台可能没有', - access_code VARCHAR(255) COMMENT '个别平台的授权信息,部分平台可能没有', - union_id VARCHAR(255) COMMENT '第三方用户的 union id,部分平台可能没有', - scope VARCHAR(255) COMMENT '第三方用户授予的权限,部分平台可能没有', - token_type VARCHAR(255) COMMENT '个别平台的授权信息,部分平台可能没有', - id_token VARCHAR(255) COMMENT 'id token,部分平台可能没有', - mac_algorithm VARCHAR(255) COMMENT '小米平台用户的附带属性,部分平台可能没有', - mac_key VARCHAR(255) COMMENT '小米平台用户的附带属性,部分平台可能没有', - code VARCHAR(255) COMMENT '用户的授权code,部分平台可能没有', - oauth_token VARCHAR(255) COMMENT 'Twitter平台用户的附带属性,部分平台可能没有', - oauth_token_secret VARCHAR(255) COMMENT 'Twitter平台用户的附带属性,部分平台可能没有', - PRIMARY KEY (`id`) -) ENGINE = InnoDB COMMENT = '第三方登录'; - --- 菜单 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('第三方认证', '1', '1', 'oauth', 'system/oauth/index',"", 1, 0, 'C', '0', '0', 'system:oauth:list', 'checkbox', 'admin', sysdate(), '', null, '第三方认证菜单'); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - --- 按钮 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('第三方认证查询', @parentId, '1', '#', '','', 1, 0, 'F', '0', '0', 'system:oauth:query', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('第三方认证新增', @parentId, '2', '#', '','', 1, 0, 'F', '0', '0', 'system:oauth:add', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('第三方认证修改', @parentId, '3', '#', '','', 1, 0, 'F', '0', '0', 'system:oauth:edit', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('第三方认证删除', @parentId, '4', '#', '','', 1, 0, 'F', '0', '0', 'system:oauth:remove', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('第三方认证导出', @parentId, '5', '#', '','', 1, 0, 'F', '0', '0', 'system:oauth:export', '#', 'admin', sysdate(), '', null, ''); \ No newline at end of file diff --git a/sql/mysql/create_database.sql b/sql/mysql/create_database.sql deleted file mode 100644 index 6592849c7dd93933a2df155785094eb2be47fe66..0000000000000000000000000000000000000000 --- a/sql/mysql/create_database.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE DATABASE IF NOT EXISTS ry CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; \ No newline at end of file diff --git a/sql/mysql/gen.sql b/sql/mysql/gen.sql deleted file mode 100644 index 32de0842d7ff7138c71f5b47aac68d121808ac7d..0000000000000000000000000000000000000000 --- a/sql/mysql/gen.sql +++ /dev/null @@ -1,95 +0,0 @@ - --- ---------------------------- --- 18、代码生成业务表 --- ---------------------------- -DROP TABLE IF EXISTS `gen_table`; -CREATE TABLE `gen_table` ( - `table_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', - `table_name` varchar(200) NOT NULL COMMENT '表名称', - `table_alias` varchar(200) NOT NULL COMMENT '表别名', - `table_comment` varchar(500) DEFAULT '' COMMENT '表描述', - `have_sub_column` char(1) DEFAULT '0' COMMENT '是否含有关联字段', - `sub_table_name` varchar(64) DEFAULT NULL COMMENT '关联子表的表名', - `sub_table_fk_name` varchar(64) DEFAULT NULL COMMENT '子表关联的外键名', - `class_name` varchar(100) DEFAULT '' COMMENT '实体类名称', - `tpl_category` varchar(200) DEFAULT 'crud' COMMENT '使用的模板(crud单表操作 tree树表操作)', - `tpl_web_type` varchar(200) DEFAULT 'element-plus' COMMENT '使用的模板类型', - `package_name` varchar(100) DEFAULT NULL COMMENT '生成包路径', - `module_name` varchar(30) DEFAULT NULL COMMENT '生成模块名', - `business_name` varchar(30) DEFAULT NULL COMMENT '生成业务名', - `function_name` varchar(50) DEFAULT NULL COMMENT '生成功能名', - `function_author` varchar(50) DEFAULT NULL COMMENT '生成功能作者', - `gen_type` char(1) DEFAULT '0' COMMENT '生成代码方式(0zip压缩包 1自定义路径)', - `gen_path` varchar(200) DEFAULT '/' COMMENT '生成路径(不填默认项目路径)', - `options` varchar(1000) DEFAULT NULL COMMENT '其它生成选项', - `create_by` varchar(64) DEFAULT '' COMMENT '创建者', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_by` varchar(64) DEFAULT '' COMMENT '更新者', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - `remark` varchar(500) DEFAULT NULL COMMENT '备注', - PRIMARY KEY (`table_id`) -) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '代码生成业务表'; - - --- ---------------------------- --- 19、代码生成业务表字段 --- ---------------------------- -DROP TABLE IF EXISTS `gen_table_column`; -CREATE TABLE `gen_table_column` ( - `column_id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', - `table_id` varchar(64) DEFAULT NULL COMMENT '归属表编号', - `column_name` varchar(200) DEFAULT NULL COMMENT '列名称', - `column_comment` varchar(500) DEFAULT NULL COMMENT '列描述', - `column_type` varchar(100) DEFAULT NULL COMMENT '列类型', - `java_type` varchar(500) DEFAULT NULL COMMENT 'JAVA类型', - `java_field` varchar(200) DEFAULT NULL COMMENT 'JAVA字段名', - `is_pk` char(1) DEFAULT NULL COMMENT '是否主键(1是)', - `is_increment` char(1) DEFAULT NULL COMMENT '是否自增(1是)', - `is_required` char(1) DEFAULT NULL COMMENT '是否必填(1是)', - `is_insert` char(1) DEFAULT NULL COMMENT '是否为插入字段(1是)', - `is_edit` char(1) DEFAULT NULL COMMENT '是否编辑字段(1是)', - `is_list` char(1) DEFAULT NULL COMMENT '是否列表字段(1是)', - `is_query` char(1) DEFAULT NULL COMMENT '是否查询字段(1是)', - `query_type` varchar(200) DEFAULT 'EQ' COMMENT '查询方式(等于、不等于、大于、小于、范围)', - `html_type` varchar(200) DEFAULT NULL COMMENT '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)', - `dict_type` varchar(200) DEFAULT '' COMMENT '字典类型', - `sort` int DEFAULT NULL COMMENT '排序', - `sub_column_table_name` varchar(200) DEFAULT NULL COMMENT '关联表名称', - `sub_column_fk_name` varchar(200) DEFAULT NULL COMMENT '关联字段名称', - `sub_column_name` varchar(200) DEFAULT NULL COMMENT '映射字段名称', - `sub_column_java_field` varchar(200) DEFAULT NULL COMMENT '映射字段JAVA字段名', - `sub_column_java_type` varchar(255) DEFAULT NULL COMMENT '映射字段JAVA类型', - `create_by` varchar(64) DEFAULT '' COMMENT '创建者', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_by` varchar(64) DEFAULT '' COMMENT '更新者', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - PRIMARY KEY (`column_id`) -) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '代码生成业务表字段'; - - - -DROP TABLE IF EXISTS `gen_join_table`; -CREATE TABLE `gen_join_table` ( - `table_id` bigint NOT NULL COMMENT '表编号', - `left_table_id` bigint NOT NULL COMMENT '左表名称', - `right_table_id` bigint NOT NULL COMMENT '右表编号', - `left_table_alias` varchar(200) NOT NULL COMMENT '左表别名', - `right_table_alias` varchar(200) NOT NULL COMMENT '右表别名', - `left_table_fk` varchar(200) NOT NULL COMMENT '左表关联键', - `right_table_fk` varchar(200) NOT NULL COMMENT '右表关联键', - `join_type` varchar(200) NOT NULL COMMENT '关联类型', - `join_columns` varchar(500) DEFAULT '' COMMENT '关联字段', - `order_num` varchar(64) NOT NULL COMMENT '序号', - `new_table_id` bigint NOT NULL COMMENT '新表编号', - PRIMARY KEY (`table_id`,`right_table_id`,`left_table_id`) -) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '代码生成关联表'; - - -insert into sys_menu values('116', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单'); --- 代码生成按钮 -insert into sys_menu values('1055', '生成查询', '116', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1056', '生成修改', '116', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1057', '生成删除', '116', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1058', '导入代码', '116', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1059', '预览代码', '116', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1060', '生成代码', '116', '6', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, ''); diff --git a/sql/mysql/message.sql b/sql/mysql/message.sql deleted file mode 100644 index c710989f08cde2ce20b788759d3c84a570348414..0000000000000000000000000000000000000000 --- a/sql/mysql/message.sql +++ /dev/null @@ -1,101 +0,0 @@ --- ---------------------------- --- 消息系统 --- ---------------------------- --- 消息表 -DROP TABLE IF EXISTS message_system; -CREATE TABLE message_system ( - message_id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', - message_title varchar(64) NULL DEFAULT NULL COMMENT '标题', - create_by varchar(64) NULL DEFAULT NULL COMMENT '创建者', - create_time datetime NULL DEFAULT NULL COMMENT '创建时间', - send_mode varchar(100) NULL DEFAULT NULL COMMENT '发送方式(0平台 1手机号 2 邮箱)', - code varchar(100) NULL DEFAULT NULL COMMENT '号码', - message_content text NULL COMMENT '消息内容', - message_recipient varchar(100) NULL DEFAULT NULL COMMENT '接收人', - message_status varchar(64) NULL DEFAULT NULL COMMENT '消息状态(0未读 1已读)', - message_type varchar(64) NULL DEFAULT NULL COMMENT '消息类型', - update_by varchar(64) NULL DEFAULT NULL COMMENT '更新者', - update_time datetime NULL DEFAULT NULL COMMENT '更新时间', - remark varchar(500) NULL DEFAULT NULL COMMENT '备注', - PRIMARY KEY (message_id) USING BTREE -) ENGINE = InnoDB COMMENT = '消息表' ; - --- 模版表 -DROP TABLE IF EXISTS message_template; -CREATE TABLE message_template ( - template_id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', - template_name varchar(100) NULL DEFAULT NULL COMMENT '模版名称', - template_code varchar(64) NULL DEFAULT NULL COMMENT '模版CODE', - template_type varchar(64) NULL DEFAULT NULL COMMENT '模版类型', - template_content text NULL COMMENT '模版内容', - template_variable text NULL COMMENT '变量属性', - create_by varchar(64) NULL DEFAULT NULL COMMENT '创建者', - create_time datetime NULL DEFAULT NULL COMMENT '创建时间', - update_by varchar(64) NULL DEFAULT NULL COMMENT '更新者', - update_time datetime NULL DEFAULT NULL COMMENT '更新时间', - remark varchar(500) NULL DEFAULT NULL COMMENT '备注', - PRIMARY KEY (template_id) USING BTREE -) ENGINE = InnoDB COMMENT = '模版表' ; - --- 变量表 -DROP TABLE IF EXISTS message_variable; -CREATE TABLE message_variable ( - variable_id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', - variable_name varchar(100) NULL DEFAULT NULL COMMENT '变量名称', - variable_type varchar(64) NULL DEFAULT NULL COMMENT '变量类型', - variable_content varchar(100) NULL DEFAULT NULL COMMENT '变量内容', - create_by varchar(64) NULL DEFAULT NULL COMMENT '创建者', - create_time datetime NULL DEFAULT NULL COMMENT '创建时间', - update_by varchar(64) NULL DEFAULT NULL COMMENT '更新者', - update_time datetime NULL DEFAULT NULL COMMENT '更新时间', - remark varchar(500) NULL DEFAULT NULL COMMENT '备注', - PRIMARY KEY (variable_id) USING BTREE -) ENGINE = InnoDB COMMENT = '变量表' ; - -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '消息系统', 0, 6, 'modelMessage', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'message', 'admin', '2024-12-31 11:57:29', 'xl', '2025-01-03 15:48:44', ''); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - -select @messageParentId := @parentId; --- 消息系统菜单 -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '消息管理', @messageParentId, 0, 'messageSystem', 'modelMessage/messageSystem/index', NULL, '', 1, 0, 'C', '0', '0', 'modelMessage:messageSystem:list', '#', 'admin', '2024-12-21 15:00:31', 'admin', '2024-12-31 15:04:49', '消息管理菜单'); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '消息管理查询', @parentId, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:query', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '消息管理新增', @parentId, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:add', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '消息管理修改', @parentId, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:edit', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '消息管理删除', @parentId, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:remove', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '消息管理导出', @parentId, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:export', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); - -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '模版管理', @messageParentId, 1, 'template', 'modelMessage/template/index', NULL, '', 1, 0, 'C', '0', '0', 'modelMessage:template:list', '#', 'admin', '2024-12-31 14:59:52', '', NULL, '模版管理菜单'); - -SELECT @parentId := LAST_INSERT_ID(); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '模版管理查询', @parentId, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:query', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '模版管理新增', @parentId, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:add', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '模版管理修改', @parentId, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:edit', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '模版管理删除', @parentId, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:remove', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '模版管理导出', @parentId, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:export', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); - - -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '变量管理', @messageParentId, 2, 'variable', 'modelMessage/variable/index', NULL, '', 1, 0, 'C', '0', '0', 'modelMessage:variable:list', '#', 'admin', '2024-12-31 15:01:50', 'admin', '2024-12-31 15:04:56', '变量管理菜单'); - -SELECT @parentId := LAST_INSERT_ID(); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '变量管理查询', @parentId, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:query', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '变量管理新增', @parentId, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:add', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '变量管理修改', @parentId, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:edit', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '变量管理删除', @parentId, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:remove', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); -INSERT INTO sys_menu ( menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ( '变量管理导出', @parentId, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:export', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); - --- 消息系统字典 -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (142, 0, '未读', '0', 'message_status', NULL, 'primary', 'N', '0', 'xl', '2024-12-21 15:13:02', '', NULL, NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (143, 1, '已读', '1', 'message_status', NULL, 'success', 'N', '0', 'xl', '2024-12-21 15:13:15', 'xl', '2024-12-21 15:13:22', NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (144, 0, '平台', '0', 'send_mode', NULL, 'primary', 'N', '0', 'xl', '2024-12-25 09:40:01', '', NULL, NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (145, 1, '短信', '1', 'send_mode', NULL, 'success', 'N', '0', 'xl', '2024-12-25 09:40:16', 'xl', '2025-01-01 10:12:07', NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (146, 2, '邮件', '2', 'send_mode', NULL, 'warning', 'N', '0', 'xl', '2024-12-25 09:40:28', 'xl', '2025-01-01 10:12:14', NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (147, 0, '验证码', '0', 'template_type', NULL, 'primary', 'N', '0', 'xl', '2025-01-03 09:22:52', '', NULL, NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (148, 0, '通知', '0', 'message_type', NULL, 'primary', 'N', '0', 'xl', '2025-01-03 15:12:29', '', NULL, NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (149, 0, '提示', '1', 'message_type', NULL, 'success', 'N', '0', 'xl', '2025-01-03 15:12:41', 'xl', '2025-01-03 15:12:45', NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (150, 1, '推广', '1', 'template_type', NULL, 'success', 'N', '0', 'xl', '2025-01-03 15:13:15', '', NULL, NULL); - diff --git a/sql/mysql/online.sql b/sql/mysql/online.sql deleted file mode 100644 index df99eaeee6c1126a3af2a3d7455a8334cc62f711..0000000000000000000000000000000000000000 --- a/sql/mysql/online.sql +++ /dev/null @@ -1,71 +0,0 @@ -DROP TABLE IF EXISTS online_mb; - -CREATE TABLE online_mb ( - mb_id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', - tag varchar(255) NULL COMMENT '标签名', - tag_id varchar(255) NULL COMMENT '标签id', - parameter_type varchar(255) NULL COMMENT '参数类型', - result_map varchar(255) NULL COMMENT '结果类型', - sql_text varchar(255) NULL COMMENT 'sql语句', - path varchar(255) NULL COMMENT '请求路径', - method varchar(255) NULL COMMENT '请求方式', - result_type varchar(255) NULL COMMENT '响应类型', - actuator varchar(255) NULL COMMENT '执行器', - user_id char(1) NULL COMMENT '是否需要userId', - dept_id char(1) NULL COMMENT '是否需要deptId', - permission_type varchar(255) NULL COMMENT '许可类型', - permission_value varchar(255) NULL COMMENT '许可值', - del_flag varchar(10) NOT NULL DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)', - PRIMARY KEY (mb_id) -) ENGINE = InnoDB COMMENT = '在线接口'; - -INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query,route_name, is_frame, is_cache, menu_type, visible, `status`, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ('Online', 0, 5, 'onlinedev', NULL, NULL,'', 1, 0, 'M', '0', '0', NULL, 'international', 'admin', '2024-03-07 19:38:34', '', NULL, ''); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - --- 菜单 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component,route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('mybatis在线接口', @parentId, '1', 'mb', 'online/mb/index','', 1, 0, 'C', '0', '0', 'online:mb:list', 'code', 'admin', sysdate(), '', null, 'mybatis在线接口菜单'); - -INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query,route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ('数据库', @parentId, 1, 'db', 'online/db/index', NULL,'', 1, 0, 'C', '0', '0', 'admin', 'table', 'admin', '2024-03-07 19:48:24', 'admin', '2024-03-07 19:54:46', ''); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - --- 按钮 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component,route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('mybatis在线接口查询', @parentId, '1', '#', '','', 1, 0, 'F', '0', '0', 'online:mb:query', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component,route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('mybatis在线接口新增', @parentId, '2', '#', '','', 1, 0, 'F', '0', '0', 'online:mb:add', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component,route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('mybatis在线接口修改', @parentId, '3', '#', '','', 1, 0, 'F', '0', '0', 'online:mb:edit', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('mybatis在线接口删除', @parentId, '4', '#', '','', 1, 0, 'F', '0', '0', 'online:mb:remove', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('mybatis在线接口导出', @parentId, '5', '#', '','', 1, 0, 'F', '0', '0', 'online:mb:export', '#', 'admin', sysdate(), '', null, ''); - - -INSERT INTO sys_dict_type ( dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES ( '请求方式', 'online_api_method', '0', 'admin', '2024-02-21 18:22:03', 'admin', '2024-02-21 18:22:13', NULL); -INSERT INTO sys_dict_type ( dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES ( '标签名', 'online_api_tag', '0', 'admin', '2024-02-21 18:22:29', '', NULL, NULL); -INSERT INTO sys_dict_type ( dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES ( '响应类型', 'online_api_result', '0', 'admin', '2024-02-21 18:22:46', '', NULL, NULL); -INSERT INTO sys_dict_type ( dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES ( '执行器', 'online_api_actuator', '0', 'admin', '2024-02-21 18:23:03', '', NULL, NULL); - - -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'POST', 'POST', 'online_api_method', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:23:23', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'GET', 'GET', 'online_api_method', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:23:30', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'PUT', 'PUT', 'online_api_method', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:23:37', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'DELETE', 'DELETE', 'online_api_method', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:23:49', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'select', 'select', 'online_api_tag', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:24:06', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'update', 'update', 'online_api_tag', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:24:12', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'insert', 'insert', 'online_api_tag', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:24:18', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'delete', 'delete', 'online_api_tag', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:24:26', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'selectList', 'selectList', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:25:00', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'insert', 'insert', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:25:05', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'selectOne', 'selectOne', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:25:11', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'update', 'update', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:25:16', '', NULL, NULL); -INSERT INTO sys_dict_data ( dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES ( 0, 'delete', 'delete', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', '2024-02-21 18:25:21', '', NULL, NULL); diff --git a/sql/mysql/pay.sql b/sql/mysql/pay.sql deleted file mode 100644 index c9d9011a5ffa3dc9e0611974d54ea292b9caea26..0000000000000000000000000000000000000000 --- a/sql/mysql/pay.sql +++ /dev/null @@ -1,95 +0,0 @@ --- ---------------------------- --- 订单表 --- ---------------------------- -DROP TABLE IF EXISTS `pay_order`; -CREATE TABLE `pay_order` ( - order_id bigint NOT NULL AUTO_INCREMENT COMMENT '订单id', - order_number varchar(255) NULL DEFAULT NULL COMMENT '订单号', - third_number varchar(255) NULL DEFAULT NULL COMMENT '第三方订单号', - order_status varchar(255) NULL DEFAULT NULL COMMENT '订单状态', - total_amount varchar(255) NULL DEFAULT NULL COMMENT '订单总金额', - actual_amount varchar(255) NULL DEFAULT NULL COMMENT '实际支付金额', - order_content varchar(255) NULL DEFAULT NULL COMMENT '订单内容', - order_message varchar(255) NULL DEFAULT NULL COMMENT '负载信息', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', - PRIMARY KEY (`order_id`) -) ENGINE = InnoDB COMMENT = '订单'; - --- ---------------------------- --- 发票表 --- ---------------------------- -DROP TABLE IF EXISTS `pay_invoice`; -CREATE TABLE `pay_invoice` ( - invoice_id bigint NOT NULL AUTO_INCREMENT COMMENT '发票id', - order_number varchar(255) NULL DEFAULT NULL COMMENT '订单号', - invoice_type varchar(255) NULL DEFAULT NULL COMMENT '发票类型', - invoice_header varchar(255) NULL DEFAULT NULL COMMENT '发票抬头', - invoice_number varchar(255) NULL DEFAULT NULL COMMENT '纳税人识别号', - invoice_phone varchar(255) NULL DEFAULT NULL COMMENT '收票人手机号', - invoice_email varchar(255) NULL DEFAULT NULL COMMENT '收票人邮箱', - invoice_remark varchar(255) NULL DEFAULT NULL COMMENT '发票备注', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', - PRIMARY KEY (`invoice_id`) -) ENGINE = InnoDB COMMENT = '发票'; - -INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query,route_name, is_frame, is_cache, menu_type, visible, `status`, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES ('支付管理', 0, 4, 'pay', NULL, NULL, '',1, 0, 'M', '0', '0', NULL, 'money', 'admin', '2024-02-15 22:40:23', '', NULL, ''); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - -select @payParentId := @parentId; - --- 菜单 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('订单', @payParentId, '1', 'order', 'pay/order/index', '',1, 0, 'C', '0', '0', 'pay:order:list', '#', 'admin', sysdate(), '', null, '订单菜单'); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - --- 按钮 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('订单查询', @parentId, '1', '#', '', '',1, 0, 'F', '0', '0', 'pay:order:query', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('订单新增', @parentId, '2', '#', '', '',1, 0, 'F', '0', '0', 'pay:order:add', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('订单修改', @parentId, '3', '#', '', '',1, 0, 'F', '0', '0', 'pay:order:edit', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('订单删除', @parentId, '4', '#', '', '',1, 0, 'F', '0', '0', 'pay:order:remove', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('订单导出', @parentId, '5', '#', '', '',1, 0, 'F', '0', '0', 'pay:order:export', '#', 'admin', sysdate(), '', null, ''); - - --- 菜单 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('发票', @payParentId, '1', 'invoice', 'pay/invoice/index', '',1, 0, 'C', '0', '0', 'pay:invoice:list', '#', 'admin', sysdate(), '', null, '发票菜单'); - --- 按钮父菜单ID -SELECT @parentId := LAST_INSERT_ID(); - --- 按钮 SQL -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('发票查询', @parentId, '1', '#', '', '',1, 0, 'F', '0', '0', 'pay:invoice:query', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('发票新增', @parentId, '2', '#', '', '',1, 0, 'F', '0', '0', 'pay:invoice:add', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('发票修改', @parentId, '3', '#', '', '',1, 0, 'F', '0', '0', 'pay:invoice:edit', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('发票删除', @parentId, '4', '#', '', '',1, 0, 'F', '0', '0', 'pay:invoice:remove', '#', 'admin', sysdate(), '', null, ''); - -insert into sys_menu (menu_name, parent_id, order_num, path, component, route_name,is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values('发票导出', @parentId, '5', '#', '', '',1, 0, 'F', '0', '0', 'pay:invoice:export', '#', 'admin', sysdate(), '', null, ''); \ No newline at end of file diff --git a/sql/mysql/quartz.sql b/sql/mysql/quartz.sql deleted file mode 100644 index cee613b7bb879cdf12b6b90ce04fbd73c237e430..0000000000000000000000000000000000000000 --- a/sql/mysql/quartz.sql +++ /dev/null @@ -1,174 +0,0 @@ -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; - --- ---------------------------- --- 1、存储每一个已配置的 jobDetail 的详细信息 --- ---------------------------- -create table QRTZ_JOB_DETAILS ( - sched_name varchar(120) not null comment '调度名称', - job_name varchar(200) not null comment '任务名称', - job_group varchar(200) not null comment '任务组名', - description varchar(250) null comment '相关介绍', - job_class_name varchar(250) not null comment '执行任务类名称', - is_durable varchar(1) not null comment '是否持久化', - is_nonconcurrent varchar(1) not null comment '是否并发', - is_update_data varchar(1) not null comment '是否更新数据', - requests_recovery varchar(1) not null comment '是否接受恢复执行', - job_data blob null comment '存放持久化job对象', - primary key (sched_name, job_name, job_group) -) engine=innodb comment = '任务详细信息表'; - --- ---------------------------- --- 2、 存储已配置的 Trigger 的信息 --- ---------------------------- -create table QRTZ_TRIGGERS ( - sched_name varchar(120) not null comment '调度名称', - trigger_name varchar(200) not null comment '触发器的名字', - trigger_group varchar(200) not null comment '触发器所属组的名字', - job_name varchar(200) not null comment 'qrtz_job_details表job_name的外键', - job_group varchar(200) not null comment 'qrtz_job_details表job_group的外键', - description varchar(250) null comment '相关介绍', - next_fire_time bigint(13) null comment '上一次触发时间(毫秒)', - prev_fire_time bigint(13) null comment '下一次触发时间(默认为-1表示不触发)', - priority integer null comment '优先级', - trigger_state varchar(16) not null comment '触发器状态', - trigger_type varchar(8) not null comment '触发器的类型', - start_time bigint(13) not null comment '开始时间', - end_time bigint(13) null comment '结束时间', - calendar_name varchar(200) null comment '日程表名称', - misfire_instr smallint(2) null comment '补偿执行的策略', - job_data blob null comment '存放持久化job对象', - 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 comment = '触发器详细信息表'; - --- ---------------------------- --- 3、 存储简单的 Trigger,包括重复次数,间隔,以及已触发的次数 --- ---------------------------- -create table QRTZ_SIMPLE_TRIGGERS ( - sched_name varchar(120) not null comment '调度名称', - trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', - trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', - repeat_count bigint(7) not null comment '重复的次数统计', - repeat_interval bigint(12) not null comment '重复的间隔时间', - times_triggered bigint(10) not null comment '已经触发的次数', - 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 comment = '简单触发器的信息表'; - --- ---------------------------- --- 4、 存储 Cron Trigger,包括 Cron 表达式和时区信息 --- ---------------------------- -create table QRTZ_CRON_TRIGGERS ( - sched_name varchar(120) not null comment '调度名称', - trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', - trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', - cron_expression varchar(200) not null comment 'cron表达式', - time_zone_id varchar(80) comment '时区', - 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 comment = 'Cron类型的触发器表'; - --- ---------------------------- --- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型,JobStore 并不知道如何存储实例的时候) --- ---------------------------- -create table QRTZ_BLOB_TRIGGERS ( - sched_name varchar(120) not null comment '调度名称', - trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', - trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', - blob_data blob null comment '存放持久化Trigger对象', - 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 comment = 'Blob类型的触发器表'; - --- ---------------------------- --- 6、 以 Blob 类型存储存放日历信息, quartz可配置一个日历来指定一个时间范围 --- ---------------------------- -create table QRTZ_CALENDARS ( - sched_name varchar(120) not null comment '调度名称', - calendar_name varchar(200) not null comment '日历名称', - calendar blob not null comment '存放持久化calendar对象', - primary key (sched_name, calendar_name) -) engine=innodb comment = '日历信息表'; - --- ---------------------------- --- 7、 存储已暂停的 Trigger 组的信息 --- ---------------------------- -create table QRTZ_PAUSED_TRIGGER_GRPS ( - sched_name varchar(120) not null comment '调度名称', - trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', - primary key (sched_name, trigger_group) -) engine=innodb comment = '暂停的触发器表'; - --- ---------------------------- --- 8、 存储与已触发的 Trigger 相关的状态信息,以及相联 Job 的执行信息 --- ---------------------------- -create table QRTZ_FIRED_TRIGGERS ( - sched_name varchar(120) not null comment '调度名称', - entry_id varchar(95) not null comment '调度器实例id', - trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', - trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', - instance_name varchar(200) not null comment '调度器实例名', - fired_time bigint(13) not null comment '触发的时间', - sched_time bigint(13) not null comment '定时器制定的时间', - priority integer not null comment '优先级', - state varchar(16) not null comment '状态', - job_name varchar(200) null comment '任务名称', - job_group varchar(200) null comment '任务组名', - is_nonconcurrent varchar(1) null comment '是否并发', - requests_recovery varchar(1) null comment '是否接受恢复执行', - primary key (sched_name, entry_id) -) engine=innodb comment = '已触发的触发器表'; - --- ---------------------------- --- 9、 存储少量的有关 Scheduler 的状态信息,假如是用于集群中,可以看到其他的 Scheduler 实例 --- ---------------------------- -create table QRTZ_SCHEDULER_STATE ( - sched_name varchar(120) not null comment '调度名称', - instance_name varchar(200) not null comment '实例名称', - last_checkin_time bigint(13) not null comment '上次检查时间', - checkin_interval bigint(13) not null comment '检查间隔时间', - primary key (sched_name, instance_name) -) engine=innodb comment = '调度器状态表'; - --- ---------------------------- --- 10、 存储程序的悲观锁的信息(假如使用了悲观锁) --- ---------------------------- -create table QRTZ_LOCKS ( - sched_name varchar(120) not null comment '调度名称', - lock_name varchar(40) not null comment '悲观锁名称', - primary key (sched_name, lock_name) -) engine=innodb comment = '存储的悲观锁信息表'; - --- ---------------------------- --- 11、 Quartz集群实现同步机制的行锁表 --- ---------------------------- -create table QRTZ_SIMPROP_TRIGGERS ( - sched_name varchar(120) not null comment '调度名称', - trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', - trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', - str_prop_1 varchar(512) null comment 'String类型的trigger的第一个参数', - str_prop_2 varchar(512) null comment 'String类型的trigger的第二个参数', - str_prop_3 varchar(512) null comment 'String类型的trigger的第三个参数', - int_prop_1 int null comment 'int类型的trigger的第一个参数', - int_prop_2 int null comment 'int类型的trigger的第二个参数', - long_prop_1 bigint null comment 'long类型的trigger的第一个参数', - long_prop_2 bigint null comment 'long类型的trigger的第二个参数', - dec_prop_1 numeric(13,4) null comment 'decimal类型的trigger的第一个参数', - dec_prop_2 numeric(13,4) null comment 'decimal类型的trigger的第二个参数', - bool_prop_1 varchar(1) null comment 'Boolean类型的trigger的第一个参数', - bool_prop_2 varchar(1) null comment 'Boolean类型的trigger的第二个参数', - 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 comment = '同步机制的行锁表'; - -commit; \ No newline at end of file diff --git a/sql/mysql/ry_20230223.sql b/sql/mysql/ry_20230223.sql deleted file mode 100644 index 735433951aefdf40e0d6333e656066e68eac992d..0000000000000000000000000000000000000000 --- a/sql/mysql/ry_20230223.sql +++ /dev/null @@ -1,640 +0,0 @@ --- ---------------------------- --- 1、部门表 --- ---------------------------- -drop table if exists sys_dept; -create table sys_dept ( - dept_id bigint(20) not null auto_increment comment '部门id', - parent_id bigint(20) default 0 comment '父部门id', - ancestors varchar(50) default '' comment '祖级列表', - dept_name varchar(30) default '' comment '部门名称', - order_num int(4) default 0 comment '显示顺序', - leader varchar(20) default null comment '负责人', - phone varchar(11) default null comment '联系电话', - email varchar(50) default null comment '邮箱', - status char(1) default '0' comment '部门状态(0正常 1停用)', - del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - primary key (dept_id) -) engine=innodb auto_increment=200 comment = '部门表'; - --- ---------------------------- --- 初始化-部门表数据 --- ---------------------------- -insert into sys_dept values(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); -insert into sys_dept values(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); -insert into sys_dept values(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); -insert into sys_dept values(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); -insert into sys_dept values(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); -insert into sys_dept values(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); -insert into sys_dept values(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); -insert into sys_dept values(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); -insert into sys_dept values(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); -insert into sys_dept values(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); - - --- ---------------------------- --- 2、用户信息表 --- ---------------------------- -drop table if exists sys_user; -create table sys_user ( - user_id bigint(20) not null auto_increment comment '用户ID', - dept_id bigint(20) default null comment '部门ID', - user_name varchar(30) not null comment '用户账号', - nick_name varchar(30) not null comment '用户昵称', - user_type varchar(2) default '00' comment '用户类型(00系统用户)', - email varchar(50) default '' comment '用户邮箱', - phonenumber varchar(11) default '' comment '手机号码', - sex char(1) default '0' comment '用户性别(0男 1女 2未知)', - avatar varchar(100) default '' comment '头像地址', - password varchar(100) default '' comment '密码', - status char(1) default '0' comment '帐号状态(0正常 1停用)', - del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', - login_ip varchar(128) default '' comment '最后登录IP', - login_date datetime comment '最后登录时间', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', - primary key (user_id) -) engine=innodb auto_increment=100 comment = '用户信息表'; - --- ---------------------------- --- 初始化-用户信息表数据 --- ---------------------------- -insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '管理员'); -insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '测试员'); - - --- ---------------------------- --- 3、岗位信息表 --- ---------------------------- -drop table if exists sys_post; -create table sys_post -( - post_id bigint(20) not null auto_increment comment '岗位ID', - post_code varchar(64) not null comment '岗位编码', - post_name varchar(50) not null comment '岗位名称', - post_sort int(4) not null comment '显示顺序', - status char(1) not null comment '状态(0正常 1停用)', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', - primary key (post_id) -) engine=innodb comment = '岗位信息表'; - --- ---------------------------- --- 初始化-岗位信息表数据 --- ---------------------------- -insert into sys_post values(1, 'ceo', '董事长', 1, '0', 'admin', sysdate(), '', null, ''); -insert into sys_post values(2, 'se', '项目经理', 2, '0', 'admin', sysdate(), '', null, ''); -insert into sys_post values(3, 'hr', '人力资源', 3, '0', 'admin', sysdate(), '', null, ''); -insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', sysdate(), '', null, ''); - - --- ---------------------------- --- 4、角色信息表 --- ---------------------------- -drop table if exists sys_role; -create table sys_role ( - role_id bigint(20) not null auto_increment comment '角色ID', - role_name varchar(30) not null comment '角色名称', - role_key varchar(100) not null comment '角色权限字符串', - role_sort int(4) not null comment '显示顺序', - data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', - menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示', - dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示', - status char(1) not null comment '角色状态(0正常 1停用)', - del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', - primary key (role_id) -) engine=innodb auto_increment=100 comment = '角色信息表'; - --- ---------------------------- --- 初始化-角色信息表数据 --- ---------------------------- -insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员'); -insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色'); - - --- ---------------------------- --- 5、菜单权限表 --- ---------------------------- -drop table if exists sys_menu; -create table sys_menu ( - menu_id bigint(20) not null auto_increment comment '菜单ID', - menu_name varchar(50) not null comment '菜单名称', - parent_id bigint(20) default 0 comment '父菜单ID', - order_num int(4) default 0 comment '显示顺序', - path varchar(200) default '' comment '路由地址', - component varchar(255) default null comment '组件路径', - query varchar(255) default null comment '路由参数', - route_name varchar(50) default '' comment '路由名称', - is_frame int(1) default 1 comment '是否为外链(0是 1否)', - is_cache int(1) default 0 comment '是否缓存(0缓存 1不缓存)', - menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)', - visible char(1) default 0 comment '菜单状态(0显示 1隐藏)', - status char(1) default 0 comment '菜单状态(0正常 1停用)', - perms varchar(100) default null comment '权限标识', - icon varchar(100) default '#' comment '菜单图标', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default '' comment '备注', - primary key (menu_id) -) engine=innodb auto_increment=2000 comment = '菜单权限表'; - --- ---------------------------- --- 初始化-菜单信息表数据 --- ---------------------------- --- 一级菜单 -insert into sys_menu values('1', '系统管理', '0', '1', 'system', null, '', '', 1, 0, 'M', '0', '0', '', 'system', 'admin', sysdate(), '', null, '系统管理目录'); -insert into sys_menu values('2', '系统监控', '0', '2', 'monitor', null, '', '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', sysdate(), '', null, '系统监控目录'); -insert into sys_menu values('3', '系统工具', '0', '3', 'tool', null, '', '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', sysdate(), '', null, '系统工具目录'); -insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', null, '', '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', sysdate(), '', null, '若依官网地址'); --- 二级菜单 -insert into sys_menu values('100', '用户管理', '1', '1', 'user', 'system/user/index', '', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', sysdate(), '', null, '用户管理菜单'); -insert into sys_menu values('101', '角色管理', '1', '2', 'role', 'system/role/index', '', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', sysdate(), '', null, '角色管理菜单'); -insert into sys_menu values('102', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', sysdate(), '', null, '菜单管理菜单'); -insert into sys_menu values('103', '部门管理', '1', '4', 'dept', 'system/dept/index', '', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', sysdate(), '', null, '部门管理菜单'); -insert into sys_menu values('104', '岗位管理', '1', '5', 'post', 'system/post/index', '', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', sysdate(), '', null, '岗位管理菜单'); -insert into sys_menu values('105', '字典管理', '1', '6', 'dict', 'system/dict/index', '', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate(), '', null, '字典管理菜单'); -insert into sys_menu values('106', '参数设置', '1', '7', 'config', 'system/config/index', '', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate(), '', null, '参数设置菜单'); -insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单'); -insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单'); -insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单'); -insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单'); -insert into sys_menu values('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', '', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, '数据监控菜单'); -insert into sys_menu values('112', '服务监控', '2', '4', 'server', 'monitor/server/index', '', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单'); -insert into sys_menu values('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', sysdate(), '', null, '缓存监控菜单'); -insert into sys_menu values('114', '缓存列表', '2', '6', 'cacheList', 'monitor/cache/list', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis-list', 'admin', sysdate(), '', null, '缓存列表菜单'); -insert into sys_menu values('115', '表单构建', '3', '1', 'build', 'tool/build/index', '', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单'); -insert into sys_menu values('117', '系统接口', '3', '3', 'swagger', 'tool/swagger/index', '', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单'); --- 三级菜单 -insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'monitor/operlog/index', '', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单'); -insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'monitor/logininfor/index', '', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单'); --- 用户管理按钮 -insert into sys_menu values('1000', '用户查询', '100', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1001', '用户新增', '100', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1002', '用户修改', '100', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1003', '用户删除', '100', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1004', '用户导出', '100', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1005', '用户导入', '100', '6', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1006', '重置密码', '100', '7', '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', sysdate(), '', null, ''); --- 角色管理按钮 -insert into sys_menu values('1007', '角色查询', '101', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1008', '角色新增', '101', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1009', '角色修改', '101', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1010', '角色删除', '101', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1011', '角色导出', '101', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', sysdate(), '', null, ''); --- 菜单管理按钮 -insert into sys_menu values('1012', '菜单查询', '102', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1013', '菜单新增', '102', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1014', '菜单修改', '102', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1015', '菜单删除', '102', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', sysdate(), '', null, ''); --- 部门管理按钮 -insert into sys_menu values('1016', '部门查询', '103', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1017', '部门新增', '103', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1018', '部门修改', '103', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1019', '部门删除', '103', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', sysdate(), '', null, ''); --- 岗位管理按钮 -insert into sys_menu values('1020', '岗位查询', '104', '1', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1021', '岗位新增', '104', '2', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1022', '岗位修改', '104', '3', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1023', '岗位删除', '104', '4', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1024', '岗位导出', '104', '5', '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', sysdate(), '', null, ''); --- 字典管理按钮 -insert into sys_menu values('1025', '字典查询', '105', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1026', '字典新增', '105', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1027', '字典修改', '105', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1028', '字典删除', '105', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1029', '字典导出', '105', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', sysdate(), '', null, ''); --- 参数设置按钮 -insert into sys_menu values('1030', '参数查询', '106', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1031', '参数新增', '106', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1032', '参数修改', '106', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1033', '参数删除', '106', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1034', '参数导出', '106', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', sysdate(), '', null, ''); --- 通知公告按钮 -insert into sys_menu values('1035', '公告查询', '107', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1036', '公告新增', '107', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1037', '公告修改', '107', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', sysdate(), '', null, ''); --- 操作日志按钮 -insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1041', '日志导出', '500', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', sysdate(), '', null, ''); --- 登录日志按钮 -insert into sys_menu values('1042', '登录查询', '501', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1043', '登录删除', '501', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1044', '日志导出', '501', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1045', '账户解锁', '501', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock', '#', 'admin', sysdate(), '', null, ''); - --- 在线用户按钮 -insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, ''); --- 定时任务按钮 -insert into sys_menu values('1049', '任务查询', '110', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1050', '任务新增', '110', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1051', '任务修改', '110', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1052', '任务删除', '110', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1053', '状态修改', '110', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1054', '任务导出', '110', '6', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, ''); - - - - --- ---------------------------- --- 6、用户和角色关联表 用户N-1角色 --- ---------------------------- -drop table if exists sys_user_role; -create table sys_user_role ( - user_id bigint(20) not null comment '用户ID', - role_id bigint(20) not null comment '角色ID', - primary key(user_id, role_id) -) engine=innodb comment = '用户和角色关联表'; - --- ---------------------------- --- 初始化-用户和角色关联表数据 --- ---------------------------- -insert into sys_user_role values ('1', '1'); -insert into sys_user_role values ('2', '2'); - - --- ---------------------------- --- 7、角色和菜单关联表 角色1-N菜单 --- ---------------------------- -drop table if exists sys_role_menu; -create table sys_role_menu ( - role_id bigint(20) not null comment '角色ID', - menu_id bigint(20) not null comment '菜单ID', - primary key(role_id, menu_id) -) engine=innodb comment = '角色和菜单关联表'; - --- ---------------------------- --- 初始化-角色和菜单关联表数据 --- ---------------------------- -insert into sys_role_menu values ('2', '1'); -insert into sys_role_menu values ('2', '2'); -insert into sys_role_menu values ('2', '3'); -insert into sys_role_menu values ('2', '4'); -insert into sys_role_menu values ('2', '100'); -insert into sys_role_menu values ('2', '101'); -insert into sys_role_menu values ('2', '102'); -insert into sys_role_menu values ('2', '103'); -insert into sys_role_menu values ('2', '104'); -insert into sys_role_menu values ('2', '105'); -insert into sys_role_menu values ('2', '106'); -insert into sys_role_menu values ('2', '107'); -insert into sys_role_menu values ('2', '108'); -insert into sys_role_menu values ('2', '109'); -insert into sys_role_menu values ('2', '110'); -insert into sys_role_menu values ('2', '111'); -insert into sys_role_menu values ('2', '112'); -insert into sys_role_menu values ('2', '113'); -insert into sys_role_menu values ('2', '114'); -insert into sys_role_menu values ('2', '115'); -insert into sys_role_menu values ('2', '116'); -insert into sys_role_menu values ('2', '117'); -insert into sys_role_menu values ('2', '500'); -insert into sys_role_menu values ('2', '501'); -insert into sys_role_menu values ('2', '1000'); -insert into sys_role_menu values ('2', '1001'); -insert into sys_role_menu values ('2', '1002'); -insert into sys_role_menu values ('2', '1003'); -insert into sys_role_menu values ('2', '1004'); -insert into sys_role_menu values ('2', '1005'); -insert into sys_role_menu values ('2', '1006'); -insert into sys_role_menu values ('2', '1007'); -insert into sys_role_menu values ('2', '1008'); -insert into sys_role_menu values ('2', '1009'); -insert into sys_role_menu values ('2', '1010'); -insert into sys_role_menu values ('2', '1011'); -insert into sys_role_menu values ('2', '1012'); -insert into sys_role_menu values ('2', '1013'); -insert into sys_role_menu values ('2', '1014'); -insert into sys_role_menu values ('2', '1015'); -insert into sys_role_menu values ('2', '1016'); -insert into sys_role_menu values ('2', '1017'); -insert into sys_role_menu values ('2', '1018'); -insert into sys_role_menu values ('2', '1019'); -insert into sys_role_menu values ('2', '1020'); -insert into sys_role_menu values ('2', '1021'); -insert into sys_role_menu values ('2', '1022'); -insert into sys_role_menu values ('2', '1023'); -insert into sys_role_menu values ('2', '1024'); -insert into sys_role_menu values ('2', '1025'); -insert into sys_role_menu values ('2', '1026'); -insert into sys_role_menu values ('2', '1027'); -insert into sys_role_menu values ('2', '1028'); -insert into sys_role_menu values ('2', '1029'); -insert into sys_role_menu values ('2', '1030'); -insert into sys_role_menu values ('2', '1031'); -insert into sys_role_menu values ('2', '1032'); -insert into sys_role_menu values ('2', '1033'); -insert into sys_role_menu values ('2', '1034'); -insert into sys_role_menu values ('2', '1035'); -insert into sys_role_menu values ('2', '1036'); -insert into sys_role_menu values ('2', '1037'); -insert into sys_role_menu values ('2', '1038'); -insert into sys_role_menu values ('2', '1039'); -insert into sys_role_menu values ('2', '1040'); -insert into sys_role_menu values ('2', '1041'); -insert into sys_role_menu values ('2', '1042'); -insert into sys_role_menu values ('2', '1043'); -insert into sys_role_menu values ('2', '1044'); -insert into sys_role_menu values ('2', '1045'); -insert into sys_role_menu values ('2', '1046'); -insert into sys_role_menu values ('2', '1047'); -insert into sys_role_menu values ('2', '1048'); -insert into sys_role_menu values ('2', '1049'); -insert into sys_role_menu values ('2', '1050'); -insert into sys_role_menu values ('2', '1051'); -insert into sys_role_menu values ('2', '1052'); -insert into sys_role_menu values ('2', '1053'); -insert into sys_role_menu values ('2', '1054'); -insert into sys_role_menu values ('2', '1055'); -insert into sys_role_menu values ('2', '1056'); -insert into sys_role_menu values ('2', '1057'); -insert into sys_role_menu values ('2', '1058'); -insert into sys_role_menu values ('2', '1059'); -insert into sys_role_menu values ('2', '1060'); - --- ---------------------------- --- 8、角色和部门关联表 角色1-N部门 --- ---------------------------- -drop table if exists sys_role_dept; -create table sys_role_dept ( - role_id bigint(20) not null comment '角色ID', - dept_id bigint(20) not null comment '部门ID', - primary key(role_id, dept_id) -) engine=innodb comment = '角色和部门关联表'; - --- ---------------------------- --- 初始化-角色和部门关联表数据 --- ---------------------------- -insert into sys_role_dept values ('2', '100'); -insert into sys_role_dept values ('2', '101'); -insert into sys_role_dept values ('2', '105'); - - --- ---------------------------- --- 9、用户与岗位关联表 用户1-N岗位 --- ---------------------------- -drop table if exists sys_user_post; -create table sys_user_post -( - user_id bigint(20) not null comment '用户ID', - post_id bigint(20) not null comment '岗位ID', - primary key (user_id, post_id) -) engine=innodb comment = '用户与岗位关联表'; - --- ---------------------------- --- 初始化-用户与岗位关联表数据 --- ---------------------------- -insert into sys_user_post values ('1', '1'); -insert into sys_user_post values ('2', '2'); - - --- ---------------------------- --- 10、操作日志记录 --- ---------------------------- -drop table if exists sys_oper_log; -create table sys_oper_log ( - oper_id bigint(20) not null auto_increment comment '日志主键', - title varchar(50) default '' comment '模块标题', - business_type int(2) default 0 comment '业务类型(0其它 1新增 2修改 3删除)', - method varchar(100) default '' comment '方法名称', - request_method varchar(10) default '' comment '请求方式', - operator_type int(1) default 0 comment '操作类别(0其它 1后台用户 2手机端用户)', - oper_name varchar(50) default '' comment '操作人员', - dept_name varchar(50) default '' comment '部门名称', - oper_url varchar(255) default '' comment '请求URL', - oper_ip varchar(128) default '' comment '主机地址', - oper_location varchar(255) default '' comment '操作地点', - oper_param varchar(2000) default '' comment '请求参数', - json_result varchar(2000) default '' comment '返回参数', - status int(1) default 0 comment '操作状态(0正常 1异常)', - error_msg varchar(2000) default '' comment '错误消息', - oper_time datetime comment '操作时间', - cost_time bigint(20) default 0 comment '消耗时间', - primary key (oper_id), - key idx_sys_oper_log_bt (business_type), - key idx_sys_oper_log_s (status), - key idx_sys_oper_log_ot (oper_time) -) engine=innodb auto_increment=100 comment = '操作日志记录'; - - --- ---------------------------- --- 11、字典类型表 --- ---------------------------- -drop table if exists sys_dict_type; -create table sys_dict_type -( - dict_id bigint(20) not null auto_increment comment '字典主键', - dict_name varchar(100) default '' comment '字典名称', - dict_type varchar(100) default '' comment '字典类型', - status char(1) default '0' comment '状态(0正常 1停用)', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', - primary key (dict_id), - unique (dict_type) -) engine=innodb auto_increment=100 comment = '字典类型表'; - -insert into sys_dict_type values(1, '用户性别', 'sys_user_sex', '0', 'admin', sysdate(), '', null, '用户性别列表'); -insert into sys_dict_type values(2, '菜单状态', 'sys_show_hide', '0', 'admin', sysdate(), '', null, '菜单状态列表'); -insert into sys_dict_type values(3, '系统开关', 'sys_normal_disable', '0', 'admin', sysdate(), '', null, '系统开关列表'); -insert into sys_dict_type values(4, '任务状态', 'sys_job_status', '0', 'admin', sysdate(), '', null, '任务状态列表'); -insert into sys_dict_type values(5, '任务分组', 'sys_job_group', '0', 'admin', sysdate(), '', null, '任务分组列表'); -insert into sys_dict_type values(6, '系统是否', 'sys_yes_no', '0', 'admin', sysdate(), '', null, '系统是否列表'); -insert into sys_dict_type values(7, '通知类型', 'sys_notice_type', '0', 'admin', sysdate(), '', null, '通知类型列表'); -insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0', 'admin', sysdate(), '', null, '通知状态列表'); -insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', sysdate(), '', null, '操作类型列表'); -insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', sysdate(), '', null, '登录状态列表'); - - --- ---------------------------- --- 12、字典数据表 --- ---------------------------- -drop table if exists sys_dict_data; -create table sys_dict_data -( - dict_code bigint(20) not null auto_increment comment '字典编码', - dict_sort int(4) default 0 comment '字典排序', - dict_label varchar(100) default '' comment '字典标签', - dict_value varchar(100) default '' comment '字典键值', - dict_type varchar(100) default '' comment '字典类型', - css_class varchar(100) default null comment '样式属性(其他样式扩展)', - list_class varchar(100) default null comment '表格回显样式', - is_default char(1) default 'N' comment '是否默认(Y是 N否)', - status char(1) default '0' comment '状态(0正常 1停用)', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', - primary key (dict_code) -) engine=innodb auto_increment=100 comment = '字典数据表'; - -insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', sysdate(), '', null, '性别男'); -insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别女'); -insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别未知'); -insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '显示菜单'); -insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '隐藏菜单'); -insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态'); -insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态'); -insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态'); -insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态'); -insert into sys_dict_data values(10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', sysdate(), '', null, '默认分组'); -insert into sys_dict_data values(11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', sysdate(), '', null, '系统分组'); -insert into sys_dict_data values(12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '系统默认是'); -insert into sys_dict_data values(13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '系统默认否'); -insert into sys_dict_data values(14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', sysdate(), '', null, '通知'); -insert into sys_dict_data values(15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', sysdate(), '', null, '公告'); -insert into sys_dict_data values(16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态'); -insert into sys_dict_data values(17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '关闭状态'); -insert into sys_dict_data values(18, 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '其他操作'); -insert into sys_dict_data values(19, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '新增操作'); -insert into sys_dict_data values(20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '修改操作'); -insert into sys_dict_data values(21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '删除操作'); -insert into sys_dict_data values(22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '授权操作'); -insert into sys_dict_data values(23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导出操作'); -insert into sys_dict_data values(24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导入操作'); -insert into sys_dict_data values(25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '强退操作'); -insert into sys_dict_data values(26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '生成操作'); -insert into sys_dict_data values(27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '清空操作'); -insert into sys_dict_data values(28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '正常状态'); -insert into sys_dict_data values(29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态'); - - --- ---------------------------- --- 13、参数配置表 --- ---------------------------- -drop table if exists sys_config; -create table sys_config ( - config_id int(5) not null auto_increment comment '参数主键', - config_name varchar(100) default '' comment '参数名称', - config_key varchar(100) default '' comment '参数键名', - config_value varchar(500) default '' comment '参数键值', - config_type char(1) default 'N' comment '系统内置(Y是 N否)', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', - primary key (config_id) -) engine=innodb auto_increment=100 comment = '参数配置表'; - -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-green', 'Y', 'admin', '2023-04-13 20:46:20', 'admin', '2023-04-22 00:45:19', '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow'); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', '2023-04-13 20:46:20', '', NULL, '初始化密码 123456'); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-light', 'Y', 'admin', '2023-04-13 20:46:20', 'admin', '2023-04-22 00:45:25', '深色主题theme-dark,浅色主题theme-light'); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (4, '账号自助-验证码开关', 'sys.account.captchaEnabled', 'true', 'Y', 'admin', '2023-04-13 20:46:20', '', NULL, '是否开启验证码功能(true开启,false关闭)'); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (5, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'true', 'Y', 'admin', '2023-04-13 20:46:20', 'admin', '2023-04-22 00:41:41', '是否开启注册用户功能(true开启,false关闭)'); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (100, '主题颜色', 'sys.index.theme', '#11A983', 'Y', 'admin', '2023-04-22 00:57:18', 'admin', '2023-04-22 00:58:23', NULL); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (101, '开启TopNav', 'sys.index.topNav', 'true', 'Y', 'admin', '2023-04-22 00:58:59', '', NULL, NULL); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (102, '开启Tags-Views', 'sys.index.tagsView', 'true', 'Y', 'admin', '2023-04-22 00:59:40', '', NULL, NULL); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (103, '显示Logo', 'sys.index.sidebarLogo', 'true', 'Y', 'admin', '2023-04-22 01:00:20', '', NULL, NULL); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (104, '固定Header', 'sys.index.fixedHeader', 'true', 'Y', 'admin', '2023-04-22 01:00:53', '', NULL, NULL); -INSERT INTO `sys_config` (`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (105, '动态标题', 'sys.index.dynamicTitle', 'true', 'Y', 'admin', '2023-04-22 01:01:26', 'admin', '2023-04-22 01:01:41', NULL); - - --- ---------------------------- --- 14、系统访问记录 --- ---------------------------- -drop table if exists sys_logininfor; -create table sys_logininfor ( - info_id bigint(20) not null auto_increment comment '访问ID', - user_name varchar(50) default '' comment '用户账号', - ipaddr varchar(128) default '' comment '登录IP地址', - login_location varchar(255) default '' comment '登录地点', - browser varchar(50) default '' comment '浏览器类型', - os varchar(50) default '' comment '操作系统', - status char(1) default '0' comment '登录状态(0成功 1失败)', - msg varchar(255) default '' comment '提示消息', - login_time datetime comment '访问时间', - primary key (info_id), - key idx_sys_logininfor_s (status), - key idx_sys_logininfor_lt (login_time) -) engine=innodb auto_increment=100 comment = '系统访问记录'; - - --- ---------------------------- --- 15、定时任务调度表 --- ---------------------------- -drop table if exists sys_job; -create table sys_job ( - job_id bigint(20) not null auto_increment comment '任务ID', - job_name varchar(64) default '' comment '任务名称', - job_group varchar(64) default 'DEFAULT' comment '任务组名', - invoke_target varchar(500) not null comment '调用目标字符串', - cron_expression varchar(255) default '' comment 'cron执行表达式', - misfire_policy varchar(20) default '3' comment '计划执行错误策略(1立即执行 2执行一次 3放弃执行)', - concurrent char(1) default '1' comment '是否并发执行(0允许 1禁止)', - status char(1) default '0' comment '状态(0正常 1暂停)', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default '' comment '备注信息', - primary key (job_id, job_name, job_group) -) engine=innodb auto_increment=100 comment = '定时任务调度表'; - -insert into sys_job values(1, '系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); -insert into sys_job values(2, '系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(\'ry\')', '0/15 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); -insert into sys_job values(3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); - - --- ---------------------------- --- 16、定时任务调度日志表 --- ---------------------------- -drop table if exists sys_job_log; -create table sys_job_log ( - job_log_id bigint(20) not null auto_increment comment '任务日志ID', - job_name varchar(64) not null comment '任务名称', - job_group varchar(64) not null comment '任务组名', - invoke_target varchar(500) not null comment '调用目标字符串', - job_message varchar(500) comment '日志信息', - status char(1) default '0' comment '执行状态(0正常 1失败)', - exception_info varchar(2000) default '' comment '异常信息', - create_time datetime comment '创建时间', - primary key (job_log_id) -) engine=innodb comment = '定时任务调度日志表'; - - --- ---------------------------- --- 17、通知公告表 --- ---------------------------- -drop table if exists sys_notice; -create table sys_notice ( - notice_id int(4) not null auto_increment comment '公告ID', - notice_title varchar(50) not null comment '公告标题', - notice_type char(1) not null comment '公告类型(1通知 2公告)', - notice_content longblob default null comment '公告内容', - status char(1) default '0' comment '公告状态(0正常 1关闭)', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(255) default null comment '备注', - primary key (notice_id) -) engine=innodb auto_increment=10 comment = '通知公告表'; - --- ---------------------------- --- 初始化-公告信息表数据 --- ---------------------------- -insert into sys_notice values('1', '温馨提醒:2018-07-01 若依新版本发布啦', '2', '新版本内容', '0', 'admin', sysdate(), '', null, '管理员'); -insert into sys_notice values('2', '维护通知:2018-07-01 若依系统凌晨维护', '1', '维护内容', '0', 'admin', sysdate(), '', null, '管理员'); diff --git a/sql/postgresql/auth.sql b/sql/postgresql/auth.sql deleted file mode 100644 index 2fe637c6865cb0168c45de82bbc7baec33de804f..0000000000000000000000000000000000000000 --- a/sql/postgresql/auth.sql +++ /dev/null @@ -1,78 +0,0 @@ --- ---------------------------- --- 1、oauth_user 表 --- ---------------------------- -DROP TABLE IF EXISTS oauth_user CASCADE; - -CREATE TABLE oauth_user ( - id SERIAL NOT NULL PRIMARY KEY, - uuid VARCHAR(255) NOT NULL, - user_id BIGINT NOT NULL, - source VARCHAR(255) NOT NULL, - access_token VARCHAR(255) NOT NULL, - expire_in INT, - refresh_token VARCHAR(255), - open_id VARCHAR(255), - uid VARCHAR(255), - access_code VARCHAR(255), - union_id VARCHAR(255), - scope VARCHAR(255), - token_type VARCHAR(255), - id_token VARCHAR(255), - mac_algorithm VARCHAR(255), - mac_key VARCHAR(255), - code VARCHAR(255), - oauth_token VARCHAR(255), - oauth_token_secret VARCHAR(255) -); - -COMMENT ON TABLE oauth_user IS '第三方登录'; -COMMENT ON COLUMN oauth_user.id IS '主键'; -COMMENT ON COLUMN oauth_user.uuid IS '第三方系统的唯一ID,详细解释请参考:名词解释'; -COMMENT ON COLUMN oauth_user.user_id IS '用户ID'; -COMMENT ON COLUMN oauth_user.source IS '第三方用户来源,可选值:GITHUB、GITEE、QQ,更多请参考:AuthDefaultSource.java(opens new window)'; -COMMENT ON COLUMN oauth_user.access_token IS '用户的授权令牌'; -COMMENT ON COLUMN oauth_user.expire_in IS '第三方用户的授权令牌的有效期,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.refresh_token IS '刷新令牌,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.open_id IS '第三方用户的 open id,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.uid IS '第三方用户的 ID,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.access_code IS '个别平台的授权信息,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.union_id IS '第三方用户的 union id,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.scope IS '第三方用户授予的权限,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.token_type IS '个别平台的授权信息,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.id_token IS 'id token,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.mac_algorithm IS '小米平台用户的附带属性,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.mac_key IS '小米平台用户的附带属性,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.code IS '用户的授权code,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.oauth_token IS 'Twitter平台用户的附带属性,部分平台可能没有'; -COMMENT ON COLUMN oauth_user.oauth_token_secret IS 'Twitter平台用户的附带属性,部分平台可能没有'; - --- ---------------------------- --- 菜单 SQL --- ---------------------------- -SELECT setval('sys_menu_menu_id_seq', max(menu_id)) FROM sys_menu WHERE menu_id < 100; -INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES ('第三方认证', 1, 1, 'oauth', 'system/oauth/index', '', 1, 0, 'C', '0', '0', 'system:oauth:list', 'checkbox', 'admin', CURRENT_TIMESTAMP, '', NULL, '第三方认证菜单'); - --- 按钮父菜单ID -DO $$ -DECLARE - parentId INTEGER; -BEGIN - SELECT LASTVAL() INTO parentId; - - -- 按钮 SQL - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('第三方认证查询', parentId, 1, '#', '', '', 1, 0, 'F', '0', '0', 'system:oauth:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('第三方认证新增', parentId, 2, '#', '', '', 1, 0, 'F', '0', '0', 'system:oauth:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('第三方认证修改', parentId, 3, '#', '', '', 1, 0, 'F', '0', '0', 'system:oauth:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('第三方认证删除', parentId, 4, '#', '', '', 1, 0, 'F', '0', '0', 'system:oauth:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('第三方认证导出', parentId, 5, '#', '', '', 1, 0, 'F', '0', '0', 'system:oauth:export', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); -END $$; \ No newline at end of file diff --git a/sql/postgresql/create_database.sql b/sql/postgresql/create_database.sql deleted file mode 100644 index a0ea1eae75d241092989f0b9c2bf1a7f513f94c3..0000000000000000000000000000000000000000 --- a/sql/postgresql/create_database.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE DATABASE ry WITH ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TEMPLATE = template0; \ No newline at end of file diff --git a/sql/postgresql/gen.sql b/sql/postgresql/gen.sql deleted file mode 100644 index 0061688817983b33b72e43e31101a4fd0c368a9a..0000000000000000000000000000000000000000 --- a/sql/postgresql/gen.sql +++ /dev/null @@ -1,169 +0,0 @@ --- ---------------------------- --- 18、代码生成业务表 --- ---------------------------- -DROP TABLE IF EXISTS gen_table; -CREATE TABLE gen_table ( - table_id bigserial PRIMARY KEY, - table_name varchar(200) DEFAULT '' , - table_comment varchar(500) NOT NULL , - table_alias varchar(200) NOT NULL , - have_sub_column char(1) DEFAULT '0', - sub_table_name varchar(64) DEFAULT NULL, - sub_table_fk_name varchar(64) DEFAULT NULL, - class_name varchar(100) DEFAULT '' , - tpl_category varchar(200) DEFAULT 'crud', - tpl_web_type varchar(200) DEFAULT 'element-plus', - package_name varchar(100) DEFAULT NULL, - module_name varchar(30) DEFAULT NULL, - business_name varchar(30) DEFAULT NULL, - function_name varchar(50) DEFAULT NULL, - function_author varchar(50) DEFAULT NULL, - gen_type char(1) DEFAULT '0', - gen_path varchar(200) DEFAULT '/' , - options varchar(1000) DEFAULT NULL, - create_by varchar(64) DEFAULT '' , - create_time timestamp DEFAULT CURRENT_TIMESTAMP, - update_by varchar(64) DEFAULT '' , - update_time timestamp DEFAULT CURRENT_TIMESTAMP, - remark varchar(500) DEFAULT NULL -); - -COMMENT ON TABLE gen_table IS '代码生成业务表'; -COMMENT ON COLUMN gen_table.table_id IS '编号'; -COMMENT ON COLUMN gen_table.table_name IS '表名称'; -COMMENT ON COLUMN gen_table.table_alias IS '表别名'; -COMMENT ON COLUMN gen_table.table_comment IS '表描述'; -COMMENT ON COLUMN gen_table.have_sub_column IS '是否含有关联字段'; -COMMENT ON COLUMN gen_table.sub_table_name IS '关联子表的表名'; -COMMENT ON COLUMN gen_table.sub_table_fk_name IS '子表关联的外键名'; -COMMENT ON COLUMN gen_table.class_name IS '实体类名称'; -COMMENT ON COLUMN gen_table.tpl_category IS '使用的模板(crud单表操作 tree树表操作)'; -COMMENT ON COLUMN gen_table.tpl_web_type IS '使用的模板类型'; -COMMENT ON COLUMN gen_table.package_name IS '生成包路径'; -COMMENT ON COLUMN gen_table.module_name IS '生成模块名'; -COMMENT ON COLUMN gen_table.business_name IS '生成业务名'; -COMMENT ON COLUMN gen_table.function_name IS '生成功能名'; -COMMENT ON COLUMN gen_table.function_author IS '生成功能作者'; -COMMENT ON COLUMN gen_table.gen_type IS '生成代码方式(0zip压缩包 1自定义路径)'; -COMMENT ON COLUMN gen_table.gen_path IS '生成路径(不填默认项目路径)'; -COMMENT ON COLUMN gen_table.options IS '其它生成选项'; -COMMENT ON COLUMN gen_table.create_by IS '创建者'; -COMMENT ON COLUMN gen_table.create_time IS '创建时间'; -COMMENT ON COLUMN gen_table.update_by IS '更新者'; -COMMENT ON COLUMN gen_table.update_time IS '更新时间'; -COMMENT ON COLUMN gen_table.remark IS '备注'; - --- ---------------------------- --- 19、代码生成业务表字段 --- ---------------------------- -DROP TABLE IF EXISTS gen_table_column; -CREATE TABLE gen_table_column ( - column_id bigserial PRIMARY KEY, - table_id bigint DEFAULT NULL, - column_name varchar(200) DEFAULT NULL, - column_comment varchar(500) DEFAULT NULL, - column_type varchar(100) DEFAULT NULL, - java_type varchar(500) DEFAULT NULL, - java_field varchar(200) DEFAULT NULL, - is_pk char(1) DEFAULT NULL, - is_increment char(1) DEFAULT NULL, - is_required char(1) DEFAULT NULL, - is_insert char(1) DEFAULT NULL, - is_edit char(1) DEFAULT NULL, - is_list char(1) DEFAULT NULL, - is_query char(1) DEFAULT NULL, - query_type varchar(200) DEFAULT 'EQ', - html_type varchar(200) DEFAULT NULL, - dict_type varchar(200) DEFAULT '' , - sort int DEFAULT NULL, - sub_column_table_name varchar(200) DEFAULT NULL, - sub_column_fk_name varchar(200) DEFAULT NULL, - sub_column_name varchar(200) DEFAULT NULL, - sub_column_java_field varchar(200) DEFAULT NULL, - sub_column_java_type varchar(255) DEFAULT NULL, - create_by varchar(64) DEFAULT '' , - create_time timestamp DEFAULT CURRENT_TIMESTAMP, - update_by varchar(64) DEFAULT '' , - update_time timestamp DEFAULT CURRENT_TIMESTAMP -); - -COMMENT ON TABLE gen_table_column IS '代码生成业务表字段'; -COMMENT ON COLUMN gen_table_column.column_id IS '编号'; -COMMENT ON COLUMN gen_table_column.table_id IS '归属表编号'; -COMMENT ON COLUMN gen_table_column.column_name IS '列名称'; -COMMENT ON COLUMN gen_table_column.column_comment IS '列描述'; -COMMENT ON COLUMN gen_table_column.column_type IS '列类型'; -COMMENT ON COLUMN gen_table_column.java_type IS 'JAVA类型'; -COMMENT ON COLUMN gen_table_column.java_field IS 'JAVA字段名'; -COMMENT ON COLUMN gen_table_column.is_pk IS '是否主键(1是)'; -COMMENT ON COLUMN gen_table_column.is_increment IS '是否自增(1是)'; -COMMENT ON COLUMN gen_table_column.is_required IS '是否必填(1是)'; -COMMENT ON COLUMN gen_table_column.is_insert IS '是否为插入字段(1是)'; -COMMENT ON COLUMN gen_table_column.is_edit IS '是否编辑字段(1是)'; -COMMENT ON COLUMN gen_table_column.is_list IS '是否列表字段(1是)'; -COMMENT ON COLUMN gen_table_column.is_query IS '是否查询字段(1是)'; -COMMENT ON COLUMN gen_table_column.query_type IS '查询方式(等于、不等于、大于、小于、范围)'; -COMMENT ON COLUMN gen_table_column.html_type IS '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)'; -COMMENT ON COLUMN gen_table_column.dict_type IS '字典类型'; -COMMENT ON COLUMN gen_table_column.sort IS '排序'; -COMMENT ON COLUMN gen_table_column.sub_column_table_name IS '关联表名称'; -COMMENT ON COLUMN gen_table_column.sub_column_fk_name IS '关联字段名称'; -COMMENT ON COLUMN gen_table_column.sub_column_name IS '映射字段名称'; -COMMENT ON COLUMN gen_table_column.sub_column_java_field IS '映射字段JAVA字段名'; -COMMENT ON COLUMN gen_table_column.sub_column_java_type IS '映射字段JAVA类型'; -COMMENT ON COLUMN gen_table_column.create_by IS '创建者'; -COMMENT ON COLUMN gen_table_column.create_time IS '创建时间'; -COMMENT ON COLUMN gen_table_column.update_by IS '更新者'; -COMMENT ON COLUMN gen_table_column.update_time IS '更新时间'; - -DROP TABLE IF EXISTS gen_join_table; -CREATE TABLE gen_join_table ( - table_id bigserial, - left_table_id bigint DEFAULT NULL, - right_table_id bigint DEFAULT NULL, - left_table_alias varchar(200) DEFAULT NULL, - right_table_alias varchar(200) DEFAULT NULL, - left_table_fk varchar(200) DEFAULT NULL, - right_table_fk varchar(200) DEFAULT NULL, - join_type varchar(200) DEFAULT NULL, - join_columns varchar(500) DEFAULT NULL, - order_num varchar(64) DEFAULT NULL, - new_table_id bigint DEFAULT NULL, - PRIMARY KEY (table_id, right_table_id, left_table_id) -); - -COMMENT ON TABLE gen_table_column IS '代码生成关联表'; -COMMENT ON COLUMN gen_table_column.table_id IS '表编号'; -COMMENT ON COLUMN gen_table_column.left_table_id IS '左表名称'; -COMMENT ON COLUMN gen_table_column.right_table_id IS '右表编号'; -COMMENT ON COLUMN gen_table_column.left_table_alias IS '左表别名'; -COMMENT ON COLUMN gen_table_column.right_table_alias IS '右表别名'; -COMMENT ON COLUMN gen_table_column.left_table_fk IS '左表关联键'; -COMMENT ON COLUMN gen_table_column.right_table_fk IS '右表关联键'; -COMMENT ON COLUMN gen_table_column.join_type IS '关联类型'; -COMMENT ON COLUMN gen_table_column.join_columns IS '关联字段'; -COMMENT ON COLUMN gen_table_column.order_num IS '序号'; -COMMENT ON COLUMN gen_table_column.new_table_id IS '新表编号'; - --- 插入菜单数据 -INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES (116, '代码生成', 3, 2, 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', CURRENT_TIMESTAMP, '', NULL, '代码生成菜单'); - --- 代码生成按钮 -INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES (1055, '生成查询', 116, 1, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - -INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES (1056, '生成修改', 116, 2, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - -INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES (1057, '生成删除', 116, 3, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - -INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES (1058, '导入代码', 116, 4, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - -INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES (1059, '预览代码', 116, 5, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - -INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES (1060, '生成代码', 116, 6, '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); \ No newline at end of file diff --git a/sql/postgresql/message.sql b/sql/postgresql/message.sql deleted file mode 100644 index 7293ee4a6be1302c16c6908f56d7fc9eb20e8780..0000000000000000000000000000000000000000 --- a/sql/postgresql/message.sql +++ /dev/null @@ -1,178 +0,0 @@ --- ---------------------------- --- 消息系统 --- ---------------------------- --- 消息表 -DROP TABLE IF EXISTS message_system; -CREATE TABLE message_system ( - message_id bigserial PRIMARY KEY, - message_title varchar(64) DEFAULT NULL, - create_by varchar(64) DEFAULT NULL, - create_time timestamp DEFAULT NULL, - send_mode varchar(100) DEFAULT NULL, - code varchar(100) DEFAULT NULL, - message_content text DEFAULT NULL, - message_recipient varchar(100) DEFAULT NULL, - message_status varchar(64) DEFAULT NULL, - message_type varchar(64) DEFAULT NULL, - update_by varchar(64) DEFAULT NULL, - update_time timestamp DEFAULT NULL, - remark varchar(500) DEFAULT NULL -); - -COMMENT ON TABLE message_system IS '消息表'; -COMMENT ON COLUMN message_system.message_id IS '主键'; -COMMENT ON COLUMN message_system.message_title IS '标题'; -COMMENT ON COLUMN message_system.create_by IS '创建者'; -COMMENT ON COLUMN message_system.create_time IS '创建时间'; -COMMENT ON COLUMN message_system.send_mode IS '发送方式(0平台 1手机号 2 邮箱)'; -COMMENT ON COLUMN message_system.code IS '号码'; -COMMENT ON COLUMN message_system.message_content IS '消息内容'; -COMMENT ON COLUMN message_system.message_recipient IS '接收人'; -COMMENT ON COLUMN message_system.message_status IS '消息状态(0未读 1已读)'; -COMMENT ON COLUMN message_system.message_type IS '消息类型'; -COMMENT ON COLUMN message_system.update_by IS '更新者'; -COMMENT ON COLUMN message_system.update_time IS '更新时间'; -COMMENT ON COLUMN message_system.remark IS '备注'; - --- 模版表 -DROP TABLE IF EXISTS message_template; -CREATE TABLE message_template ( - template_id bigserial PRIMARY KEY, - template_name varchar(100) DEFAULT NULL, - template_code varchar(64) DEFAULT NULL, - template_type varchar(64) DEFAULT NULL, - template_content text DEFAULT NULL, - template_variable text DEFAULT NULL, - create_by varchar(64) DEFAULT NULL, - create_time timestamp DEFAULT NULL, - update_by varchar(64) DEFAULT NULL, - update_time timestamp DEFAULT NULL, - remark varchar(500) DEFAULT NULL -); - -COMMENT ON TABLE message_template IS '模版表'; -COMMENT ON COLUMN message_template.template_id IS '主键'; -COMMENT ON COLUMN message_template.template_name IS '模版名称'; -COMMENT ON COLUMN message_template.template_code IS '模版CODE'; -COMMENT ON COLUMN message_template.template_type IS '模版类型'; -COMMENT ON COLUMN message_template.template_content IS '模版内容'; -COMMENT ON COLUMN message_template.template_variable IS '变量属性'; -COMMENT ON COLUMN message_template.create_by IS '创建者'; -COMMENT ON COLUMN message_template.create_time IS '创建时间'; -COMMENT ON COLUMN message_template.update_by IS '更新者'; -COMMENT ON COLUMN message_template.update_time IS '更新时间'; -COMMENT ON COLUMN message_template.remark IS '备注'; - --- 变量表 -DROP TABLE IF EXISTS message_variable; -CREATE TABLE message_variable ( - variable_id bigserial PRIMARY KEY, - variable_name varchar(100) DEFAULT NULL, - variable_type varchar(64) DEFAULT NULL, - variable_content varchar(100) DEFAULT NULL, - create_by varchar(64) DEFAULT NULL, - create_time timestamp DEFAULT NULL, - update_by varchar(64) DEFAULT NULL, - update_time timestamp DEFAULT NULL, - remark varchar(500) DEFAULT NULL -); - -COMMENT ON TABLE message_variable IS '变量表'; -COMMENT ON COLUMN message_variable.variable_id IS '主键'; -COMMENT ON COLUMN message_variable.variable_name IS '变量名称'; -COMMENT ON COLUMN message_variable.variable_type IS '变量类型'; -COMMENT ON COLUMN message_variable.variable_content IS '变量内容'; -COMMENT ON COLUMN message_variable.create_by IS '创建者'; -COMMENT ON COLUMN message_variable.create_time IS '创建时间'; -COMMENT ON COLUMN message_variable.update_by IS '更新者'; -COMMENT ON COLUMN message_variable.update_time IS '更新时间'; -COMMENT ON COLUMN message_variable.remark IS '备注'; - --- ---------------------------- --- 消息系统 --- ---------------------------- --- 消息表 -INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES ('消息系统', 0, 6, 'modelMessage', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'message', 'admin', '2024-12-31 11:57:29', 'xl', '2025-01-03 15:48:44', ''); - -DO $$ -DECLARE - parentId INTEGER; - messageParentId INTEGER; -BEGIN - SELECT LASTVAL() INTO parentId; - SELECT LASTVAL() INTO messageParentId; - - - -- 消息管理菜单 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('消息管理', messageParentId, 0, 'messageSystem', 'modelMessage/messageSystem/index', NULL, '', 1, 0, 'C', '0', '0', 'modelMessage:messageSystem:list', '#', 'admin', '2024-12-21 15:00:31', 'admin', '2024-12-31 15:04:49', '消息管理菜单') - RETURNING menu_id INTO parentId; - - -- 消息管理按钮 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('消息管理查询', parentId, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:query', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('消息管理新增', parentId, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:add', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('消息管理修改', parentId, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:edit', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('消息管理删除', parentId, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:remove', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('消息管理导出', parentId, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:messageSystem:export', '#', 'admin', '2024-12-21 15:00:31', '', NULL, ''); - - -- 模版管理菜单 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('模版管理', messageParentId, 1, 'template', 'modelMessage/template/index', NULL, '', 1, 0, 'C', '0', '0', 'modelMessage:template:list', '#', 'admin', '2024-12-31 14:59:52', '', NULL, '模版管理菜单') - RETURNING menu_id INTO parentId; - - -- 模版管理按钮 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('模版管理查询', parentId, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:query', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('模版管理新增', parentId, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:add', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('模版管理修改', parentId, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:edit', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('模版管理删除', parentId, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:remove', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('模版管理导出', parentId, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:template:export', '#', 'admin', '2024-12-31 14:59:52', '', NULL, ''); - - -- 变量管理菜单 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('变量管理', messageParentId, 2, 'variable', 'modelMessage/variable/index', NULL, '', 1, 0, 'C', '0', '0', 'modelMessage:variable:list', '#', 'admin', '2024-12-31 15:01:50', 'admin', '2024-12-31 15:04:56', '变量管理菜单') - RETURNING menu_id INTO parentId; - - -- 变量管理按钮 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('变量管理查询', parentId, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:query', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('变量管理新增', parentId, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:add', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('变量管理修改', parentId, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:edit', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('变量管理删除', parentId, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:remove', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('变量管理导出', parentId, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'modelMessage:variable:export', '#', 'admin', '2024-12-31 15:01:50', '', NULL, ''); - -END $$; - --- 消息系统字典 -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (142, 0, '未读', '0', 'message_status', NULL, 'primary', 'N', '0', 'xl', '2024-12-21 15:13:02', '', NULL, NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (143, 1, '已读', '1', 'message_status', NULL, 'success', 'N', '0', 'xl', '2024-12-21 15:13:15', 'xl', '2024-12-21 15:13:22', NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (144, 0, '平台', '0', 'send_mode', NULL, 'primary', 'N', '0', 'xl', '2024-12-25 09:40:01', '', NULL, NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (145, 1, '短信', '1', 'send_mode', NULL, 'success', 'N', '0', 'xl', '2024-12-25 09:40:16', 'xl', '2025-01-01 10:12:07', NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (146, 2, '邮件', '2', 'send_mode', NULL, 'warning', 'N', '0', 'xl', '2024-12-25 09:40:28', 'xl', '2025-01-01 10:12:14', NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (147, 0, '验证码', '0', 'template_type', NULL, 'primary', 'N', '0', 'xl', '2025-01-03 09:22:52', '', NULL, NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (148, 0, '通知', '0', 'message_type', NULL, 'primary', 'N', '0', 'xl', '2025-01-03 15:12:29', '', NULL, NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (149, 0, '提示', '1', 'message_type', NULL, 'success', 'N', '0', 'xl', '2025-01-03 15:12:41', 'xl', '2025-01-03 15:12:45', NULL); -INSERT INTO sys_dict_data (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (150, 1, '推广', '1', 'template_type', NULL, 'success', 'N', '0', 'xl', '2025-01-03 15:13:15', '', NULL, NULL); \ No newline at end of file diff --git a/sql/postgresql/online.sql b/sql/postgresql/online.sql deleted file mode 100644 index 7a86270b6937255d711b6a2eccc8b3a1a13a5508..0000000000000000000000000000000000000000 --- a/sql/postgresql/online.sql +++ /dev/null @@ -1,131 +0,0 @@ --- ---------------------------- --- 18、在线接口表 --- ---------------------------- -DROP TABLE IF EXISTS online_mb; - -CREATE TABLE online_mb ( - mb_id bigserial PRIMARY KEY, - tag varchar(255) NULL, - tag_id varchar(255) NULL, - parameter_type varchar(255) NULL, - result_map varchar(255) NULL, - sql_text varchar(255) NULL, - path varchar(255) NULL, - method varchar(255) NULL, - result_type varchar(255) NULL, - actuator varchar(255) NULL, - user_id char(1) NULL, - dept_id char(1) NULL, - permission_type varchar(255) NULL, - permission_value varchar(255) NULL, - del_flag varchar(10) NOT NULL DEFAULT '0' -); - -COMMENT ON COLUMN online_mb.mb_id IS '主键'; -COMMENT ON COLUMN online_mb.tag IS '标签名'; -COMMENT ON COLUMN online_mb.tag_id IS '标签id'; -COMMENT ON COLUMN online_mb.parameter_type IS '参数类型'; -COMMENT ON COLUMN online_mb.result_map IS '结果类型'; -COMMENT ON COLUMN online_mb.sql_text IS 'sql语句'; -COMMENT ON COLUMN online_mb.path IS '请求路径'; -COMMENT ON COLUMN online_mb.method IS '请求方式'; -COMMENT ON COLUMN online_mb.result_type IS '响应类型'; -COMMENT ON COLUMN online_mb.actuator IS '执行器'; -COMMENT ON COLUMN online_mb.user_id IS '是否需要userId'; -COMMENT ON COLUMN online_mb.dept_id IS '是否需要deptId'; -COMMENT ON COLUMN online_mb.permission_type IS '许可类型'; -COMMENT ON COLUMN online_mb.permission_value IS '许可值'; -COMMENT ON COLUMN online_mb.del_flag IS '删除标志(0代表存在 1代表删除)'; - --- 插入菜单数据 -SELECT setval('sys_menu_menu_id_seq', max(menu_id)) FROM sys_menu WHERE menu_id < 100; -INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES ('Online', 0, 5, 'onlinedev', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'international', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - --- 获取插入的父菜单ID -DO $$ -DECLARE - parentId bigint; -BEGIN - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('Online', 0, 5, 'onlinedev', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'international', 'admin', CURRENT_TIMESTAMP, '', NULL, '') - RETURNING menu_id INTO parentId; - - -- 菜单 SQL - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('mybatis在线接口', parentId, '1', 'mb', 'online/mb/index', '', 1, 0, 'C', '0', '0', 'online:mb:list', 'code', 'admin', CURRENT_TIMESTAMP, '', NULL, 'mybatis在线接口菜单'); - - -- 获取插入的子菜单ID - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('数据库', parentId, 1, 'db', 'online/db/index', NULL, '', 1, 0, 'C', '0', '0', 'admin', 'table', 'admin', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, '') - RETURNING menu_id INTO parentId; - - -- 按钮 SQL - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('mybatis在线接口查询', parentId, '1', '#', '', '', 1, 0, 'F', '0', '0', 'online:mb:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('mybatis在线接口新增', parentId, '2', '#', '', '', 1, 0, 'F', '0', '0', 'online:mb:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('mybatis在线接口修改', parentId, '3', '#', '', '', 1, 0, 'F', '0', '0', 'online:mb:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('mybatis在线接口删除', parentId, '4', '#', '', '', 1, 0, 'F', '0', '0', 'online:mb:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('mybatis在线接口导出', parentId, '5', '#', '', '', 1, 0, 'F', '0', '0', 'online:mb:export', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); -END $$; - --- 插入字典类型 -INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -VALUES ('请求方式', 'online_api_method', '0', 'admin', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, NULL); - -INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -VALUES ('标签名', 'online_api_tag', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -VALUES ('响应类型', 'online_api_result', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -VALUES ('执行器', 'online_api_actuator', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - --- 插入字典数据 -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'POST', 'POST', 'online_api_method', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'GET', 'GET', 'online_api_method', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'PUT', 'PUT', 'online_api_method', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'DELETE', 'DELETE', 'online_api_method', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'select', 'select', 'online_api_tag', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'update', 'update', 'online_api_tag', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'insert', 'insert', 'online_api_tag', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'delete', 'delete', 'online_api_tag', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'selectList', 'selectList', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'insert', 'insert', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'selectOne', 'selectOne', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'update', 'update', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); - -INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -VALUES (0, 'delete', 'delete', 'online_api_actuator', NULL, 'default', 'N', '0', 'admin', CURRENT_TIMESTAMP, '', NULL, NULL); \ No newline at end of file diff --git a/sql/postgresql/pay.sql b/sql/postgresql/pay.sql deleted file mode 100644 index 689f5a6f9be2d8b222186c36def6565a306e7d80..0000000000000000000000000000000000000000 --- a/sql/postgresql/pay.sql +++ /dev/null @@ -1,122 +0,0 @@ --- ---------------------------- --- 订单表 --- ---------------------------- -DROP TABLE IF EXISTS pay_order; -CREATE TABLE pay_order ( - order_id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, - order_number varchar(255) NULL DEFAULT NULL, - third_number varchar(255) NULL DEFAULT NULL, - order_status varchar(255) NULL DEFAULT NULL, - total_amount varchar(255) NULL DEFAULT NULL, - actual_amount varchar(255) NULL DEFAULT NULL, - order_content varchar(255) NULL DEFAULT NULL, - order_message varchar(255) NULL DEFAULT NULL, - create_by varchar(64) default '', - create_time timestamp default CURRENT_TIMESTAMP, - update_by varchar(64) default '', - update_time timestamp default CURRENT_TIMESTAMP, - remark varchar(500) default null -); - -COMMENT ON COLUMN pay_order.order_id IS '订单id'; -COMMENT ON COLUMN pay_order.order_number IS '订单号'; -COMMENT ON COLUMN pay_order.third_number IS '第三方订单号'; -COMMENT ON COLUMN pay_order.order_status IS '订单状态'; -COMMENT ON COLUMN pay_order.total_amount IS '订单总金额'; -COMMENT ON COLUMN pay_order.actual_amount IS '实际支付金额'; -COMMENT ON COLUMN pay_order.order_content IS '订单内容'; -COMMENT ON COLUMN pay_order.order_message IS '负载信息'; -COMMENT ON COLUMN pay_order.create_by IS '创建者'; -COMMENT ON COLUMN pay_order.create_time IS '创建时间'; -COMMENT ON COLUMN pay_order.update_by IS '更新者'; -COMMENT ON COLUMN pay_order.update_time IS '更新时间'; -COMMENT ON COLUMN pay_order.remark IS '备注'; - --- ---------------------------- --- 发票表 --- ---------------------------- -DROP TABLE IF EXISTS pay_invoice; -CREATE TABLE pay_invoice ( - invoice_id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, - order_number varchar(255) NULL DEFAULT NULL, - invoice_type varchar(255) NULL DEFAULT NULL, - invoice_header varchar(255) NULL DEFAULT NULL, - invoice_number varchar(255) NULL DEFAULT NULL, - invoice_phone varchar(255) NULL DEFAULT NULL, - invoice_email varchar(255) NULL DEFAULT NULL, - invoice_remark varchar(255) NULL DEFAULT NULL, - create_by varchar(64) default '', - create_time timestamp default CURRENT_TIMESTAMP, - update_by varchar(64) default '', - update_time timestamp default CURRENT_TIMESTAMP, - remark varchar(500) default null -); - -COMMENT ON COLUMN pay_invoice.invoice_id IS '发票id'; -COMMENT ON COLUMN pay_invoice.order_number IS '订单号'; -COMMENT ON COLUMN pay_invoice.invoice_type IS '发票类型'; -COMMENT ON COLUMN pay_invoice.invoice_header IS '发票抬头'; -COMMENT ON COLUMN pay_invoice.invoice_number IS '纳税人识别号'; -COMMENT ON COLUMN pay_invoice.invoice_phone IS '收票人手机号'; -COMMENT ON COLUMN pay_invoice.invoice_email IS '收票人邮箱'; -COMMENT ON COLUMN pay_invoice.invoice_remark IS '发票备注'; -COMMENT ON COLUMN pay_invoice.create_by IS '创建者'; -COMMENT ON COLUMN pay_invoice.create_time IS '创建时间'; -COMMENT ON COLUMN pay_invoice.update_by IS '更新者'; -COMMENT ON COLUMN pay_invoice.update_time IS '更新时间'; -COMMENT ON COLUMN pay_invoice.remark IS '备注'; - -SELECT setval('sys_menu_menu_id_seq', max(menu_id)) FROM sys_menu WHERE menu_id < 100; --- 插入支付管理菜单 -INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -VALUES ('支付管理', 0, 4, 'pay', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'money', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); -DO $$ -DECLARE - parentId INTEGER; - payParentId INTEGER; -BEGIN - SELECT LASTVAL() INTO parentId; - SELECT LASTVAL() INTO payParentId; - - -- 插入订单菜单 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('订单', payParentId, '1', 'order', 'pay/order/index', '', 1, 0, 'C', '0', '0', 'pay:order:list', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, '订单菜单') - RETURNING menu_id INTO parentId; - - -- 插入订单按钮 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('订单查询', parentId, '1', '#', '', '', 1, 0, 'F', '0', '0', 'pay:order:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('订单新增', parentId, '2', '#', '', '', 1, 0, 'F', '0', '0', 'pay:order:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('订单修改', parentId, '3', '#', '', '', 1, 0, 'F', '0', '0', 'pay:order:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('订单删除', parentId, '4', '#', '', '', 1, 0, 'F', '0', '0', 'pay:order:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('订单导出', parentId, '5', '#', '', '', 1, 0, 'F', '0', '0', 'pay:order:export', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - -- 插入发票菜单 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('发票', parentId, '1', 'invoice', 'pay/invoice/index', '', 1, 0, 'C', '0', '0', 'pay:invoice:list', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, '发票菜单') - RETURNING menu_id INTO parentId; - - -- 插入发票按钮 - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('发票查询', payParentId, '1', '#', '', '', 1, 0, 'F', '0', '0', 'pay:invoice:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('发票新增', parentId, '2', '#', '', '', 1, 0, 'F', '0', '0', 'pay:invoice:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('发票修改', parentId, '3', '#', '', '', 1, 0, 'F', '0', '0', 'pay:invoice:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('发票删除', parentId, '4', '#', '', '', 1, 0, 'F', '0', '0', 'pay:invoice:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); - - INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) - VALUES ('发票导出', parentId, '5', '#', '', '', 1, 0, 'F', '0', '0', 'pay:invoice:export', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); -END $$; \ No newline at end of file diff --git a/sql/postgresql/quartz.sql b/sql/postgresql/quartz.sql deleted file mode 100644 index d499e02e7cdfc8ae3b7bded2c24bf90aded68d00..0000000000000000000000000000000000000000 --- a/sql/postgresql/quartz.sql +++ /dev/null @@ -1,263 +0,0 @@ -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; - --- ---------------------------- --- 1、存储每一个已配置的 jobDetail 的详细信息 --- ---------------------------- - -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 bytea NULL, - PRIMARY KEY (sched_name, job_name, job_group) -); - -COMMENT ON COLUMN QRTZ_JOB_DETAILS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_JOB_DETAILS.job_name IS '任务名称'; -COMMENT ON COLUMN QRTZ_JOB_DETAILS.job_group IS '任务组名'; -COMMENT ON COLUMN QRTZ_JOB_DETAILS.description IS '相关介绍'; -COMMENT ON COLUMN QRTZ_JOB_DETAILS.job_class_name IS '执行任务类名称'; -COMMENT ON COLUMN QRTZ_JOB_DETAILS.is_durable IS '是否持久化'; -COMMENT ON COLUMN QRTZ_JOB_DETAILS.is_nonconcurrent IS '是否并发'; -COMMENT ON COLUMN QRTZ_JOB_DETAILS.is_update_data IS '是否更新数据'; -COMMENT ON COLUMN QRTZ_JOB_DETAILS.requests_recovery IS '是否接受恢复执行'; -COMMENT ON COLUMN QRTZ_JOB_DETAILS.job_data IS '存放持久化job对象'; - --- ---------------------------- --- 2、 存储已配置的 Trigger 的信息 --- ---------------------------- -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) -); - -COMMENT ON COLUMN QRTZ_TRIGGERS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_TRIGGERS.trigger_name IS '触发器的名字'; -COMMENT ON COLUMN QRTZ_TRIGGERS.trigger_group IS '触发器所属组的名字'; -COMMENT ON COLUMN QRTZ_TRIGGERS.job_name IS 'qrtz_job_details表job_name的外键'; -COMMENT ON COLUMN QRTZ_TRIGGERS.job_group IS 'qrtz_job_details表job_group的外键'; -COMMENT ON COLUMN QRTZ_TRIGGERS.description IS '相关介绍'; -COMMENT ON COLUMN QRTZ_TRIGGERS.next_fire_time IS '上一次触发时间(毫秒)'; -COMMENT ON COLUMN QRTZ_TRIGGERS.prev_fire_time IS '下一次触发时间(默认为-1表示不触发)'; -COMMENT ON COLUMN QRTZ_TRIGGERS.priority IS '优先级'; -COMMENT ON COLUMN QRTZ_TRIGGERS.trigger_state IS '触发器状态'; -COMMENT ON COLUMN QRTZ_TRIGGERS.trigger_type IS '触发器的类型'; -COMMENT ON COLUMN QRTZ_TRIGGERS.start_time IS '开始时间'; -COMMENT ON COLUMN QRTZ_TRIGGERS.end_time IS '结束时间'; -COMMENT ON COLUMN QRTZ_TRIGGERS.calendar_name IS '日程表名称'; -COMMENT ON COLUMN QRTZ_TRIGGERS.misfire_instr IS '补偿执行的策略'; -COMMENT ON COLUMN QRTZ_TRIGGERS.job_data IS '存放持久化job对象'; - --- ---------------------------- --- 3、 存储简单的 Trigger,包括重复次数,间隔,以及已触发的次数 --- ---------------------------- -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) -); - -COMMENT ON COLUMN QRTZ_SIMPLE_TRIGGERS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_SIMPLE_TRIGGERS.trigger_name IS 'qrtz_triggers表trigger_name的外键'; -COMMENT ON COLUMN QRTZ_SIMPLE_TRIGGERS.trigger_group IS 'qrtz_triggers表trigger_group的外键'; -COMMENT ON COLUMN QRTZ_SIMPLE_TRIGGERS.repeat_count IS '重复的次数统计'; -COMMENT ON COLUMN QRTZ_SIMPLE_TRIGGERS.repeat_interval IS '重复的间隔时间'; -COMMENT ON COLUMN QRTZ_SIMPLE_TRIGGERS.times_triggered IS '已经触发的次数'; - --- ---------------------------- --- 4、 存储 Cron Trigger,包括 Cron 表达式和时区信息 --- ---------------------------- -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) 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) -); - -COMMENT ON COLUMN QRTZ_CRON_TRIGGERS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_CRON_TRIGGERS.trigger_name IS 'qrtz_triggers表trigger_name的外键'; -COMMENT ON COLUMN QRTZ_CRON_TRIGGERS.trigger_group IS 'qrtz_triggers表trigger_group的外键'; -COMMENT ON COLUMN QRTZ_CRON_TRIGGERS.cron_expression IS 'cron表达式'; -COMMENT ON COLUMN QRTZ_CRON_TRIGGERS.time_zone_id IS '时区'; - --- ---------------------------- --- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型,JobStore 并不知道如何存储实例的时候) --- ---------------------------- -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) -); - -COMMENT ON COLUMN QRTZ_BLOB_TRIGGERS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_BLOB_TRIGGERS.trigger_name IS 'qrtz_triggers表trigger_name的外键'; -COMMENT ON COLUMN QRTZ_BLOB_TRIGGERS.trigger_group IS 'qrtz_triggers表trigger_group的外键'; -COMMENT ON COLUMN QRTZ_BLOB_TRIGGERS.blob_data IS '存放持久化Trigger对象'; - --- ---------------------------- --- 6、 以 Blob 类型存储存放日历信息, quartz可配置一个日历来指定一个时间范围 --- ---------------------------- -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) -); - -COMMENT ON COLUMN QRTZ_CALENDARS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_CALENDARS.calendar_name IS '日历名称'; -COMMENT ON COLUMN QRTZ_CALENDARS.calendar IS '存放持久化calendar对象'; - --- ---------------------------- --- 7、 存储已暂停的 Trigger 组的信息 --- ---------------------------- -CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS ( - sched_name varchar(120) NOT NULL, - trigger_group varchar(200) NOT NULL, - PRIMARY KEY (sched_name, trigger_group) -); - -COMMENT ON COLUMN QRTZ_PAUSED_TRIGGER_GRPS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_PAUSED_TRIGGER_GRPS.trigger_group IS 'qrtz_triggers表trigger_group的外键'; - --- ---------------------------- --- 8、 存储与已触发的 Trigger 相关的状态信息,以及相联 Job 的执行信息 --- ---------------------------- -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 varchar(1) NULL, - requests_recovery varchar(1) NULL, - PRIMARY KEY (sched_name, entry_id) -); - -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.entry_id IS '调度器实例id'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.trigger_name IS 'qrtz_triggers表trigger_name的外键'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.trigger_group IS 'qrtz_triggers表trigger_group的外键'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.instance_name IS '调度器实例名'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.fired_time IS '触发的时间'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.sched_time IS '定时器制定的时间'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.priority IS '优先级'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.state IS '状态'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.job_name IS '任务名称'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.job_group IS '任务组名'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.is_nonconcurrent IS '是否并发'; -COMMENT ON COLUMN QRTZ_FIRED_TRIGGERS.requests_recovery IS '是否接受恢复执行'; - --- ---------------------------- --- 9、 存储少量的有关 Scheduler 的状态信息,假如是用于集群中,可以看到其他的 Scheduler 实例 --- ---------------------------- -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) -); - -COMMENT ON COLUMN QRTZ_SCHEDULER_STATE.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_SCHEDULER_STATE.instance_name IS '实例名称'; -COMMENT ON COLUMN QRTZ_SCHEDULER_STATE.last_checkin_time IS '上次检查时间'; -COMMENT ON COLUMN QRTZ_SCHEDULER_STATE.checkin_interval IS '检查间隔时间'; - --- ---------------------------- --- 10、 存储程序的悲观锁的信息(假如使用了悲观锁) --- ---------------------------- -CREATE TABLE QRTZ_LOCKS ( - sched_name varchar(120) NOT NULL, - lock_name varchar(40) NOT NULL, - PRIMARY KEY (sched_name, lock_name) -); - -COMMENT ON COLUMN QRTZ_LOCKS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_LOCKS.lock_name IS '悲观锁名称'; - --- ---------------------------- --- 11、 Quartz集群实现同步机制的行锁表 --- ---------------------------- -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) -); - -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.sched_name IS '调度名称'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.trigger_name IS 'qrtz_triggers表trigger_name的外键'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.trigger_group IS 'qrtz_triggers表trigger_group的外键'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.str_prop_1 IS 'String类型的trigger的第一个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.str_prop_2 IS 'String类型的trigger的第二个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.str_prop_3 IS 'String类型的trigger的第三个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.int_prop_1 IS 'int类型的trigger的第一个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.int_prop_2 IS 'int类型的trigger的第二个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.long_prop_1 IS 'long类型的trigger的第一个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.long_prop_2 IS 'long类型的trigger的第二个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.dec_prop_1 IS 'decimal类型的trigger的第一个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.dec_prop_2 IS 'decimal类型的trigger的第二个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.bool_prop_1 IS 'Boolean类型的trigger的第一个参数'; -COMMENT ON COLUMN QRTZ_SIMPROP_TRIGGERS.bool_prop_2 IS 'Boolean类型的trigger的第二个参数'; \ No newline at end of file diff --git a/sql/postgresql/ry_20230223.sql b/sql/postgresql/ry_20230223.sql deleted file mode 100644 index 69b33b4cf929a0100c3ca0666b87464e46fca7b2..0000000000000000000000000000000000000000 --- a/sql/postgresql/ry_20230223.sql +++ /dev/null @@ -1,1012 +0,0 @@ --- ---------------------------- --- 1、部门表 --- ---------------------------- -drop table if exists sys_dept cascade; - -create table sys_dept ( - dept_id bigserial not null primary key, - parent_id bigint default 0 , - ancestors varchar(50) default '' , - dept_name varchar(30) default '' , - order_num integer default 0 , - leader varchar(20) default null, - phone varchar(11) default null, - email varchar(50) default null, - status char(1) default '0' , - del_flag char(1) default '0' , - create_by varchar(64) default '', - create_time timestamp default current_timestamp, - update_by varchar(64) default '', - update_time timestamp default current_timestamp -); - -comment on column sys_dept.dept_id is '部门id'; -comment on column sys_dept.parent_id is '父部门id'; -comment on column sys_dept.ancestors is '祖级列表'; -comment on column sys_dept.dept_name is '部门名称'; -comment on column sys_dept.order_num is '显示顺序'; -comment on column sys_dept.leader is '负责人'; -comment on column sys_dept.phone is '联系电话'; -comment on column sys_dept.email is '邮箱'; -comment on column sys_dept.status is '部门状态(0正常 1停用)'; -comment on column sys_dept.del_flag is '删除标志(0代表存在 2代表删除)'; -comment on column sys_dept.create_by is '创建者'; -comment on column sys_dept.create_time is '创建时间'; -comment on column sys_dept.update_by is '更新者'; -comment on column sys_dept.update_time is '更新时间'; - -comment on table sys_dept is '部门表'; - --- ---------------------------- --- 初始化-部门表数据 --- ---------------------------- -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); -insert into sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -values(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', current_timestamp, '', null); - --- ---------------------------- --- 2、用户信息表 --- ---------------------------- -drop table if exists sys_user cascade; - -create table sys_user ( - user_id bigserial not null primary key, - dept_id bigint default null, - user_name varchar(30) not null, - nick_name varchar(30) not null, - user_type varchar(2) default '00', - email varchar(50) default '', - phonenumber varchar(11) default '', - sex char(1) default '0', - avatar varchar(100) default '', - password varchar(100) default '', - status char(1) default '0', - del_flag char(1) default '0', - login_ip varchar(128) default '', - login_date timestamp, - create_by varchar(64) default '', - create_time timestamp default current_timestamp, - update_by varchar(64) default '', - update_time timestamp default current_timestamp, - remark varchar(500) default null -); - -comment on column sys_user.user_id is '用户ID'; -comment on column sys_user.dept_id is '部门ID'; -comment on column sys_user.user_name is '用户账号'; -comment on column sys_user.nick_name is '用户昵称'; -comment on column sys_user.user_type is '用户类型(00系统用户)'; -comment on column sys_user.email is '用户邮箱'; -comment on column sys_user.phonenumber is '手机号码'; -comment on column sys_user.sex is '用户性别(0男 1女 2未知)'; -comment on column sys_user.avatar is '头像地址'; -comment on column sys_user.password is '密码'; -comment on column sys_user.status is '帐号状态(0正常 1停用)'; -comment on column sys_user.del_flag is '删除标志(0代表存在 2代表删除)'; -comment on column sys_user.login_ip is '最后登录IP'; -comment on column sys_user.login_date is '最后登录时间'; -comment on column sys_user.create_by is '创建者'; -comment on column sys_user.create_time is '创建时间'; -comment on column sys_user.update_by is '更新者'; -comment on column sys_user.update_time is '更新时间'; -comment on column sys_user.remark is '备注'; - -comment on table sys_user is '用户信息表'; - --- ---------------------------- --- 初始化-用户信息表数据 --- ---------------------------- -insert into sys_user (user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) -values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', current_timestamp, 'admin', current_timestamp, '', null, '管理员'); -insert into sys_user (user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) -values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', current_timestamp, 'admin', current_timestamp, '', null, '测试员'); - --- ---------------------------- --- 3、岗位信息表 --- ---------------------------- -drop table if exists sys_post cascade; - -create table sys_post ( - post_id bigserial not null primary key, - post_code varchar(64) not null, - post_name varchar(50) not null, - post_sort integer not null, - status char(1) not null, - create_by varchar(64) default '', - create_time timestamp default current_timestamp, - update_by varchar(64) default '', - update_time timestamp default current_timestamp, - remark varchar(500) default null -); - -comment on column sys_post.post_id is '岗位ID'; -comment on column sys_post.post_code is '岗位编码'; -comment on column sys_post.post_name is '岗位名称'; -comment on column sys_post.post_sort is '显示顺序'; -comment on column sys_post.status is '状态(0正常 1停用)'; -comment on column sys_post.create_by is '创建者'; -comment on column sys_post.create_time is '创建时间'; -comment on column sys_post.update_by is '更新者'; -comment on column sys_post.update_time is '更新时间'; -comment on column sys_post.remark is '备注'; - -comment on table sys_post is '岗位信息表'; - --- ---------------------------- --- 初始化-岗位信息表数据 --- ---------------------------- -insert into sys_post (post_id, post_code, post_name, post_sort, status, create_by, create_time, update_by, update_time, remark) -values(1, 'ceo', '董事长', 1, '0', 'admin', current_timestamp, '', null, ''); -insert into sys_post (post_id, post_code, post_name, post_sort, status, create_by, create_time, update_by, update_time, remark) -values(2, 'se', '项目经理', 2, '0', 'admin', current_timestamp, '', null, ''); -insert into sys_post (post_id, post_code, post_name, post_sort, status, create_by, create_time, update_by, update_time, remark) -values(3, 'hr', '人力资源', 3, '0', 'admin', current_timestamp, '', null, ''); -insert into sys_post (post_id, post_code, post_name, post_sort, status, create_by, create_time, update_by, update_time, remark) -values(4, 'user', '普通员工', 4, '0', 'admin', current_timestamp, '', null, ''); - - --- ---------------------------- --- 4、角色信息表 --- ---------------------------- -drop table if exists sys_role cascade; - -create table sys_role ( - role_id bigserial not null primary key, - role_name varchar(30) not null, - role_key varchar(100) not null, - role_sort integer not null, - data_scope char(1) default '1', - menu_check_strictly boolean default true, - dept_check_strictly boolean default true, - status char(1) not null, - del_flag char(1) default '0', - create_by varchar(64) default '', - create_time timestamp default current_timestamp, - update_by varchar(64) default '', - update_time timestamp default current_timestamp, - remark varchar(500) default null -); - -comment on column sys_role.role_id is '角色ID'; -comment on column sys_role.role_name is '角色名称'; -comment on column sys_role.role_key is '角色权限字符串'; -comment on column sys_role.role_sort is '显示顺序'; -comment on column sys_role.data_scope is '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)'; -comment on column sys_role.menu_check_strictly is '菜单树选择项是否关联显示'; -comment on column sys_role.dept_check_strictly is '部门树选择项是否关联显示'; -comment on column sys_role.status is '角色状态(0正常 1停用)'; -comment on column sys_role.del_flag is '删除标志(0代表存在 2代表删除)'; -comment on column sys_role.create_by is '创建者'; -comment on column sys_role.create_time is '创建时间'; -comment on column sys_role.update_by is '更新者'; -comment on column sys_role.update_time is '更新时间'; -comment on column sys_role.remark is '备注'; - -comment on table sys_role is '角色信息表'; - --- ---------------------------- --- 初始化-角色信息表数据 --- ---------------------------- -insert into sys_role (role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, create_by, create_time, update_by, update_time, remark) -values(1, '超级管理员', 'admin', 1, '1', true, true, '0', '0', 'admin', current_timestamp, '', null, '超级管理员'); -insert into sys_role (role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, create_by, create_time, update_by, update_time, remark) -values(2, '普通角色', 'common', 2, '2', true, true, '0', '0', 'admin', current_timestamp, '', null, '普通角色'); - - --- ---------------------------- --- 5、菜单权限表 --- ---------------------------- -drop table if exists sys_menu cascade; - -create table sys_menu ( - menu_id bigserial not null primary key, - menu_name varchar(50) not null, - parent_id bigint default 0, - order_num integer default 0, - path varchar(200) default '', - component varchar(255) default null, - query varchar(255) default null, - route_name varchar(50) default '', - is_frame char(1) default '1', - is_cache char(1) default '0', - menu_type char(1) default '', - visible char(1) default '0', - status char(1) default '0', - perms varchar(100) default null, - icon varchar(100) default '#', - create_by varchar(64) default '', - create_time timestamp default current_timestamp, - update_by varchar(64) default '', - update_time timestamp default current_timestamp, - remark varchar(500) default '' -); - -comment on column sys_menu.menu_id is '菜单ID'; -comment on column sys_menu.menu_name is '菜单名称'; -comment on column sys_menu.parent_id is '父菜单ID'; -comment on column sys_menu.order_num is '显示顺序'; -comment on column sys_menu.path is '路由地址'; -comment on column sys_menu.component is '组件路径'; -comment on column sys_menu.query is '路由参数'; -comment on column sys_menu.route_name is '路由名称'; -comment on column sys_menu.is_frame is '是否为外链(0是 1否)'; -comment on column sys_menu.is_cache is '是否缓存(0缓存 1不缓存)'; -comment on column sys_menu.menu_type is '菜单类型(M目录 C菜单 F按钮)'; -comment on column sys_menu.visible is '菜单状态(0显示 1隐藏)'; -comment on column sys_menu.status is '菜单状态(0正常 1停用)'; -comment on column sys_menu.perms is '权限标识'; -comment on column sys_menu.icon is '菜单图标'; -comment on column sys_menu.create_by is '创建者'; -comment on column sys_menu.create_time is '创建时间'; -comment on column sys_menu.update_by is '更新者'; -comment on column sys_menu.update_time is '更新时间'; -comment on column sys_menu.remark is '备注'; - -comment on table sys_menu is '菜单权限表'; - --- ---------------------------- --- 初始化-菜单信息表数据 --- ---------------------------- --- 一级菜单 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1, '系统管理', 0, 1, 'system', null, '', '', 1, 0, 'M', '0', '0', '', 'system', 'admin', current_timestamp, '', null, '系统管理目录'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(2, '系统监控', 0, 2, 'monitor', null, '', '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', current_timestamp, '', null, '系统监控目录'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(3, '系统工具', 0, 3, 'tool', null, '', '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', current_timestamp, '', null, '系统工具目录'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(4, '若依官网', 0, 4, 'http://ruoyi.vip', null, '', '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', current_timestamp, '', null, '若依官网地址'); - --- 二级菜单 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(100, '用户管理', 1, 1, 'user', 'system/user/index', '', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', current_timestamp, '', null, '用户管理菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(101, '角色管理', 1, 2, 'role', 'system/role/index', '', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', current_timestamp, '', null, '角色管理菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(102, '菜单管理', 1, 3, 'menu', 'system/menu/index', '', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', current_timestamp, '', null, '菜单管理菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(103, '部门管理', 1, 4, 'dept', 'system/dept/index', '', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', current_timestamp, '', null, '部门管理菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(104, '岗位管理', 1, 5, 'post', 'system/post/index', '', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', current_timestamp, '', null, '岗位管理菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(105, '字典管理', 1, 6, 'dict', 'system/dict/index', '', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', current_timestamp, '', null, '字典管理菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(106, '参数设置', 1, 7, 'config', 'system/config/index', '', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', current_timestamp, '', null, '参数设置菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(107, '通知公告', 1, 8, 'notice', 'system/notice/index', '', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', current_timestamp, '', null, '通知公告菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(108, '日志管理', 1, 9, 'log', '', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', current_timestamp, '', null, '日志管理菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(109, '在线用户', 2, 1, 'online', 'monitor/online/index', '', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', current_timestamp, '', null, '在线用户菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(110, '定时任务', 2, 2, 'job', 'monitor/job/index', '', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', current_timestamp, '', null, '定时任务菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(111, '数据监控', 2, 3, 'druid', 'monitor/druid/index', '', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', current_timestamp, '', null, '数据监控菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(112, '服务监控', 2, 4, 'server', 'monitor/server/index', '', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', current_timestamp, '', null, '服务监控菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', current_timestamp, '', null, '缓存监控菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(114, '缓存列表', 2, 6, 'cacheList', 'monitor/cache/list', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis-list', 'admin', current_timestamp, '', null, '缓存列表菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(115, '表单构建', 3, 1, 'build', 'tool/build/index', '', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', current_timestamp, '', null, '表单构建菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(117, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', '', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', current_timestamp, '', null, '系统接口菜单'); --- 三级菜单 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', '', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', current_timestamp, '', null, '操作日志菜单'); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(501, '登录日志', 108, 2, 'logininfor', 'monitor/logininfor/index', '', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', current_timestamp, '', null, '登录日志菜单'); - --- 用户管理按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1000, '用户查询', 100, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1001, '用户新增', 100, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1002, '用户修改', 100, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1003, '用户删除', 100, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1004, '用户导出', 100, 5, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1005, '用户导入', 100, 6, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1006, '重置密码', 100, 7, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', current_timestamp, '', null, ''); - --- 角色管理按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1007, '角色查询', 101, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1008, '角色新增', 101, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1009, '角色修改', 101, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1010, '角色删除', 101, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1011, '角色导出', 101, 5, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', current_timestamp, '', null, ''); - --- 菜单管理按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1012, '菜单查询', 102, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1013, '菜单新增', 102, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1014, '菜单修改', 102, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1015, '菜单删除', 102, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', current_timestamp, '', null, ''); - --- 部门管理按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1016, '部门查询', 103, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1017, '部门新增', 103, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1018, '部门修改', 103, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1019, '部门删除', 103, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', current_timestamp, '', null, ''); --- 岗位管理按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1020, '岗位查询', 104, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1021, '岗位新增', 104, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1022, '岗位修改', 104, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1023, '岗位删除', 104, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1024, '岗位导出', 104, 5, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', current_timestamp, '', null, ''); - --- 字典管理按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1025, '字典查询', 105, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1026, '字典新增', 105, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1027, '字典修改', 105, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1028, '字典删除', 105, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1029, '字典导出', 105, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', current_timestamp, '', null, ''); - --- 参数设置按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1030, '参数查询', 106, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1031, '参数新增', 106, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1032, '参数修改', 106, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1033, '参数删除', 106, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1034, '参数导出', 106, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', current_timestamp, '', null, ''); - --- 通知公告按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1035, '公告查询', 107, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1036, '公告新增', 107, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1037, '公告修改', 107, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1038, '公告删除', 107, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', current_timestamp, '', null, ''); - --- 操作日志按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1039, '操作查询', 500, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1040, '操作删除', 500, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1041, '日志导出', 500, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', current_timestamp, '', null, ''); - --- 登录日志按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1042, '登录查询', 501, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1043, '登录删除', 501, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1044, '日志导出', 501, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', current_timestamp, '', null, ''); - --- 在线用户按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1046, '在线查询', 109, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1047, '批量强退', 109, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1048, '单条强退', 109, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', current_timestamp, '', null, ''); - --- 定时任务按钮 -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1049, '任务查询', 110, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1050, '任务新增', 110, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1051, '任务修改', 110, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1052, '任务删除', 110, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1053, '状态修改', 110, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', current_timestamp, '', null, ''); -insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values(1054, '任务导出', 110, 6, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', current_timestamp, '', null, ''); - - - --- ---------------------------- --- 6、用户和角色关联表 用户N-1角色 --- ---------------------------- -drop table if exists sys_user_role cascade; - -create table sys_user_role ( - user_id bigint not null, - role_id bigint not null, - primary key(user_id, role_id) -); - -comment on table sys_user_role is '用户和角色关联表'; -comment on column sys_user_role.user_id is '用户ID'; -comment on column sys_user_role.role_id is '角色ID'; - --- ---------------------------- --- 初始化-用户和角色关联表数据 --- ---------------------------- -insert into sys_user_role (user_id, role_id) values (1, 1); -insert into sys_user_role (user_id, role_id) values (2, 2); - --- ---------------------------- --- 7、角色和菜单关联表 角色1-N菜单 --- ---------------------------- -drop table if exists sys_role_menu cascade; - -create table sys_role_menu ( - role_id bigint not null, - menu_id bigint not null, - primary key(role_id, 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'; - --- ---------------------------- --- 初始化-角色和菜单关联表数据 --- ---------------------------- -insert into sys_role_menu (role_id, menu_id) values (2, 1); -insert into sys_role_menu (role_id, menu_id) values (2, 2); -insert into sys_role_menu (role_id, menu_id) values (2, 3); -insert into sys_role_menu (role_id, menu_id) values (2, 4); -insert into sys_role_menu (role_id, menu_id) values (2, 100); -insert into sys_role_menu (role_id, menu_id) values (2, 101); -insert into sys_role_menu (role_id, menu_id) values (2, 102); -insert into sys_role_menu (role_id, menu_id) values (2, 103); -insert into sys_role_menu (role_id, menu_id) values (2, 104); -insert into sys_role_menu (role_id, menu_id) values (2, 105); -insert into sys_role_menu (role_id, menu_id) values (2, 106); -insert into sys_role_menu (role_id, menu_id) values (2, 107); -insert into sys_role_menu (role_id, menu_id) values (2, 108); -insert into sys_role_menu (role_id, menu_id) values (2, 109); -insert into sys_role_menu (role_id, menu_id) values (2, 110); -insert into sys_role_menu (role_id, menu_id) values (2, 111); -insert into sys_role_menu (role_id, menu_id) values (2, 112); -insert into sys_role_menu (role_id, menu_id) values (2, 113); -insert into sys_role_menu (role_id, menu_id) values (2, 114); -insert into sys_role_menu (role_id, menu_id) values (2, 115); -insert into sys_role_menu (role_id, menu_id) values (2, 116); -insert into sys_role_menu (role_id, menu_id) values (2, 117); -insert into sys_role_menu (role_id, menu_id) values (2, 500); -insert into sys_role_menu (role_id, menu_id) values (2, 501); -insert into sys_role_menu (role_id, menu_id) values (2, 1000); -insert into sys_role_menu (role_id, menu_id) values (2, 1001); -insert into sys_role_menu (role_id, menu_id) values (2, 1002); -insert into sys_role_menu (role_id, menu_id) values (2, 1003); -insert into sys_role_menu (role_id, menu_id) values (2, 1004); -insert into sys_role_menu (role_id, menu_id) values (2, 1005); -insert into sys_role_menu (role_id, menu_id) values (2, 1006); -insert into sys_role_menu (role_id, menu_id) values (2, 1007); -insert into sys_role_menu (role_id, menu_id) values (2, 1008); -insert into sys_role_menu (role_id, menu_id) values (2, 1009); -insert into sys_role_menu (role_id, menu_id) values (2, 1010); -insert into sys_role_menu (role_id, menu_id) values (2, 1011); -insert into sys_role_menu (role_id, menu_id) values (2, 1012); -insert into sys_role_menu (role_id, menu_id) values (2, 1013); -insert into sys_role_menu (role_id, menu_id) values (2, 1014); -insert into sys_role_menu (role_id, menu_id) values (2, 1015); -insert into sys_role_menu (role_id, menu_id) values (2, 1016); -insert into sys_role_menu (role_id, menu_id) values (2, 1017); -insert into sys_role_menu (role_id, menu_id) values (2, 1018); -insert into sys_role_menu (role_id, menu_id) values (2, 1019); -insert into sys_role_menu (role_id, menu_id) values (2, 1020); -insert into sys_role_menu (role_id, menu_id) values (2, 1021); -insert into sys_role_menu (role_id, menu_id) values (2, 1022); -insert into sys_role_menu (role_id, menu_id) values (2, 1023); -insert into sys_role_menu (role_id, menu_id) values (2, 1024); -insert into sys_role_menu (role_id, menu_id) values (2, 1025); -insert into sys_role_menu (role_id, menu_id) values (2, 1026); -insert into sys_role_menu (role_id, menu_id) values (2, 1027); -insert into sys_role_menu (role_id, menu_id) values (2, 1028); -insert into sys_role_menu (role_id, menu_id) values (2, 1029); -insert into sys_role_menu (role_id, menu_id) values (2, 1030); -insert into sys_role_menu (role_id, menu_id) values (2, 1031); -insert into sys_role_menu (role_id, menu_id) values (2, 1032); -insert into sys_role_menu (role_id, menu_id) values (2, 1033); -insert into sys_role_menu (role_id, menu_id) values (2, 1034); -insert into sys_role_menu (role_id, menu_id) values (2, 1035); -insert into sys_role_menu (role_id, menu_id) values (2, 1036); -insert into sys_role_menu (role_id, menu_id) values (2, 1037); -insert into sys_role_menu (role_id, menu_id) values (2, 1038); -insert into sys_role_menu (role_id, menu_id) values (2, 1039); -insert into sys_role_menu (role_id, menu_id) values (2, 1040); -insert into sys_role_menu (role_id, menu_id) values (2, 1041); -insert into sys_role_menu (role_id, menu_id) values (2, 1042); -insert into sys_role_menu (role_id, menu_id) values (2, 1043); -insert into sys_role_menu (role_id, menu_id) values (2, 1044); -insert into sys_role_menu (role_id, menu_id) values (2, 1045); -insert into sys_role_menu (role_id, menu_id) values (2, 1046); -insert into sys_role_menu (role_id, menu_id) values (2, 1047); -insert into sys_role_menu (role_id, menu_id) values (2, 1048); -insert into sys_role_menu (role_id, menu_id) values (2, 1049); -insert into sys_role_menu (role_id, menu_id) values (2, 1050); -insert into sys_role_menu (role_id, menu_id) values (2, 1051); -insert into sys_role_menu (role_id, menu_id) values (2, 1052); -insert into sys_role_menu (role_id, menu_id) values (2, 1053); -insert into sys_role_menu (role_id, menu_id) values (2, 1054); -insert into sys_role_menu (role_id, menu_id) values (2, 1055); -insert into sys_role_menu (role_id, menu_id) values (2, 1056); -insert into sys_role_menu (role_id, menu_id) values (2, 1057); -insert into sys_role_menu (role_id, menu_id) values (2, 1058); -insert into sys_role_menu (role_id, menu_id) values (2, 1059); -insert into sys_role_menu (role_id, menu_id) values (2, 1060); --- ---------------------------- --- 8、角色和部门关联表 角色1-N部门 --- ---------------------------- -drop table if exists sys_role_dept cascade; - -create table sys_role_dept ( - role_id bigint not null, - dept_id bigint not null, - primary key(role_id, dept_id) -); - -comment on table sys_role_dept is '角色和部门关联表'; -comment on column sys_role_dept.role_id is '角色ID'; -comment on column sys_role_dept.dept_id is '部门ID'; - --- ---------------------------- --- 初始化-角色和部门关联表数据 --- ---------------------------- -insert into sys_role_dept (role_id, dept_id) values (2, 100); -insert into sys_role_dept (role_id, dept_id) values (2, 101); -insert into sys_role_dept (role_id, dept_id) values (2, 105); - --- ---------------------------- --- 9、用户与岗位关联表 用户1-N岗位 --- ---------------------------- -drop table if exists sys_user_post cascade; - -create table sys_user_post ( - user_id bigint not null, - post_id bigint not null, - primary key (user_id, post_id) -); - -comment on table sys_user_post is '用户与岗位关联表'; -comment on column sys_user_post.user_id is '用户ID'; -comment on column sys_user_post.post_id is '岗位ID'; - --- ---------------------------- --- 初始化-用户与岗位关联表数据 --- ---------------------------- -insert into sys_user_post (user_id, post_id) values (1, 1); -insert into sys_user_post (user_id, post_id) values (2, 2); - --- ---------------------------- --- 10、操作日志记录 --- ---------------------------- -drop table if exists sys_oper_log cascade; - -create table sys_oper_log ( - oper_id bigserial not null primary key, - title varchar(50) default '' , - business_type smallint default 0 , - method varchar(100) default '' , - request_method varchar(10) default '' , - operator_type smallint default 0 , - oper_name varchar(50) default '' , - dept_name varchar(50) default '' , - oper_url varchar(255) default '' , - oper_ip varchar(128) default '' , - oper_location varchar(255) default '' , - oper_param varchar(2000) default '' , - json_result varchar(2000) default '' , - status smallint default 0 , - error_msg varchar(2000) default '' , - oper_time timestamp default current_timestamp , - cost_time bigint default 0 -); - -create index idx_sys_oper_log_bt on sys_oper_log (business_type); -create index idx_sys_oper_log_s on sys_oper_log (status); -create index idx_sys_oper_log_ot on sys_oper_log (oper_time); - -comment on table sys_oper_log is '操作日志记录'; -comment on column sys_oper_log.oper_id is '日志主键'; -comment on column sys_oper_log.title is '模块标题'; -comment on column sys_oper_log.business_type is '业务类型(0其它 1新增 2修改 3删除)'; -comment on column sys_oper_log.method is '方法名称'; -comment on column sys_oper_log.request_method is '请求方式'; -comment on column sys_oper_log.operator_type is '操作类别(0其它 1后台用户 2手机端用户)'; -comment on column sys_oper_log.oper_name is '操作人员'; -comment on column sys_oper_log.dept_name is '部门名称'; -comment on column sys_oper_log.oper_url is '请求URL'; -comment on column sys_oper_log.oper_ip is '主机地址'; -comment on column sys_oper_log.oper_location is '操作地点'; -comment on column sys_oper_log.oper_param is '请求参数'; -comment on column sys_oper_log.json_result is '返回参数'; -comment on column sys_oper_log.status is '操作状态(0正常 1异常)'; -comment on column sys_oper_log.error_msg is '错误消息'; -comment on column sys_oper_log.oper_time is '操作时间'; -comment on column sys_oper_log.cost_time is '消耗时间'; - --- ---------------------------- --- 11、字典类型表 --- ---------------------------- -drop table if exists sys_dict_type cascade; - -create table sys_dict_type ( - dict_id bigserial not null primary key, - dict_name varchar(100) default '' not null, - dict_type varchar(100) default '' not null, - status char(1) default '0' not null, - create_by varchar(64) default '' , - create_time timestamp default current_timestamp , - update_by varchar(64) default '' , - update_time timestamp default current_timestamp , - remark varchar(500) default null -); - -create unique index idx_sys_dict_type_dict_type on sys_dict_type (dict_type); - -comment on table sys_dict_type is '字典类型表'; -comment on column sys_dict_type.dict_id is '字典主键'; -comment on column sys_dict_type.dict_name is '字典名称'; -comment on column sys_dict_type.dict_type is '字典类型'; -comment on column sys_dict_type.status is '状态(0正常 1停用)'; -comment on column sys_dict_type.create_by is '创建者'; -comment on column sys_dict_type.create_time is '创建时间'; -comment on column sys_dict_type.update_by is '更新者'; -comment on column sys_dict_type.update_time is '更新时间'; -comment on column sys_dict_type.remark is '备注'; - --- 初始化-字典类型表数据 -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('用户性别', 'sys_user_sex', '0', 'admin', current_timestamp, '', null, '用户性别列表'); -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('菜单状态', 'sys_show_hide', '0', 'admin', current_timestamp, '', null, '菜单状态列表'); -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('系统开关', 'sys_normal_disable', '0', 'admin', current_timestamp, '', null, '系统开关列表'); -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('任务状态', 'sys_job_status', '0', 'admin', current_timestamp, '', null, '任务状态列表'); -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('任务分组', 'sys_job_group', '0', 'admin', current_timestamp, '', null, '任务分组列表'); -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('系统是否', 'sys_yes_no', '0', 'admin', current_timestamp, '', null, '系统是否列表'); -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('通知类型', 'sys_notice_type', '0', 'admin', current_timestamp, '', null, '通知类型列表'); -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('通知状态', 'sys_notice_status', '0', 'admin', current_timestamp, '', null, '通知状态列表'); -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('操作类型', 'sys_oper_type', '0', 'admin', current_timestamp, '', null, '操作类型列表'); -insert into sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) -values('系统状态', 'sys_common_status', '0', 'admin', current_timestamp, '', null, '登录状态列表'); - --- ---------------------------- --- 12、字典数据表 --- ---------------------------- -drop table if exists sys_dict_data cascade; - -create table sys_dict_data ( - dict_code bigserial not null primary key, - dict_sort integer default 0 not null, - dict_label varchar(100) default '' not null, - dict_value varchar(100) default '' not null, - dict_type varchar(100) default '' not null, - css_class varchar(100) default null, - list_class varchar(100) default null, - is_default char(1) default 'N' not null, - status char(1) default '0' not null, - create_by varchar(64) default '' , - create_time timestamp default current_timestamp , - update_by varchar(64) default '' , - update_time timestamp default current_timestamp , - remark varchar(500) default null -); - -comment on table sys_dict_data is '字典数据表'; -comment on column sys_dict_data.dict_code is '字典编码'; -comment on column sys_dict_data.dict_sort is '字典排序'; -comment on column sys_dict_data.dict_label is '字典标签'; -comment on column sys_dict_data.dict_value is '字典键值'; -comment on column sys_dict_data.dict_type is '字典类型'; -comment on column sys_dict_data.css_class is '样式属性(其他样式扩展)'; -comment on column sys_dict_data.list_class is '表格回显样式'; -comment on column sys_dict_data.is_default is '是否默认(Y是 N否)'; -comment on column sys_dict_data.status is '状态(0正常 1停用)'; -comment on column sys_dict_data.create_by is '创建者'; -comment on column sys_dict_data.create_time is '创建时间'; -comment on column sys_dict_data.update_by is '更新者'; -comment on column sys_dict_data.update_time is '更新时间'; -comment on column sys_dict_data.remark is '备注'; - --- 初始化-字典数据表数据 -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', current_timestamp, '', null, '性别男'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', current_timestamp, '', null, '性别女'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', current_timestamp, '', null, '性别未知'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', current_timestamp, '', null, '显示菜单'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', current_timestamp, '', null, '隐藏菜单'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', current_timestamp, '', null, '正常状态'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', current_timestamp, '', null, '停用状态'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', current_timestamp, '', null, '正常状态'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', current_timestamp, '', null, '停用状态'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', current_timestamp, '', null, '默认分组'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', current_timestamp, '', null, '系统分组'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', current_timestamp, '', null, '系统默认是'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', current_timestamp, '', null, '系统默认否'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', current_timestamp, '', null, '通知'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', current_timestamp, '', null, '公告'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', current_timestamp, '', null, '正常状态'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', current_timestamp, '', null, '关闭状态'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', current_timestamp, '', null, '其他操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', current_timestamp, '', null, '新增操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', current_timestamp, '', null, '修改操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', current_timestamp, '', null, '删除操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', current_timestamp, '', null, '授权操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', current_timestamp, '', null, '导出操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', current_timestamp, '', null, '导入操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', current_timestamp, '', null, '强退操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', current_timestamp, '', null, '生成操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', current_timestamp, '', null, '清空操作'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', current_timestamp, '', null, '正常状态'); -insert into sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) -values(2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', current_timestamp, '', null, '停用状态'); - --- ---------------------------- --- 13、参数配置表 --- ---------------------------- -drop table if exists sys_config cascade; - -create table sys_config ( - config_id serial not null primary key, - config_name varchar(100) default '' not null, - config_key varchar(100) default '' not null, - config_value varchar(500) default '' not null, - config_type char(1) default 'N' not null, - create_by varchar(64) default '', - create_time timestamp default current_timestamp, - update_by varchar(64) default '', - update_time timestamp default current_timestamp, - remark varchar(500) default null -); - -comment on table sys_config is '参数配置表'; -comment on column sys_config.config_id is '参数主键'; -comment on column sys_config.config_name is '参数名称'; -comment on column sys_config.config_key is '参数键名'; -comment on column sys_config.config_value is '参数键值'; -comment on column sys_config.config_type is '系统内置(Y是 N否)'; -comment on column sys_config.create_by is '创建者'; -comment on column sys_config.create_time is '创建时间'; -comment on column sys_config.update_by is '更新者'; -comment on column sys_config.update_time is '更新时间'; -comment on column sys_config.remark is '备注'; - --- 初始化-参数配置表数据 -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-green', 'Y', 'admin', '2023-04-13 20:46:20', 'admin', '2023-04-22 00:45:19', '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow'); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', '2023-04-13 20:46:20', '', null, '初始化密码 123456'); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-light', 'Y', 'admin', '2023-04-13 20:46:20', 'admin', '2023-04-22 00:45:25', '深色主题theme-dark,浅色主题theme-light'); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('账号自助-验证码开关', 'sys.account.captchaEnabled', 'true', 'Y', 'admin', '2023-04-13 20:46:20', '', null, '是否开启验证码功能(true开启,false关闭)'); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'true', 'Y', 'admin', '2023-04-13 20:46:20', 'admin', '2023-04-22 00:41:41', '是否开启注册用户功能(true开启,false关闭)'); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('主题颜色', 'sys.index.theme', '#11A983', 'Y', 'admin', '2023-04-22 00:57:18', 'admin', '2023-04-22 00:58:23', null); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('开启TopNav', 'sys.index.topNav', 'true', 'Y', 'admin', '2023-04-22 00:58:59', '', null, null); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('开启Tags-Views', 'sys.index.tagsView', 'true', 'Y', 'admin', '2023-04-22 00:59:40', '', null, null); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('显示Logo', 'sys.index.sidebarLogo', 'true', 'Y', 'admin', '2023-04-22 01:00:20', '', null, null); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('固定Header', 'sys.index.fixedHeader', 'true', 'Y', 'admin', '2023-04-22 01:00:53', '', null, null); -insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) -values('动态标题', 'sys.index.dynamicTitle', 'true', 'Y', 'admin', '2023-04-22 01:01:26', 'admin', '2023-04-22 01:01:41', null); - - --- ---------------------------- --- 14、系统访问记录 --- ---------------------------- -drop table if exists sys_logininfor cascade; - -create table sys_logininfor ( - info_id bigserial not null primary key, - user_name varchar(50) default '' not null, - ipaddr varchar(128) default '' not null, - login_location varchar(255) default '' not null, - browser varchar(50) default '' not null, - os varchar(50) default '' not null, - status char(1) default '0' not null, - msg varchar(255) default '' not null, - login_time timestamp default current_timestamp not null -); - -create index idx_sys_logininfor_s on sys_logininfor (status); -create index idx_sys_logininfor_lt on sys_logininfor (login_time); - -comment on table sys_logininfor is '系统访问记录'; -comment on column sys_logininfor.info_id is '访问ID'; -comment on column sys_logininfor.user_name is '用户账号'; -comment on column sys_logininfor.ipaddr is '登录IP地址'; -comment on column sys_logininfor.login_location is '登录地点'; -comment on column sys_logininfor.browser is '浏览器类型'; -comment on column sys_logininfor.os is '操作系统'; -comment on column sys_logininfor.status is '登录状态(0成功 1失败)'; -comment on column sys_logininfor.msg is '提示消息'; -comment on column sys_logininfor.login_time is '访问时间'; - --- ---------------------------- --- 15、定时任务调度表 --- ---------------------------- -drop table if exists sys_job cascade; - -create table sys_job ( - job_id bigserial not null, - job_name varchar(64) default '' not null, - job_group varchar(64) default 'DEFAULT' not null, - invoke_target varchar(500) default '' not null, - cron_expression varchar(255) default '' not null, - misfire_policy varchar(20) default '3' not null, - concurrent char(1) default '1' not null, - status char(1) default '0' not null, - create_by varchar(64) default '' , - create_time timestamp default current_timestamp , - update_by varchar(64) default '' , - update_time timestamp default current_timestamp , - remark varchar(500) default '' , - primary key (job_id, job_name, job_group) -); - -comment on table sys_job is '定时任务调度表'; -comment on column sys_job.job_id is '任务ID'; -comment on column sys_job.job_name is '任务名称'; -comment on column sys_job.job_group is '任务组名'; -comment on column sys_job.invoke_target is '调用目标字符串'; -comment on column sys_job.cron_expression is 'cron执行表达式'; -comment on column sys_job.misfire_policy is '计划执行错误策略(1立即执行 2执行一次 3放弃执行)'; -comment on column sys_job.concurrent is '是否并发执行(0允许 1禁止)'; -comment on column sys_job.status is '状态(0正常 1暂停)'; -comment on column sys_job.create_by is '创建者'; -comment on column sys_job.create_time is '创建时间'; -comment on column sys_job.update_by is '更新者'; -comment on column sys_job.update_time is '更新时间'; -comment on column sys_job.remark is '备注信息'; - --- 初始化-定时任务调度表数据 -insert into sys_job (job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, update_by, update_time, remark) -values('系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', current_timestamp, '', null, ''); -insert into sys_job (job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, update_by, update_time, remark) -values('系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(''ry'')', '0/15 * * * * ?', '3', '1', '1', 'admin', current_timestamp, '', null, ''); -insert into sys_job (job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, update_by, update_time, remark) -values('系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(''ry'', true, 2000, 316.50, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', current_timestamp, '', null, ''); - --- ---------------------------- --- 16、定时任务调度日志表 --- ---------------------------- -drop table if exists sys_job_log cascade; - -create table sys_job_log ( - job_log_id bigserial not null primary key, - job_name varchar(64) not null, - job_group varchar(64) not null, - invoke_target varchar(500) not null, - job_message varchar(500) default null, - status char(1) default '0' not null, - exception_info varchar(2000) default '' not null, - create_time timestamp default current_timestamp not null -); - -comment on table sys_job_log is '定时任务调度日志表'; -comment on column sys_job_log.job_log_id is '任务日志ID'; -comment on column sys_job_log.job_name is '任务名称'; -comment on column sys_job_log.job_group is '任务组名'; -comment on column sys_job_log.invoke_target is '调用目标字符串'; -comment on column sys_job_log.job_message is '日志信息'; -comment on column sys_job_log.status is '执行状态(0正常 1失败)'; -comment on column sys_job_log.exception_info is '异常信息'; -comment on column sys_job_log.create_time is '创建时间'; - --- ---------------------------- --- 17、通知公告表 --- ---------------------------- -drop table if exists sys_notice cascade; - -create table sys_notice ( - notice_id serial not null primary key, - notice_title varchar(50) not null, - notice_type char(1) not null, - notice_content bytea default null, - status char(1) default '0' not null, - create_by varchar(64) default '', - create_time timestamp default current_timestamp, - update_by varchar(64) default '', - update_time timestamp default current_timestamp, - remark varchar(255) default null -); - -comment on table sys_notice is '通知公告表'; -comment on column sys_notice.notice_id is '公告ID'; -comment on column sys_notice.notice_title is '公告标题'; -comment on column sys_notice.notice_type is '公告类型(1通知 2公告)'; -comment on column sys_notice.notice_content is '公告内容'; -comment on column sys_notice.status is '公告状态(0正常 1关闭)'; -comment on column sys_notice.create_by is '创建者'; -comment on column sys_notice.create_time is '创建时间'; -comment on column sys_notice.update_by is '更新者'; -comment on column sys_notice.update_time is '更新时间'; -comment on column sys_notice.remark is '备注'; - --- ---------------------------- --- 初始化-公告信息表数据 --- ---------------------------- -insert into sys_notice (notice_title, notice_type, notice_content, status, create_by, create_time, update_by, update_time, remark) -values('温馨提醒:2018-07-01 若依新版本发布啦', '2', decode('新版本内容', 'escape'), '0', 'admin', current_timestamp, '', null, '管理员'); -insert into sys_notice (notice_title, notice_type, notice_content, status, create_by, create_time, update_by, update_time, remark) -values('维护通知:2018-07-01 若依系统凌晨维护', '1', decode('维护内容', 'escape'), '0', 'admin', current_timestamp, '', null, '管理员'); - - -SELECT setval('sys_menu_menu_id_seq', max(menu_id)) FROM sys_menu WHERE menu_id < 100; \ No newline at end of file diff --git "a/sql/postgresql/\346\263\250\346\204\217.md" "b/sql/postgresql/\346\263\250\346\204\217.md" deleted file mode 100644 index cc106bd1f2ac63a46ac981b8b839c70b7c097d8e..0000000000000000000000000000000000000000 --- "a/sql/postgresql/\346\263\250\346\204\217.md" +++ /dev/null @@ -1,21 +0,0 @@ -请使用正则表达式批量替换项目中的以下内容 - -1. find_in_set 替换成 array_position、string_to_array - -``` -find_in_set\(([^,]+),\s*([^)]+)\) -``` - -``` -array_position(string_to_array($2, ','), CAST($1 AS TEXT)) IS NOT NULL -``` - -2. CURRENT_TIMESTAMP 替换成 CURRENT_TIMESTAMP - -``` -sysdate\(\) -``` - -``` -CURRENT_TIMESTAMP -```