sync -- 同步 RuoYi-Vue-Plus 更新。

优化 logback 日志 异步输出
增加 短信登录 与 小程序登录 示例
修复 用户绑定角色 与 角色绑定用户 异常 编写错误
update springboot 2.6.4 => 2.6.5
update springboot-admin 2.6.2 => 2.6.3
update hutool 5.7.21 => 5.7.22
update springboot-admin 2.6.3 => 2.6.5
update dynamic-datasource 3.5.0 => 3.5.1
update redisson 3.16.8 => 3.17.0
update springboot 2.6.5 => 2.6.6 修复 CVE-2022-22965 漏洞
更名 SaInterfaceImpl 为 SaPermissionImpl 完善相关注释
增加 Mybatis 全局异常处理 开启多数据源切换 严格模式 找不到数据源报错
This commit is contained in:
konbai
2022-04-16 00:06:21 +08:00
parent cf30d29f9b
commit 9295c85421
50 changed files with 1268 additions and 269 deletions

10
pom.xml
View File

@@ -14,7 +14,7 @@
<properties> <properties>
<ruoyi-flowable-plus.version>4.0.1</ruoyi-flowable-plus.version> <ruoyi-flowable-plus.version>4.0.1</ruoyi-flowable-plus.version>
<spring-boot.version>2.6.4</spring-boot.version> <spring-boot.version>2.6.6</spring-boot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
@@ -31,12 +31,12 @@
<satoken.version>1.29.0</satoken.version> <satoken.version>1.29.0</satoken.version>
<mybatis-plus.version>3.5.1</mybatis-plus.version> <mybatis-plus.version>3.5.1</mybatis-plus.version>
<p6spy.version>3.9.1</p6spy.version> <p6spy.version>3.9.1</p6spy.version>
<hutool.version>5.7.21</hutool.version> <hutool.version>5.7.22</hutool.version>
<okhttp.version>4.9.2</okhttp.version> <okhttp.version>4.9.2</okhttp.version>
<spring-boot-admin.version>2.6.2</spring-boot-admin.version> <spring-boot-admin.version>2.6.5</spring-boot-admin.version>
<redisson.version>3.16.8</redisson.version> <redisson.version>3.17.0</redisson.version>
<lock4j.version>2.2.1</lock4j.version> <lock4j.version>2.2.1</lock4j.version>
<dynamic-ds.version>3.5.0</dynamic-ds.version> <dynamic-ds.version>3.5.1</dynamic-ds.version>
<tlog.version>1.3.6</tlog.version> <tlog.version>1.3.6</tlog.version>
<xxl-job.version>2.3.0</xxl-job.version> <xxl-job.version>2.3.0</xxl-job.version>
<flowable.version>6.7.2</flowable.version> <flowable.version>6.7.2</flowable.version>

View File

@@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginBody; import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.core.domain.model.SmsLoginBody;
import com.ruoyi.common.helper.LoginHelper; import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.system.domain.vo.RouterVo; import com.ruoyi.system.domain.vo.RouterVo;
import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysMenuService;
@@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotBlank;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -60,6 +62,38 @@ public class SysLoginController {
return R.ok(ajax); return R.ok(ajax);
} }
/**
* 短信登录(示例)
*
* @param smsLoginBody 登录信息
* @return 结果
*/
@ApiOperation("短信登录(示例)")
@PostMapping("/smsLogin")
public R<Map<String, Object>> smsLogin(@Validated @RequestBody SmsLoginBody smsLoginBody) {
Map<String, Object> ajax = new HashMap<>();
// 生成令牌
String token = loginService.smsLogin(smsLoginBody.getPhonenumber(), smsLoginBody.getSmsCode());
ajax.put(Constants.TOKEN, token);
return R.ok(ajax);
}
/**
* 小程序登录(示例)
*
* @param xcxCode 小程序code
* @return 结果
*/
@ApiOperation("小程序登录(示例)")
@PostMapping("/xcxLogin")
public R<Map<String, Object>> xcxLogin(@NotBlank(message = "{xcx.code.not.blank}") String xcxCode) {
Map<String, Object> ajax = new HashMap<>();
// 生成令牌
String token = loginService.xcxLogin(xcxCode);
ajax.put(Constants.TOKEN, token);
return R.ok(ajax);
}
@ApiOperation("登出方法") @ApiOperation("登出方法")
@PostMapping("/logout") @PostMapping("/logout")
public R<Void> logout() { public R<Void> logout() {

View File

@@ -47,6 +47,8 @@ spring:
p6spy: true p6spy: true
# 设置默认的数据源或者数据源组,默认值即为 master # 设置默认的数据源或者数据源组,默认值即为 master
primary: master primary: master
# 严格模式 匹配不到数据源则报错
strict: true
datasource: datasource:
# 主库数据源 # 主库数据源
master: master:

View File

@@ -54,6 +54,8 @@ spring:
p6spy: false p6spy: false
# 设置默认的数据源或者数据源组,默认值即为 master # 设置默认的数据源或者数据源组,默认值即为 master
primary: master primary: master
# 严格模式 匹配不到数据源则报错
strict: true
datasource: datasource:
# 主库数据源 # 主库数据源
master: master:

View File

@@ -127,6 +127,8 @@ security:
# 排除路径 # 排除路径
excludes: excludes:
- /login - /login
- /smsLogin
- /xcxLogin
- /logout - /logout
- /register - /register
- /captchaImage - /captchaImage
@@ -136,6 +138,7 @@ security:
- /**/*.css - /**/*.css
- /**/*.js - /**/*.js
# swagger 文档配置 # swagger 文档配置
- /favicon.ico
- /doc.html - /doc.html
- /swagger-resources/** - /swagger-resources/**
- /webjars/** - /webjars/**

View File

@@ -18,6 +18,7 @@ user.password.not.blank=用户密码不能为空
user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间 user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间
user.password.not.valid=* 5-50个字符 user.password.not.valid=* 5-50个字符
user.email.not.valid=邮箱格式错误 user.email.not.valid=邮箱格式错误
user.phonenumber.not.blank=用户手机号不能为空
user.mobile.phone.number.not.valid=手机号格式错误 user.mobile.phone.number.not.valid=手机号格式错误
user.login.success=登录成功 user.login.success=登录成功
user.register.success=注册成功 user.register.success=注册成功
@@ -38,3 +39,7 @@ no.export.permission=您没有导出数据的权限,请联系管理员添加
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
repeat.submit.message=不允许重复提交,请稍候再试 repeat.submit.message=不允许重复提交,请稍候再试
rate.limiter.message=访问过于频繁,请稍候再试 rate.limiter.message=访问过于频繁,请稍候再试
sms.code.not.blank=短信验证码不能为空
sms.code.retry.limit.count=短信验证码输入错误{0}次
sms.code.retry.limit.exceed=短信验证码错误次数过多,帐户锁定{0}分钟
xcx.code.not.blank=小程序code不能为空

View File

@@ -18,6 +18,7 @@ user.password.not.blank=Password cannot be empty
user.password.length.valid=Password length must be between {min} and {max} characters user.password.length.valid=Password length must be between {min} and {max} characters
user.password.not.valid=* 5-50 characters user.password.not.valid=* 5-50 characters
user.email.not.valid=Mailbox format error user.email.not.valid=Mailbox format error
user.phonenumber.not.blank=Phone number cannot be blank
user.mobile.phone.number.not.valid=Phone number format error user.mobile.phone.number.not.valid=Phone number format error
user.login.success=Login successful user.login.success=Login successful
user.register.success=Register successful user.register.success=Register successful
@@ -38,3 +39,7 @@ no.export.permission=You do not have permission to export dataplease contact
no.view.permission=You do not have permission to view dataplease contact your administrator to add permissions [{0}] no.view.permission=You do not have permission to view dataplease contact your administrator to add permissions [{0}]
repeat.submit.message=Repeat submit is not allowed, please try again later repeat.submit.message=Repeat submit is not allowed, please try again later
rate.limiter.message=Visit too frequently, please try again later rate.limiter.message=Visit too frequently, please try again later
sms.code.not.blank=Sms code cannot be blank
sms.code.retry.limit.count=Sms code input error {0} times
sms.code.retry.limit.exceed=Too many sms code errors, account locked for {0} minutes
xcx.code.not.blank=Mini program code cannot be blank

View File

@@ -18,6 +18,7 @@ user.password.not.blank=用户密码不能为空
user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间 user.password.length.valid=用户密码长度必须在{min}到{max}个字符之间
user.password.not.valid=* 5-50个字符 user.password.not.valid=* 5-50个字符
user.email.not.valid=邮箱格式错误 user.email.not.valid=邮箱格式错误
user.phonenumber.not.blank=用户手机号不能为空
user.mobile.phone.number.not.valid=手机号格式错误 user.mobile.phone.number.not.valid=手机号格式错误
user.login.success=登录成功 user.login.success=登录成功
user.register.success=注册成功 user.register.success=注册成功
@@ -38,3 +39,7 @@ no.export.permission=您没有导出数据的权限,请联系管理员添加
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
repeat.submit.message=不允许重复提交,请稍候再试 repeat.submit.message=不允许重复提交,请稍候再试
rate.limiter.message=访问过于频繁,请稍候再试 rate.limiter.message=访问过于频繁,请稍候再试
sms.code.not.blank=短信验证码不能为空
sms.code.retry.limit.count=短信验证码输入错误{0}次
sms.code.retry.limit.exceed=短信验证码错误次数过多,帐户锁定{0}分钟
xcx.code.not.blank=小程序code不能为空

View File

@@ -77,6 +77,26 @@
</filter> </filter>
</appender> </appender>
<!-- info异步输出 -->
<appender name="async_info" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="file_info"/>
</appender>
<!-- error异步输出 -->
<appender name="async_error" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<discardingThreshold>0</discardingThreshold>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<queueSize>512</queueSize>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref ref="file_error"/>
</appender>
<!-- 系统模块日志级别控制 --> <!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" /> <logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 --> <!-- Spring日志级别控制 -->
@@ -88,8 +108,8 @@
<!--系统操作日志--> <!--系统操作日志-->
<root level="info"> <root level="info">
<appender-ref ref="file_info" /> <appender-ref ref="async_info" />
<appender-ref ref="file_error" /> <appender-ref ref="async_error" />
<appender-ref ref="file_console" /> <appender-ref ref="file_console" />
</root> </root>

View File

@@ -78,13 +78,13 @@ public class SysRole extends BaseEntity {
* 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 * 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示
*/ */
@ApiModelProperty(value = "菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示") @ApiModelProperty(value = "菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示")
private Integer menuCheckStrictly; private Boolean menuCheckStrictly;
/** /**
* 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 * 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示
*/ */
@ApiModelProperty(value = "部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 ") @ApiModelProperty(value = "部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 ")
private Integer deptCheckStrictly; private Boolean deptCheckStrictly;
/** /**
* 角色状态0正常 1停用 * 角色状态0正常 1停用
@@ -136,5 +136,4 @@ public class SysRole extends BaseEntity {
public boolean isAdmin() { public boolean isAdmin() {
return UserConstants.ADMIN_ID.equals(this.roleId); return UserConstants.ADMIN_ID.equals(this.roleId);
} }
} }

View File

@@ -0,0 +1,33 @@
package com.ruoyi.common.core.domain.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 短信登录对象
*
* @author Lion Li
*/
@Data
@ApiModel("短信登录对象")
public class SmsLoginBody {
/**
* 用户名
*/
@NotBlank(message = "{user.phonenumber.not.blank}")
@ApiModelProperty(value = "用户手机号")
private String phonenumber;
/**
* 用户密码
*/
@NotBlank(message = "{sms.code.not.blank}")
@ApiModelProperty(value = "短信验证码")
private String smsCode;
}

View File

@@ -0,0 +1,24 @@
package com.ruoyi.common.core.domain.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* 小程序登录用户身份权限
*
* @author Lion Li
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class XcxLoginUser extends LoginUser {
private static final long serialVersionUID = 1L;
/**
* openid
*/
private String openid;
}

View File

@@ -21,7 +21,12 @@ public enum DeviceType {
/** /**
* app端 * app端
*/ */
APP("app"); APP("app"),
/**
* 小程序端
*/
XCX("xcx");
private final String device; private final String device;
} }

View File

@@ -21,12 +21,13 @@ import java.sql.SQLException;
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DataBaseHelper { public class DataBaseHelper {
private static final DynamicRoutingDataSource DS = SpringUtils.getBean(DynamicRoutingDataSource.class);
/** /**
* 获取当前数据库类型 * 获取当前数据库类型
*/ */
public static DataBaseType getDataBaseType() { public static DataBaseType getDataBaseType() {
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) SpringUtils.getBean(DataSource.class); DataSource dataSource = DS.determineDataSource();
DataSource dataSource = ds.determineDataSource();
try (Connection conn = dataSource.getConnection()) { try (Connection conn = dataSource.getConnection()) {
DatabaseMetaData metaData = conn.getMetaData(); DatabaseMetaData metaData = conn.getMetaData();
String databaseProductName = metaData.getDatabaseProductName(); String databaseProductName = metaData.getDatabaseProductName();

View File

@@ -22,17 +22,17 @@ import java.util.Date;
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DateUtils extends org.apache.commons.lang3.time.DateUtils { public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String YYYY = "yyyy"; public static final String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM"; public static final String YYYY_MM = "yyyy-MM";
public static String YYYY_MM_DD = "yyyy-MM-dd"; public static final String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = { private static final String[] PARSE_PATTERNS = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
@@ -55,27 +55,27 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return dateTimeNow(YYYY_MM_DD); return dateTimeNow(YYYY_MM_DD);
} }
public static final String getTime() { public static String getTime() {
return dateTimeNow(YYYY_MM_DD_HH_MM_SS); return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
} }
public static final String dateTimeNow() { public static String dateTimeNow() {
return dateTimeNow(YYYYMMDDHHMMSS); return dateTimeNow(YYYYMMDDHHMMSS);
} }
public static final String dateTimeNow(final String format) { public static String dateTimeNow(final String format) {
return parseDateToStr(format, new Date()); return parseDateToStr(format, new Date());
} }
public static final String dateTime(final Date date) { public static String dateTime(final Date date) {
return parseDateToStr(YYYY_MM_DD, date); return parseDateToStr(YYYY_MM_DD, date);
} }
public static final String parseDateToStr(final String format, final Date date) { public static String parseDateToStr(final String format, final Date date) {
return new SimpleDateFormat(format).format(date); return new SimpleDateFormat(format).format(date);
} }
public static final Date dateTime(final String format, final String ts) { public static Date dateTime(final String format, final String ts) {
try { try {
return new SimpleDateFormat(format).parse(ts); return new SimpleDateFormat(format).parse(ts);
} catch (ParseException e) { } catch (ParseException e) {
@@ -86,7 +86,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/** /**
* 日期路径 即年/月/日 如2018/08/08 * 日期路径 即年/月/日 如2018/08/08
*/ */
public static final String datePath() { public static String datePath() {
Date now = new Date(); Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd"); return DateFormatUtils.format(now, "yyyy/MM/dd");
} }
@@ -94,7 +94,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/** /**
* 日期路径 即年/月/日 如20180808 * 日期路径 即年/月/日 如20180808
*/ */
public static final String dateTime() { public static String dateTime() {
Date now = new Date(); Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd"); return DateFormatUtils.format(now, "yyyyMMdd");
} }
@@ -107,7 +107,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return null; return null;
} }
try { try {
return parseDate(str.toString(), parsePatterns); return parseDate(str.toString(), PARSE_PATTERNS);
} catch (ParseException e) { } catch (ParseException e) {
return null; return null;
} }
@@ -124,8 +124,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
/** /**
* 计算相差天数 * 计算相差天数
*/ */
public static int differentDaysByMillisecond(Date date1, Date date2) public static int differentDaysByMillisecond(Date date1, Date date2) {
{
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
} }

View File

@@ -18,10 +18,10 @@ import java.awt.*;
@Configuration @Configuration
public class CaptchaConfig { public class CaptchaConfig {
private final int width = 160; private static final int WIDTH = 160;
private final int height = 60; private static final int HEIGHT = 60;
private final Color background = Color.PINK; private static final Color BACKGROUND = Color.PINK;
private final Font font = new Font("Arial", Font.BOLD, 48); private static final Font FONT = new Font("Arial", Font.BOLD, 48);
/** /**
* 圆圈干扰验证码 * 圆圈干扰验证码
@@ -29,9 +29,9 @@ public class CaptchaConfig {
@Lazy @Lazy
@Bean @Bean
public CircleCaptcha circleCaptcha() { public CircleCaptcha circleCaptcha() {
CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(width, height); CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(WIDTH, HEIGHT);
captcha.setBackground(background); captcha.setBackground(BACKGROUND);
captcha.setFont(font); captcha.setFont(FONT);
return captcha; return captcha;
} }
@@ -41,9 +41,9 @@ public class CaptchaConfig {
@Lazy @Lazy
@Bean @Bean
public LineCaptcha lineCaptcha() { public LineCaptcha lineCaptcha() {
LineCaptcha captcha = CaptchaUtil.createLineCaptcha(width, height); LineCaptcha captcha = CaptchaUtil.createLineCaptcha(WIDTH, HEIGHT);
captcha.setBackground(background); captcha.setBackground(BACKGROUND);
captcha.setFont(font); captcha.setFont(FONT);
return captcha; return captcha;
} }
@@ -53,9 +53,9 @@ public class CaptchaConfig {
@Lazy @Lazy
@Bean @Bean
public ShearCaptcha shearCaptcha() { public ShearCaptcha shearCaptcha() {
ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(width, height); ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(WIDTH, HEIGHT);
captcha.setBackground(background); captcha.setBackground(BACKGROUND);
captcha.setFont(font); captcha.setFont(FONT);
return captcha; return captcha;
} }

View File

@@ -5,7 +5,7 @@ import cn.dev33.satoken.interceptor.SaRouteInterceptor;
import cn.dev33.satoken.jwt.StpLogicJwtForStyle; import cn.dev33.satoken.jwt.StpLogicJwtForStyle;
import cn.dev33.satoken.router.SaRouter; import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.stp.StpLogic; import cn.dev33.satoken.stp.StpLogic;
import cn.hutool.core.util.ObjectUtil; import cn.dev33.satoken.stp.StpUtil;
import com.ruoyi.common.helper.LoginHelper; import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.framework.config.properties.SecurityProperties; import com.ruoyi.framework.config.properties.SecurityProperties;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -43,15 +43,17 @@ public class SaTokenConfig implements WebMvcConfigurer {
.match("/**") .match("/**")
// 排除下不需要拦截的 // 排除下不需要拦截的
.notMatch(securityProperties.getExcludes()) .notMatch(securityProperties.getExcludes())
// 对未排除的路径进行检查
.check(() -> { .check(() -> {
Long userId = LoginHelper.getUserId(); // 检查是否登录 是否有token
if (ObjectUtil.isNotNull(userId)) { StpUtil.checkLogin();
// 有效率影响 用于临时测试
// if (log.isDebugEnabled()) { // 有效率影响 用于临时测试
// log.debug("剩余有效时间: {}", StpUtil.getTokenTimeout()); // if (log.isDebugEnabled()) {
// log.debug("临时有效时间: {}", StpUtil.getTokenActivityTimeout()); // log.debug("剩余有效时间: {}", StpUtil.getTokenTimeout());
// } // log.debug("临时有效时间: {}", StpUtil.getTokenActivityTimeout());
} // }
}); });
}) { }) {
@SuppressWarnings("all") @SuppressWarnings("all")

View File

@@ -53,7 +53,7 @@ public class UserActionListener implements SaTokenListener {
dto.setUserName(user.getUsername()); dto.setUserName(user.getUsername());
dto.setDeptName(user.getDeptName()); dto.setDeptName(user.getDeptName());
RedisUtils.setCacheObject(Constants.ONLINE_TOKEN_KEY + tokenValue, dto, tokenConfig.getTimeout(), TimeUnit.SECONDS); RedisUtils.setCacheObject(Constants.ONLINE_TOKEN_KEY + tokenValue, dto, tokenConfig.getTimeout(), TimeUnit.SECONDS);
log.info("user doLogin, useId:{}, token:{}", loginId, tokenValue); log.info("user doLogin, userId:{}, token:{}", loginId, tokenValue);
} else if (userType == UserType.APP_USER) { } else if (userType == UserType.APP_USER) {
// app端 自行根据业务编写 // app端 自行根据业务编写
} }
@@ -65,7 +65,7 @@ public class UserActionListener implements SaTokenListener {
@Override @Override
public void doLogout(String loginType, Object loginId, String tokenValue) { public void doLogout(String loginType, Object loginId, String tokenValue) {
RedisUtils.deleteObject(Constants.ONLINE_TOKEN_KEY + tokenValue); RedisUtils.deleteObject(Constants.ONLINE_TOKEN_KEY + tokenValue);
log.info("user doLogout, useId:{}, token:{}", loginId, tokenValue); log.info("user doLogout, userId:{}, token:{}", loginId, tokenValue);
} }
/** /**
@@ -74,7 +74,7 @@ public class UserActionListener implements SaTokenListener {
@Override @Override
public void doKickout(String loginType, Object loginId, String tokenValue) { public void doKickout(String loginType, Object loginId, String tokenValue) {
RedisUtils.deleteObject(Constants.ONLINE_TOKEN_KEY + tokenValue); RedisUtils.deleteObject(Constants.ONLINE_TOKEN_KEY + tokenValue);
log.info("user doLogoutByLoginId, useId:{}, token:{}", loginId, tokenValue); log.info("user doLogoutByLoginId, userId:{}, token:{}", loginId, tokenValue);
} }
/** /**
@@ -83,7 +83,7 @@ public class UserActionListener implements SaTokenListener {
@Override @Override
public void doReplaced(String loginType, Object loginId, String tokenValue) { public void doReplaced(String loginType, Object loginId, String tokenValue) {
RedisUtils.deleteObject(Constants.ONLINE_TOKEN_KEY + tokenValue); RedisUtils.deleteObject(Constants.ONLINE_TOKEN_KEY + tokenValue);
log.info("user doReplaced, useId:{}, token:{}", loginId, tokenValue); log.info("user doReplaced, userId:{}, token:{}", loginId, tokenValue);
} }
/** /**

View File

@@ -9,9 +9,17 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* sa-token 权限管理实现类
*
* @author Lion Li
*/
@Component @Component
public class SaInterfaceImpl implements StpInterface { public class SaPermissionImpl implements StpInterface {
/**
* 获取菜单权限列表
*/
@Override @Override
public List<String> getPermissionList(Object loginId, String loginType) { public List<String> getPermissionList(Object loginId, String loginType) {
LoginUser loginUser = LoginHelper.getLoginUser(); LoginUser loginUser = LoginHelper.getLoginUser();
@@ -19,11 +27,14 @@ public class SaInterfaceImpl implements StpInterface {
if (userType == UserType.SYS_USER) { if (userType == UserType.SYS_USER) {
return new ArrayList<>(loginUser.getMenuPermission()); return new ArrayList<>(loginUser.getMenuPermission());
} else if (userType == UserType.APP_USER) { } else if (userType == UserType.APP_USER) {
// app端权限返回 自行根据业务编写 // 其他端 自行根据业务编写
} }
return new ArrayList<>(); return new ArrayList<>();
} }
/**
* 获取角色权限列表
*/
@Override @Override
public List<String> getRoleList(Object loginId, String loginType) { public List<String> getRoleList(Object loginId, String loginType) {
LoginUser loginUser = LoginHelper.getLoginUser(); LoginUser loginUser = LoginHelper.getLoginUser();
@@ -31,7 +42,7 @@ public class SaInterfaceImpl implements StpInterface {
if (userType == UserType.SYS_USER) { if (userType == UserType.SYS_USER) {
return new ArrayList<>(loginUser.getRolePermission()); return new ArrayList<>(loginUser.getRolePermission());
} else if (userType == UserType.APP_USER) { } else if (userType == UserType.APP_USER) {
// app端权限返回 自行根据业务编写 // 其他端 自行根据业务编写
} }
return new ArrayList<>(); return new ArrayList<>();
} }

View File

@@ -9,7 +9,9 @@ import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.exception.DemoModeException; import com.ruoyi.common.exception.DemoModeException;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.MyBatisSystemException;
import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.validation.BindException; import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MethodArgumentNotValidException;
@@ -71,6 +73,31 @@ public class GlobalExceptionHandler {
return R.fail(e.getMessage()); return R.fail(e.getMessage());
} }
/**
* 主键或UNIQUE索引数据重复异常
*/
@ExceptionHandler(DuplicateKeyException.class)
public R<Void> handleDuplicateKeyException(DuplicateKeyException e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
log.error("请求地址'{}',数据库中已存在记录'{}'", requestURI, e.getMessage());
return R.fail("数据库中已存在该记录,请联系管理员确认");
}
/**
* Mybatis系统异常 通用处理
*/
@ExceptionHandler(MyBatisSystemException.class)
public R<Void> handleCannotFindDataSourceException(MyBatisSystemException e, HttpServletRequest request) {
String requestURI = request.getRequestURI();
String message = e.getMessage();
if (message.contains("CannotFindDataSourceException")) {
log.error("请求地址'{}', 未找到数据源", requestURI);
return R.fail("未找到数据源,请联系管理员确认");
}
log.error("请求地址'{}', Mybatis系统异常", requestURI, e);
return R.fail(message);
}
/** /**
* 业务异常 * 业务异常
*/ */

View File

@@ -16,15 +16,13 @@ import java.util.List;
@InterceptorIgnore(dataPermission = "true") @InterceptorIgnore(dataPermission = "true")
public interface GenTableMapper extends BaseMapperPlus<GenTableMapper, GenTable, GenTable> { public interface GenTableMapper extends BaseMapperPlus<GenTableMapper, GenTable, GenTable> {
Page<GenTable> selectPageDbTableList(@Param("page") Page<GenTable> page, @Param("genTable") GenTable genTable);
/** /**
* 查询据库列表 * 查询据库列表
* *
* @param genTable 查询条件 * @param genTable 查询条件
* @return 数据库表集合 * @return 数据库表集合
*/ */
List<GenTable> selectDbTableList(GenTable genTable); Page<GenTable> selectPageDbTableList(@Param("page") Page<GenTable> page, @Param("genTable") GenTable genTable);
/** /**
* 查询据库列表 * 查询据库列表

View File

@@ -91,17 +91,6 @@ public class GenTableServiceImpl implements IGenTableService {
return TableDataInfo.build(page); return TableDataInfo.build(page);
} }
/**
* 查询业务列表
*
* @param genTable 业务信息
* @return 业务集合
*/
@Override
public List<GenTable> selectGenTableList(GenTable genTable) {
return baseMapper.selectList(this.buildGenTableQueryWrapper(genTable));
}
private QueryWrapper<GenTable> buildGenTableQueryWrapper(GenTable genTable) { private QueryWrapper<GenTable> buildGenTableQueryWrapper(GenTable genTable) {
Map<String, Object> params = genTable.getParams(); Map<String, Object> params = genTable.getParams();
QueryWrapper<GenTable> wrapper = Wrappers.query(); QueryWrapper<GenTable> wrapper = Wrappers.query();
@@ -119,17 +108,6 @@ public class GenTableServiceImpl implements IGenTableService {
return TableDataInfo.build(page); return TableDataInfo.build(page);
} }
/**
* 查询据库列表
*
* @param genTable 业务信息
* @return 数据库表集合
*/
@Override
public List<GenTable> selectDbTableList(GenTable genTable) {
return baseMapper.selectDbTableList(genTable);
}
/** /**
* 查询据库列表 * 查询据库列表
* *

View File

@@ -23,19 +23,13 @@ public interface IGenTableService {
*/ */
List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId); List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId);
TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery);
TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery);
/** /**
* 查询业务列表 * 查询业务列表
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 业务集合 * @return 业务集合
*/ */
List<GenTable> selectGenTableList(GenTable genTable); TableDataInfo<GenTable> selectPageGenTableList(GenTable genTable, PageQuery pageQuery);
/** /**
* 查询据库列表 * 查询据库列表
@@ -43,7 +37,7 @@ public interface IGenTableService {
* @param genTable 业务信息 * @param genTable 业务信息
* @return 数据库表集合 * @return 数据库表集合
*/ */
List<GenTable> selectDbTableList(GenTable genTable); TableDataInfo<GenTable> selectPageDbTableList(GenTable genTable, PageQuery pageQuery);
/** /**
* 查询据库列表 * 查询据库列表

View File

@@ -5,6 +5,8 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.generator.config.GenConfig; import com.ruoyi.generator.config.GenConfig;
import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn; import com.ruoyi.generator.domain.GenTableColumn;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.RegExUtils;
import java.util.Arrays; import java.util.Arrays;
@@ -14,6 +16,7 @@ import java.util.Arrays;
* *
* @author ruoyi * @author ruoyi
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class GenUtils { public class GenUtils {
/** /**

View File

@@ -1,6 +1,8 @@
package com.ruoyi.generator.util; package com.ruoyi.generator.util;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.velocity.app.Velocity; import org.apache.velocity.app.Velocity;
import java.util.Properties; import java.util.Properties;
@@ -10,6 +12,7 @@ import java.util.Properties;
* *
* @author ruoyi * @author ruoyi
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class VelocityInitializer { public class VelocityInitializer {
/** /**

View File

@@ -11,6 +11,8 @@ import com.ruoyi.common.utils.JsonUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTable;
import com.ruoyi.generator.domain.GenTableColumn; import com.ruoyi.generator.domain.GenTableColumn;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.velocity.VelocityContext; import org.apache.velocity.VelocityContext;
import java.util.*; import java.util.*;
@@ -20,6 +22,7 @@ import java.util.*;
* *
* @author ruoyi * @author ruoyi
*/ */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class VelocityUtils { public class VelocityUtils {
/** /**

View File

@@ -95,6 +95,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE table_name = (#{tableName}) WHERE table_name = (#{tableName})
</if> </if>
<if test="@com.ruoyi.common.helper.DataBaseHelper@isSqlServer()"> <if test="@com.ruoyi.common.helper.DataBaseHelper@isSqlServer()">
SELECT
cast(A.NAME as nvarchar) as column_name,
cast(B.NAME as nvarchar) + (case when B.NAME = 'numeric' then '(' + cast(A.prec as nvarchar) + ',' + cast(A.scale as nvarchar) + ')' else '' end) as column_type,
cast(G.[VALUE] as nvarchar) as column_comment,
(SELECT 1 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE Z WHERE TABLE_NAME = D.NAME and A.NAME = Z.column_name ) as is_pk,
colorder as sort
FROM SYSCOLUMNS A
LEFT JOIN SYSTYPES B ON A.XTYPE = B.XUSERTYPE
INNER JOIN SYSOBJECTS D ON A.ID = D.ID AND D.XTYPE='U' AND D.NAME != 'DTPROPERTIES'
LEFT JOIN SYS.EXTENDED_PROPERTIES G ON A.ID = G.MAJOR_ID AND A.COLID = G.MINOR_ID
LEFT JOIN SYS.EXTENDED_PROPERTIES F ON D.ID = F.MAJOR_ID AND F.MINOR_ID = 0
WHERE D.NAME = #{tableName}
ORDER BY A.COLORDER
</if> </if>
</select> </select>

View File

@@ -109,64 +109,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc order by create_time desc
</if> </if>
<if test="@com.ruoyi.common.helper.DataBaseHelper@isSqlServer()"> <if test="@com.ruoyi.common.helper.DataBaseHelper@isSqlServer()">
</if> SELECT cast(D.NAME as nvarchar) as table_name,
</select> cast(F.VALUE as nvarchar) as table_comment,
crdate as create_time,
<select id="selectDbTableList" resultMap="GenTableResult"> refdate as update_time
<if test="@com.ruoyi.common.helper.DataBaseHelper@isMySql()"> FROM SYSOBJECTS D
select table_name, table_comment, create_time, update_time INNER JOIN SYS.EXTENDED_PROPERTIES F ON D.ID = F.MAJOR_ID
from information_schema.tables AND F.MINOR_ID = 0 AND D.XTYPE = 'U' AND D.NAME != 'DTPROPERTIES'
AND table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%' AND D.NAME NOT LIKE 'xxl_job_%' AND D.NAME NOT LIKE 'gen_%'
AND table_name NOT IN (select table_name from gen_table) AND D.NAME NOT IN (select table_name from gen_table)
<if test="tableName != null and tableName != ''">
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
</if>
<if test="tableComment != null and tableComment != ''">
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
</if>
order by create_time desc
</if>
<if test="@com.ruoyi.common.helper.DataBaseHelper@isOracle()">
select lower(dt.table_name) as table_name, dtc.comments as table_comment, uo.created as create_time, uo.last_ddl_time as update_time
from user_tables dt, user_tab_comments dtc, user_objects uo
where dt.table_name = dtc.table_name
and dt.table_name = uo.object_name
and uo.object_type = 'TABLE'
AND dt.table_name NOT LIKE 'XXL_JOB_%' AND dt.table_name NOT LIKE 'GEN_%'
AND lower(dt.table_name) NOT IN (select table_name from gen_table)
<if test="tableName != null and tableName != ''">
AND lower(dt.table_name) like lower(concat(concat('%', #{tableName}), '%'))
</if>
<if test="tableComment != null and tableComment != ''">
AND lower(dtc.comments) like lower(concat(concat('%', #{tableComment}), '%'))
</if>
order by create_time desc
</if>
<if test="@com.ruoyi.common.helper.DataBaseHelper@isPostgerSql()">
select table_name, table_comment, create_time, update_time
from (
SELECT c.relname AS table_name,
obj_description(c.oid) AS table_comment,
CURRENT_TIMESTAMP AS create_time,
CURRENT_TIMESTAMP AS update_time
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE (c.relkind = ANY (ARRAY ['r'::"char", 'p'::"char"]))
AND c.relname != 'spatial_%'::text
AND n.nspname = 'public'::name
AND n.nspname <![CDATA[ <> ]]> ''::name
) list_table
where table_name NOT LIKE 'xxl_job_%' AND table_name NOT LIKE 'gen_%'
AND table_name NOT IN (select table_name from gen_table)
<if test="genTable.tableName != null and genTable.tableName != ''"> <if test="genTable.tableName != null and genTable.tableName != ''">
AND lower(table_name) like lower(concat('%', #{genTable.tableName}, '%')) AND lower(D.NAME) like lower(concat(N'%', N'${genTable.tableName}', N'%'))
</if> </if>
<if test="genTable.tableComment != null and genTable.tableComment != ''"> <if test="genTable.tableComment != null and genTable.tableComment != ''">
AND lower(table_comment) like lower(concat('%', #{genTable.tableComment}, '%')) AND lower(CAST(F.VALUE AS nvarchar)) like lower(concat(N'%', N'${genTable.tableComment}', N'%'))
</if> </if>
order by create_time desc order by crdate desc
</if>
<if test="@com.ruoyi.common.helper.DataBaseHelper@isSqlServer()">
</if> </if>
</select> </select>
@@ -213,13 +171,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</if> </if>
<if test="@com.ruoyi.common.helper.DataBaseHelper@isSqlServer()"> <if test="@com.ruoyi.common.helper.DataBaseHelper@isSqlServer()">
SELECT cast(D.NAME as nvarchar) as table_name,
cast(F.VALUE as nvarchar) as table_comment,
crdate as create_time,
refdate as update_time
FROM SYSOBJECTS D
INNER JOIN SYS.EXTENDED_PROPERTIES F ON D.ID = F.MAJOR_ID
AND F.MINOR_ID = 0 AND D.XTYPE = 'U' AND D.NAME != 'DTPROPERTIES'
AND D.NAME NOT LIKE 'xxl_job_%' AND D.NAME NOT LIKE 'gen_%'
AND D.NAME in
<foreach collection="array" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</if> </if>
</select> </select>
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult"> <select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
<if test="@com.ruoyi.common.helper.DataBaseHelper@isMySql()"> <if test="@com.ruoyi.common.helper.DataBaseHelper@isMySql()">
select table_name, table_comment, create_time, update_time from information_schema.tables select table_name, table_comment, create_time, update_time from information_schema.tables
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database()) where table_name NOT LIKE 'xxl_job_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
and table_name = #{tableName} and table_name = #{tableName}
</if> </if>
<if test="@com.ruoyi.common.helper.DataBaseHelper@isOracle()"> <if test="@com.ruoyi.common.helper.DataBaseHelper@isOracle()">
@@ -250,6 +220,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and table_name = #{tableName} and table_name = #{tableName}
</if> </if>
<if test="@com.ruoyi.common.helper.DataBaseHelper@isSqlServer()"> <if test="@com.ruoyi.common.helper.DataBaseHelper@isSqlServer()">
SELECT cast(D.NAME as nvarchar) as table_name,
cast(F.VALUE as nvarchar) as table_comment,
crdate as create_time,
refdate as update_time
FROM SYSOBJECTS D
INNER JOIN SYS.EXTENDED_PROPERTIES F ON D.ID = F.MAJOR_ID
AND F.MINOR_ID = 0 AND D.XTYPE = 'U' AND D.NAME != 'DTPROPERTIES'
AND D.NAME NOT LIKE 'xxl_job_%' AND D.NAME NOT LIKE 'gen_%'
AND D.NAME = #{tableName}
</if> </if>
</select> </select>

View File

@@ -12,11 +12,14 @@ import java.io.InputStream;
*/ */
public interface IOssStrategy { public interface IOssStrategy {
/**
* 创建存储桶
*/
void createBucket(); void createBucket();
/** /**
* 获取服务商类型 * 获取服务商类型
* @return * @return 对象存储服务商枚举
*/ */
OssEnumd getServiceType(); OssEnumd getServiceType();
@@ -25,6 +28,7 @@ public interface IOssStrategy {
* *
* @param data 文件字节数组 * @param data 文件字节数组
* @param path 文件路径,包含文件名 * @param path 文件路径,包含文件名
* @param contentType 文件类型
* @return 返回http地址 * @return 返回http地址
*/ */
UploadResult upload(byte[] data, String path, String contentType); UploadResult upload(byte[] data, String path, String contentType);
@@ -41,6 +45,7 @@ public interface IOssStrategy {
* *
* @param data 文件字节数组 * @param data 文件字节数组
* @param suffix 后缀 * @param suffix 后缀
* @param contentType 文件类型
* @return 返回http地址 * @return 返回http地址
*/ */
UploadResult uploadSuffix(byte[] data, String suffix, String contentType); UploadResult uploadSuffix(byte[] data, String suffix, String contentType);
@@ -50,6 +55,7 @@ public interface IOssStrategy {
* *
* @param inputStream 字节流 * @param inputStream 字节流
* @param path 文件路径,包含文件名 * @param path 文件路径,包含文件名
* @param contentType 文件类型
* @return 返回http地址 * @return 返回http地址
*/ */
UploadResult upload(InputStream inputStream, String path, String contentType); UploadResult upload(InputStream inputStream, String path, String contentType);
@@ -59,6 +65,7 @@ public interface IOssStrategy {
* *
* @param inputStream 字节流 * @param inputStream 字节流
* @param suffix 后缀 * @param suffix 后缀
* @param contentType 文件类型
* @return 返回http地址 * @return 返回http地址
*/ */
UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType); UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType);

View File

@@ -60,5 +60,10 @@ public abstract class AbstractOssStrategy implements IOssStrategy {
@Override @Override
public abstract UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType); public abstract UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType);
/**
* 获取域名访问链接
*
* @return 域名访问链接
*/
public abstract String getEndpointLink(); public abstract String getEndpointLink();
} }

View File

@@ -68,6 +68,14 @@ public interface SysUserMapper extends BaseMapperPlus<SysUserMapper, SysUser, Sy
*/ */
SysUser selectUserByUserName(String userName); SysUser selectUserByUserName(String userName);
/**
* 通过手机号查询用户
*
* @param phonenumber 手机号
* @return 用户对象信息
*/
SysUser selectUserByPhonenumber(String phonenumber);
/** /**
* 通过用户ID查询用户 * 通过用户ID查询用户
* *

View File

@@ -3,6 +3,8 @@ package com.ruoyi.system.mapper;
import com.ruoyi.common.core.mapper.BaseMapperPlus; import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.domain.SysUserRole;
import java.util.List;
/** /**
* 用户与角色关联表 数据层 * 用户与角色关联表 数据层
* *
@@ -10,6 +12,6 @@ import com.ruoyi.system.domain.SysUserRole;
*/ */
public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRoleMapper, SysUserRole, SysUserRole> { public interface SysUserRoleMapper extends BaseMapperPlus<SysUserRoleMapper, SysUserRole, SysUserRole> {
Long selectUserIdByRoleId(Long roleId); List<Long> selectUserIdsByRoleId(Long roleId);
} }

View File

@@ -48,6 +48,14 @@ public interface ISysUserService {
*/ */
SysUser selectUserByUserName(String userName); SysUser selectUserByUserName(String userName);
/**
* 通过手机号查询用户
*
* @param phonenumber 手机号
* @return 用户对象信息
*/
SysUser selectUserByPhonenumber(String phonenumber);
/** /**
* 通过用户ID查询用户 * 通过用户ID查询用户
* *

View File

@@ -8,6 +8,7 @@ import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.dto.RoleDTO; import com.ruoyi.common.core.domain.dto.RoleDTO;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.domain.model.XcxLoginUser;
import com.ruoyi.common.core.service.LogininforService; import com.ruoyi.common.core.service.LogininforService;
import com.ruoyi.common.enums.DeviceType; import com.ruoyi.common.enums.DeviceType;
import com.ruoyi.common.enums.UserStatus; import com.ruoyi.common.enums.UserStatus;
@@ -87,6 +88,8 @@ public class SysLoginService {
// 登录成功 清空错误次数 // 登录成功 清空错误次数
RedisUtils.deleteObject(Constants.LOGIN_ERROR + username); RedisUtils.deleteObject(Constants.LOGIN_ERROR + username);
// 此处可根据登录用户的数据不同 自行创建 loginUser
LoginUser loginUser = buildLoginUser(user); LoginUser loginUser = buildLoginUser(user);
// 生成token // 生成token
LoginHelper.loginByDevice(loginUser, DeviceType.PC); LoginHelper.loginByDevice(loginUser, DeviceType.PC);
@@ -96,10 +99,84 @@ public class SysLoginService {
return StpUtil.getTokenValue(); return StpUtil.getTokenValue();
} }
public String smsLogin(String phonenumber, String smsCode) {
// 通过手机号查找用户
SysUser user = loadUserByPhonenumber(phonenumber);
HttpServletRequest request = ServletUtils.getRequest();
// 获取用户登录错误次数(可自定义限制策略 例如: key + username + ip)
Integer errorNumber = RedisUtils.getCacheObject(Constants.LOGIN_ERROR + user.getUserName());
// 锁定时间内登录 则踢出
if (ObjectUtil.isNotNull(errorNumber) && errorNumber.equals(Constants.LOGIN_ERROR_NUMBER)) {
asyncService.recordLogininfor(user.getUserName(), Constants.LOGIN_FAIL, MessageUtils.message("sms.code.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME), request);
throw new UserException("sms.code.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME);
}
if (!validateSmsCode(phonenumber, smsCode)) {
// 是否第一次
errorNumber = ObjectUtil.isNull(errorNumber) ? 1 : errorNumber + 1;
// 达到规定错误次数 则锁定登录
if (errorNumber.equals(Constants.LOGIN_ERROR_NUMBER)) {
RedisUtils.setCacheObject(Constants.LOGIN_ERROR + user.getUserName(), errorNumber, Constants.LOGIN_ERROR_LIMIT_TIME, TimeUnit.MINUTES);
asyncService.recordLogininfor(user.getUserName(), Constants.LOGIN_FAIL, MessageUtils.message("sms.code.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME), request);
throw new UserException("sms.code.retry.limit.exceed", Constants.LOGIN_ERROR_LIMIT_TIME);
} else {
// 未达到规定错误次数 则递增
RedisUtils.setCacheObject(Constants.LOGIN_ERROR + user.getUserName(), errorNumber);
asyncService.recordLogininfor(user.getUserName(), Constants.LOGIN_FAIL, MessageUtils.message("sms.code.retry.limit.count", errorNumber), request);
throw new UserException("sms.code.retry.limit.count", errorNumber);
}
}
// 登录成功 清空错误次数
RedisUtils.deleteObject(Constants.LOGIN_ERROR + user.getUserName());
// 此处可根据登录用户的数据不同 自行创建 loginUser
LoginUser loginUser = buildLoginUser(user);
// 生成token
LoginHelper.loginByDevice(loginUser, DeviceType.APP);
asyncService.recordLogininfor(user.getUserName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"), request);
recordLoginInfo(user.getUserId(), user.getUserName());
return StpUtil.getTokenValue();
}
public String xcxLogin(String xcxCode) {
HttpServletRequest request = ServletUtils.getRequest();
// xcxCode 为 小程序调用 wx.login 授权后获取
// todo 以下自行实现
// 校验 appid + appsrcret + xcxCode 调用登录凭证校验接口 获取 session_key 与 openid
String openid = "";
SysUser user = loadUserByOpenid(openid);
// 此处可根据登录用户的数据不同 自行创建 loginUser
XcxLoginUser loginUser = new XcxLoginUser();
loginUser.setUserId(user.getUserId());
loginUser.setUsername(user.getUserName());
loginUser.setUserType(user.getUserType());
loginUser.setOpenid(openid);
// 生成token
LoginHelper.loginByDevice(loginUser, DeviceType.XCX);
asyncService.recordLogininfor(user.getUserName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"), request);
recordLoginInfo(user.getUserId(), user.getUserName());
return StpUtil.getTokenValue();
}
public void logout(String loginName) { public void logout(String loginName) {
asyncService.recordLogininfor(loginName, Constants.LOGOUT, MessageUtils.message("user.logout.success"), ServletUtils.getRequest()); asyncService.recordLogininfor(loginName, Constants.LOGOUT, MessageUtils.message("user.logout.success"), ServletUtils.getRequest());
} }
/**
* 校验短信验证码
*/
private boolean validateSmsCode(String phonenumber, String smsCode) {
// todo 此处使用手机号查询redis验证码与参数验证码是否一致 用户自行实现
return true;
}
/** /**
* 校验验证码 * 校验验证码
* *
@@ -136,6 +213,38 @@ public class SysLoginService {
return user; return user;
} }
private SysUser loadUserByPhonenumber(String phonenumber) {
SysUser user = userService.selectUserByPhonenumber(phonenumber);
if (ObjectUtil.isNull(user)) {
log.info("登录用户:{} 不存在.", phonenumber);
throw new UserException("user.not.exists", phonenumber);
} else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
log.info("登录用户:{} 已被删除.", phonenumber);
throw new UserException("user.password.delete", phonenumber);
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
log.info("登录用户:{} 已被停用.", phonenumber);
throw new UserException("user.blocked", phonenumber);
}
return user;
}
private SysUser loadUserByOpenid(String openid) {
// 使用 openid 查询绑定用户 如未绑定用户 则根据业务自行处理 例如 创建默认用户
// todo 自行实现 userService.selectUserByOpenid(openid);
SysUser user = new SysUser();
if (ObjectUtil.isNull(user)) {
log.info("登录用户:{} 不存在.", openid);
// todo 用户不存在 业务逻辑自行实现
} else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
log.info("登录用户:{} 已被删除.", openid);
// todo 用户已被删除 业务逻辑自行实现
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
log.info("登录用户:{} 已被停用.", openid);
// todo 用户已被停用 业务逻辑自行实现
}
return user;
}
/** /**
* 构建登录用户 * 构建登录用户
*/ */

View File

@@ -85,7 +85,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override @Override
public List<Long> selectDeptListByRoleId(Long roleId) { public List<Long> selectDeptListByRoleId(Long roleId) {
SysRole role = roleMapper.selectById(roleId); SysRole role = roleMapper.selectById(roleId);
return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly() == 1); return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly());
} }
/** /**

View File

@@ -123,7 +123,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
@Override @Override
public List<Long> selectMenuListByRoleId(Long roleId) { public List<Long> selectMenuListByRoleId(Long roleId) {
SysRole role = roleMapper.selectById(roleId); SysRole role = roleMapper.selectById(roleId);
return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly() == 1); return baseMapper.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly());
} }
/** /**

View File

@@ -115,7 +115,7 @@ public class SysUserServiceImpl implements ISysUserService {
*/ */
@Override @Override
public TableDataInfo<SysUser> selectUnallocatedList(SysUser user, PageQuery pageQuery) { public TableDataInfo<SysUser> selectUnallocatedList(SysUser user, PageQuery pageQuery) {
Long userId = userRoleMapper.selectUserIdByRoleId(user.getRoleId()); List<Long> userId = userRoleMapper.selectUserIdsByRoleId(user.getRoleId());
QueryWrapper<SysUser> wrapper = Wrappers.query(); QueryWrapper<SysUser> wrapper = Wrappers.query();
wrapper.eq("u.del_flag", UserConstants.USER_NORMAL) wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
.and(w -> w.ne("r.role_id", user.getRoleId()).or().isNull("r.role_id")) .and(w -> w.ne("r.role_id", user.getRoleId()).or().isNull("r.role_id"))
@@ -137,6 +137,17 @@ public class SysUserServiceImpl implements ISysUserService {
return baseMapper.selectUserByUserName(userName); return baseMapper.selectUserByUserName(userName);
} }
/**
* 通过手机号查询用户
*
* @param phonenumber 手机号
* @return 用户对象信息
*/
@Override
public SysUser selectUserByPhonenumber(String phonenumber) {
return baseMapper.selectUserByPhonenumber(phonenumber);
}
/** /**
* 通过用户ID查询用户 * 通过用户ID查询用户
* *

View File

@@ -121,6 +121,11 @@
where u.del_flag = '0' and u.user_name = #{userName} where u.del_flag = '0' and u.user_name = #{userName}
</select> </select>
<select id="selectUserByPhonenumber" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.del_flag = '0' and u.phonenumber = #{phonenumber}
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult"> <select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/> <include refid="selectUserVo"/>
where u.del_flag = '0' and u.user_id = #{userId} where u.del_flag = '0' and u.user_id = #{userId}

View File

@@ -8,7 +8,7 @@
<result property="userId" column="user_id"/> <result property="userId" column="user_id"/>
<result property="roleId" column="role_id"/> <result property="roleId" column="role_id"/>
</resultMap> </resultMap>
<select id="selectUserIdByRoleId" resultType="Long"> <select id="selectUserIdsByRoleId" resultType="Long">
select u.user_id from sys_user u select u.user_id from sys_user u
inner join sys_user_role ur inner join sys_user_role ur
on u.user_id = ur.user_id and ur.role_id = #{roleId} on u.user_id = ur.user_id and ur.role_id = #{roleId}

View File

@@ -21,7 +21,11 @@ export default {
} }
if (title) { if (title) {
vnodes.push(<span slot='title'>{(title)}</span>) if (title.length > 5) {
vnodes.push(<span slot='title' title={(title)}>{(title)}</span>)
} else {
vnodes.push(<span slot='title'>{(title)}</span>)
}
} }
return vnodes return vnodes
} }

View File

@@ -101,6 +101,10 @@ export default {
width: calc(100% - 54px); width: calc(100% - 54px);
} }
.sidebarHide .fixed-header {
width: 100%;
}
.mobile .fixed-header { .mobile .fixed-header {
width: 100%; width: 100%;
} }

View File

@@ -222,6 +222,7 @@ Router.prototype.push = function push(location) {
} }
export default new Router({ export default new Router({
base: process.env.VUE_APP_CONTEXT_PATH,
mode: 'history', // 去掉url中的# mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes routes: constantRoutes

View File

@@ -12,6 +12,9 @@ const state = {
const mutations = { const mutations = {
TOGGLE_SIDEBAR: state => { TOGGLE_SIDEBAR: state => {
if (state.sidebar.hide) {
return false;
}
state.sidebar.opened = !state.sidebar.opened state.sidebar.opened = !state.sidebar.opened
state.sidebar.withoutAnimation = false state.sidebar.withoutAnimation = false
if (state.sidebar.opened) { if (state.sidebar.opened) {

View File

@@ -51,7 +51,7 @@ const user = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getInfo().then(res => {
const user = res.data.user const user = res.data.user
const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : user.avatar; const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : user.avatar;
if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.data.roles) commit('SET_ROLES', res.data.roles)
commit('SET_PERMISSIONS', res.data.permissions) commit('SET_PERMISSIONS', res.data.permissions)

View File

@@ -1,6 +1,14 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="数据源" prop="dataName">
<el-input
v-model="queryParams.dataName"
placeholder="请输入数据源名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="表名称" prop="tableName"> <el-form-item label="表名称" prop="tableName">
<el-input <el-input
v-model="queryParams.tableName" v-model="queryParams.tableName"
@@ -218,7 +226,8 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
tableName: undefined, tableName: undefined,
tableComment: undefined tableComment: undefined,
dataName: "master"
}, },
// 预览参数 // 预览参数
preview: { preview: {
@@ -230,7 +239,7 @@ export default {
}; };
}, },
created() { created() {
localStorage.setItem("dataName", "master"); localStorage.setItem("dataName", this.queryParams.dataName);
this.getList(); this.getList();
}, },
activated() { activated() {
@@ -254,6 +263,7 @@ export default {
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
localStorage.setItem("dataName", this.queryParams.dataName);
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },

View File

@@ -1,67 +1,68 @@
rem 使用者应根据自身平台编码自行转换 防止乱码 例如 win使用gbk编码
@echo off @echo off
rem jarƽ<EFBFBD><EFBFBD>Ŀ¼ rem jar平级目录
set AppName=ruoyi-admin.jar set AppName=ruoyi-admin.jar
rem JVM<EFBFBD><EFBFBD><EFBFBD><EFBFBD> rem JVM参数
set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC" set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
ECHO. ECHO.
ECHO. [1] <EFBFBD><EFBFBD><EFBFBD><EFBFBD>%AppName% ECHO. [1] 启动%AppName%
ECHO. [2] <EFBFBD>ر<EFBFBD>%AppName% ECHO. [2] 关闭%AppName%
ECHO. [3] <EFBFBD><EFBFBD><EFBFBD><EFBFBD>%AppName% ECHO. [3] 重启%AppName%
ECHO. [4] <EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ %AppName% ECHO. [4] 启动状态 %AppName%
ECHO. [5] <EFBFBD><EFBFBD> <20><> ECHO. [5] 退 出
ECHO. ECHO.
ECHO.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ECHO.请输入选择项目的序号:
set /p ID= set /p ID=
IF "%id%"=="1" GOTO start IF "%id%"=="1" GOTO start
IF "%id%"=="2" GOTO stop IF "%id%"=="2" GOTO stop
IF "%id%"=="3" GOTO restart IF "%id%"=="3" GOTO restart
IF "%id%"=="4" GOTO status IF "%id%"=="4" GOTO status
IF "%id%"=="5" EXIT IF "%id%"=="5" EXIT
PAUSE PAUSE
:start :start
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a set pid=%%a
set image_name=%%b set image_name=%%b
) )
if defined pid ( if defined pid (
echo %%is running echo %%is running
PAUSE PAUSE
) )
start javaw %JVM_OPTS% -jar %AppName% start javaw %JVM_OPTS% -jar %AppName%
echo starting<EFBFBD><EFBFBD><EFBFBD><EFBFBD> echo starting……
echo Start %AppName% success... echo Start %AppName% success...
goto:eof goto:eof
rem <EFBFBD><EFBFBD><EFBFBD><EFBFBD>stopͨ<EFBFBD><EFBFBD>jps<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>pid<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rem 函数stop通过jps命令查找pid并结束进程
:stop :stop
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a set pid=%%a
set image_name=%%b set image_name=%%b
) )
if not defined pid (echo process %AppName% does not exists) else ( if not defined pid (echo process %AppName% does not exists) else (
echo prepare to kill %image_name% echo prepare to kill %image_name%
echo start kill %pid% ... echo start kill %pid% ...
rem <20><><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD>ID<49><44>kill<6C><6C><EFBFBD><EFBFBD> rem 根据进程IDkill进程
taskkill /f /pid %pid% taskkill /f /pid %pid%
) )
goto:eof goto:eof
:restart :restart
call :stop call :stop
call :start call :start
goto:eof goto:eof
:status :status
for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do (
set pid=%%a set pid=%%a
set image_name=%%b set image_name=%%b
) )
if not defined pid (echo process %AppName% is dead ) else ( if not defined pid (echo process %AppName% is dead ) else (
echo %image_name% is running echo %image_name% is running
) )
goto:eof goto:eof

View File

@@ -1,9 +1,9 @@
DROP TABLE if EXISTS test_demo; DROP TABLE if EXISTS test_demo;
CREATE TABLE test_demo CREATE TABLE test_demo
( (
id int(0) NOT NULL COMMENT '主键', id bigint(0) NOT NULL COMMENT '主键',
dept_id int(0) NULL DEFAULT NULL COMMENT '部门id', dept_id bigint(0) NULL DEFAULT NULL COMMENT '部门id',
user_id int(0) NULL DEFAULT NULL COMMENT '用户id', user_id bigint(0) NULL DEFAULT NULL COMMENT '用户id',
order_num int(0) NULL DEFAULT 0 COMMENT '排序号', order_num int(0) NULL DEFAULT 0 COMMENT '排序号',
test_key varchar(255) NULL DEFAULT NULL COMMENT 'key键', test_key varchar(255) NULL DEFAULT NULL COMMENT 'key键',
value varchar(255) NULL DEFAULT NULL COMMENT '', value varchar(255) NULL DEFAULT NULL COMMENT '',
@@ -19,10 +19,10 @@ CREATE TABLE test_demo
DROP TABLE if EXISTS test_tree; DROP TABLE if EXISTS test_tree;
CREATE TABLE test_tree CREATE TABLE test_tree
( (
id int(0) NOT NULL COMMENT '主键', id bigint(0) NOT NULL COMMENT '主键',
parent_id int(0) NULL DEFAULT 0 COMMENT '父id', parent_id bigint(0) NULL DEFAULT 0 COMMENT '父id',
dept_id int(0) NULL DEFAULT NULL COMMENT '部门id', dept_id bigint(0) NULL DEFAULT NULL COMMENT '部门id',
user_id int(0) NULL DEFAULT NULL COMMENT '用户id', user_id bigint(0) NULL DEFAULT NULL COMMENT '用户id',
tree_name varchar(255) NULL DEFAULT NULL COMMENT '', tree_name varchar(255) NULL DEFAULT NULL COMMENT '',
version int(0) NULL DEFAULT 0 COMMENT '版本', version int(0) NULL DEFAULT 0 COMMENT '版本',
create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间', create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
@@ -36,24 +36,24 @@ CREATE TABLE test_tree
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 (3, 108, 'test', '本部门及以下 密码666666', 'sys_user', '', '', '0', '', '$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), 'test', sysdate(), 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 (3, 108, 'test', '本部门及以下 密码666666', 'sys_user', '', '', '0', '', '$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), 'test', sysdate(), 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 (4, 102, 'test1', '仅本人 密码666666', 'sys_user', '', '', '0', '', '$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), 'test1', sysdate(), 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 (4, 102, 'test1', '仅本人 密码666666', 'sys_user', '', '', '0', '', '$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), 'test1', sysdate(), NULL);
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (5, '测试菜单', 0, 5, 'demo', NULL, 1, 0, 'M', '0', '0', NULL, 'star', 'admin', '2021-05-30 00:34:26', NULL, NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (5, '测试菜单', 0, 5, 'demo', NULL, 1, 0, 'M', '0', '0', NULL, 'star', 'admin', sysdate(), NULL, NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1500, '测试单表', 5, 1, 'demo', 'demo/demo/index', 1, 0, 'C', '0', '0', 'demo:demo:list', '#', 'admin', '2021-05-30 00:39:23', '', NULL, '测试单表菜单'); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1500, '测试单表', 5, 1, 'demo', 'demo/demo/index', 1, 0, 'C', '0', '0', 'demo:demo:list', '#', 'admin', sysdate(), '', NULL, '测试单表菜单');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1501, '测试单表查询', 1500, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:query', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1501, '测试单表查询', 1500, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:query', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1502, '测试单表新增', 1500, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:add', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1502, '测试单表新增', 1500, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:add', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1503, '测试单表修改', 1500, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:edit', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1503, '测试单表修改', 1500, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:edit', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1504, '测试单表删除', 1500, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:remove', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1504, '测试单表删除', 1500, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:remove', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1505, '测试单表导出', 1500, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:export', '#', 'admin', '2021-05-30 00:39:23', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1505, '测试单表导出', 1500, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:export', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1506, '测试树表', 5, 1, 'tree', 'demo/tree/index', 1, 0, 'C', '0', '0', 'demo:tree:list', '#', 'admin', '2021-05-30 00:39:30', '', NULL, '测试树表菜单'); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1506, '测试树表', 5, 1, 'tree', 'demo/tree/index', 1, 0, 'C', '0', '0', 'demo:tree:list', '#', 'admin', sysdate(), '', NULL, '测试树表菜单');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1507, '测试树表查询', 1506, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:query', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1507, '测试树表查询', 1506, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:query', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1508, '测试树表新增', 1506, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:add', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1508, '测试树表新增', 1506, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:add', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1509, '测试树表修改', 1506, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:edit', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1509, '测试树表修改', 1506, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:edit', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1510, '测试树表删除', 1506, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:remove', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1510, '测试树表删除', 1506, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:remove', '#', 'admin', sysdate(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1511, '测试树表导出', 1506, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:export', '#', 'admin', '2021-05-30 00:39:30', '', NULL, ''); INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1511, '测试树表导出', 1506, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:export', '#', 'admin', sysdate(), '', 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 (3, '本部门及以下', 'test1', 3, '4', 1, 1, '0', '0', 'admin', '2021-05-08 22:31:37', 'admin', '2021-05-08 22:32:03', 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 (3, '本部门及以下', 'test1', 3, '4', 1, 1, '0', '0', 'admin', sysdate(), 'admin', NULL, 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 (4, '仅本人', 'test2', 4, '5', 1, 1, '0', '0', 'admin', '2021-05-30 01:14:52', 'admin', '2021-05-30 01:18:38', 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 (4, '仅本人', 'test2', 4, '5', 1, 1, '0', '0', 'admin', sysdate(), 'admin', NULL, NULL);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1); INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 5); INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 5);
@@ -142,30 +142,30 @@ INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1511);
INSERT INTO sys_user_role(user_id, role_id) VALUES (3, 3); INSERT INTO sys_user_role(user_id, role_id) VALUES (3, 3);
INSERT INTO sys_user_role(user_id, role_id) VALUES (4, 4); INSERT INTO sys_user_role(user_id, role_id) VALUES (4, 4);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 102, 4, 1, '测试数据权限', '测试', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 102, 4, 1, '测试数据权限', '测试', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 102, 3, 2, '子节点1', '111', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 102, 3, 2, '子节点1', '111', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 102, 3, 3, '子节点2', '222', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 102, 3, 3, '子节点2', '222', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 108, 4, 4, '测试数据', 'demo', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 108, 4, 4, '测试数据', 'demo', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 108, 3, 13, '子节点11', '1111', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 108, 3, 13, '子节点11', '1111', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 108, 3, 12, '子节点22', '2222', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 108, 3, 12, '子节点22', '2222', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 108, 3, 11, '子节点33', '3333', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 108, 3, 11, '子节点33', '3333', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 108, 3, 10, '子节点44', '4444', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 108, 3, 10, '子节点44', '4444', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 108, 3, 9, '子节点55', '5555', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 108, 3, 9, '子节点55', '5555', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 108, 3, 8, '子节点66', '6666', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 108, 3, 8, '子节点66', '6666', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 108, 3, 7, '子节点77', '7777', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 108, 3, 7, '子节点77', '7777', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 108, 3, 6, '子节点88', '8888', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 108, 3, 6, '子节点88', '8888', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 108, 3, 5, '子节点99', '9999', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 108, 3, 5, '子节点99', '9999', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 0, 102, 4, '测试数据权限', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 0, 102, 4, '测试数据权限', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 1, 102, 3, '子节点1', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 1, 102, 3, '子节点1', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 2, 102, 3, '子节点2', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 2, 102, 3, '子节点2', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 0, 108, 4, '测试树1', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 0, 108, 4, '测试树1', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 4, 108, 3, '子节点11', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 4, 108, 3, '子节点11', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 4, 108, 3, '子节点22', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 4, 108, 3, '子节点22', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 4, 108, 3, '子节点33', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 4, 108, 3, '子节点33', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 5, 108, 3, '子节点44', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 5, 108, 3, '子节点44', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 6, 108, 3, '子节点55', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 6, 108, 3, '子节点55', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 7, 108, 3, '子节点66', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 7, 108, 3, '子节点66', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 7, 108, 3, '子节点77', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 7, 108, 3, '子节点77', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 10, 108, 3, '子节点88', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 10, 108, 3, '子节点88', 0, sysdate(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 10, 108, 3, '子节点99', 0, '2021-06-01 10:00:00', 'admin', NULL, NULL, 0); INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 10, 108, 3, '子节点99', 0, sysdate(), 'admin', NULL, NULL, 0);

View File

@@ -2,7 +2,7 @@
-- 1、部门表 -- 1、部门表
-- ---------------------------- -- ----------------------------
drop table if exists sys_dept; drop table if exists sys_dept;
create table sys_dept create table if not exists sys_dept
( (
dept_id int8, dept_id int8,
parent_id int8 default 0, parent_id int8 default 0,
@@ -55,7 +55,7 @@ insert into sys_dept values(109, 102, '0,100,102', '财务部门', 2, '若
-- 2、用户信息表 -- 2、用户信息表
-- ---------------------------- -- ----------------------------
drop table if exists sys_user; drop table if exists sys_user;
create table sys_user create table if not exists sys_user
( (
user_id int8, user_id int8,
dept_id int8, dept_id int8,
@@ -111,7 +111,7 @@ insert into sys_user values(2, 105, 'ry', '若依', 'sys_user', 'crazyL
-- 3、岗位信息表 -- 3、岗位信息表
-- ---------------------------- -- ----------------------------
drop table if exists sys_post; drop table if exists sys_post;
create table sys_post create table if not exists sys_post
( (
post_id int8, post_id int8,
post_code varchar(64) not null, post_code varchar(64) not null,
@@ -150,15 +150,15 @@ insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', now(),
-- 4、角色信息表 -- 4、角色信息表
-- ---------------------------- -- ----------------------------
drop table if exists sys_role; drop table if exists sys_role;
create table sys_role create table if not exists sys_role
( (
role_id int8, role_id int8,
role_name varchar(30) not null, role_name varchar(30) not null,
role_key varchar(100) not null, role_key varchar(100) not null,
role_sort int4 not null, role_sort int4 not null,
data_scope char default '1'::bpchar, data_scope char default '1'::bpchar,
menu_check_strictly smallint default 1, menu_check_strictly bool default true,
dept_check_strictly smallint default 1, dept_check_strictly bool default true,
status char not null, status char not null,
del_flag char default '0'::bpchar, del_flag char default '0'::bpchar,
create_by varchar(64) default ''::varchar, create_by varchar(64) default ''::varchar,
@@ -188,15 +188,15 @@ comment on column sys_role.remark is '备注';
-- ---------------------------- -- ----------------------------
-- 初始化-角色信息表数据 -- 初始化-角色信息表数据
-- ---------------------------- -- ----------------------------
insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', now(), '', null, '超级管理员'); insert into sys_role values('1', '超级管理员', 'admin', 1, '1', 't', 't', '0', '0', 'admin', now(), '', null, '超级管理员');
insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', now(), '', null, '普通角色'); insert into sys_role values('2', '普通角色', 'common', 2, '2', 't', 't', '0', '0', 'admin', now(), '', null, '普通角色');
-- ---------------------------- -- ----------------------------
-- 5、菜单权限表 -- 5、菜单权限表
-- ---------------------------- -- ----------------------------
drop table if exists sys_menu; drop table if exists sys_menu;
create table sys_menu create table if not exists sys_menu
( (
menu_id int8, menu_id int8,
menu_name varchar(50) not null, menu_name varchar(50) not null,
@@ -383,7 +383,7 @@ insert into sys_menu values('1170', '发起流程', '124', '1', '#', '', '', 1,
-- 6、用户和角色关联表 用户N-1角色 -- 6、用户和角色关联表 用户N-1角色
-- ---------------------------- -- ----------------------------
drop table if exists sys_user_role; drop table if exists sys_user_role;
create table sys_user_role create table if not exists sys_user_role
( (
user_id int8 not null, user_id int8 not null,
role_id int8 not null, role_id int8 not null,
@@ -405,7 +405,7 @@ insert into sys_user_role values ('2', '2');
-- 7、角色和菜单关联表 角色1-N菜单 -- 7、角色和菜单关联表 角色1-N菜单
-- ---------------------------- -- ----------------------------
drop table if exists sys_role_menu; drop table if exists sys_role_menu;
create table sys_role_menu create table if not exists sys_role_menu
( (
role_id int8 not null, role_id int8 not null,
menu_id int8 not null, menu_id int8 not null,
@@ -531,7 +531,7 @@ insert into sys_role_menu values ('2', '1170');
-- 8、角色和部门关联表 角色1-N部门 -- 8、角色和部门关联表 角色1-N部门
-- ---------------------------- -- ----------------------------
drop table if exists sys_role_dept; drop table if exists sys_role_dept;
create table sys_role_dept create table if not exists sys_role_dept
( (
role_id int8 not null, role_id int8 not null,
dept_id int8 not null, dept_id int8 not null,
@@ -554,7 +554,7 @@ insert into sys_role_dept values ('2', '105');
-- 9、用户与岗位关联表 用户1-N岗位 -- 9、用户与岗位关联表 用户1-N岗位
-- ---------------------------- -- ----------------------------
drop table if exists sys_user_post; drop table if exists sys_user_post;
create table sys_user_post create table if not exists sys_user_post
( (
user_id int8 not null, user_id int8 not null,
post_id int8 not null, post_id int8 not null,
@@ -576,7 +576,7 @@ insert into sys_user_post values ('2', '2');
-- 10、操作日志记录 -- 10、操作日志记录
-- ---------------------------- -- ----------------------------
drop table if exists sys_oper_log; drop table if exists sys_oper_log;
create table sys_oper_log create table if not exists sys_oper_log
( (
oper_id int8, oper_id int8,
title varchar(50) default ''::varchar, title varchar(50) default ''::varchar,
@@ -619,7 +619,7 @@ comment on column sys_oper_log.oper_time is '操作时间';
-- 11、字典类型表 -- 11、字典类型表
-- ---------------------------- -- ----------------------------
drop table if exists sys_dict_type; drop table if exists sys_dict_type;
create table sys_dict_type create table if not exists sys_dict_type
( (
dict_id int8, dict_id int8,
dict_name varchar(100) default ''::varchar, dict_name varchar(100) default ''::varchar,
@@ -658,7 +658,7 @@ insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0',
-- 12、字典数据表 -- 12、字典数据表
-- ---------------------------- -- ----------------------------
drop table if exists sys_dict_data; drop table if exists sys_dict_data;
create table sys_dict_data create table if not exists sys_dict_data
( (
dict_code int8, dict_code int8,
dict_sort int4 default 0, dict_sort int4 default 0,
@@ -723,7 +723,7 @@ insert into sys_dict_data values(28, 2, '失败', '1', 'sys_common_st
-- 13、参数配置表 -- 13、参数配置表
-- ---------------------------- -- ----------------------------
drop table if exists sys_config; drop table if exists sys_config;
create table sys_config create table if not exists sys_config
( (
config_id int8, config_id int8,
config_name varchar(100) default ''::varchar, config_name varchar(100) default ''::varchar,
@@ -762,7 +762,7 @@ insert into sys_config values(11, 'OSS预览列表资源开关', 'sys.o
-- 14、系统访问记录 -- 14、系统访问记录
-- ---------------------------- -- ----------------------------
drop table if exists sys_logininfor; drop table if exists sys_logininfor;
create table sys_logininfor create table if not exists sys_logininfor
( (
info_id int8, info_id int8,
user_name varchar(50) default ''::varchar, user_name varchar(50) default ''::varchar,
@@ -791,7 +791,7 @@ comment on column sys_logininfor.login_time is '访问时间';
-- 17、通知公告表 -- 17、通知公告表
-- ---------------------------- -- ----------------------------
drop table if exists sys_notice; drop table if exists sys_notice;
create table sys_notice create table if not exists sys_notice
( (
notice_id int8, notice_id int8,
notice_title varchar(50) not null, notice_title varchar(50) not null,
@@ -829,7 +829,7 @@ insert into sys_notice values('2', '维护通知2018-07-01 系统凌晨维护
-- 18、代码生成业务表 -- 18、代码生成业务表
-- ---------------------------- -- ----------------------------
drop table if exists gen_table; drop table if exists gen_table;
create table gen_table create table if not exists gen_table
( (
table_id int8, table_id int8,
table_name varchar(200) default ''::varchar, table_name varchar(200) default ''::varchar,
@@ -880,7 +880,7 @@ comment on column gen_table.remark is '备注';
-- 19、代码生成业务表字段 -- 19、代码生成业务表字段
-- ---------------------------- -- ----------------------------
drop table if exists gen_table_column; drop table if exists gen_table_column;
create table gen_table_column create table if not exists gen_table_column
( (
column_id int8, column_id int8,
table_id int8, table_id int8,
@@ -935,7 +935,7 @@ comment on column gen_table_column.update_time is '更新时间';
-- OSS对象存储表 -- OSS对象存储表
-- ---------------------------- -- ----------------------------
drop table if exists sys_oss; drop table if exists sys_oss;
create table sys_oss create table if not exists sys_oss
( (
oss_id int8, oss_id int8,
file_name varchar(255) default ''::varchar not null, file_name varchar(255) default ''::varchar not null,
@@ -966,7 +966,7 @@ comment on column sys_oss.service is '服务商';
-- OSS对象存储动态配置表 -- OSS对象存储动态配置表
-- ---------------------------- -- ----------------------------
drop table if exists sys_oss_config; drop table if exists sys_oss_config;
create table sys_oss_config create table if not exists sys_oss_config
( (
oss_config_id int8, oss_config_id int8,
config_key varchar(255) default ''::varchar not null, config_key varchar(255) default ''::varchar not null,
@@ -1083,4 +1083,3 @@ comment on column wf_category.create_time is '创建时间';
comment on column wf_category.update_by is '更新者'; comment on column wf_category.update_by is '更新者';
comment on column wf_category.update_time is '更新时间'; comment on column wf_category.update_time is '更新时间';
comment on column wf_category.del_flag is '删除标志0代表存在 2代表删除'; comment on column wf_category.del_flag is '删除标志0代表存在 2代表删除';

View File

@@ -0,0 +1,196 @@
DROP TABLE if EXISTS test_demo;
create table if not exists test_demo
(
id int8,
dept_id int8,
user_id int8,
order_num int4 default 0,
test_key varchar(255),
value varchar(255),
version int4 default 0,
create_time timestamp,
create_by varchar(64),
update_time timestamp,
update_by varchar(64),
del_flag int4 default 0
);
comment on table test_demo is '测试单表';
comment on column test_demo.id is '主键';
comment on column test_demo.dept_id is '部门id';
comment on column test_demo.user_id is '用户id';
comment on column test_demo.order_num is '排序号';
comment on column test_demo.test_key is 'key键';
comment on column test_demo.value is '';
comment on column test_demo.version is '版本';
comment on column test_demo.create_time is '创建时间';
comment on column test_demo.create_by is '创建人';
comment on column test_demo.update_time is '更新时间';
comment on column test_demo.update_by is '更新人';
comment on column test_demo.del_flag is '删除标志';
DROP TABLE if EXISTS test_tree;
create table if not exists test_tree
(
id int8,
parent_id int8 default 0,
dept_id int8,
user_id int8,
tree_name varchar(255),
version int4 default 0,
create_time timestamp,
create_by varchar(64),
update_time timestamp,
update_by varchar(64),
del_flag integer default 0
);
comment on table test_tree is '测试树表';
comment on column test_tree.id is '主键';
comment on column test_tree.parent_id is '父id';
comment on column test_tree.dept_id is '部门id';
comment on column test_tree.user_id is '用户id';
comment on column test_tree.tree_name is '';
comment on column test_tree.version is '版本';
comment on column test_tree.create_time is '创建时间';
comment on column test_tree.create_by is '创建人';
comment on column test_tree.update_time is '更新时间';
comment on column test_tree.update_by is '更新人';
comment on column test_tree.del_flag 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 (3, 108, 'test', '本部门及以下 密码666666', 'sys_user', '', '', '0', '', '$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', '0', '0', '127.0.0.1', now(), 'admin', now(), 'test', now(), 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 (4, 102, 'test1', '仅本人 密码666666', 'sys_user', '', '', '0', '', '$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', '0', '0', '127.0.0.1', now(), 'admin', now(), 'test1', now(), NULL);
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (5, '测试菜单', 0, 5, 'demo', NULL, 1, 0, 'M', '0', '0', NULL, 'star', 'admin', now(), NULL, NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1500, '测试单表', 5, 1, 'demo', 'demo/demo/index', 1, 0, 'C', '0', '0', 'demo:demo:list', '#', 'admin', now(), '', NULL, '测试单表菜单');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1501, '测试单表查询', 1500, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:query', '#', 'admin', now(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1502, '测试单表新增', 1500, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:add', '#', 'admin', now(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1503, '测试单表修改', 1500, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:edit', '#', 'admin', now(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1504, '测试单表删除', 1500, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:remove', '#', 'admin', now(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1505, '测试单表导出', 1500, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:demo:export', '#', 'admin', now(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1506, '测试树表', 5, 1, 'tree', 'demo/tree/index', 1, 0, 'C', '0', '0', 'demo:tree:list', '#', 'admin', now(), '', NULL, '测试树表菜单');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1507, '测试树表查询', 1506, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:query', '#', 'admin', now(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1508, '测试树表新增', 1506, 2, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:add', '#', 'admin', now(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1509, '测试树表修改', 1506, 3, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:edit', '#', 'admin', now(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1510, '测试树表删除', 1506, 4, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:remove', '#', 'admin', now(), '', NULL, '');
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) VALUES (1511, '测试树表导出', 1506, 5, '#', '', 1, 0, 'F', '0', '0', 'demo:tree:export', '#', 'admin', now(), '', 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 (3, '本部门及以下', 'test1', 3, '4', 't', 't', '0', '0', 'admin', now(), 'admin', NULL, 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 (4, '仅本人', 'test2', 4, '5', 't', 't', '0', '0', 'admin', now(), 'admin', NULL, NULL);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 5);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 100);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 101);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 102);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 103);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 104);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 105);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 106);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 107);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 108);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 500);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 501);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1001);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1002);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1003);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1004);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1005);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1006);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1007);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1008);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1009);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1010);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1011);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1012);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1013);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1014);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1015);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1016);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1017);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1018);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1019);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1020);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1021);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1022);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1023);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1024);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1025);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1026);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1027);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1028);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1029);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1030);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1031);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1032);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1033);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1034);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1035);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1036);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1037);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1038);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1039);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1040);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1041);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1042);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1043);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1044);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1045);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1500);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1501);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1502);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1503);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1504);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1505);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1506);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1507);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1508);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1509);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1510);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (3, 1511);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 5);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1500);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1501);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1502);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1503);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1504);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1505);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1506);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1507);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1508);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1509);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1510);
INSERT INTO sys_role_menu(role_id, menu_id) VALUES (4, 1511);
INSERT INTO sys_user_role(user_id, role_id) VALUES (3, 3);
INSERT INTO sys_user_role(user_id, role_id) VALUES (4, 4);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 102, 4, 1, '测试数据权限', '测试', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 102, 3, 2, '子节点1', '111', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 102, 3, 3, '子节点2', '222', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 108, 4, 4, '测试数据', 'demo', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 108, 3, 13, '子节点11', '1111', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 108, 3, 12, '子节点22', '2222', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 108, 3, 11, '子节点33', '3333', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 108, 3, 10, '子节点44', '4444', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 108, 3, 9, '子节点55', '5555', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 108, 3, 8, '子节点66', '6666', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 108, 3, 7, '子节点77', '7777', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 108, 3, 6, '子节点88', '8888', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_demo(id, dept_id, user_id, order_num, test_key, value, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 108, 3, 5, '子节点99', '9999', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (1, 0, 102, 4, '测试数据权限', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (2, 1, 102, 3, '子节点1', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (3, 2, 102, 3, '子节点2', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (4, 0, 108, 4, '测试树1', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (5, 4, 108, 3, '子节点11', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (6, 4, 108, 3, '子节点22', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (7, 4, 108, 3, '子节点33', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (8, 5, 108, 3, '子节点44', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (9, 6, 108, 3, '子节点55', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (10, 7, 108, 3, '子节点66', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (11, 7, 108, 3, '子节点77', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (12, 10, 108, 3, '子节点88', 0, now(), 'admin', NULL, NULL, 0);
INSERT INTO test_tree(id, parent_id, dept_id, user_id, tree_name, version, create_time, create_by, update_time, update_by, del_flag) VALUES (13, 10, 108, 3, '子节点99', 0, now(), 'admin', NULL, NULL, 0);

View File

@@ -0,0 +1,478 @@
CREATE TABLE [test_demo]
(
[id] bigint NOT NULL,
[dept_id] bigint NULL,
[user_id] bigint NULL,
[order_num] int DEFAULT ((0)) NULL,
[test_key] nvarchar(255) NULL,
[value] nvarchar(255) NULL,
[version] int DEFAULT ((0)) NULL,
[create_time] datetime2(0) NULL,
[create_by] nvarchar(64) NULL,
[update_time] datetime2(0) NULL,
[update_by] nvarchar(64) NULL,
[del_flag] int DEFAULT ((0)) NULL,
CONSTRAINT [PK__test_dem__3213E83F176051C8] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
GO
EXEC sp_addextendedproperty
'MS_Description', N'主键',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'id'
GO
EXEC sp_addextendedproperty
'MS_Description', N'部门id',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'dept_id'
GO
EXEC sp_addextendedproperty
'MS_Description', N'用户id',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'user_id'
GO
EXEC sp_addextendedproperty
'MS_Description', N'排序号',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'order_num'
GO
EXEC sp_addextendedproperty
'MS_Description', N'key键',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'test_key'
GO
EXEC sp_addextendedproperty
'MS_Description', N'',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'value'
GO
EXEC sp_addextendedproperty
'MS_Description', N'版本',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'version'
GO
EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'create_time'
GO
EXEC sp_addextendedproperty
'MS_Description', N'创建人',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'create_by'
GO
EXEC sp_addextendedproperty
'MS_Description', N'更新时间',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'update_time'
GO
EXEC sp_addextendedproperty
'MS_Description', N'更新人',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'update_by'
GO
EXEC sp_addextendedproperty
'MS_Description', N'删除标志',
'SCHEMA', N'dbo',
'TABLE', N'test_demo',
'COLUMN', N'del_flag'
GO
EXEC sp_addextendedproperty
'MS_Description', N'测试单表',
'SCHEMA', N'dbo',
'TABLE', N'test_demo'
GO
CREATE TABLE [test_tree]
(
[id] bigint NOT NULL,
[parent_id] bigint DEFAULT ((0)) NULL,
[dept_id] bigint NULL,
[user_id] bigint NULL,
[tree_name] nvarchar(255) NULL,
[version] int DEFAULT ((0)) NULL,
[create_time] datetime2(0) NULL,
[create_by] nvarchar(64) NULL,
[update_time] datetime2(0) NULL,
[update_by] nvarchar(64) NULL,
[del_flag] int DEFAULT ((0)) NULL,
CONSTRAINT [PK__test_tre__3213E83FC75A1B63] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
)
ON [PRIMARY]
GO
EXEC sp_addextendedproperty
'MS_Description', N'主键',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'id'
GO
EXEC sp_addextendedproperty
'MS_Description', N'父id',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'parent_id'
GO
EXEC sp_addextendedproperty
'MS_Description', N'部门id',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'dept_id'
GO
EXEC sp_addextendedproperty
'MS_Description', N'用户id',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'user_id'
GO
EXEC sp_addextendedproperty
'MS_Description', N'',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'tree_name'
GO
EXEC sp_addextendedproperty
'MS_Description', N'版本',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'version'
GO
EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'create_time'
GO
EXEC sp_addextendedproperty
'MS_Description', N'创建人',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'create_by'
GO
EXEC sp_addextendedproperty
'MS_Description', N'更新时间',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'update_time'
GO
EXEC sp_addextendedproperty
'MS_Description', N'更新人',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'update_by'
GO
EXEC sp_addextendedproperty
'MS_Description', N'删除标志',
'SCHEMA', N'dbo',
'TABLE', N'test_tree',
'COLUMN', N'del_flag'
GO
EXEC sp_addextendedproperty
'MS_Description', N'测试树表',
'SCHEMA', N'dbo',
'TABLE', N'test_tree'
GO
INSERT [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 (3, 108, N'test', N'本部门及以下 密码666666', N'sys_user', N'', N'', N'0', N'', N'$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', N'0', N'0', N'127.0.0.1', getdate(), N'admin', getdate(), N'test', getdate(), NULL);
GO
INSERT [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 (4, 102, N'test1', N'仅本人 密码666666', N'sys_user', N'', N'', N'0', N'', N'$2a$10$b8yUzN0C71sbz.PhNOCgJe.Tu1yWC3RNrTyjSQ8p1W0.aaUXUJ.Ne', N'0', N'0', N'127.0.0.1', getdate(), N'admin', getdate(), N'test1', getdate(), NULL);
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (5, N'测试菜单', 0, 5, N'demo', NULL, 1, 0, N'M', N'0', N'0', NULL, N'star', N'admin', getdate(), NULL, NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1500, N'测试单表', 5, 1, N'demo', N'demo/demo/index', 1, 0, N'C', N'0', N'0', N'demo:demo:list', N'#', N'admin', getdate(), N'', NULL, N'测试单表菜单');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1501, N'测试单表查询', 1500, 1, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:demo:query', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1502, N'测试单表新增', 1500, 2, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:demo:add', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1503, N'测试单表修改', 1500, 3, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:demo:edit', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1504, N'测试单表删除', 1500, 4, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:demo:remove', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1505, N'测试单表导出', 1500, 5, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:demo:export', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1506, N'测试树表', 5, 1, N'tree', N'demo/tree/index', 1, 0, N'C', N'0', N'0', N'demo:tree:list', N'#', N'admin', getdate(), N'', NULL, N'测试树表菜单');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1507, N'测试树表查询', 1506, 1, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:tree:query', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1508, N'测试树表新增', 1506, 2, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:tree:add', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1509, N'测试树表修改', 1506, 3, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:tree:edit', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1510, N'测试树表删除', 1506, 4, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:tree:remove', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [sys_menu] ([menu_id], [menu_name], [parent_id], [order_num], [path], [component], [is_frame], [is_cache], [menu_type], [visible], [status], [perms], [icon], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1511, N'测试树表导出', 1506, 5, N'#', N'', 1, 0, N'F', N'0', N'0', N'demo:tree:export', N'#', N'admin', getdate(), N'', NULL, N'');
GO
INSERT [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 (3, N'本部门及以下', N'test1', 3, N'4', 1, 1, N'0', N'0', N'admin', getdate(), N'admin', NULL, NULL);
GO
INSERT [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 (4, N'仅本人', N'test2', 4, N'5', 1, 1, N'0', N'0', N'admin', getdate(), N'admin', NULL, NULL);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 5);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 100);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 101);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 102);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 103);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 104);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 105);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 106);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 107);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 108);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 500);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 501);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1001);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1002);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1003);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1004);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1005);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1006);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1007);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1008);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1009);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1010);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1011);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1012);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1013);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1014);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1015);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1016);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1017);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1018);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1019);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1020);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1021);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1022);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1023);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1024);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1025);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1026);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1027);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1028);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1029);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1030);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1031);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1032);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1033);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1034);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1035);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1036);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1037);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1038);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1039);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1040);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1041);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1042);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1043);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1044);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1045);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1500);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1501);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1502);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1503);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1504);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1505);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1506);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1507);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1508);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1509);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1510);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (3, 1511);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 5);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1500);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1501);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1502);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1503);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1504);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1505);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1506);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1507);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1508);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1509);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1510);
GO
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (4, 1511);
GO
INSERT [sys_user_role] ([user_id], [role_id]) VALUES (3, 3);
GO
INSERT [sys_user_role] ([user_id], [role_id]) VALUES (4, 4);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (1, 102, 4, 1, N'测试数据权限', N'测试', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (2, 102, 3, 2, N'子节点1', N'111', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (3, 102, 3, 3, N'子节点2', N'222', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (4, 108, 4, 4, N'测试数据', N'demo', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (5, 108, 3, 13, N'子节点11', N'1111', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (6, 108, 3, 12, N'子节点22', N'2222', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (7, 108, 3, 11, N'子节点33', N'3333', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (8, 108, 3, 10, N'子节点44', N'4444', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (9, 108, 3, 9, N'子节点55', N'5555', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (10, 108, 3, 8, N'子节点66', N'6666', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (11, 108, 3, 7, N'子节点77', N'7777', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (12, 108, 3, 6, N'子节点88', N'8888', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_demo] ([id], [dept_id], [user_id], [order_num], [test_key], [value], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (13, 108, 3, 5, N'子节点99', N'9999', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (1, 0, 102, 4, N'测试数据权限', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (2, 1, 102, 3, N'子节点1', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (3, 2, 102, 3, N'子节点2', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (4, 0, 108, 4, N'测试树1', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (5, 4, 108, 3, N'子节点11', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (6, 4, 108, 3, N'子节点22', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (7, 4, 108, 3, N'子节点33', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (8, 5, 108, 3, N'子节点44', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (9, 6, 108, 3, N'子节点55', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (10, 7, 108, 3, N'子节点66', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (11, 7, 108, 3, N'子节点77', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (12, 10, 108, 3, N'子节点88', 0, getdate(), N'admin', NULL, NULL, 0);
GO
INSERT [test_tree] ([id], [parent_id], [dept_id], [user_id], [tree_name], [version], [create_time], [create_by], [update_time], [update_by], [del_flag]) VALUES (13, 10, 108, 3, N'子节点99', 0, getdate(), N'admin', NULL, NULL, 0);
GO