add 新增 SysClient CRUD ;

update 更新 SysClient 表字段 (activityTimeout, timeout) ;
update 更新 sql (字段, 菜单, 角色) ;
fix 修正注释说明 ;
This commit is contained in:
Michelle.Chung 2023-06-18 16:57:44 +08:00
parent 9b967a0659
commit 85ea5487a1
12 changed files with 524 additions and 95 deletions

View File

@ -32,7 +32,7 @@ public enum AuthTypeEnumd {
EMAIL("email", EmailAuthStrategy.class),
/**
* 邮件认证
* 小程序认证
*/
XCX("xcx", XcxAuthStrategy.class)
;

View File

@ -139,6 +139,7 @@ tenant:
- sys_role_menu
- sys_user_post
- sys_user_role
- sys_client
# MyBatisPlus配置
# https://baomidou.com/config/

View File

@ -0,0 +1,115 @@
package org.dromara.system.controller.system;
import java.util.List;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.system.domain.vo.SysClientVo;
import org.dromara.system.domain.bo.SysClientBo;
import org.dromara.system.service.ISysClientService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 客户端管理
*
* @author Michelle.Chung
* @date 2023-06-18
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/client")
public class SysClientController extends BaseController {
private final ISysClientService sysClientService;
/**
* 查询客户端管理列表
*/
@SaCheckPermission("system:client:list")
@GetMapping("/list")
public TableDataInfo<SysClientVo> list(SysClientBo bo, PageQuery pageQuery) {
return sysClientService.queryPageList(bo, pageQuery);
}
/**
* 导出客户端管理列表
*/
@SaCheckPermission("system:client:export")
@Log(title = "客户端管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(SysClientBo bo, HttpServletResponse response) {
List<SysClientVo> list = sysClientService.queryList(bo);
ExcelUtil.exportExcel(list, "客户端管理", SysClientVo.class, response);
}
/**
* 获取客户端管理详细信息
*
* @param id 主键
*/
@SaCheckPermission("system:client:query")
@GetMapping("/{id}")
public R<SysClientVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(sysClientService.queryById(id));
}
/**
* 新增客户端管理
*/
@SaCheckPermission("system:client:add")
@Log(title = "客户端管理", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysClientBo bo) {
return toAjax(sysClientService.insertByBo(bo));
}
/**
* 修改客户端管理
*/
@SaCheckPermission("system:client:edit")
@Log(title = "客户端管理", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysClientBo bo) {
return toAjax(sysClientService.updateByBo(bo));
}
/**
* 状态修改
*/
@SaCheckPermission("system:client:edit")
@Log(title = "客户端管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public R<Void> changeStatus(@RequestBody SysClientBo bo) {
return toAjax(sysClientService.updateUserStatus(bo.getId(), bo.getStatus()));
}
/**
* 删除客户端管理
*
* @param ids 主键串
*/
@SaCheckPermission("system:client:remove")
@Log(title = "客户端管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(sysClientService.deleteWithValidByIds(List.of(ids), true));
}
}

View File

@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 授权管理对象 sys_auth
* 授权管理对象 sys_client
*
* @author Michelle.Chung
* @date 2023-05-15
@ -47,6 +47,16 @@ public class SysClient extends BaseEntity {
*/
private String grantType;
/**
* token活跃超时时间
*/
private Long activityTimeout;
/**
* token固定超时时间
*/
private Long timeout;
/**
* 状态0正常 1停用
*/

View File

@ -9,8 +9,10 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.util.List;
/**
* 授权管理业务对象 sys_auth
* 授权管理业务对象 sys_client
*
* @author Michelle.Chung
* @date 2023-05-15
@ -46,9 +48,24 @@ public class SysClientBo extends BaseEntity {
/**
* 授权类型
*/
@NotBlank(message = "授权类型不能为空", groups = { AddGroup.class, EditGroup.class })
@NotNull(message = "授权类型不能为空", groups = { AddGroup.class, EditGroup.class })
private List<String> grantTypeList;
/**
* 授权类型
*/
private String grantType;
/**
* token活跃超时时间
*/
private Long activityTimeout;
/**
* token固定超时时间
*/
private Long timeout;
/**
* 状态0正常 1停用
*/

View File

@ -10,10 +10,11 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* 授权管理视图对象 sys_auth
* 授权管理视图对象 sys_client
*
* @author Michelle.Chung
* @date 2023-05-15
@ -54,8 +55,25 @@ public class SysClientVo implements Serializable {
* 授权类型
*/
@ExcelProperty(value = "授权类型")
private List<String> grantTypeList;
/**
* 授权类型
*/
private String grantType;
/**
* token活跃超时时间
*/
@ExcelProperty(value = "token活跃超时时间")
private Long activityTimeout;
/**
* token固定超时时间
*/
@ExcelProperty(value = "token固定超时时间")
private Long timeout;
/**
* 状态0正常 1停用
*/

View File

@ -0,0 +1,54 @@
package org.dromara.system.service;
import org.dromara.system.domain.vo.SysClientVo;
import org.dromara.system.domain.bo.SysClientBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 客户端管理Service接口
*
* @author Michelle.Chung
* @date 2023-06-18
*/
public interface ISysClientService {
/**
* 查询客户端管理
*/
SysClientVo queryById(Long id);
/**
* 查询客户端管理列表
*/
TableDataInfo<SysClientVo> queryPageList(SysClientBo bo, PageQuery pageQuery);
/**
* 查询客户端管理列表
*/
List<SysClientVo> queryList(SysClientBo bo);
/**
* 新增客户端管理
*/
Boolean insertByBo(SysClientBo bo);
/**
* 修改客户端管理
*/
Boolean updateByBo(SysClientBo bo);
/**
* 修改状态
*/
int updateUserStatus(Long id, String status);
/**
* 校验并批量删除客户端管理信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@ -0,0 +1,134 @@
package org.dromara.system.service.impl;
import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.dromara.system.domain.bo.SysClientBo;
import org.dromara.system.domain.vo.SysClientVo;
import org.dromara.system.domain.SysClient;
import org.dromara.system.mapper.SysClientMapper;
import org.dromara.system.service.ISysClientService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* 客户端管理Service业务层处理
*
* @author Michelle.Chung
* @date 2023-06-18
*/
@RequiredArgsConstructor
@Service
public class SysClientServiceImpl implements ISysClientService {
private final SysClientMapper baseMapper;
/**
* 查询客户端管理
*/
@Override
public SysClientVo queryById(Long id) {
SysClientVo vo = baseMapper.selectVoById(id);
vo.setGrantTypeList(List.of(vo.getGrantType().split(",")));
return vo;
}
/**
* 查询客户端管理列表
*/
@Override
public TableDataInfo<SysClientVo> queryPageList(SysClientBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(bo);
Page<SysClientVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
result.getRecords().forEach(r -> r.setGrantTypeList(List.of(r.getGrantType().split(","))));
return TableDataInfo.build(result);
}
/**
* 查询客户端管理列表
*/
@Override
public List<SysClientVo> queryList(SysClientBo bo) {
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<SysClient> buildQueryWrapper(SysClientBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SysClient> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotBlank(bo.getClientId()), SysClient::getClientId, bo.getClientId());
lqw.eq(StringUtils.isNotBlank(bo.getClientKey()), SysClient::getClientKey, bo.getClientKey());
lqw.eq(StringUtils.isNotBlank(bo.getClientSecret()), SysClient::getClientSecret, bo.getClientSecret());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysClient::getStatus, bo.getStatus());
return lqw;
}
/**
* 新增客户端管理
*/
@Override
public Boolean insertByBo(SysClientBo bo) {
SysClient add = MapstructUtils.convert(bo, SysClient.class);
validEntityBeforeSave(add);
add.setGrantType(String.join(",", bo.getGrantTypeList()));
// 生成clientid
String clientKey = bo.getClientKey();
String clientSecret = bo.getClientSecret();
add.setClientId(SecureUtil.md5(clientKey + clientSecret));
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改客户端管理
*/
@Override
public Boolean updateByBo(SysClientBo bo) {
SysClient update = MapstructUtils.convert(bo, SysClient.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 修改状态
*/
@Override
public int updateUserStatus(Long id, String status) {
return baseMapper.update(null,
new LambdaUpdateWrapper<SysClient>()
.set(SysClient::getStatus, status)
.eq(SysClient::getId, id));
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(SysClient entity) {
//TODO 做一些数据校验,如唯一约束
}
/**
* 批量删除客户端管理
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteBatchIds(ids) > 0;
}
}

View File

@ -369,7 +369,8 @@ insert into sys_menu values('113', '缓存监控', '2', '5', 'cache',
insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 103, 1, sysdate, null, null, '表单构建菜单');
insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 103, 1, sysdate, null, null, '代码生成菜单');
insert into sys_menu values('121', '租户管理', '6', '1', 'tenant', 'system/tenant/index', '', 1, 0, 'C', '0', '0', 'system:tenant:list', 'list', 103, 1, sysdate, null, null, '租户管理菜单');
insert into sys_menu values('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', 1, 0, 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, sysdate, null, null, '租户套餐管理菜单');
insert into sys_menu values('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', 1, 0, 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, sysdate, null, null, '租户套餐管理菜单');
insert into sys_menu values('123', '客户端管理', '1', '1', 'client', 'system/client/index', '', 1, 0, 'C', '0', '0', 'system:client:list', 'international', 103, 1, sysdate, null, null, '客户端管理菜单');
-- springboot-admin监控
insert into sys_menu values('117', 'Admin监控', '2', '5', 'Admin', 'monitor/admin/index', '', 1, 0, 'C', '0', '0', 'monitor:admin:list', 'dashboard', 103, 1, sysdate, null, null, 'Admin监控菜单');
-- oss菜单
@ -466,7 +467,12 @@ insert into sys_menu values('1612', '租户套餐新增', '122', '2', '#', '', '
insert into sys_menu values('1613', '租户套餐修改', '122', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:edit', '#', 103, 1, sysdate, null, null, '');
insert into sys_menu values('1614', '租户套餐删除', '122', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:remove', '#', 103, 1, sysdate, null, null, '');
insert into sys_menu values('1615', '租户套餐导出', '122', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:export', '#', 103, 1, sysdate, null, null, '');
-- 客户端管理按钮
insert into sys_menu values('1061', '客户端管理查询', '123', '1', '#', '', 1, 0, 'F', '0', '0', 'system:client:query', '#', 103, 1, sysdate, null, null, '');
insert into sys_menu values('1062', '客户端管理新增', '123', '2', '#', '', 1, 0, 'F', '0', '0', 'system:client:add', '#', 103, 1, sysdate, null, null, '');
insert into sys_menu values('1063', '客户端管理修改', '123', '3', '#', '', 1, 0, 'F', '0', '0', 'system:client:edit', '#', 103, 1, sysdate, null, null, '');
insert into sys_menu values('1064', '客户端管理删除', '123', '4', '#', '', 1, 0, 'F', '0', '0', 'system:client:remove', '#', 103, 1, sysdate, null, null, '');
insert into sys_menu values('1065', '客户端管理导出', '123', '5', '#', '', 1, 0, 'F', '0', '0', 'system:client:export', '#', 103, 1, sysdate, null, null, '');
-- ----------------------------
-- 6、用户和角色关联表 用户N-1角色
@ -585,6 +591,11 @@ insert into sys_role_menu values ('2', '1057');
insert into sys_role_menu values ('2', '1058');
insert into sys_role_menu values ('2', '1059');
insert into sys_role_menu values ('2', '1060');
insert into sys_role_menu values ('2', '1061');
insert into sys_role_menu values ('2', '1062');
insert into sys_role_menu values ('2', '1063');
insert into sys_role_menu values ('2', '1064');
insert into sys_role_menu values ('2', '1065');
-- ----------------------------
-- 8、角色和部门关联表 角色1-N部门
@ -1112,38 +1123,42 @@ insert into sys_oss_config values (5, '000000', 'image', 'ruoyi', 'r
-- 系统授权表
-- ----------------------------
create table sys_client (
id number(20) not null,
client_id varchar(64) default null,
client_key varchar(32) default null,
client_secret varchar(255) default null,
grant_type varchar(255) default null,
status char(1) default '0',
del_flag char(1) default '0',
create_dept number(20) default null,
create_by number(20) default null,
create_time date,
update_by number(20) default null,
update_time date
id number(20) not null,
client_id varchar(64) default null,
client_key varchar(32) default null,
client_secret varchar(255) default null,
grant_type varchar(255) default null,
activity_timeout number(11) default 1800,
timeout number(11) default 604800,
status char(1) default '0',
del_flag char(1) default '0',
create_dept number(20) default null,
create_by number(20) default null,
create_time date,
update_by number(20) default null,
update_time date
)
alter table sys_client add constraint pk_sys_client primary key (id);
comment on table sys_client is '系统授权表';
comment on column sys_client.id is '主建';
comment on column sys_client.client_id is '客户端id';
comment on column sys_client.client_key is '客户端key';
comment on column sys_client.client_secret is '客户端秘钥';
comment on column sys_client.grant_type is '授权类型';
comment on column sys_client.status is '状态0正常 1停用';
comment on column sys_client.del_flag is '删除标志0代表存在 2代表删除';
comment on column sys_client.create_dept is '创建部门';
comment on column sys_client.create_by is '创建者';
comment on column sys_client.create_time is '创建时间';
comment on column sys_client.update_by is '更新者';
comment on column sys_client.update_time is '更新时间';
comment on table sys_client is '系统授权表';
comment on column sys_client.id is '主建';
comment on column sys_client.client_id is '客户端id';
comment on column sys_client.client_key is '客户端key';
comment on column sys_client.client_secret is '客户端秘钥';
comment on column sys_client.grant_type is '授权类型';
comment on column sys_client.activity_timeout is 'token活跃超时时间';
comment on column sys_client.timeout is 'token固定超时';
comment on column sys_client.status is '状态0正常 1停用';
comment on column sys_client.del_flag is '删除标志0代表存在 2代表删除';
comment on column sys_client.create_dept is '创建部门';
comment on column sys_client.create_by is '创建者';
comment on column sys_client.create_time is '创建时间';
comment on column sys_client.update_by is '更新者';
comment on column sys_client.update_time is '更新时间';
insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password', 0, 0, 103, 1, sysdate, 1, sysdate);
insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms', 0, 0, 103, 1, sysdate, 1, sysdate);
insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password', 1800, 604800, 0, 0, 103, 1, sysdate, 1, sysdate);
insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms', 1800, 604800, 0, 0, 103, 1, sysdate, 1, sysdate);
-- ----------------------------

View File

@ -379,7 +379,8 @@ insert into sys_menu values('113', '缓存监控', '2', '5', 'cache',
insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', '1', '0', 'C', '0', '0', 'tool:build:list', 'build', 103, 1, now(), null, null, '表单构建菜单');
insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', '1', '0', 'C', '0', '0', 'tool:gen:list', 'code', 103, 1, now(), null, null, '代码生成菜单');
insert into sys_menu values('121', '租户管理', '6', '1', 'tenant', 'system/tenant/index', '', '1', '0', 'C', '0', '0', 'system:tenant:list', 'list', 103, 1, now(), null, null, '租户管理菜单');
insert into sys_menu values('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', '1', '0', 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, now(), null, null, '租户套餐管理菜单');
insert into sys_menu values('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', '1', '0', 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, now(), null, null, '租户套餐管理菜单');
insert into sys_menu values('123', '客户端管理', '1', '1', 'client', 'system/client/index', '', '1', '0', 'C', '0', '0', 'system:client:list', 'international', 103, 1, now(), null, null, '客户端管理菜单');
-- springboot-admin监控
insert into sys_menu values('117', 'Admin监控', '2', '5', 'Admin', 'monitor/admin/index', '', '1', '0', 'C', '0', '0', 'monitor:admin:list', 'dashboard', 103, 1, now(), null, null, 'Admin监控菜单');
@ -477,7 +478,12 @@ insert into sys_menu values('1612', '租户套餐新增', '122', '2', '#', '', '
insert into sys_menu values('1613', '租户套餐修改', '122', '3', '#', '', '', '1', '0', 'F', '0', '0', 'system:tenantPackage:edit', '#', 103, 1, now(), null, null, '');
insert into sys_menu values('1614', '租户套餐删除', '122', '4', '#', '', '', '1', '0', 'F', '0', '0', 'system:tenantPackage:remove', '#', 103, 1, now(), null, null, '');
insert into sys_menu values('1615', '租户套餐导出', '122', '5', '#', '', '', '1', '0', 'F', '0', '0', 'system:tenantPackage:export', '#', 103, 1, now(), null, null, '');
-- 客户端管理按钮
insert into sys_menu values('1061', '客户端管理查询', '123', '1', '#', '', '1', '0', 'F', '0', '0', 'system:client:query', '#', 103, 1, now(), null, null, '');
insert into sys_menu values('1062', '客户端管理新增', '123', '2', '#', '', '1', '0', 'F', '0', '0', 'system:client:add', '#', 103, 1, now(), null, null, '');
insert into sys_menu values('1063', '客户端管理修改', '123', '3', '#', '', '1', '0', 'F', '0', '0', 'system:client:edit', '#', 103, 1, now(), null, null, '');
insert into sys_menu values('1064', '客户端管理删除', '123', '4', '#', '', '1', '0', 'F', '0', '0', 'system:client:remove', '#', 103, 1, now(), null, null, '');
insert into sys_menu values('1065', '客户端管理导出', '123', '5', '#', '', '1', '0', 'F', '0', '0', 'system:client:export', '#', 103, 1, now(), null, null, '');
-- ----------------------------
-- 6、用户和角色关联表 用户N-1角色
@ -598,6 +604,11 @@ insert into sys_role_menu values ('2', '1057');
insert into sys_role_menu values ('2', '1058');
insert into sys_role_menu values ('2', '1059');
insert into sys_role_menu values ('2', '1060');
insert into sys_role_menu values ('2', '1061');
insert into sys_role_menu values ('2', '1062');
insert into sys_role_menu values ('2', '1063');
insert into sys_role_menu values ('2', '1064');
insert into sys_role_menu values ('2', '1065');
-- ----------------------------
-- 8、角色和部门关联表 角色1-N部门
@ -1137,37 +1148,41 @@ insert into sys_oss_config values (5, '000000', 'image', 'ruoyi', 'r
-- ----------------------------
drop table if exists sys_client;
create table sys_client (
id int8,
client_id varchar(64) ''::varchar,
client_key varchar(32) ''::varchar,
client_secret varchar(255) ''::varchar,
grant_type varchar(255) ''::varchar,
status char(1) default '0'::bpchar,
del_flag char(1) default '0'::bpchar,
create_dept int8,
create_by int8,
create_time timestamp,
update_by int8,
update_time timestamp,
id int8,
client_id varchar(64) ''::varchar,
client_key varchar(32) ''::varchar,
client_secret varchar(255) ''::varchar,
grant_type varchar(255) ''::varchar,
activity_timeout int4 default 1800,
timeout int4 default 604800,
status char(1) default '0'::bpchar,
del_flag char(1) default '0'::bpchar,
create_dept int8,
create_by int8,
create_time timestamp,
update_by int8,
update_time timestamp,
constraint sys_client_pk primary key (id)
)
comment on table sys_client is '系统授权表';
comment on column sys_client.id is '主建';
comment on column sys_client.client_id is '客户端id';
comment on column sys_client.client_key is '客户端key';
comment on column sys_client.client_secret is '客户端秘钥';
comment on column sys_client.grant_type is '授权类型';
comment on column sys_client.status is '状态0正常 1停用';
comment on column sys_client.del_flag is '删除标志0代表存在 2代表删除';
comment on column sys_client.create_dept is '创建部门';
comment on column sys_client.create_by is '创建者';
comment on column sys_client.create_time is '创建时间';
comment on column sys_client.update_by is '更新者';
comment on column sys_client.update_time is '更新时间';
comment on table sys_client is '系统授权表';
comment on column sys_client.id is '主建';
comment on column sys_client.client_id is '客户端id';
comment on column sys_client.client_key is '客户端key';
comment on column sys_client.client_secret is '客户端秘钥';
comment on column sys_client.grant_type is '授权类型';
comment on column sys_client.activity_timeout is 'token活跃超时时间';
comment on column sys_client.timeout is 'token固定超时';
comment on column sys_client.status is '状态0正常 1停用';
comment on column sys_client.del_flag is '删除标志0代表存在 2代表删除';
comment on column sys_client.create_dept is '创建部门';
comment on column sys_client.create_by is '创建者';
comment on column sys_client.create_time is '创建时间';
comment on column sys_client.update_by is '更新者';
comment on column sys_client.update_time is '更新时间';
insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password', 0, 0, 103, 1, now(), 1, now());
insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms', 0, 0, 103, 1, now(), 1, now());
insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password', 1800, 604800, 0, 0, 103, 1, now(), 1, now());
insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms', 1800, 604800, 0, 0, 103, 1, now(), 1, now());
-- 字符串自动转时间 避免框架时间查询报错问题
create or replace function cast_varchar_to_timestamp(varchar) returns timestamptz as $$

View File

@ -245,8 +245,9 @@ insert into sys_menu values('109', '在线用户', '2', '1', 'online',
insert into sys_menu values('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 103, 1, sysdate(), null, null, '缓存监控菜单');
insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 103, 1, sysdate(), null, null, '表单构建菜单');
insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 103, 1, sysdate(), null, null, '代码生成菜单');
insert into sys_menu values ('121', '租户管理', '6', '1', 'tenant', 'system/tenant/index', '', 1, 0, 'C', '0', '0', 'system:tenant:list', 'list', 103, 1, sysdate(), null, null, '租户管理菜单');
insert into sys_menu values ('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', 1, 0, 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, sysdate(), null, null, '租户套餐管理菜单');
insert into sys_menu values('121', '租户管理', '6', '1', 'tenant', 'system/tenant/index', '', 1, 0, 'C', '0', '0', 'system:tenant:list', 'list', 103, 1, sysdate(), null, null, '租户管理菜单');
insert into sys_menu values('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', 1, 0, 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, sysdate(), null, null, '租户套餐管理菜单');
insert into sys_menu values('123', '客户端管理', '1', '1', 'client', 'system/client/index', '', 1, 0, 'C', '0', '0', 'system:client:list', 'international', 103, 1, sysdate(), null, null, '客户端管理菜单');
-- springboot-admin监控
insert into sys_menu values('117', 'Admin监控', '2', '5', 'Admin', 'monitor/admin/index', '', 1, 0, 'C', '0', '0', 'monitor:admin:list', 'dashboard', 103, 1, sysdate(), null, null, 'Admin监控菜单');
@ -344,7 +345,12 @@ insert into sys_menu values ('1612', '租户套餐新增', '122', '2', '#', '',
insert into sys_menu values ('1613', '租户套餐修改', '122', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:edit', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values ('1614', '租户套餐删除', '122', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:remove', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values ('1615', '租户套餐导出', '122', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:tenantPackage:export', '#', 103, 1, sysdate(), null, null, '');
-- 客户端管理按钮
insert into sys_menu values('1061', '客户端管理查询', '123', '1', '#', '', 1, 0, 'F', '0', '0', 'system:client:query', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('1062', '客户端管理新增', '123', '2', '#', '', 1, 0, 'F', '0', '0', 'system:client:add', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('1063', '客户端管理修改', '123', '3', '#', '', 1, 0, 'F', '0', '0', 'system:client:edit', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('1064', '客户端管理删除', '123', '4', '#', '', 1, 0, 'F', '0', '0', 'system:client:remove', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu values('1065', '客户端管理导出', '123', '5', '#', '', 1, 0, 'F', '0', '0', 'system:client:export', '#', 103, 1, sysdate(), null, null, '');
-- ----------------------------
-- 6、用户和角色关联表 用户N-1角色
@ -455,6 +461,11 @@ insert into sys_role_menu values ('2', '1057');
insert into sys_role_menu values ('2', '1058');
insert into sys_role_menu values ('2', '1059');
insert into sys_role_menu values ('2', '1060');
insert into sys_role_menu values ('2', '1061');
insert into sys_role_menu values ('2', '1062');
insert into sys_role_menu values ('2', '1063');
insert into sys_role_menu values ('2', '1064');
insert into sys_role_menu values ('2', '1065');
-- ----------------------------
-- 8、角色和部门关联表 角色1-N部门
@ -801,20 +812,22 @@ insert into sys_oss_config values (5, '000000', 'image', 'ruoyi', 'r
-- ----------------------------
drop table if exists sys_client;
create table sys_client (
id bigint(20) not null comment 'id',
client_id varchar(64) default null comment '客户端id',
client_key varchar(32) default null comment '客户端key',
client_secret varchar(255) default null comment '客户端秘钥',
grant_type varchar(255) default null comment '授权类型',
status char(1) default '0' comment '状态0正常 1停用',
del_flag char(1) default '0' comment '删除标志0代表存在 2代表删除',
create_dept bigint(20) default null comment '创建部门',
create_by bigint(20) default null comment '创建者',
create_time datetime default null comment '创建时间',
update_by bigint(20) default null comment '更新者',
update_time datetime default null comment '更新时间',
id bigint(20) not null comment 'id',
client_id varchar(64) default null comment '客户端id',
client_key varchar(32) default null comment '客户端key',
client_secret varchar(255) default null comment '客户端秘钥',
grant_type varchar(255) default null comment '授权类型',
activity_timeout int(11) default 1800 comment 'token活跃超时时间',
timeout int(11) default 604800 comment 'token固定超时',
status char(1) default '0' comment '状态0正常 1停用',
del_flag char(1) default '0' comment '删除标志0代表存在 2代表删除',
create_dept bigint(20) default null comment '创建部门',
create_by bigint(20) default null comment '创建者',
create_time datetime default null comment '创建时间',
update_by bigint(20) default null comment '更新者',
update_time datetime default null comment '更新时间',
primary key (id)
) engine=innodb comment='系统授权表';
insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password', 0, 0, 103, 1, sysdate(), 1, sysdate());
insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms', 0, 0, 103, 1, sysdate(), 1, sysdate());
insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password', 1800, 604800, 0, 0, 103, 1, sysdate(), 1, sysdate());
insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms', 1800, 604800, 0, 0, 103, 1, sysdate(), 1, sysdate());

View File

@ -1441,6 +1441,8 @@ INSERT sys_menu VALUES (121, N'租户管理', 6, 1, N'tenant', N'system/tenant/i
GO
INSERT sys_menu VALUES (122, N'租户套餐管理', 6, 2, N'tenantPackage', N'system/tenantPackage/index', N'', 1, 0, N'C', N'0', N'0', N'system:tenantPackage:list', N'code', 103, 1, getdate(), NULL, NULL, N'租户套餐管理菜单')
GO
INSERT sys_menu VALUES (100, N'客户端管理', 1, 1, N'client', N'system/client/index', N'', 1, 0, N'C', N'0', N'0', N'system:client:list', N'international', 103, 1, getdate(), NULL, NULL, N'客户端管理菜单')
GO
INSERT sys_menu VALUES (117, N'Admin监控', 2, 5, N'Admin', N'monitor/admin/index', N'', 1, 0, N'C', N'0', N'0', N'monitor:admin:list', N'dashboard', 103, 1, getdate(), NULL, NULL, N'Admin监控菜单');
GO
INSERT sys_menu VALUES (118, N'文件管理', 1, 10, N'oss', N'system/oss/index', N'', 1, 0, N'C', '0', N'0', N'system:oss:list', N'upload', 103, 1, getdate(), NULL, NULL, N'文件管理菜单');
@ -1596,6 +1598,17 @@ INSERT sys_menu VALUES (1614, N'租户套餐删除', 122, 4, N'#', N'', N'', 1,
GO
INSERT sys_menu VALUES (1615, N'租户套餐导出', 122, 5, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'system:tenantPackage:export', N'#', 103, 1, getdate(), NULL, NULL, N'');
GO
-- 客户端管理按钮
INSERT sys_menu VALUES (1061, N'客户端管理查询', 123, 1, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'system:client:query', N'#', 103, 1, getdate(), NULL, NULL, N'');
GO
INSERT sys_menu VALUES (1062, N'客户端管理新增', 123, 2, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'system:client:add', N'#', 103, 1, getdate(), NULL, NULL, N'');
GO
INSERT sys_menu VALUES (1063, N'客户端管理修改', 123, 3, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'system:client:edit', N'#', 103, 1, getdate(), NULL, NULL, N'');
GO
INSERT sys_menu VALUES (1064, N'客户端管理删除', 123, 4, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'system:client:remove', N'#', 103, 1, getdate(), NULL, NULL, N'');
GO
INSERT sys_menu VALUES (1065, N'客户端管理导出', 123, 5, N'#', N'', N'', 1, 0, N'F', N'0', N'0', N'system:client:export', N'#', 103, 1, getdate(), NULL, NULL, N'');
GO
CREATE TABLE sys_notice
(
@ -2319,6 +2332,16 @@ INSERT sys_role_menu VALUES (2, 1059)
GO
INSERT sys_role_menu VALUES (2, 1060)
GO
INSERT sys_role_menu VALUES (2, 1061)
GO
INSERT sys_role_menu VALUES (2, 1062)
GO
INSERT sys_role_menu VALUES (2, 1063)
GO
INSERT sys_role_menu VALUES (2, 1064)
GO
INSERT sys_role_menu VALUES (2, 1065)
GO
CREATE TABLE sys_user
(
@ -2823,19 +2846,21 @@ GO
CREATE TABLE sys_client
(
id bigint NOT NULL,
client_id nvarchar(20) DEFAULT '' NULL,
client_key nvarchar(255) DEFAULT '' NULL,
client_secret nvarchar(255) DEFAULT '' NULL,
grant_type nvarchar(255) DEFAULT '' NULL,
status nchar(1) DEFAULT ('0') NULL,
del_flag nchar(1) DEFAULT ('0') NULL,
create_dept bigint NULL,
create_by bigint NULL,
create_time datetime2(7) NULL,
update_by bigint NULL,
update_time datetime2(7) NULL
CONSTRAINT PK__sys_client___BFBDE87009ED2882 PRIMARY KEY CLUSTERED (id)
id bigint NOT NULL,
client_id nvarchar(20) DEFAULT '' NULL,
client_key nvarchar(255) DEFAULT '' NULL,
client_secret nvarchar(255) DEFAULT '' NULL,
grant_type nvarchar(255) DEFAULT '' NULL,
activity_timeout int DEFAULT ((1800)) NULL,
timeout int DEFAULT ((604800)) NULL,
status nchar(1) DEFAULT ('0') NULL,
del_flag nchar(1) DEFAULT ('0') NULL,
create_dept bigint NULL,
create_by bigint NULL,
create_time datetime2(7) NULL,
update_by bigint NULL,
update_time datetime2(7) NULL
CONSTRAINT PK__sys_client___BFBDE87009ED2882 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]
)
@ -2873,6 +2898,18 @@ EXEC sp_addextendedproperty
'COLUMN', N'grant_type'
GO
EXEC sp_addextendedproperty
'MS_Description', N'token活跃超时时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_client',
'COLUMN', N'activity_timeout'
GO
EXEC sp_addextendedproperty
'MS_Description', N'token固定超时',
'SCHEMA', N'dbo',
'TABLE', N'sys_client',
'COLUMN', N'timeout'
GO
EXEC sp_addextendedproperty
'MS_Description', N'状态0正常 1停用',
'SCHEMA', N'dbo',
'TABLE', N'sys_client',
@ -2920,7 +2957,7 @@ EXEC sp_addextendedproperty
'TABLE', N'sys_client'
GO
INSERT INTO sys_client VALUES (N'1', N'e5cd7e4891bf95d1d19206ce24a7b32e', N'pc', N'pc123', N'password', N'0', N'0', 103, 1, getdate(), 1, getdate())
INSERT INTO sys_client VALUES (N'1', N'e5cd7e4891bf95d1d19206ce24a7b32e', N'pc', N'pc123', N'password', 1800, 604800, N'0', N'0', 103, 1, getdate(), 1, getdate())
GO
INSERT INTO sys_client VALUES (N'2', N'428a8310cd442757ae699df5d894f051', N'app', N'app123', N'password,sms', N'0', N'0', 103, 1, getdate(), 1, getdate())
INSERT INTO sys_client VALUES (N'2', N'428a8310cd442757ae699df5d894f051', N'app', N'app123', N'password,sms', 1800, 604800, N'0', N'0', 103, 1, getdate(), 1, getdate())
GO