init: 导入团队知识库内容

This commit is contained in:
yueqian-ai
2026-05-14 16:56:48 +08:00
commit acca2041f0
1681 changed files with 285734 additions and 0 deletions
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2026 Qiantong Technology Co., Ltd.
qModel Model Platform(Open Source Edition)
*
License:
Released under the Apache License, Version 2.0.
You may use, modify, and distribute this software for commercial purposes
under the terms of the License.
*
Special Notice:
All derivative versions are strictly prohibited from modifying or removing
the default system logo and copyright information.
For brand customization, please apply for brand customization authorization via official channels.
*
More information: https://qmodel.qiantong.tech/business.html
*
============================================================================
*
版权所有 © 2026 江苏千桐科技有限公司
qModel 模型平台(开源版)
*
许可协议:
本项目基于 Apache License 2.0 开源协议发布,
允许在遵守协议的前提下进行商用、修改和分发。
*
特别说明:
所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
如需定制品牌,请通过官方渠道申请品牌定制授权。
*
更多信息请访问:https://qmodel.qiantong.tech/business.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>qmodel-framework</artifactId>
<groupId>tech.qiantong</groupId>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>qmodel-auth</artifactId>
<description>
auth模块
</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>tech.qiantong</groupId>
<artifactId>qmodel-security</artifactId>
<version>1.0.1</version>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>tech.qiantong</groupId>
<artifactId>qmodel-common</artifactId>
</dependency>
<!-- Sa-Token 权限认证, 在线文档:https://sa-token.cc -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.39.0</version>
</dependency>
<!-- Sa-Token OAuth2.0 模块 -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-oauth2</artifactId>
<version>1.39.0</version>
</dependency>
<!-- Sa-Token 整合 Redis (可选) -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-redis-jackson</artifactId>
<version>1.39.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,135 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.controller;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import tech.qiantong.qmodel.auth.domain.AuthClient;
import tech.qiantong.qmodel.common.annotation.Log;
import tech.qiantong.qmodel.common.core.controller.BaseController;
import tech.qiantong.qmodel.common.core.domain.AjaxResult;
import tech.qiantong.qmodel.common.core.page.TableDataInfo;
import tech.qiantong.qmodel.common.enums.BusinessType;
import tech.qiantong.qmodel.common.utils.poi.ExcelUtil;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* 应用管理Controller
*
* @author qModel
* @date 2024-08-31
*/
@RestController
@RequestMapping("/auth/client")
public class AuthClientController extends BaseController {
@Resource
private IService<AuthClient> authClientService;
/**
* 查询应用管理列表
*/
@PreAuthorize("@ss.hasPermi('auth:client:list')")
@GetMapping("/list")
public TableDataInfo list(AuthClient authClient) {
startPage();
QueryWrapper<AuthClient> queryWrapper = new QueryWrapper<>(authClient);
List<AuthClient> list = authClientService.list(queryWrapper);
return getDataTable(list);
}
/**
* 导出应用管理列表
*/
@PreAuthorize("@ss.hasPermi('auth:client:export')")
@Log(title = "应用管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AuthClient authClient) {
QueryWrapper<AuthClient> queryWrapper = new QueryWrapper<>(authClient);
List<AuthClient> list = authClientService.list(queryWrapper);
ExcelUtil<AuthClient> util = new ExcelUtil<>(AuthClient.class);
util.exportExcel(response, list, "应用管理数据");
}
/**
* 获取应用管理详细信息
*/
@PreAuthorize("@ss.hasPermi('auth:client:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(authClientService.getById(id));
}
/**
* 新增应用管理
*/
@PreAuthorize("@ss.hasPermi('auth:client:add')")
@Log(title = "应用管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AuthClient authClient) {
authClient.setCreatorId(getUserId());
authClient.setCreateBy(getNickName());
authClient.setSecretKey(IdUtil.simpleUUID());
return toAjax(authClientService.save(authClient));
}
/**
* 修改应用管理
*/
@PreAuthorize("@ss.hasPermi('auth:client:edit')")
@Log(title = "应用管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AuthClient authClient) {
authClient.setUpdatorId(getUserId());
authClient.setUpdateBy(getNickName());
authClient.setUpdateTime(new Date());
return toAjax(authClientService.updateById(authClient));
}
/**
* 删除应用管理
*/
@PreAuthorize("@ss.hasPermi('auth:client:remove')")
@Log(title = "应用管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(authClientService.removeByIds(Arrays.asList(ids)));
}
}
@@ -0,0 +1,127 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
import tech.qiantong.qmodel.common.annotation.Log;
import tech.qiantong.qmodel.common.core.controller.BaseController;
import tech.qiantong.qmodel.common.core.domain.AjaxResult;
import tech.qiantong.qmodel.common.core.page.TableDataInfo;
import tech.qiantong.qmodel.common.enums.BusinessType;
import tech.qiantong.qmodel.common.utils.poi.ExcelUtil;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
* 应用和用户关联Controller
*
* @author qModel
* @date 2024-08-31
*/
@RestController
@RequestMapping("/auth/user")
public class AuthClientUserController extends BaseController {
@Resource
private IService<AuthClientUser> authClientUserService;
/**
* 查询应用和用户关联列表
*/
@PreAuthorize("@ss.hasPermi('auth:user:list')")
@GetMapping("/list")
public TableDataInfo list(AuthClientUser authClientUser) {
startPage();
QueryWrapper<AuthClientUser> queryWrapper = new QueryWrapper<>(authClientUser);
List<AuthClientUser> list = authClientUserService.list(queryWrapper);
return getDataTable(list);
}
/**
* 导出应用和用户关联列表
*/
@PreAuthorize("@ss.hasPermi('auth:user:export')")
@Log(title = "应用和用户关联", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AuthClientUser authClientUser) {
QueryWrapper<AuthClientUser> queryWrapper = new QueryWrapper<>(authClientUser);
List<AuthClientUser> list = authClientUserService.list(queryWrapper);
ExcelUtil<AuthClientUser> util = new ExcelUtil<>(AuthClientUser.class);
util.exportExcel(response, list, "应用和用户关联数据");
}
/**
* 获取应用和用户关联详细信息
*/
@PreAuthorize("@ss.hasPermi('auth:user:query')")
@GetMapping(value = "/{clientId}")
public AjaxResult getInfo(@PathVariable("clientId") Long clientId) {
return success(authClientUserService.getById(clientId));
}
/**
* 新增应用和用户关联
*/
@PreAuthorize("@ss.hasPermi('auth:user:add')")
@Log(title = "应用和用户关联", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AuthClientUser authClientUser) {
return toAjax(authClientUserService.save(authClientUser));
}
/**
* 修改应用和用户关联
*/
@PreAuthorize("@ss.hasPermi('auth:user:edit')")
@Log(title = "应用和用户关联", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AuthClientUser authClientUser) {
return toAjax(authClientUserService.updateById(authClientUser));
}
/**
* 删除应用和用户关联
*/
@PreAuthorize("@ss.hasPermi('auth:user:remove')")
@Log(title = "应用和用户关联", businessType = BusinessType.DELETE)
@DeleteMapping("/{clientIds}")
public AjaxResult remove(@PathVariable Long[] clientIds) {
return toAjax(authClientUserService.removeByIds(Arrays.asList(clientIds)));
}
}
@@ -0,0 +1,225 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
//package tech.qiantong.qmodel.controller;
//
//import cn.dev33.satoken.context.SaHolder;
//import cn.dev33.satoken.oauth2.config.SaOAuth2ServerConfig;
//import cn.dev33.satoken.oauth2.processor.SaOAuth2ServerProcessor;
//import cn.dev33.satoken.oauth2.strategy.SaOAuth2Strategy;
//import cn.dev33.satoken.stp.SaLoginModel;
//import cn.dev33.satoken.stp.StpUtil;
//import cn.dev33.satoken.util.SaResult;
//import cn.hutool.core.convert.Convert;
//import tech.qiantong.qmodel.entity.domain.core.common.SysUser;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.servlet.ModelAndView;
//
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * OAuth2 Server 的 Controller
// * 负责 OAuth2 相关的认证、登录、授权操作
// *
// * @author anivia
// */
//@RestController
//@RequestMapping("/oauth2")
//public class AuthOAuth2ServerController {
//
// @Autowired
// private ISysUserService userService;
//
// /**
// * 配置 OAuth2 认证服务
// */
// @Autowired
// public void configOAuth2Server(SaOAuth2ServerConfig oauth2Server) {
//
// // 配置登录处理
// oauth2Server.doLoginHandle = (name, pwd) -> {
// Boolean rememberMe = Convert.toBool(SaHolder.getRequest().getParam("rememberMe"));
// SysUser user = userService.findUserByNameOrPhone(name);
//
// if (user != null && user.comparePwd(pwd)) {
// SaLoginModel loginModel = new SaLoginModel()
// // 此次登录的客户端设备标识,用于在 [同账号异地登录] 时指定此次登录的设备标识
// .setDevice("PC")
// // 是否为持久 Cookie,持久 Cookie 在浏览器关闭时不会自动删除,下次打开仍然存在
// .setIsLastingCookie(rememberMe)
// .setIsWriteHeader(true);
// StpUtil.login(user.getUserId(), loginModel);
// // TODO: 缺少登录日志记录
// return SaResult.ok();
// } else {
// return SaResult.error("账号或密码错误");
// }
// };
//
// // 配置未登录时返回的 View
// oauth2Server.notLoginView = () -> {
// return new ModelAndView("sso/index.html");
// };
//
// // 配置授权确认视图
// oauth2Server.confirmView = (clientId, scopes) -> {
// Map<String, Object> map = new HashMap<>();
// map.put("clientId", clientId);
// map.put("scope", scopes);
// return new ModelAndView("sso/confirm.html", map);
// };
//
// // OAuth2 会话数据存储与访问策略
// SaOAuth2Strategy.instance.createAccessToken = (clientId, loginId, scopes) -> {
// return StpUtil.getOrCreateLoginSession(loginId);
// };
// }
//
// /**
// * 处理 OAuth2 授权请求
// * 支持授权码模式和隐式模式
// *
// * 请求参数:
// * response_type 响应类型(必填项)
// * client_id 应用 ID(必填项)
// * redirect_uri 用户确认后授权的重定向 URL 地址(必填项)
// * scope 请求授权范围,用空格分隔(必填项)
// * state 用于防止 CSRF 攻击的状态值,可选项,返回时会附加到重定向 URL(非必填项)
// *
// * @return 返回授权结果的视图
// */
// @RequestMapping("/authorize")
// public Object authorize() {
// return SaOAuth2ServerProcessor.instance.authorize();
// }
//
// /**
// * 处理用户登录请求
// *
// * 请求参数:
// * name 用户名(必填项)
// * pwd 密码(必填项)
// * rememberMe 是否记住登录状态(必填项)
// *
// * @return 用户登录的结果
// */
// @PostMapping("/doLogin")
// public Object doLogin() {
// return SaOAuth2ServerProcessor.instance.doLogin();
// }
//
// /**
// * 处理用户确认授权请求
// *
// * 请求参数:
// * client_id 应用 ID(必填项)
// * scope 确认的授权范围,用空格分隔(必填项)
// * build_redirect_uri 是否重新构建重定向 URLtrue/false)(非必填项)
// * response_type URL 上的 response_type 参数值(必填项)
// * redirect_uri URL 上的 redirect_uri 参数值(必填项)
// * state URL 上的 state 参数值(必填项)
// *
// * @return 用户确认授权的结果
// */
// @RequestMapping("/doConfirm")
// public Object doConfirm() {
// return SaOAuth2ServerProcessor.instance.doConfirm();
// }
//
// /**
// * 通过 Code 获取 Access-Token 请求
// * 支持授权码模式(Code 模式)
// *
// * 请求参数:
// * grant_type 授权类型,应填写 authorization_code(必填项)
// * client_id 应用 ID(必填项)
// * client_secret 应用密钥(必填项)
// * code 授权码(必填项)
// *
// * @return 返回 Token 结果
// */
// @PostMapping("/token")
// public Object token() {
// return SaOAuth2ServerProcessor.instance.token();
// }
//
// /**
// * 使用 Refresh-Token 刷新 Access-Token 请求
// *
// * 请求参数:
// * grant_type 授权类型,应填写 refresh_token(必填项)
// * client_id 应用 ID(必填项)
// * client_secret 应用密钥(必填项)
// * refresh_token 刷新的 Refresh-Token(必填项)
// *
// * @return 刷新 Token 的结果
// */
// @PostMapping("/refresh")
// public Object refresh() {
// return SaOAuth2ServerProcessor.instance.refresh();
// }
//
// /**
// * 撤销 Access-Token 请求
// *
// * 请求参数:
// * client_id 应用 ID(必填项)
// * client_secret 应用密钥(必填项)
// * access_token 要撤销的 Access-Token(必填项)
// *
// * @return 撤销 Token 的结果
// */
// @PostMapping("/revoke")
// public Object revoke() {
// return SaOAuth2ServerProcessor.instance.revoke();
// }
//
// /**
// * 处理客户端凭证模式(Client Credentials)获取 Access-Token 请求
// *
// * 请求参数:
// * grant_type 授权类型,应填写 client_credentials(必填项)
// * client_id 应用 ID(必填项)
// * client_secret 应用密钥(必填项)
// * scope 请求的授权范围,用空格分隔(非必填项)
// *
// * @return 凭证模式获取的 Token 结果
// */
// @PostMapping("/client_token")
// public Object clientToken() {
// return SaOAuth2ServerProcessor.instance.clientToken();
// }
//}
@@ -0,0 +1,105 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import tech.qiantong.qmodel.common.annotation.Excel;
import tech.qiantong.qmodel.common.core.domain.BaseEntity;
/**
* 应用管理对象 auth_client
*
* @author qModel
* @date 2024-08-31
*/
@Data
@TableName(value = "auth_client")
public class AuthClient extends BaseEntity {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 应用ID */
@TableId(type = IdType.AUTO)
private Long id;
/** 应用秘钥 */
@Excel(name = "应用秘钥")
private String secretKey;
/** 应用名称 */
@Excel(name = "应用名称")
private String name;
/** 应用类型;0Web1App2:小程序 */
@Excel(name = "应用类型;0:Web,1:App,2:小程序")
private Integer type;
/** 应用图标 */
@Excel(name = "应用图标")
private String icon;
/** 应用首页 */
@Excel(name = "应用首页")
private String homeUrl;
/** 同步地址 */
@Excel(name = "同步地址")
private String syncUrl;
/** 允许授权的url */
@Excel(name = "允许授权的url")
private String redirectUrl;
/** 是否公开 */
@Excel(name = "是否公开")
private Integer publicFlag;
/** 是否有效;0:无效,1:有效 */
@Excel(name = "是否有效;0:无效,1:有效")
private Integer validFlag;
/** 删除标志;1:已删除,0:未删除 */
@TableLogic
private Integer delFlag;
/** 创建人id;创建者的sys_user_id */
@Excel(name = "创建人id;创建者的sys_user_id")
private Long creatorId;
/** 更新人id;更新者的sys_user_id */
@Excel(name = "更新人id;更新者的sys_user_id")
private Long updatorId;
}
@@ -0,0 +1,70 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import tech.qiantong.qmodel.common.annotation.Excel;
import tech.qiantong.qmodel.common.core.domain.BaseEntity;
/**
* 应用和用户关联对象 auth_client_user
*
* @author qModel
* @date 2024-08-31
*/
@Data
@TableName(value = "auth_client_user")
public class AuthClientUser extends BaseEntity {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 应用ID */
@Excel(name = "应用ID")
@TableId(type = IdType.AUTO)
private Long clientId;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** open_id */
@Excel(name = "open_id")
private String openId;
}
@@ -0,0 +1,46 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import tech.qiantong.qmodel.auth.domain.AuthClient;
/**
* 应用管理Mapper接口
*
* @author qModel
* @date 2024-08-31
*/
public interface AuthClientMapper extends BaseMapper<AuthClient> {
}
@@ -0,0 +1,46 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
/**
* 应用和用户关联Mapper接口
*
* @author qModel
* @date 2024-08-31
*/
public interface AuthClientUserMapper extends BaseMapper<AuthClientUser> {
}
@@ -0,0 +1,46 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.service;
import com.baomidou.mybatisplus.extension.service.IService;
import tech.qiantong.qmodel.auth.domain.AuthClient;
/**
* 应用管理Service接口
*
* @author qModel
* @date 2024-08-31
*/
public interface IAuthClientService extends IService<AuthClient> {
}
@@ -0,0 +1,46 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.service;
import com.baomidou.mybatisplus.extension.service.IService;
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
/**
* 应用和用户关联Service接口
*
* @author qModel
* @date 2024-08-31
*/
public interface IAuthClientUserService extends IService<AuthClientUser> {
}
@@ -0,0 +1,58 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.qiantong.qmodel.auth.domain.AuthClient;
import tech.qiantong.qmodel.auth.mapper.AuthClientMapper;
import tech.qiantong.qmodel.auth.service.IAuthClientService;
import javax.annotation.Resource;
/**
* 应用管理Service业务层处理
*
* @author qModel
* @date 2024-08-31
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class AuthClientServiceImpl extends ServiceImpl<AuthClientMapper,AuthClient> implements IAuthClientService {
@Resource
private AuthClientMapper authClientMapper;
}
@@ -0,0 +1,58 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
import tech.qiantong.qmodel.auth.mapper.AuthClientUserMapper;
import tech.qiantong.qmodel.auth.service.IAuthClientUserService;
import javax.annotation.Resource;
/**
* 应用和用户关联Service业务层处理
*
* @author qModel
* @date 2024-08-31
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class AuthClientUserServiceImpl extends ServiceImpl<AuthClientUserMapper,AuthClientUser> implements IAuthClientUserService {
@Resource
private AuthClientUserMapper authClientUserMapper;
}
@@ -0,0 +1,119 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.service.impl;
import cn.dev33.satoken.oauth2.consts.GrantType;
import cn.dev33.satoken.oauth2.data.loader.SaOAuth2DataLoader;
import cn.dev33.satoken.oauth2.data.model.loader.SaClientModel;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.IdUtil;
import org.springframework.stereotype.Component;
import tech.qiantong.qmodel.auth.domain.AuthClient;
import tech.qiantong.qmodel.auth.domain.AuthClientUser;
import tech.qiantong.qmodel.auth.service.IAuthClientService;
import tech.qiantong.qmodel.auth.service.IAuthClientUserService;
import javax.annotation.Resource;
/**
* OAuth2.0 数据加载实现类
* 实现 SaOAuth2DataLoader 接口
* 负责提供 OAuth2.0 客户端信息及用户信息
*/
@Component
public class AuthOAuth2DataLoaderImpl implements SaOAuth2DataLoader {
@Resource
private IAuthClientService clientService;
@Resource
private IAuthClientUserService clientUserService;
/**
* 根据 clientId 获取 Client 信息
*
* @param clientId 客户端ID
* @return SaClientModel 客户端模型
*/
@Override
public SaClientModel getClientModel(String clientId) {
AuthClient client = clientService.getById(Convert.toLong(clientId));
if (client != null) {
return new SaClientModel()
// 客户端ID
.setClientId(client.getId().toString())
// 客户端密钥
.setClientSecret(client.getSecretKey())
// 允许的重定向URL
.addAllowRedirectUris(client.getRedirectUrl().split(","))
// 允许的作用域
.addContractScopes("userinfo", "admin")
// 允许的授权模式
.addAllowGrantTypes(
GrantType.authorization_code,
GrantType.implicit,
GrantType.refresh_token,
GrantType.password,
GrantType.client_credentials
);
} else {
return null;
}
}
/**
* 根据 clientId 和 loginId 获取 openid
*
* @param clientId 客户端ID
* @param loginId 用户ID
* @return openid 用户唯一标识
*/
@Override
public String getOpenid(String clientId, Object loginId) {
AuthClientUser openid = clientUserService.lambdaQuery()
.eq(AuthClientUser::getClientId, Convert.toLong(clientId))
.eq(AuthClientUser::getUserId, Convert.toLong(loginId))
.one();
if (openid == null) {
openid = new AuthClientUser();
openid.setClientId(Convert.toLong(clientId));
openid.setUserId(Convert.toLong(loginId));
openid.setOpenId(IdUtil.simpleUUID());
clientUserService.save(openid);
}
return openid.getOpenId();
}
}
@@ -0,0 +1,49 @@
/*
* Copyright © 2026 Qiantong Technology Co., Ltd.
* qModel Model Platform(Open Source Edition)
* *
* License:
* Released under the Apache License, Version 2.0.
* You may use, modify, and distribute this software for commercial purposes
* under the terms of the License.
* *
* Special Notice:
* All derivative versions are strictly prohibited from modifying or removing
* the default system logo and copyright information.
* For brand customization, please apply for brand customization authorization via official channels.
* *
* More information: https://qmodel.qiantong.tech/business.html
* *
* ============================================================================
* *
* 版权所有 © 2026 江苏千桐科技有限公司
* qModel 模型平台(开源版)
* *
* 许可协议:
* 本项目基于 Apache License 2.0 开源协议发布,
* 允许在遵守协议的前提下进行商用、修改和分发。
* *
* 特别说明:
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
* *
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
*/
package tech.qiantong.qmodel.auth.service.impl;
import cn.dev33.satoken.oauth2.template.SaOAuth2Template;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* Sa-Token OAuth2.0 整合实现 【重写框架】
* @author qModel
*/
@Component
public class AuthOAuth2TemplateImpl extends SaOAuth2Template {
private static final Logger log = LoggerFactory.getLogger(AuthOAuth2TemplateImpl.class);
}
@@ -0,0 +1,76 @@
# Copyright © 2026 Qiantong Technology Co., Ltd.
# qModel Model Platform(Open Source Edition)
# *
# License:
# Released under the Apache License, Version 2.0.
# You may use, modify, and distribute this software for commercial purposes
# under the terms of the License.
# *
# Special Notice:
# All derivative versions are strictly prohibited from modifying or removing
# the default system logo and copyright information.
# For brand customization, please apply for brand customization authorization via official channels.
# *
# More information: https://qmodel.qiantong.tech/business.html
# *
# ============================================================================
# *
# 版权所有 © 2026 江苏千桐科技有限公司
# qModel 模型平台(开源版)
# *
# 许可协议:
# 本项目基于 Apache License 2.0 开源协议发布,
# 允许在遵守协议的前提下进行商用、修改和分发。
# *
# 特别说明:
# 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
# 如需定制品牌,请通过官方渠道申请品牌定制授权。
# *
# 更多信息请访问:https://qmodel.qiantong.tech/business.html
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: aniviaToken
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
is-share: true
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik
token-style: uuid
# 是否输出操作日志
is-log: true
# oauth2服务配置
oauth2-server:
# 是否打开模式:授权码(Authorization Code
enable-authorization-code: true
# 是否打开模式:隐藏式(Implicit)
enable-implicit: true
# 是否打开模式:密码式(Password)
enable-password: true
# 是否打开模式:凭证式(Client Credentials
enable-client-credentials: true
# 是否在每次 Refresh-Token 刷新 Access-Token 时,产生一个新的 Refresh-Token
is-new-refresh: false
# Code授权码 保存的时间(单位:秒) 默认五分钟
code-timeout: 300
# Access-Token 保存的时间(单位:秒) 默认两个小时
access-token-timeout: 7200
# Refresh-Token 保存的时间(单位:秒) 默认30 天
refresh-token-timeout: 2592000
# Client-Token 保存的时间(单位:秒) 默认两个小时
client-token-timeout: 7200
# Lower-Client-Token 保存的时间(单位:秒) 默认为 -1,代表延续 Client-Token 有效期
lower-client-token-timeout: -1
# 指定高级权限,多个用逗号隔开
higher-scope: admin
# 指定低级权限,多个用逗号隔开
lower-scope: userinfo
# 模式4是否返回 AccessToken 字段
mode4-return-access-token: false
# 是否在返回值中隐藏默认的状态字段 (code、msg、data)
hide-status-field: false
@@ -0,0 +1,76 @@
# Copyright © 2026 Qiantong Technology Co., Ltd.
# qModel Model Platform(Open Source Edition)
# *
# License:
# Released under the Apache License, Version 2.0.
# You may use, modify, and distribute this software for commercial purposes
# under the terms of the License.
# *
# Special Notice:
# All derivative versions are strictly prohibited from modifying or removing
# the default system logo and copyright information.
# For brand customization, please apply for brand customization authorization via official channels.
# *
# More information: https://qmodel.qiantong.tech/business.html
# *
# ============================================================================
# *
# 版权所有 © 2026 江苏千桐科技有限公司
# qModel 模型平台(开源版)
# *
# 许可协议:
# 本项目基于 Apache License 2.0 开源协议发布,
# 允许在遵守协议的前提下进行商用、修改和分发。
# *
# 特别说明:
# 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
# 如需定制品牌,请通过官方渠道申请品牌定制授权。
# *
# 更多信息请访问:https://qmodel.qiantong.tech/business.html
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: aniviaToken
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
is-share: true
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik
token-style: uuid
# 是否输出操作日志
is-log: true
# oauth2服务配置
oauth2-server:
# 是否打开模式:授权码(Authorization Code
enable-authorization-code: true
# 是否打开模式:隐藏式(Implicit)
enable-implicit: true
# 是否打开模式:密码式(Password)
enable-password: true
# 是否打开模式:凭证式(Client Credentials
enable-client-credentials: true
# 是否在每次 Refresh-Token 刷新 Access-Token 时,产生一个新的 Refresh-Token
is-new-refresh: false
# Code授权码 保存的时间(单位:秒) 默认五分钟
code-timeout: 300
# Access-Token 保存的时间(单位:秒) 默认两个小时
access-token-timeout: 7200
# Refresh-Token 保存的时间(单位:秒) 默认30 天
refresh-token-timeout: 2592000
# Client-Token 保存的时间(单位:秒) 默认两个小时
client-token-timeout: 7200
# Lower-Client-Token 保存的时间(单位:秒) 默认为 -1,代表延续 Client-Token 有效期
lower-client-token-timeout: -1
# 指定高级权限,多个用逗号隔开
higher-scope: admin
# 指定低级权限,多个用逗号隔开
lower-scope: userinfo
# 模式4是否返回 AccessToken 字段
mode4-return-access-token: false
# 是否在返回值中隐藏默认的状态字段 (code、msg、data)
hide-status-field: false
@@ -0,0 +1,76 @@
# Copyright © 2026 Qiantong Technology Co., Ltd.
# qModel Model Platform(Open Source Edition)
# *
# License:
# Released under the Apache License, Version 2.0.
# You may use, modify, and distribute this software for commercial purposes
# under the terms of the License.
# *
# Special Notice:
# All derivative versions are strictly prohibited from modifying or removing
# the default system logo and copyright information.
# For brand customization, please apply for brand customization authorization via official channels.
# *
# More information: https://qmodel.qiantong.tech/business.html
# *
# ============================================================================
# *
# 版权所有 © 2026 江苏千桐科技有限公司
# qModel 模型平台(开源版)
# *
# 许可协议:
# 本项目基于 Apache License 2.0 开源协议发布,
# 允许在遵守协议的前提下进行商用、修改和分发。
# *
# 特别说明:
# 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
# 如需定制品牌,请通过官方渠道申请品牌定制授权。
# *
# 更多信息请访问:https://qmodel.qiantong.tech/business.html
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: aniviaToken
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
is-share: true
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik
token-style: uuid
# 是否输出操作日志
is-log: true
# oauth2服务配置
oauth2-server:
# 是否打开模式:授权码(Authorization Code
enable-authorization-code: true
# 是否打开模式:隐藏式(Implicit)
enable-implicit: true
# 是否打开模式:密码式(Password)
enable-password: true
# 是否打开模式:凭证式(Client Credentials
enable-client-credentials: true
# 是否在每次 Refresh-Token 刷新 Access-Token 时,产生一个新的 Refresh-Token
is-new-refresh: false
# Code授权码 保存的时间(单位:秒) 默认五分钟
code-timeout: 300
# Access-Token 保存的时间(单位:秒) 默认两个小时
access-token-timeout: 7200
# Refresh-Token 保存的时间(单位:秒) 默认30 天
refresh-token-timeout: 2592000
# Client-Token 保存的时间(单位:秒) 默认两个小时
client-token-timeout: 7200
# Lower-Client-Token 保存的时间(单位:秒) 默认为 -1,代表延续 Client-Token 有效期
lower-client-token-timeout: -1
# 指定高级权限,多个用逗号隔开
higher-scope: admin
# 指定低级权限,多个用逗号隔开
lower-scope: userinfo
# 模式4是否返回 AccessToken 字段
mode4-return-access-token: false
# 是否在返回值中隐藏默认的状态字段 (code、msg、data)
hide-status-field: false
@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright © 2026 Qiantong Technology Co., Ltd.
qModel Model Platform(Open Source Edition)
*
License:
Released under the Apache License, Version 2.0.
You may use, modify, and distribute this software for commercial purposes
under the terms of the License.
*
Special Notice:
All derivative versions are strictly prohibited from modifying or removing
the default system logo and copyright information.
For brand customization, please apply for brand customization authorization via official channels.
*
More information: https://qmodel.qiantong.tech/business.html
*
============================================================================
*
版权所有 © 2026 江苏千桐科技有限公司
qModel 模型平台(开源版)
*
许可协议:
本项目基于 Apache License 2.0 开源协议发布,
允许在遵守协议的前提下进行商用、修改和分发。
*
特别说明:
所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
如需定制品牌,请通过官方渠道申请品牌定制授权。
*
更多信息请访问:https://qmodel.qiantong.tech/business.html
-->
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="tech.qiantong.auth.mapper.AuthClientMapper">
<resultMap type="AuthClient" id="AuthClientResult">
<result property="id" column="id" />
<result property="secretKey" column="secret_key" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="icon" column="icon" />
<result property="homeUrl" column="home_url" />
<result property="syncUrl" column="sync_url" />
<result property="redirectUrl" column="redirect_url" />
<result property="publicFlag" column="public_flag" />
<result property="validFlag" column="valid_flag" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="creatorId" column="creator_id" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updatorId" column="updator_id" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectAuthClientVo">
select id, secret_key, name, type, icon, home_url, sync_url, redirect_url, public_flag, valid_flag, del_flag, create_by, creator_id, create_time, update_by, updator_id, update_time, remark from auth_client
</sql>
<select id="selectAuthClientList" parameterType="AuthClient" resultMap="AuthClientResult">
<include refid="selectAuthClientVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="secretKey != null and secretKey != ''"> and secret_key = #{secretKey}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null "> and type = #{type}</if>
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
<if test="homeUrl != null and homeUrl != ''"> and home_url = #{homeUrl}</if>
<if test="syncUrl != null and syncUrl != ''"> and sync_url = #{syncUrl}</if>
<if test="redirectUrl != null and redirectUrl != ''"> and redirect_url = #{redirectUrl}</if>
<if test="publicFlag != null "> and public_flag = #{publicFlag}</if>
<if test="validFlag != null "> and valid_flag = #{validFlag}</if>
<if test="delFlag != null "> and del_flag = #{delFlag}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="updatorId != null and updatorId != ''"> and updator_id = #{updatorId}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
</where>
</select>
<select id="selectAuthClientById" parameterType="Long" resultMap="AuthClientResult">
<include refid="selectAuthClientVo"/>
where id = #{id}
</select>
<insert id="insertAuthClient" parameterType="AuthClient" useGeneratedKeys="true" keyProperty="id">
insert into auth_client
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="secretKey != null and secretKey != ''">secret_key,</if>
<if test="name != null and name != ''">name,</if>
<if test="type != null">type,</if>
<if test="icon != null">icon,</if>
<if test="homeUrl != null">home_url,</if>
<if test="syncUrl != null and syncUrl != ''">sync_url,</if>
<if test="redirectUrl != null and redirectUrl != ''">redirect_url,</if>
<if test="publicFlag != null">public_flag,</if>
<if test="validFlag != null">valid_flag,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="creatorId != null">creator_id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updatorId != null">updator_id,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="secretKey != null and secretKey != ''">#{secretKey},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="type != null">#{type},</if>
<if test="icon != null">#{icon},</if>
<if test="homeUrl != null">#{homeUrl},</if>
<if test="syncUrl != null and syncUrl != ''">#{syncUrl},</if>
<if test="redirectUrl != null and redirectUrl != ''">#{redirectUrl},</if>
<if test="publicFlag != null">#{publicFlag},</if>
<if test="validFlag != null">#{validFlag},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updatorId != null">#{updatorId},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateAuthClient" parameterType="AuthClient">
update auth_client
<trim prefix="SET" suffixOverrides=",">
<if test="secretKey != null and secretKey != ''">secret_key = #{secretKey},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="icon != null">icon = #{icon},</if>
<if test="homeUrl != null">home_url = #{homeUrl},</if>
<if test="syncUrl != null and syncUrl != ''">sync_url = #{syncUrl},</if>
<if test="redirectUrl != null and redirectUrl != ''">redirect_url = #{redirectUrl},</if>
<if test="publicFlag != null">public_flag = #{publicFlag},</if>
<if test="validFlag != null">valid_flag = #{validFlag},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updatorId != null">updator_id = #{updatorId},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAuthClientById" parameterType="Long">
delete from auth_client where id = #{id}
</delete>
<delete id="deleteAuthClientByIds" parameterType="String">
delete from auth_client where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright © 2026 Qiantong Technology Co., Ltd.
qModel Model Platform(Open Source Edition)
*
License:
Released under the Apache License, Version 2.0.
You may use, modify, and distribute this software for commercial purposes
under the terms of the License.
*
Special Notice:
All derivative versions are strictly prohibited from modifying or removing
the default system logo and copyright information.
For brand customization, please apply for brand customization authorization via official channels.
*
More information: https://qmodel.qiantong.tech/business.html
*
============================================================================
*
版权所有 © 2026 江苏千桐科技有限公司
qModel 模型平台(开源版)
*
许可协议:
本项目基于 Apache License 2.0 开源协议发布,
允许在遵守协议的前提下进行商用、修改和分发。
*
特别说明:
所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
如需定制品牌,请通过官方渠道申请品牌定制授权。
*
更多信息请访问:https://qmodel.qiantong.tech/business.html
-->
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="tech.qiantong.auth.mapper.AuthClientUserMapper">
<resultMap type="AuthClientUser" id="AuthClientUserResult">
<result property="clientId" column="client_id" />
<result property="userId" column="user_id" />
<result property="openId" column="open_id" />
</resultMap>
<sql id="selectAuthClientUserVo">
select client_id, user_id, open_id from auth_client_user
</sql>
<select id="selectAuthClientUserList" parameterType="AuthClientUser" resultMap="AuthClientUserResult">
<include refid="selectAuthClientUserVo"/>
<where>
<if test="clientId != null "> and client_id = #{clientId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="openId != null and openId != ''"> and open_id = #{openId}</if>
</where>
</select>
<select id="selectAuthClientUserByClientId" parameterType="Long" resultMap="AuthClientUserResult">
<include refid="selectAuthClientUserVo"/>
where client_id = #{clientId}
</select>
<insert id="insertAuthClientUser" parameterType="AuthClientUser">
insert into auth_client_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="clientId != null">client_id,</if>
<if test="userId != null">user_id,</if>
<if test="openId != null and openId != ''">open_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null">#{clientId},</if>
<if test="userId != null">#{userId},</if>
<if test="openId != null and openId != ''">#{openId},</if>
</trim>
</insert>
<update id="updateAuthClientUser" parameterType="AuthClientUser">
update auth_client_user
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="openId != null and openId != ''">open_id = #{openId},</if>
</trim>
where client_id = #{clientId}
</update>
<delete id="deleteAuthClientUserByClientId" parameterType="Long">
delete from auth_client_user where client_id = #{clientId}
</delete>
<delete id="deleteAuthClientUserByClientIds" parameterType="String">
delete from auth_client_user where client_id in
<foreach item="clientId" collection="array" open="(" separator="," close=")">
#{clientId}
</foreach>
</delete>
</mapper>