commit dfb943919d9616f88dd044c0b5616198df3673c3 Author: yy <1137267053@qq.com> Date: Fri Sep 11 17:34:14 2026 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..13275f1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ +.kotlin + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..f6906f2 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# 已忽略包含查询文件的默认文件夹 +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..1d30484 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..63e9001 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..c7ea920 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..59adc43 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b93cb69 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..975885f --- /dev/null +++ b/README.md @@ -0,0 +1,230 @@ +有色再生资源交易平台 - 后端项目架构设计文档 +项目代号:METALLOOP / metalloop +文档版本:v1.0 +创建时间:2026-09-09 +技术基座:Spring Boot 3.x + Sa-Token + MyBatis-Plus + MySQL 8.0 + Redis 6.0 + +1. 项目概述 + 本后端服务于“有色再生资源交易平台”,提供用户认证、权限管理、企业认证、产品目录管理、供应/求购信息发布与审核、即时聊天集成等核心业务 API。系统采用 RBAC(基于角色的访问控制) 权限模型,通过 Sa-Token 实现认证与鉴权,具备高扩展性和可维护性。 + +1.1 核心业务目标 +支持企业注册、认证(营业执照 + 法人信息)、入驻平台; + +支持企业发布供应信息与求购信息; + +支持管理员审核交易信息与企业认证资料; + +支持基于 RBAC 的后台管理权限体系; + +支持与 OpenIM 集成,实现买卖双方在线即时沟通; + +支持多环境部署(开发、测试、生产)。 + +2. 技术栈选型 + 组件 选型 版本 说明 + JDK Oracle OpenJDK 17 LTS 长期支持版本,兼容 Spring Boot 3.x + 开发框架 Spring Boot 3.2.x 核心基础框架 + 安全认证 Sa-Token 1.37.x 轻量级权限认证框架,支持 RBAC、分布式会话 + ORM 框架 MyBatis-Plus 3.5.x 增强 MyBatis,提供代码生成、分页、逻辑删除等 + 数据库 MySQL 8.0+ 关系型数据库,支持事务、窗口函数等 + 缓存 / 会话存储 Redis 6.0+ 用于 Sa-Token 分布式会话、接口防刷、热点数据缓存 + API 文档 Knife4j / Swagger 4.x 在线接口调试与文档生成 + 工具库 Hutool 5.8.x 常用工具类集合(日期、加密、Bean 拷贝等) + JSON 处理 Jackson (Spring Boot 内置) 序列化/反序列化 + 日志 SLF4J + Logback (Spring Boot 内置) 日志门面 + 实现 + 连接池 HikariCP (Spring Boot 内置) 高性能数据库连接池 + 构建工具 Maven 3.6+ 项目构建与依赖管理 +3. 系统模块划分(Maven 多模块) + 项目采用 Maven 多模块结构,便于后续拆分微服务或模块独立部署。 + +text +metalloop-backend/ +├── pom.xml # 父 POM,统一版本管理 +├── metalloop-common/ # 公共模块(无业务依赖) +│ ├── src/main/java/ +│ │ └── com.metalloop.common/ +│ │ ├── annotation/ # 自定义注解 +│ │ ├── constant/ # 常量、枚举类 +│ │ ├── exception/ # 自定义异常 +│ │ ├── model/ # 统一返回模型(Result、PageResult) +│ │ └── utils/ # 工具类(MD5、JWT、DateUtil 等) +│ └── pom.xml +│ +├── metalloop-framework/ # 框架配置模块 +│ ├── src/main/java/ +│ │ └── com.metalloop.framework/ +│ │ ├── config/ # 通用配置(Jackson、线程池、CORS) +│ │ ├── satoken/ # Sa-Token 配置、权限拦截器 +│ │ ├── mybatis/ # MyBatis-Plus 配置(分页、填充、逻辑删除) +│ │ └── swagger/ # Knife4j 配置 +│ └── pom.xml +│ +├── metalloop-dao/ # 数据访问层 +│ ├── src/main/java/ +│ │ └── com.metalloop.dao/ +│ │ ├── entity/ # 数据库实体类(对应每张表) +│ │ ├── mapper/ # MyBatis-Plus Mapper 接口 +│ │ ├── dto/ # 数据传输对象(业务层入参/出参) +│ │ └── vo/ # 视图对象(Controller 返回专用) +│ └── pom.xml +│ +├── metalloop-service/ # 业务逻辑层 +│ ├── src/main/java/ +│ │ └── com.metalloop.service/ +│ │ ├── auth/ # 认证服务 +│ │ ├── user/ # 用户服务 +│ │ ├── enterprise/ # 企业服务(含认证审核) +│ │ ├── product/ # 产品、品种、材质服务 +│ │ ├── trade/ # 供应/求购信息服务 +│ │ ├── permission/ # 权限与角色服务 +│ │ ├── im/ # OpenIM 集成服务 +│ │ └── impl/ # 各服务实现类(按模块分包) +│ └── pom.xml +│ +├── metalloop-api/ # API 接口定义(可选,用于 Feign 或微服务) +│ ├── src/main/java/ +│ │ └── com.metalloop.api/ # 对外暴露的 API 接口 +│ └── pom.xml +│ +└── metalloop-web/ # Web 启动模块 +├── src/main/java/ +│ └── com.metalloop.web/ +│ ├── controller/ # REST Controller(按模块分包) +│ ├── interceptor/ # 全局拦截器 +│ ├── filter/ # 过滤器 +│ └── advice/ # 全局异常处理器 +├── src/main/resources/ +│ ├── application.yml # 主配置文件 +│ ├── application-dev.yml # 开发环境配置 +│ ├── application-prod.yml # 生产环境配置 +│ ├── logback-spring.xml # 日志配置 +│ └── mapper/ # MyBatis XML 映射文件(可选) +└── pom.xml + +4. 包结构设计(单模块方案) + 若采用单模块结构,推荐按业务模块分包,清晰隔离各领域: + +text +com.metalloop +│ +├── common # 公共组件(可独立为 common 模块) +│ ├── annotation # 自定义注解 +│ │ ├── @RequirePermission # 权限校验注解(可选,Sa-Token 自带 @SaCheckPermission) +│ │ └── @LogOperation # 操作日志注解 +│ ├── constant # 常量与枚举 +│ │ ├── ApiCode.java # API 响应码枚举 +│ │ ├── AuditStatusEnum.java # 审核状态枚举 +│ │ └── UserStatusEnum.java # 用户状态枚举 +│ ├── exception # 异常处理 +│ │ ├── BusinessException.java # 业务异常 +│ │ └── GlobalExceptionHandler.java # 全局异常拦截 +│ ├── model # 统一响应模型 +│ │ ├── Result.java # 统一返回结构 +│ │ └── PageResult.java # 分页返回结构 +│ └── utils # 工具类 +│ ├── RedisUtil.java # Redis 工具封装 +│ ├── SecurityUtil.java # 加密工具(BCrypt、MD5) +│ └── BeanCopyUtil.java # 对象拷贝工具 +│ +├── framework # 框架集成(可独立为 framework 模块) +│ ├── satoken +│ │ ├── SaTokenConfig.java # Sa-Token 配置类 +│ │ ├── StpInterfaceImpl.java # 权限/角色数据源实现 +│ │ └── SaTokenInterceptor.java # 全局鉴权拦截器(可选) +│ ├── mybatis +│ │ ├── MybatisPlusConfig.java # 分页、乐观锁配置 +│ │ ├── MetaObjectHandler.java # 自动填充(createTime、updateTime) +│ │ └── LogicDeleteConfig.java # 逻辑删除配置(若使用) +│ ├── redis +│ │ └── RedisConfig.java # Redis 序列化配置(Jackson2Json) +│ └── swagger +│ └── Knife4jConfig.java # API 文档配置 +│ +├── modules # 业务模块 +│ │ +│ ├── auth # 认证模块 +│ │ ├── controller +│ │ │ └── AuthController.java # 登录、登出、刷新 Token +│ │ ├── service +│ │ │ ├── AuthService.java +│ │ │ └── impl +│ │ │ └── AuthServiceImpl.java +│ │ ├── model +│ │ │ ├── LoginDTO.java # 登录请求参数 +│ │ │ └── LoginVO.java # 登录响应(含 Token) +│ │ └── mapper # (复用 dao 层 Mapper) +│ │ +│ ├── user # 用户管理模块 +│ │ ├── controller +│ │ │ └── UserController.java # 用户 CRUD、禁用/启用 +│ │ ├── service +│ │ └── model +│ │ +│ ├── enterprise # 企业管理模块 +│ │ ├── controller +│ │ │ └── EnterpriseController.java # 企业认证、审核、查询 +│ │ ├── service +│ │ ├── model +│ │ │ ├── EnterpriseSubmitDTO.java # 提交认证资料 +│ │ │ └── EnterpriseAuditDTO.java # 审核操作 +│ │ └── mapper +│ │ +│ ├── product # 产品目录模块 +│ │ ├── controller +│ │ │ ├── ProductController.java +│ │ │ ├── VarietyController.java +│ │ │ └── MaterialController.java +│ │ ├── service +│ │ └── model +│ │ +│ ├── trade # 交易信息模块 +│ │ ├── controller +│ │ │ ├── SupplyController.java # 供应信息 +│ │ │ └── PurchaseController.java # 求购信息 +│ │ ├── service +│ │ └── model +│ │ +│ ├── permission # 权限管理模块(后台) +│ │ ├── controller +│ │ │ ├── RoleController.java # 角色 CRUD +│ │ │ └── PermissionController.java # 权限/菜单管理 +│ │ ├── service +│ │ └── model +│ │ +│ └── im # 即时聊天模块(OpenIM 集成) +│ ├── controller +│ │ └── IMController.java # 获取 IM Token、Webhook 接收 +│ ├── service +│ │ ├── IMService.java # OpenIM API 调用封装 +│ │ └── WebhookService.java # 处理 OpenIM 回调事件 +│ └── model +│ +└── web # Web 层公共配置 +├── config +│ └── WebMvcConfig.java # 跨域、静态资源、拦截器注册 +├── filter +│ └── RequestLogFilter.java # 请求日志过滤器 +└── MainApplication.java # Spring Boot 启动类 +5. 数据库表清单 + 5.1 系统权限模块(sys_*) + 表名 说明 关键字段 + sys_user 用户表 id, username, password, phone, enterprise_id, auth_status, user_status + sys_role 角色表 id, role_name, status, is_system, sort + sys_permission 权限表(菜单 + 按钮) id, name, code, type, parent_id, api_path, route_path + sys_user_role 用户-角色关联表 user_id, role_id + sys_role_permission 角色-权限关联表 role_id, permission_id + 5.2 企业模块(sys_enterprise 系列) + 注:根据现有数据库,企业表实际前缀为 sys_,与系统模块共用,逻辑上可按业务域区分。 + +表名 说明 关键字段 +sys_enterprise 企业信息主表 id, enterprise_name, legal_person, unified_social_credit_code, audit_status, credit_limit +sys_enterprise_image 企业图片附件表 id, enterprise_id, image_type, image_url +5.3 业务交易模块(biz_*) +表名 说明 关键字段 +biz_product 产品基础表 id, product_name, product_code, unit, status +biz_variety 品种表(支持层级) id, variety_name, parent_id, variety_grade +biz_material 材质基础表 id, material_name +biz_enterprise_product 企业经营产品表 id, enterprise_id, variety_id, material_id, unit_price, weight +biz_purchase_request 求购信息表 id, create_user_id, title, quantity, unit_price, audit_status, expire_time +biz_supply_info 发布信息表(供应) id, create_user_id, title, quantity, unit_price, audit_status, expire_time +biz_product_element_detail 产品材质详情表 id, product_id, element_name, element_content \ No newline at end of file diff --git a/metaloop.iml b/metaloop.iml new file mode 100644 index 0000000..a80f8af --- /dev/null +++ b/metaloop.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..444405c --- /dev/null +++ b/pom.xml @@ -0,0 +1,158 @@ + + 4.0.0 + + com.metalloop + metaloop + 0.0.1-SNAPSHOT + jar + + + org.springframework.boot + spring-boot-starter-parent + 3.4.13 + + + + + 17 + 1.46.0 + 3.5.9 + 1.6.3 + 3.40.0 + 5.8.31 + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-security + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + com.baomidou + mybatis-plus-spring-boot3-starter + ${mybatis-plus.version} + + + + com.baomidou + mybatis-plus-jsqlparser + ${mybatis-plus.version} + + + com.mysql + mysql-connector-j + runtime + + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.8.13 + + + + + cn.dev33 + sa-token-spring-boot3-starter + ${sa-token.version} + + + cn.dev33 + sa-token-redis-jackson + ${sa-token.version} + + + + + org.redisson + redisson-spring-boot-starter + ${redisson.version} + + + + + org.mapstruct + mapstruct + ${mapstruct.version} + + + cn.hutool + hutool-json + ${hutool.version} + + + org.projectlombok + lombok + provided + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${java.version} + ${java.version} + + + org.projectlombok + lombok + ${lombok.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + + + + + \ No newline at end of file diff --git a/src/Main.java b/src/Main.java new file mode 100644 index 0000000..fe7aa2b --- /dev/null +++ b/src/Main.java @@ -0,0 +1,15 @@ +//TIP 要运行代码,请按 或 +// 点击装订区域中的 图标。 +public class Main { + public static void main(String[] args) { + //TIP 当文本光标位于高亮显示的文本处时按 + // 查看 IntelliJ IDEA 建议如何修正。 + System.out.printf("Hello and welcome!"); + + for (int i = 1; i <= 5; i++) { + //TIP 按 开始调试代码。我们已经设置了一个 断点 + // 但您始终可以通过按 添加更多断点。 + System.out.println("i = " + i); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/Application.java b/src/main/java/com/metalloop/Application.java new file mode 100644 index 0000000..d61fde9 --- /dev/null +++ b/src/main/java/com/metalloop/Application.java @@ -0,0 +1,17 @@ +package com.metalloop; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringBootApplication + +@EnableTransactionManagement +@EnableScheduling +public class Application { + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/src/main/java/com/metalloop/common/auth/Authentication.java b/src/main/java/com/metalloop/common/auth/Authentication.java new file mode 100644 index 0000000..8133544 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/Authentication.java @@ -0,0 +1,142 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.auth; + + +import com.metalloop.common.auth.permission.Permission; +import com.metalloop.common.auth.userdetails.UserDetails; + +import java.util.Collection; + +/** + * 认证后的用户信息 + * + * @author zhaowenhao + * @since 2023-03-21 + */ +public class Authentication { + + /** + * 权限集合 + */ + Collection permissions; + + /** + * 用户Id + */ + String userId; + + /** + * 用户登录名 + */ + String username; + + /** + * 访问令牌 + */ + String accessToken; + + + /** + * 返回授予用户的权限。无法返回null 。 + * + * @return 按自然键排序的权限集合。 + */ + public Collection getPermissions() { + return this.permissions; + } + + /** + * 返回用于对用户进行身份验证的用户Id。无法返回null 。 + * + * @return 用户Id + */ + public String getUserId() { + return this.userId; + } + + /** + * 返回用于对用户进行身份验证的用户名。无法返回null 。 + * + * @return 用户名 + */ + public String getUsername() { + return this.username; + } + + /** + * 获取访问令牌 + * + * @return 访问令牌 + */ + public String getAccessToken() { + return accessToken; + } + + public void setPermissions(Collection permissions) { + this.permissions = permissions; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public void setUsername(String username) { + this.username = username; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + /** + * 从UserDetails中构建认证通过的用户 + * + * @param userDetails UserDetails + * @return 认证通过的用户 + */ + public static Builder withUserDetails(UserDetails userDetails) { + return new Builder(userDetails); + } + + public static class Builder { + private final Collection permissions; + private final String userId; + private final String username; + private String accessToken; + + public Builder(UserDetails userDetails) { + this.permissions = userDetails.getPermissions(); + this.userId = userDetails.getUserId(); + this.username = userDetails.getUsername(); + } + + public Builder accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + public Authentication build() { + Authentication authentication = new Authentication(); + authentication.setPermissions(this.permissions); + authentication.setUserId(this.userId); + authentication.setUsername(this.username); + authentication.setAccessToken(this.accessToken); + return authentication; + } + } +} diff --git a/src/main/java/com/metalloop/common/auth/config/AuthServerConfiguration.java b/src/main/java/com/metalloop/common/auth/config/AuthServerConfiguration.java new file mode 100644 index 0000000..085d464 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/config/AuthServerConfiguration.java @@ -0,0 +1,109 @@ +package com.metalloop.common.auth.config; + +import com.metalloop.common.enums.LoginType; +import com.metalloop.common.auth.password.PasswordDecryptor; +import com.metalloop.common.auth.password.RsaPasswordDecryptor; +import com.metalloop.modules.auth.controller.AuthController; +import com.metalloop.common.auth.encrypt.KeyProperties; +import com.metalloop.modules.auth.controller.RsaPublicKeyController; +import com.metalloop.modules.auth.model.req.AuthenticationRequest; +import jakarta.annotation.PostConstruct; +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.util.Assert; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; + +import java.util.Collections; +import java.util.List; + +/** + * 认证服务器配置类 + * + * @author zhaowenhao + * @since 2023-03-19 + */ + +@SuppressWarnings({"SpringJavaAutowiredFieldsWarningInspection", "SpringJavaInjectionPointsAutowiringInspection"}) +@Configuration +@EnableConfigurationProperties({KeyProperties.class}) +public class AuthServerConfiguration { + + @Autowired + private List configurers = Collections.emptyList(); + + @Autowired + private RequestMappingHandlerMapping handlerMapping; + + @Autowired + private KeyProperties keyProperties; + + @PostConstruct + public void init() { + // 检查是否有相关的配置 + Assert.notEmpty(configurers, "找不到认证服务器的相关配置"); + // 遍历每个配置器 + for (AuthServerConfigurer configurer : configurers) { + AuthServerEndpointsConfigurer endpointsConfigurer = new AuthServerEndpointsConfigurer(); + try { + configurer.configure(endpointsConfigurer); + } catch (Exception e) { + throw new IllegalStateException("无法配置认证端点", e); + } + // 为每个服务创建并注册一个 AuthController + LoginType loginType = endpointsConfigurer.getLoginType(); + AuthController authController = new AuthController(loginType, endpointsConfigurer.getUserDetailsService(), + endpointsConfigurer.getLoginSuccessHandler(), endpointsConfigurer.getLogoutSuccessHandler(), + passwordDecryptor(keyProperties), passwordEncoder(), endpointsConfigurer.getVerifyCodeHandler(), endpointsConfigurer.getPasswordCheckFailureHandler()); + // 注册登录和登出端点 + if ("wechat".equals(loginType.getType())) { +// registerEndpoint(endpointsConfigurer.getLoginProcessingUrl(), "miniAppLogin", authController, RequestMethod.POST, AuthenticationMiniAppRequest.class, HttpServletRequest.class); +// registerEndpoint(endpointsConfigurer.getLogoutProcessingUrl(), "miniAppLogout", authController, RequestMethod.POST); + } else { + registerEndpoint(endpointsConfigurer.getLoginProcessingUrl(), "login", authController, RequestMethod.POST, AuthenticationRequest.class, HttpServletRequest.class); + registerEndpoint(endpointsConfigurer.getLogoutProcessingUrl(), "logout", authController, RequestMethod.POST); + } + // 为每个服务创建并注册一个 RsaPublicKeyController + RsaPublicKeyController rsaPublicKeyController = new RsaPublicKeyController(keyProperties); + // 注册公钥获取端点 + registerEndpoint(endpointsConfigurer.getPublicKeyFetchUrl(), "getPublicKey", rsaPublicKeyController, RequestMethod.GET); + // 如果开启了单点登陆 + if (Boolean.TRUE.equals(endpointsConfigurer.getEnableSso())) { + authController.initSso(endpointsConfigurer.getSsoCodeService(), endpointsConfigurer.getSsoCodeTimeOut()); + // 注册单点登陆相关端点 + registerEndpoint(endpointsConfigurer.getSsoCodeFetchUrl(), "getSsoCode", authController, RequestMethod.GET); + registerEndpoint(endpointsConfigurer.getSsoUserinfoFetchUrl(), "getSsoUserInfo", authController, RequestMethod.GET, String.class); + } + } + } + + /** + * 注册端点的辅助方法 + */ + private void registerEndpoint(String url, String methodName, Object controller, RequestMethod requestMethod, Class... parameterTypes) { + RequestMappingInfo mappingInfo = RequestMappingInfo.paths(url).methods(requestMethod).build(); + try { + handlerMapping.registerMapping(mappingInfo, controller, controller.getClass().getMethod(methodName, parameterTypes)); + } catch (NoSuchMethodException e) { + throw new IllegalStateException("注册端点出错", e); + } + } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Bean + @ConditionalOnMissingBean(PasswordDecryptor.class) + public PasswordDecryptor passwordDecryptor(KeyProperties keyProperties) { + return new RsaPasswordDecryptor(keyProperties); + } +} diff --git a/src/main/java/com/metalloop/common/auth/config/AuthServerConfigurer.java b/src/main/java/com/metalloop/common/auth/config/AuthServerConfigurer.java new file mode 100644 index 0000000..37e90d1 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/config/AuthServerConfigurer.java @@ -0,0 +1,18 @@ +package com.metalloop.common.auth.config; + +/** + * 认证服务器配置器 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public interface AuthServerConfigurer { + + /** + * 配置操作 + * + * @param configurer 配置器 + * @throws Exception 异常 + */ + void configure(AuthServerEndpointsConfigurer configurer) throws Exception; +} diff --git a/src/main/java/com/metalloop/common/auth/config/AuthServerConfigurerAdapter.java b/src/main/java/com/metalloop/common/auth/config/AuthServerConfigurerAdapter.java new file mode 100644 index 0000000..82de24b --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/config/AuthServerConfigurerAdapter.java @@ -0,0 +1,16 @@ +package com.metalloop.common.auth.config; + +import org.springframework.util.Assert; + +/** + * 认证服务器配置器适配器 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public class AuthServerConfigurerAdapter implements AuthServerConfigurer { + @Override + public void configure(AuthServerEndpointsConfigurer configurer) throws Exception { + Assert.notNull(configurer, "认证服务器端点配置器不能为空"); + } +} diff --git a/src/main/java/com/metalloop/common/auth/config/AuthServerEndpointsConfigurer.java b/src/main/java/com/metalloop/common/auth/config/AuthServerEndpointsConfigurer.java new file mode 100644 index 0000000..ac97f3c --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/config/AuthServerEndpointsConfigurer.java @@ -0,0 +1,227 @@ +package com.metalloop.common.auth.config; + + +import com.metalloop.common.auth.handler.*; +import com.metalloop.common.auth.sso.SsoCodeService; +import com.metalloop.common.auth.userdetails.UserDetailsService; +import com.metalloop.common.enums.LoginType; + +/** + * 认证服务器端点配置器 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public class AuthServerEndpointsConfigurer { + + /** + * 账号类型 + */ + private LoginType loginType = LoginType.DEFAULT; + + /** + * 用户详细信息服务 + */ + private UserDetailsService userDetailsService; + + /** + * 登录处理Url + */ + private String loginProcessingUrl = "/login"; + + /** + * 登录处理Url + */ + private String verifyCodeProcessingUrl = "/getVerifyCode"; + + /** + * 登出处理Url + */ + private String logoutProcessingUrl = "/logout"; + + /** + * 公钥提取Url + */ + private String publicKeyFetchUrl = "/rsa/public-key"; + + /** + * 登录成功处理器 + */ + private LoginSuccessHandler loginSuccessHandler = new DefaultLoginSuccessHandler(); + + /** + * 验证码生成处理器 + */ + private VerifyCodeHandler verifyCodeHandler = new DefaultVerifyCodeHandler(); + + /** + * 密码校验失败处理器 + */ + private PasswordCheckFailureHandler passwordCheckFailureHandler = new DefaultPasswordCheckFailureHandler(); + + /** + * 登出成功处理器 + */ + private LogoutSuccessHandler logoutSuccessHandler = new DefaultLogoutSuccessHandler(); + + /** + * 是否启用单点登录 + */ + private Boolean enableSso = false; + + /** + * 单点登录授权码服务 + */ + private SsoCodeService ssoCodeService; + + /** + * 单点登录授权码过期时间 + */ + private Integer ssoCodeTimeOut = 300; + + /** + * 单点登录授权码获取Url + */ + private String ssoCodeFetchUrl = "/sso/code"; + + /** + * 单点登录授权码用户信息获取Url + */ + private String ssoUserinfoFetchUrl = "/sso/userinfo"; + + + public AuthServerEndpointsConfigurer loginType(LoginType loginType) { + this.loginType = loginType; + return this; + } + + public AuthServerEndpointsConfigurer userDetailsService(UserDetailsService userDetailsService) { + this.userDetailsService = userDetailsService; + return this; + } + + public AuthServerEndpointsConfigurer loginProcessingUrl(String loginProcessingUrl) { + this.loginProcessingUrl = loginProcessingUrl; + return this; + } + + public AuthServerEndpointsConfigurer verifyCodeProcessingUrl(String verifyCodeProcessingUrl) { + this.verifyCodeProcessingUrl = verifyCodeProcessingUrl; + return this; + } + + public AuthServerEndpointsConfigurer logoutProcessingUrl(String logoutProcessingUrl) { + this.logoutProcessingUrl = logoutProcessingUrl; + return this; + } + + public AuthServerEndpointsConfigurer publicKeyFetchUrl(String publicKeyFetchUrl) { + this.publicKeyFetchUrl = publicKeyFetchUrl; + return this; + } + + public AuthServerEndpointsConfigurer loginSuccessHandler(LoginSuccessHandler loginSuccessHandler) { + this.loginSuccessHandler = loginSuccessHandler; + return this; + } + + public AuthServerEndpointsConfigurer verifyCodeHandler(VerifyCodeHandler verifyCodeHandler) { + this.verifyCodeHandler = verifyCodeHandler; + return this; + } + + public AuthServerEndpointsConfigurer passwordCheckFailureHandler(PasswordCheckFailureHandler passwordCheckFailureHandler) { + this.passwordCheckFailureHandler = passwordCheckFailureHandler; + return this; + } + + public AuthServerEndpointsConfigurer logoutSuccessHandler(LogoutSuccessHandler logoutSuccessHandler) { + this.logoutSuccessHandler = logoutSuccessHandler; + return this; + } + + public AuthServerEndpointsConfigurer enableSso(boolean enableSso) { + this.enableSso = enableSso; + return this; + } + + public AuthServerEndpointsConfigurer ssoCodeService(SsoCodeService ssoCodeService) { + this.ssoCodeService = ssoCodeService; + return this; + } + + public AuthServerEndpointsConfigurer ssoCodeTimeOut(int ssoCodeTimeOut) { + this.ssoCodeTimeOut = ssoCodeTimeOut; + return this; + } + + public AuthServerEndpointsConfigurer ssoCodeFetchUrl(String ssoCodeFetchUrl) { + this.ssoCodeFetchUrl = ssoCodeFetchUrl; + return this; + } + + public AuthServerEndpointsConfigurer ssoUserinfoFetchUrl(String ssoUserinfoFetchUrl) { + this.ssoUserinfoFetchUrl = ssoUserinfoFetchUrl; + return this; + } + + public LoginType getLoginType() { + return loginType; + } + + public UserDetailsService getUserDetailsService() { + return userDetailsService; + } + + public String getLoginProcessingUrl() { + return loginProcessingUrl; + } + + public String getVerifyCodeProcessingUrl() { + return verifyCodeProcessingUrl; + } + + public String getLogoutProcessingUrl() { + return logoutProcessingUrl; + } + + public LoginSuccessHandler getLoginSuccessHandler() { + return loginSuccessHandler; + } + + public VerifyCodeHandler getVerifyCodeHandler() { + return verifyCodeHandler; + } + + public PasswordCheckFailureHandler getPasswordCheckFailureHandler(){ + return passwordCheckFailureHandler; + } + + public LogoutSuccessHandler getLogoutSuccessHandler() { + return logoutSuccessHandler; + } + + public String getPublicKeyFetchUrl() { + return publicKeyFetchUrl; + } + + public Boolean getEnableSso() { + return enableSso; + } + + public SsoCodeService getSsoCodeService() { + return ssoCodeService; + } + + public Integer getSsoCodeTimeOut() { + return ssoCodeTimeOut; + } + + public String getSsoCodeFetchUrl() { + return ssoCodeFetchUrl; + } + + public String getSsoUserinfoFetchUrl() { + return ssoUserinfoFetchUrl; + } +} diff --git a/src/main/java/com/metalloop/common/auth/config/EnableAuthServer.java b/src/main/java/com/metalloop/common/auth/config/EnableAuthServer.java new file mode 100644 index 0000000..ca5857a --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/config/EnableAuthServer.java @@ -0,0 +1,22 @@ +package com.metalloop.common.auth.config; + +import com.metalloop.framework.satoken.admin.config.SaTokenAdminConfiguration; +import com.metalloop.framework.satoken.self.config.SaTokenSelfConfiguration; +import org.springframework.context.annotation.Import; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 开启认证服务器 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Import({AuthServerConfiguration.class, SaTokenAdminConfiguration.class, SaTokenSelfConfiguration.class}) +public @interface EnableAuthServer { +} diff --git a/src/main/java/com/metalloop/common/auth/encrypt/KeyProperties.java b/src/main/java/com/metalloop/common/auth/encrypt/KeyProperties.java new file mode 100644 index 0000000..49b711a --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/encrypt/KeyProperties.java @@ -0,0 +1,148 @@ +package com.metalloop.common.auth.encrypt; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.core.io.Resource; + +/** + * 加密解密配置 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@ConfigurationProperties(KeyProperties.PREFIX) +public class KeyProperties { + + /** + * ConfigurationProperties prefix for KeyProperties. + */ + public static final String PREFIX = "auth-server.encrypt"; + + /** + * A symmetric key. As a stronger alternative, consider using a keystore. + */ + private String key; + + /** + * A salt for the symmetric key, in the form of a hex-encoded byte array. As a + * stronger alternative, consider using a keystore. + */ + private String salt = "deadbeef"; + + /** + * Flag to say that a process should fail if there is an encryption or decryption + * error. + */ + private boolean failOnError = true; + + /** + * The key store properties for locating a key in a Java Key Store (a file in a format + * defined and understood by the JVM). + */ + private KeyStore keyStore = new KeyStore(); + + public boolean isFailOnError() { + return this.failOnError; + } + + public void setFailOnError(boolean failOnError) { + this.failOnError = failOnError; + } + + public String getKey() { + return this.key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getSalt() { + return this.salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + public KeyStore getKeyStore() { + return this.keyStore; + } + + public void setKeyStore(KeyStore keyStore) { + this.keyStore = keyStore; + } + + /** + * Key store properties. + */ + public static class KeyStore { + + /** + * Location of the key store file, e.g. classpath:/keystore.jks. + */ + private Resource location; + + /** + * Password that locks the keystore. + */ + private String password; + + /** + * Alias for a key in the store. + */ + private String alias; + + /** + * Secret protecting the key (defaults to the same as the password). + */ + private String secret; + + /** + * The KeyStore type. Defaults to jks. + */ + private String type = "jks"; + + public String getAlias() { + return this.alias; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public Resource getLocation() { + return this.location; + } + + public void setLocation(Resource location) { + this.location = location; + } + + public String getPassword() { + return this.password; + } + + public String getType() { + return type; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSecret() { + return this.secret == null ? this.password : this.secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public void setType(String type) { + this.type = type; + } + + } + +} + diff --git a/src/main/java/com/metalloop/common/auth/encrypt/KeyStoreKeyFactory.java b/src/main/java/com/metalloop/common/auth/encrypt/KeyStoreKeyFactory.java new file mode 100644 index 0000000..7254eb7 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/encrypt/KeyStoreKeyFactory.java @@ -0,0 +1,73 @@ +package com.metalloop.common.auth.encrypt; + + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.core.io.Resource; + +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyStore; +import java.security.PublicKey; +import java.security.interfaces.RSAPrivateCrtKey; +import java.security.spec.RSAPublicKeySpec; + +/** + * Factory for RSA key pairs from a JKS keystore file. User provides a {@link Resource} location of a keystore file and + * the password to unlock it, and the factory grabs the keypairs from the store by name (and optionally password). + * + * @author Dave Syer + */ +public class KeyStoreKeyFactory { + + private static final Log logger = LogFactory.getLog(KeyStoreKeyFactory.class); + + private final Resource resource; + + private final char[] password; + + private KeyStore store; + + private final Object lock = new Object(); + + public KeyStoreKeyFactory(Resource resource, char[] password) { + this.resource = resource; + this.password = password; + } + + public KeyPair getKeyPair(String alias) { + return getKeyPair(alias, password); + } + + public KeyPair getKeyPair(String alias, char[] password) { + InputStream inputStream = null; + try { + synchronized (lock) { + if (store == null) { + synchronized (lock) { + store = KeyStore.getInstance("jks"); + inputStream = resource.getInputStream(); + store.load(inputStream, this.password); + } + } + } + RSAPrivateCrtKey key = (RSAPrivateCrtKey) store.getKey(alias, password); + RSAPublicKeySpec spec = new RSAPublicKeySpec(key.getModulus(), key.getPublicExponent()); + PublicKey publicKey = KeyFactory.getInstance("RSA").generatePublic(spec); + return new KeyPair(publicKey, key); + } catch (Exception e) { + throw new IllegalStateException("Cannot load keys from store: " + resource, e); + } finally { + try { + if (inputStream != null) { + inputStream.close(); + } + } catch (IOException e) { + logger.warn("Cannot close open stream: ", e); + } + } + } +} + diff --git a/src/main/java/com/metalloop/common/auth/handler/DefaultLoginSuccessHandler.java b/src/main/java/com/metalloop/common/auth/handler/DefaultLoginSuccessHandler.java new file mode 100644 index 0000000..b7e2f53 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/handler/DefaultLoginSuccessHandler.java @@ -0,0 +1,23 @@ +package com.metalloop.common.auth.handler; + + +import com.metalloop.common.auth.Authentication; +import com.metalloop.common.model.Result; +import com.metalloop.modules.auth.model.resp.AuthenticationResponse; + +/** + * 登录成功处理器默认实现 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public class DefaultLoginSuccessHandler implements LoginSuccessHandler { + @Override + public Object onSuccess(Authentication authentication) { + AuthenticationResponse authenticationResponse = new AuthenticationResponse(); + authenticationResponse.setAccessToken(authentication.getAccessToken()); + authenticationResponse.setUsername(authentication.getUsername()); + authenticationResponse.setUserId(authentication.getUserId()); + return Result.ok(authenticationResponse); + } +} diff --git a/src/main/java/com/metalloop/common/auth/handler/DefaultLogoutSuccessHandler.java b/src/main/java/com/metalloop/common/auth/handler/DefaultLogoutSuccessHandler.java new file mode 100644 index 0000000..675fdb4 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/handler/DefaultLogoutSuccessHandler.java @@ -0,0 +1,18 @@ +package com.metalloop.common.auth.handler; + + +import com.metalloop.common.auth.Authentication; +import com.metalloop.common.model.Result; + +/** + * 登出成功处理器默认实现 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public class DefaultLogoutSuccessHandler implements LogoutSuccessHandler { + @Override + public Object onSuccess(Authentication authentication) { + return Result.ok(); + } +} diff --git a/src/main/java/com/metalloop/common/auth/handler/DefaultPasswordCheckFailureHandler.java b/src/main/java/com/metalloop/common/auth/handler/DefaultPasswordCheckFailureHandler.java new file mode 100644 index 0000000..057bc8e --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/handler/DefaultPasswordCheckFailureHandler.java @@ -0,0 +1,27 @@ +package com.metalloop.common.auth.handler; + + +import com.metalloop.common.auth.userdetails.UserDetails; + +/** + * 密码校验失败处理器默认实现 + * + * @author lifan + * @date 2024/3/26 18:04 + */ +public class DefaultPasswordCheckFailureHandler implements PasswordCheckFailureHandler { + + @Override + public void onFailure(String ip, UserDetails userDetails) { + + } + + @Override + public void onSuccess(String ip, UserDetails userDetails) { + + } + + @Override + public void checkAccountLockStatus(String ip, UserDetails userDetails) { + } +} diff --git a/src/main/java/com/metalloop/common/auth/handler/DefaultVerifyCodeHandler.java b/src/main/java/com/metalloop/common/auth/handler/DefaultVerifyCodeHandler.java new file mode 100644 index 0000000..c44464f --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/handler/DefaultVerifyCodeHandler.java @@ -0,0 +1,15 @@ +package com.metalloop.common.auth.handler; + +public class DefaultVerifyCodeHandler implements VerifyCodeHandler{ + + + @Override + public boolean createVerifyCode(String phoneNum) { + return false; + } + + @Override + public boolean checkVerifyCode(String phoneNum, String verifyCode) { + return false; + } +} diff --git a/src/main/java/com/metalloop/common/auth/handler/LoginSuccessHandler.java b/src/main/java/com/metalloop/common/auth/handler/LoginSuccessHandler.java new file mode 100644 index 0000000..f2fb700 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/handler/LoginSuccessHandler.java @@ -0,0 +1,21 @@ +package com.metalloop.common.auth.handler; + + +import com.metalloop.common.auth.Authentication; + +/** + * 登录成功处理器 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public interface LoginSuccessHandler { + + /** + * 处理登录成功的情况,例如生成令牌、返回用户信息等。 + * + * @param authentication 认证信息 + * @return 登录成功后的响应对象 + */ + Object onSuccess(Authentication authentication); +} diff --git a/src/main/java/com/metalloop/common/auth/handler/LogoutSuccessHandler.java b/src/main/java/com/metalloop/common/auth/handler/LogoutSuccessHandler.java new file mode 100644 index 0000000..c3a69bb --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/handler/LogoutSuccessHandler.java @@ -0,0 +1,21 @@ +package com.metalloop.common.auth.handler; + + +import com.metalloop.common.auth.Authentication; + +/** + * 登出成功处理器 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public interface LogoutSuccessHandler { + + /** + * 处理登出成功的情况,认证信息可能为null + * + * @param authentication 认证信息,可能为null + * @return 登录成功后的响应对象 + */ + Object onSuccess(Authentication authentication); +} diff --git a/src/main/java/com/metalloop/common/auth/handler/PasswordCheckFailureHandler.java b/src/main/java/com/metalloop/common/auth/handler/PasswordCheckFailureHandler.java new file mode 100644 index 0000000..9685ba0 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/handler/PasswordCheckFailureHandler.java @@ -0,0 +1,35 @@ +package com.metalloop.common.auth.handler; + + +import com.metalloop.common.auth.userdetails.UserDetails; + +/** + * @author lifan + * @date 2024/3/26 17:58 + */ +public interface PasswordCheckFailureHandler { + + /** + * 处理密码校验失败的情况 + * + * @param ip 用户ip + * @param userDetails 账户信息 + */ + void onFailure(String ip, UserDetails userDetails); + + /** + * 处理密码校验成功的情况 + * + * @param ip 用户ip + * @param userDetails 账户信息 + */ + void onSuccess(String ip, UserDetails userDetails); + + /** + * 检查账户锁定状态 + * + * @param ip 用户ip + * @param userDetails 账户信息 + */ + void checkAccountLockStatus(String ip, UserDetails userDetails); +} diff --git a/src/main/java/com/metalloop/common/auth/handler/VerifyCodeHandler.java b/src/main/java/com/metalloop/common/auth/handler/VerifyCodeHandler.java new file mode 100644 index 0000000..1d749a6 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/handler/VerifyCodeHandler.java @@ -0,0 +1,21 @@ +package com.metalloop.common.auth.handler; + +public interface VerifyCodeHandler { + + /** + * 生成验证码 + * + * @param phoneNum 手机号 + * @return 是否成功 + */ + boolean createVerifyCode(String phoneNum); + + /** + * 校验验证码 + * + * @param phoneNum 手机号 + * @param verifyCode 待校验的验证码 + * @return 是否成功 + */ + boolean checkVerifyCode(String phoneNum, String verifyCode); +} diff --git a/src/main/java/com/metalloop/common/auth/model/AuthenticationMiniAppRequest.java b/src/main/java/com/metalloop/common/auth/model/AuthenticationMiniAppRequest.java new file mode 100644 index 0000000..f8ae73f --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/model/AuthenticationMiniAppRequest.java @@ -0,0 +1,38 @@ +package com.metalloop.common.auth.model; + +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + + +/** + * 小程序公众号认证请求 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@Data +public class AuthenticationMiniAppRequest { + + /** + * 用户名 + */ + @NotBlank(message = "用户名不能为空") + private String username; + + /** + * 密码 + */ + @NotBlank(message = "密码不能为空") + private String password; + + /** + * openId + */ + @NotBlank(message = "openId") + private String openId; + + /** + * 验证码 + */ + private String verifyCode; +} diff --git a/src/main/java/com/metalloop/common/auth/model/AuthenticationRequest.java b/src/main/java/com/metalloop/common/auth/model/AuthenticationRequest.java new file mode 100644 index 0000000..ccce113 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/model/AuthenticationRequest.java @@ -0,0 +1,32 @@ +package com.metalloop.common.auth.model; + +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + + +/** + * 认证请求 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@Data +public class AuthenticationRequest { + + /** + * 用户名 + */ + @NotBlank(message = "用户名不能为空") + private String username; + + /** + * 密码 + */ + @NotBlank(message = "密码不能为空") + private String password; + + /** + * 验证码 + */ + private String verifyCode; +} diff --git a/src/main/java/com/metalloop/common/auth/model/AuthenticationResponse.java b/src/main/java/com/metalloop/common/auth/model/AuthenticationResponse.java new file mode 100644 index 0000000..e6b06cb --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/model/AuthenticationResponse.java @@ -0,0 +1,29 @@ +package com.metalloop.common.auth.model; + +import lombok.Data; + +/** + * 认证响应 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@Data +public class AuthenticationResponse { + + /** + * 访问令牌 + */ + private String accessToken; + + /** + * 用户登录名 + */ + private String username; + + /** + * 用户ID + */ + private String userId; + +} diff --git a/src/main/java/com/metalloop/common/auth/password/PasswordDecryptor.java b/src/main/java/com/metalloop/common/auth/password/PasswordDecryptor.java new file mode 100644 index 0000000..88ee8b6 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/password/PasswordDecryptor.java @@ -0,0 +1,18 @@ +package com.metalloop.common.auth.password; + +/** + * 密码解密器 + * + * @author zhaowenhao + * @since 2023-02-02 + */ +public interface PasswordDecryptor { + + /** + * 解密密码密文 + * + * @param rawPassword 密码密文 + * @return 密码明文 + */ + String decrypt(String rawPassword); +} diff --git a/src/main/java/com/metalloop/common/auth/password/RsaPasswordDecryptor.java b/src/main/java/com/metalloop/common/auth/password/RsaPasswordDecryptor.java new file mode 100644 index 0000000..eef8ab5 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/password/RsaPasswordDecryptor.java @@ -0,0 +1,44 @@ +package com.metalloop.common.auth.password; + +import com.metalloop.common.exception.BadCredentialsException; +import com.metalloop.common.utils.RsaUtils; +import com.metalloop.common.auth.encrypt.KeyProperties; +import com.metalloop.common.auth.encrypt.KeyStoreKeyFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.security.KeyPair; +import java.security.PrivateKey; + +/** + * RSA 密码解密器 + * + * @author zhaowenhao + */ +public class RsaPasswordDecryptor implements PasswordDecryptor { + protected final Log logger = LogFactory.getLog(getClass()); + + /** + * Key encryption properties. + */ + private final KeyProperties keyProperties; + + public RsaPasswordDecryptor(KeyProperties keyProperties) { + this.keyProperties = keyProperties; + } + + @Override + public String decrypt(String rawPassword) { + if (keyProperties != null) { + KeyPair keyPair = new KeyStoreKeyFactory(keyProperties.getKeyStore().getLocation(), keyProperties.getKeyStore().getSecret().toCharArray()).getKeyPair(keyProperties.getKeyStore().getAlias()); + PrivateKey privateKey = keyPair.getPrivate(); + try { + return RsaUtils.decrypt(rawPassword, privateKey); + } catch (Exception e) { + logger.debug("Authentication failed: 解密密码出错: " + e.getMessage()); + throw new BadCredentialsException("用户名或密码错误"); + } + } + return rawPassword; + } +} diff --git a/src/main/java/com/metalloop/common/auth/permission/Permission.java b/src/main/java/com/metalloop/common/auth/permission/Permission.java new file mode 100644 index 0000000..1fd0bbb --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/permission/Permission.java @@ -0,0 +1,42 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.auth.permission; + +import java.io.Serializable; + +/** + * 表示权限,包括权限码和权限对应的URI。 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public interface Permission extends Serializable { + + /** + * 获取权限码 + * + * @return 权限码 + */ + String getPermissionCode(); + + /** + * 获取权限对应的URI + * + * @return 权限对应的URI + */ + String getPermissionUri(); +} diff --git a/src/main/java/com/metalloop/common/auth/permission/PermissionService.java b/src/main/java/com/metalloop/common/auth/permission/PermissionService.java new file mode 100644 index 0000000..0aef218 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/permission/PermissionService.java @@ -0,0 +1,19 @@ +package com.metalloop.common.auth.permission; + +import java.util.List; +import java.util.concurrent.Future; + +/** + * 权限服务 + * + * @author zhaowenhao + */ +public interface PermissionService { + + /** + * 加载所有权限,实现者应缓存权限列表,避免每次都查询数据库 + * + * @return 权限列表 + */ + Future> loadAllPermissions(); +} diff --git a/src/main/java/com/metalloop/common/auth/permission/SimplePermission.java b/src/main/java/com/metalloop/common/auth/permission/SimplePermission.java new file mode 100644 index 0000000..2dafecd --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/permission/SimplePermission.java @@ -0,0 +1,30 @@ +package com.metalloop.common.auth.permission; + +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 简单的权限实现 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@Data +@NoArgsConstructor +public class SimplePermission implements Permission { + + /** + * 权限码 + */ + private String permissionCode; + + /** + * 权限对应的URI + */ + private String permissionUri; + + public SimplePermission(String permissionCode, String permissionUri) { + this.permissionCode = permissionCode; + this.permissionUri = permissionUri; + } +} diff --git a/src/main/java/com/metalloop/common/auth/sso/SsoCodeService.java b/src/main/java/com/metalloop/common/auth/sso/SsoCodeService.java new file mode 100644 index 0000000..448c823 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/sso/SsoCodeService.java @@ -0,0 +1,31 @@ +package com.metalloop.common.auth.sso; + + +import com.metalloop.common.auth.sso.model.SsoUserInfo; +import com.metalloop.common.exception.BadCredentialsException; + +/** + * 单点登录授权码服务,需要一个服务来生成授权码,并验证授权码的有效性 + * + * @author zhaowenhao + * @since 2024-02-28 + */ +public interface SsoCodeService { + + /** + * 生成指定用户的单点登陆授权码 + * + * @param userId 用户ID + * @param timeout 过期时间,单位:秒 + * @return 单点登陆授权码 + */ + String generateCode(String userId, long timeout); + + /** + * 验证单点登陆授权码的有效性,如果授权码有效,返回授权码对应的用户信息 + * + * @param code 单点登陆授权码 + * @return 单点登陆用户信息 + */ + SsoUserInfo validateCode(String code) throws BadCredentialsException; +} diff --git a/src/main/java/com/metalloop/common/auth/sso/model/SimpleSsoUserInfo.java b/src/main/java/com/metalloop/common/auth/sso/model/SimpleSsoUserInfo.java new file mode 100644 index 0000000..5e09c86 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/sso/model/SimpleSsoUserInfo.java @@ -0,0 +1,298 @@ +package com.metalloop.common.auth.sso.model; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 简单的用户信息实现 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@Data +@NoArgsConstructor +public class SimpleSsoUserInfo implements SsoUserInfo { + + // region 用户基本信息 + /** + * 用户在数据库中的唯一标识符 + */ + private String userId; + + /** + * 用户登录名 + */ + private String username; + + /** + * 用户全名 + */ + private String fullName; + + /** + * 用户昵称 + */ + private String nickName; + + /** + * 用户类型 + */ + private String type; + + /** + * 执法类型 + */ + private String lawType; + + /** + * 职位/职称 + */ + private String jobTitle; + + /** + * 用户个人资料页面的 URL + */ + private String profile; + + /** + * 用户个人资料图片的 URL + */ + private String picture; + + /** + * 用户的首选电子邮件地址 + */ + private String email; + + /** + * 用户的首选电话号码 + */ + private String phoneNumber; + + /** + * 用户的性别 + */ + private String gender; + + /** + * 用户的出生日期 + */ + private String birthdate; + + /** + * 用户的地址 + */ + private String address; + + /** + * 用户的身份证号 + */ + private String idNumber; + + /** + * 用户的工作单位 + */ + private String workUnit; + // endregion 用户基本信息 + + // region 用户机构信息 + /** + * 用户机构在数据库中的唯一标识符,为了兼容不同的情况,这里使用字符串类型 + */ + private String orgId; + /** + * 用户的机构编码 + */ + private String orgCode; + + /** + * 用户的机构名称 + */ + private String orgName; + + /** + * 用户的机构级别 + */ + private String orgLevel; + + /** + * 用户的机构类型 + */ + private String orgType; + // endregion 用户机构信息 + + public SimpleSsoUserInfo(Builder builder) { + this.userId = builder.userId; + this.username = builder.username; + this.fullName = builder.fullName; + this.nickName = builder.nickName; + this.type = builder.type; + this.lawType = builder.lawType; + this.jobTitle = builder.jobTitle; + this.profile = builder.profile; + this.picture = builder.picture; + this.email = builder.email; + this.phoneNumber = builder.phoneNumber; + this.gender = builder.gender; + this.birthdate = builder.birthdate; + this.address = builder.address; + this.idNumber = builder.idNumber; + this.workUnit = builder.workUnit; + this.orgId = builder.orgId; + this.orgCode = builder.orgCode; + this.orgName = builder.orgName; + this.orgLevel = builder.orgLevel; + this.orgType = builder.orgType; + } + + public static Builder withUserId(String userId) { + return new Builder(userId); + } + + + public static class Builder { + private final String userId; + private String username; + private String fullName; + private String nickName; + private String type; + private String lawType; + private String jobTitle; + private String profile; + private String picture; + private String email; + private String phoneNumber; + private String gender; + private String birthdate; + private String address; + private String idNumber; + private String workUnit; + private String orgId; + private String orgCode; + private String orgName; + private String orgLevel; + private String orgType; + private List roleNames; + + public Builder(String userId) { + this.userId = userId; + } + + public Builder username(String username) { + this.username = username; + return this; + } + + public Builder fullName(String fullName) { + this.fullName = fullName; + return this; + } + + public Builder nickName(String nickName) { + this.nickName = nickName; + return this; + } + + public Builder type(String type) { + this.type = type; + return this; + } + + public Builder lawType(String lawType) { + this.lawType = lawType; + return this; + } + + public Builder jobTitle(String jobTitle) { + this.jobTitle = jobTitle; + return this; + } + + public Builder profile(String profile) { + this.profile = profile; + return this; + } + + public Builder picture(String picture) { + this.picture = picture; + return this; + } + + public Builder email(String email) { + this.email = email; + return this; + } + + public Builder phoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder gender(String gender) { + this.gender = gender; + return this; + } + + public Builder birthdate(String birthdate) { + this.birthdate = birthdate; + return this; + } + + public Builder address(String address) { + this.address = address; + return this; + } + + public Builder idNumber(String idNumber) { + this.idNumber = idNumber; + return this; + } + + public Builder workUnit(String workUnit) { + this.workUnit = workUnit; + return this; + } + + public Builder orgId(String orgId) { + this.orgId = orgId; + return this; + } + + public Builder orgCode(String orgCode) { + this.orgCode = orgCode; + return this; + } + + public Builder orgName(String orgName) { + this.orgName = orgName; + return this; + } + + public Builder orgLevel(String orgLevel) { + this.orgLevel = orgLevel; + return this; + } + + public Builder orgType(String orgType) { + this.orgType = orgType; + return this; + } + + public Builder roleNames(List roleNames) { + this.roleNames = roleNames; + return this; + } + + + + public SimpleSsoUserInfo build() { + return new SimpleSsoUserInfo(this); + } + + public List getRoleNames() { + return roleNames; + } + } +} diff --git a/src/main/java/com/metalloop/common/auth/sso/model/SsoUserInfo.java b/src/main/java/com/metalloop/common/auth/sso/model/SsoUserInfo.java new file mode 100644 index 0000000..3e71341 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/sso/model/SsoUserInfo.java @@ -0,0 +1,203 @@ +package com.metalloop.common.auth.sso.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.io.Serializable; + +/** + * 单点登录用户信息接口,相较于UserInfo,该接口只包含用户的非敏感基本信息,不包含用户的角色和权限信息。 + * + * @author zhaowenhao + * @since 2024-02-28 + */ +public interface SsoUserInfo extends Serializable { + + // region 用户基本信息 + + /** + * 用户在数据库中的唯一标识符,为了兼容不同的情况,这里使用字符串类型。 + * + * @return 用户在数据库中的唯一标识符。 + */ + String getUserId(); + + /** + * 获取用户的Long类型唯一标识符,适配用户唯一标识符为 Long 类型的情况,减少转换代码。 + * + * @return 用户在数据库中的Long类型唯一标识符 + */ + @JsonIgnore + default Long getUserIdAsLong() { + if (getUserId() == null) { + return null; + } + try { + return Long.valueOf(getUserId()); + } catch (Exception e) { + return null; + } + } + + /** + * 返回用户登录名。 + * + * @return 返回用户登录名。 + */ + String getUsername(); + + /** + * 返回用户的全名。 + * + * @return 返回用户的全名 + */ + String getFullName(); + + /** + * 返回用户的昵称。 + * + * @return 返回用户的昵称 + */ + String getNickName(); + + /** + * 返回用户的类型。 + * + * @return 返回用户的类型 + */ + String getType(); + + /** + * 返回执法类型。 + * + * @return 返回执法类型 + */ + String getLawType(); + + /** + * 返回职位/职称 + * + * @return 返回职位/职称 + */ + String getJobTitle(); + + + /** + * 返回用户个人资料页面的URL。 + * + * @return 返回用户个人资料页面的URL。 + */ + String getProfile(); + + /** + * 返回用户个人资料图片的URL。 + * + * @return 用户个人资料图片的URL。 + */ + String getPicture(); + + /** + * 返回用户的首选电子邮件地址。 + * + * @return 户的首选电子邮件地址 + */ + String getEmail(); + + /** + * 返回用户的首选电话号码。 + * + * @return 首选电话号码 + */ + String getPhoneNumber(); + + /** + * 返回用户的性别。 + * + * @return 返回用户的性别 + */ + String getGender(); + + /** + * 返回用户的出生日期。 + * + * @return 用户的出生日期 + */ + String getBirthdate(); + + /** + * 返回用户的地址。 + * + * @return 返回用户的地址 + */ + String getAddress(); + + /** + * 返回用户的身份证号。 + * + * @return 返回用户的身份证号 + */ + String getIdNumber(); + + /** + * 返回用户的工作单位。 + * + * @return 返回用户的工作单位 + */ + String getWorkUnit(); + + // endregion 用户基本信息 + + // region 用户机构信息 + + /** + * 用户机构在数据库中的唯一标识符,为了兼容不同的情况,这里使用字符串类型。 + * + * @return 用户机构在数据库中的唯一标识符 + */ + String getOrgId(); + + /** + * 获取用户机构的Long类型唯一标识符,适配用户机构唯一标识符为 Long 类型的情况,减少转换代码。 + * + * @return 用户机构在数据库中的Long类型唯一标识符 + */ + @JsonIgnore + default Long getOrgIdAsLong() { + if (getOrgId() == null) { + return null; + } + try { + return Long.valueOf(getOrgId()); + } catch (Exception e) { + return null; + } + } + + /** + * 返回用户的机构编码。 + * + * @return 返回用户的机构编码 + */ + String getOrgCode(); + + /** + * 返回用户的机构名称。 + * + * @return 返回用户的机构名称。 + */ + String getOrgName(); + + /** + * 返回用户的机构级别。 + * + * @return 机构级别 + */ + String getOrgLevel(); + + /** + * 返回用户的机构类型。 + * + * @return 机构类型 + */ + String getOrgType(); + // endregion 用户机构信息 +} diff --git a/src/main/java/com/metalloop/common/auth/userdetails/SimpleUserDetails.java b/src/main/java/com/metalloop/common/auth/userdetails/SimpleUserDetails.java new file mode 100644 index 0000000..5b1e433 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/userdetails/SimpleUserDetails.java @@ -0,0 +1,45 @@ +package com.metalloop.common.auth.userdetails; + +import com.metalloop.common.auth.permission.SimplePermission; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; + +/** + * 简单的用户核心信息实现 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@Data +@NoArgsConstructor +public class SimpleUserDetails implements UserDetails { + + private String userId; + private String phoneNum; + private String username; + private String password; + private boolean accountNonExpired; + private boolean accountNonLocked; + private boolean credentialsNonExpired; + private boolean enabled; + private String lawType; + private Collection permissions; + + public SimpleUserDetails(String userId, String phoneNum,String username, String password, + Collection permissions, + boolean accountNonExpired, boolean accountNonLocked, + boolean credentialsNonExpired, boolean enabled, String lawType) { + this.userId = userId; + this.phoneNum = phoneNum; + this.username = username; + this.password = password; + this.permissions = permissions; + this.accountNonExpired = accountNonExpired; + this.accountNonLocked = accountNonLocked; + this.credentialsNonExpired = credentialsNonExpired; + this.enabled = enabled; + this.lawType = lawType; + } +} diff --git a/src/main/java/com/metalloop/common/auth/userdetails/UserDetails.java b/src/main/java/com/metalloop/common/auth/userdetails/UserDetails.java new file mode 100644 index 0000000..d1c3dc5 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/userdetails/UserDetails.java @@ -0,0 +1,106 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.auth.userdetails; + + +import com.metalloop.common.auth.permission.Permission; + +import java.io.Serializable; +import java.util.Collection; + +/** + * 提供核心用户信息,这些信息稍后会封装到Authentication对象中。这允许将与安 + * 全无关的用户信息(例如电子邮件地址、电话号码等)存储在方便的位置。 + * 具体的实现必须特别小心,以确保强制执行为每个方法详细说明的非空契约。 + * + * @author zhaowenhao + * @see UserDetailsService + * @see Permission + * @since 2023-03-19 + */ +public interface UserDetails extends Serializable { + + /** + * 返回授予用户的权限。无法返回null 。 + * + * @return 按自然键排序的权限集合。 + */ + Collection getPermissions(); + + /** + * 返回用于对用户进行身份验证的用户Id。无法返回null 。 + * + * @return 用户Id + */ + String getUserId(); + + /** + * 用户手机号 + * + * @return 用户手机号 + */ + String getPhoneNum(); + + /** + * 返回用于对用户进行身份验证的用户名。无法返回null 。 + * + * @return 用户名 + */ + String getUsername(); + + /** + * 返回用于验证用户身份的密码。 + * + * @return 密码 + */ + String getPassword(); + + /** + * 指示用户的帐户是否已过期。无法验证过期的帐户。 + * + * @return 如果用户的帐户有效(即未过期)则为true ,如果不再有效(即已过期) false + */ + boolean isAccountNonExpired(); + + /** + * 指示用户是锁定还是解锁。无法对锁定的用户进行身份验证。 + * + * @return 如果用户未被锁定, true ,否则为false + */ + boolean isAccountNonLocked(); + + /** + * 指示用户的凭据(密码)是否已过期。过期的凭据会阻止身份验证。 + * + * @return 如果用户的凭据有效(即未过期), true ;如果不再有效(即,已过期), false + */ + boolean isCredentialsNonExpired(); + + /** + * 指示用户是启用还是禁用。无法对禁用的用户进行身份验证。 + * + * @return 如果用户已启用, true ,否则为false + */ + boolean isEnabled(); + + /** + * 执法类型:0-调度员;1-指挥员;2-办件员 + * @return 用户执法类型 + */ + String getLawType(); + +} diff --git a/src/main/java/com/metalloop/common/auth/userdetails/UserDetailsService.java b/src/main/java/com/metalloop/common/auth/userdetails/UserDetailsService.java new file mode 100644 index 0000000..deb1131 --- /dev/null +++ b/src/main/java/com/metalloop/common/auth/userdetails/UserDetailsService.java @@ -0,0 +1,41 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.auth.userdetails; +//import com.wanji.software.tocc.common.exception.UsernameNotFoundException; + +//import com.wanji.software.tocc.common.exception.UsernameNotFoundException; + +import org.springframework.security.core.userdetails.UsernameNotFoundException; + +/** + * 加载用户特定数据的核心接口,它在整个框架中用作用户 DAO, + * 该接口只需要一种只读方法,这简化了对新数据访问策略的支持 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public interface UserDetailsService { + + /** + * 根据用户名获取用户详情 + * + * @param username 用户登录名 + * @return 用户详情 + * @throws UsernameNotFoundException 用户名不存在 + */ + UserDetails loadUserByUsername(String username) throws UsernameNotFoundException; +} diff --git a/src/main/java/com/metalloop/common/constant/CommonConstant.java b/src/main/java/com/metalloop/common/constant/CommonConstant.java new file mode 100644 index 0000000..c30e58c --- /dev/null +++ b/src/main/java/com/metalloop/common/constant/CommonConstant.java @@ -0,0 +1,134 @@ +package com.metalloop.common.constant; + +/** + * 全局公共常量 + * + * @author zlt + * @since 2018/10/29 + */ +public interface CommonConstant { + /** + * 项目版本号(banner使用) + */ + String PROJECT_VERSION = "1.0.0"; + + /** + * token请求头名称 + */ + String TOKEN_HEADER = "Authorization"; + + /** + * The access token issued by the authorization server. This value is REQUIRED. + */ + String ACCESS_TOKEN = "access_token"; + + String BEARER_TYPE = "Bearer"; + + /** + * 标签 header key + */ + String HEADER_LABEL = "x-label"; + + /** + * 标签 header 分隔符 + */ + String HEADER_LABEL_SPLIT = ","; + + /** + * 标签或 名称 + */ + String LABEL_OR = "labelOr"; + + /** + * 标签且 名称 + */ + String LABEL_AND = "labelAnd"; + + /** + * 权重key + */ + String WEIGHT_KEY = "weight"; + + /** + * 删除 + */ + String STATUS_DEL = "1"; + + /** + * 正常 + */ + String STATUS_NORMAL = "0"; + + /** + * 锁定 + */ + String STATUS_LOCK = "9"; + + /** + * 目录 + */ + Integer CATALOG = -1; + + /** + * 菜单 + */ + Integer MENU = 1; + + /** + * 权限 + */ + Integer PERMISSION = 2; + + /** + * 删除标记 + */ + String DEL_FLAG = "is_del"; + + /** + * 超级管理员用户名 + */ + String ADMIN_USER_NAME = "admin"; + + /** + * 公共日期格式 + */ + String MONTH_FORMAT = "yyyy-MM"; + String DATE_FORMAT = "yyyy-MM-dd"; + String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; + String SIMPLE_MONTH_FORMAT = "yyyyMM"; + String SIMPLE_DATE_FORMAT = "yyyyMMdd"; + String SIMPLE_DATETIME_FORMAT = "yyyyMMddHHmmss"; + String TIME_ZONE_GMT8 = "GMT+8"; + + String DEF_USER_PASSWORD = "123456"; + + String LOCK_KEY_PREFIX = "LOCK_KEY"; + + /** + * 租户id参数 + */ + String TENANT_ID_PARAM = "tenantId"; + + + /** + * 日志链路追踪id信息头 + */ + String TRACE_ID_HEADER = "x-traceId-header"; + /** + * 日志链路追踪id日志标志 + */ + String LOG_TRACE_ID = "traceId"; + /** + * 负载均衡策略-版本号 信息头 + */ + String Z_L_T_VERSION = "z-l-t-version"; + /** + * 注册中心元数据 版本号 + */ + String METADATA_VERSION = "version"; + + /** + * 文件分隔符 + */ + String PATH_SPLIT = "/"; +} diff --git a/src/main/java/com/metalloop/common/constant/SecurityConstants.java b/src/main/java/com/metalloop/common/constant/SecurityConstants.java new file mode 100644 index 0000000..37e50af --- /dev/null +++ b/src/main/java/com/metalloop/common/constant/SecurityConstants.java @@ -0,0 +1,21 @@ +package com.metalloop.common.constant; +/** + * Security 相关常量 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public interface SecurityConstants { + + + /** + * 用户ID请求头 + */ + String HEADER_USER_USERID = "x-userid"; + + /** + * 用户信息在session中的key + */ + String SESSION_KEY_AUTHENTICATION = "AUTHENTICATION_SESSION_KEY"; + +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/common/core/lock/DistributedLock.java b/src/main/java/com/metalloop/common/core/lock/DistributedLock.java new file mode 100644 index 0000000..27f8d2a --- /dev/null +++ b/src/main/java/com/metalloop/common/core/lock/DistributedLock.java @@ -0,0 +1,80 @@ +package com.metalloop.common.core.lock; + +import java.util.concurrent.TimeUnit; + +/** + * 分布式锁顶级接口 + * + * @author zlt + * @date 2018/5/29 14:12 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +public interface DistributedLock { + /** + * 获取锁,如果获取不成功则一直等待直到lock被获取 + * + * @param key 锁的key + * @param leaseTime 加锁的时间,超过这个时间后锁便自动解锁; + * 如果leaseTime为-1,则保持锁定直到显式解锁 + * @param unit {@code leaseTime} 参数的时间单位 + * @param isFair 是否公平锁 + * @return 锁对象 + */ + ZLock lock(String key, long leaseTime, TimeUnit unit, boolean isFair) throws Exception; + + default ZLock lock(String key, long leaseTime, TimeUnit unit) throws Exception { + return this.lock(key, leaseTime, unit, false); + } + + default ZLock lock(String key, boolean isFair) throws Exception { + return this.lock(key, -1, null, isFair); + } + + default ZLock lock(String key) throws Exception { + return this.lock(key, -1, null, false); + } + + /** + * 尝试获取锁,如果锁不可用则等待最多waitTime时间后放弃 + * + * @param key 锁的key + * @param waitTime 获取锁的最大尝试时间(单位 {@code unit}) + * @param leaseTime 加锁的时间,超过这个时间后锁便自动解锁; + * 如果leaseTime为-1,则保持锁定直到显式解锁 + * @param unit {@code waitTime} 和 {@code leaseTime} 参数的时间单位 + * @return 锁对象,如果获取锁失败则为null + */ + ZLock tryLock(String key, long waitTime, long leaseTime, TimeUnit unit, boolean isFair) throws Exception; + + default ZLock tryLock(String key, long waitTime, long leaseTime, TimeUnit unit) throws Exception { + return this.tryLock(key, waitTime, leaseTime, unit, false); + } + + default ZLock tryLock(String key, long waitTime, TimeUnit unit, boolean isFair) throws Exception { + return this.tryLock(key, waitTime, -1, unit, isFair); + } + + default ZLock tryLock(String key, long waitTime, TimeUnit unit) throws Exception { + return this.tryLock(key, waitTime, -1, unit, false); + } + + /** + * 释放锁 + * + * @param lock 锁对象 + */ + void unlock(Object lock) throws Exception; + + /** + * 释放锁 + * + * @param zLock 锁抽象对象 + */ + default void unlock(ZLock zLock) throws Exception { + if (zLock != null) { + this.unlock(zLock.getLock()); + } + } +} diff --git a/src/main/java/com/metalloop/common/core/lock/Lock.java b/src/main/java/com/metalloop/common/core/lock/Lock.java new file mode 100644 index 0000000..a4edfca --- /dev/null +++ b/src/main/java/com/metalloop/common/core/lock/Lock.java @@ -0,0 +1,43 @@ +package com.metalloop.common.core.lock; + +import java.lang.annotation.*; +import java.util.concurrent.TimeUnit; + +/** + * @author zlt + * @date 2020/6/6 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Lock { + /** + * 锁的key + */ + String key(); + + /** + * 获取锁的最大尝试时间(单位 {@code unit}) + * 该值大于0则使用 locker.tryLock 方法加锁,否则使用 locker.lock 方法 + */ + long waitTime() default 0; + + /** + * 加锁的时间(单位 {@code unit}),超过这个时间后锁便自动解锁; + * 如果leaseTime为-1,则保持锁定直到显式解锁 + */ + long leaseTime() default -1; + + /** + * 参数的时间单位 + */ + TimeUnit unit() default TimeUnit.SECONDS; + + /** + * 是否公平锁 + */ + boolean isFair() default false; +} diff --git a/src/main/java/com/metalloop/common/core/lock/LockAspect.java b/src/main/java/com/metalloop/common/core/lock/LockAspect.java new file mode 100644 index 0000000..ea4a592 --- /dev/null +++ b/src/main/java/com/metalloop/common/core/lock/LockAspect.java @@ -0,0 +1,98 @@ +package com.metalloop.common.core.lock; + +import cn.hutool.core.util.StrUtil; +import com.metalloop.common.exception.LockException; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.DefaultParameterNameDiscoverer; +import org.springframework.expression.EvaluationContext; +import org.springframework.expression.Expression; +import org.springframework.expression.spel.standard.SpelExpressionParser; +import org.springframework.expression.spel.support.StandardEvaluationContext; + +/** + * 分布式锁切面 + * + * @author zlt + * @date 2020/6/6 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +@Slf4j +@Aspect +public class LockAspect { + @Autowired(required = false) + private DistributedLock locker; + + /** + * 用于SpEL表达式解析. + */ + private SpelExpressionParser spelExpressionParser = new SpelExpressionParser(); + /** + * 用于获取方法参数定义名字. + */ + private DefaultParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer(); + + @Around("@within(lock) || @annotation(lock)") + public Object aroundLock(ProceedingJoinPoint point, Lock lock) throws Throwable { + if (lock == null) { + // 获取类上的注解 + lock = point.getTarget().getClass().getDeclaredAnnotation(Lock.class); + } + String lockKey = lock.key(); + if (locker == null) { + throw new LockException("DistributedLock is null"); + } + if (StrUtil.isEmpty(lockKey)) { + throw new LockException("lockKey is null"); + } + + if (lockKey.contains("#")) { + MethodSignature methodSignature = (MethodSignature) point.getSignature(); + // 获取方法参数值 + Object[] args = point.getArgs(); + lockKey = getValBySpEL(lockKey, methodSignature, args); + } + ZLock lockObj = null; + try { + // 加锁 + if (lock.waitTime() > 0) { + lockObj = locker.tryLock(lockKey, lock.waitTime(), lock.leaseTime(), lock.unit(), lock.isFair()); + } else { + lockObj = locker.lock(lockKey, lock.leaseTime(), lock.unit(), lock.isFair()); + } + + if (lockObj != null) { + return point.proceed(); + } else { + throw new LockException("锁等待超时"); + } + } finally { + locker.unlock(lockObj); + } + } + + /** + * 解析spEL表达式 + */ + private String getValBySpEL(String spEL, MethodSignature methodSignature, Object[] args) { + // 获取方法形参名数组 + String[] paramNames = nameDiscoverer.getParameterNames(methodSignature.getMethod()); + if (paramNames != null && paramNames.length > 0) { + Expression expression = spelExpressionParser.parseExpression(spEL); + // spring的表达式上下文对象 + EvaluationContext context = new StandardEvaluationContext(); + // 给上下文赋值 + for (int i = 0; i < args.length; i++) { + context.setVariable(paramNames[i], args[i]); + } + return expression.getValue(context).toString(); + } + return null; + } +} diff --git a/src/main/java/com/metalloop/common/core/lock/LockCondition.java b/src/main/java/com/metalloop/common/core/lock/LockCondition.java new file mode 100644 index 0000000..032c6da --- /dev/null +++ b/src/main/java/com/metalloop/common/core/lock/LockCondition.java @@ -0,0 +1,50 @@ +package com.metalloop.common.core.lock; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.Getter; + +/** + * LockCondition 是一个封装类,它包含了在实现幂等性操作时所需要的关键信息。 + *

+ * 这个类的主要组成部分包括: + *

+ * - 是否开启获取锁及检查(enabled):如果为 true,则执行获取锁及检查;如果为 false,则跳过获取锁及检查。 + *

+ * - 锁定键(lockKey):用于分布式锁的键,唯一标识了应该被锁定的资源。 + *

+ * - 查询包装器(queryWrapper):定义了用于检查数据是否已存在的查询条件。 + *

+ * - 消息(msg):如果已存在符合查询条件的数据,那么这个消息将被用于抛出 IdempotencyException 异常。 + *

+ * 使用 LockCondition 类可以让代码更加清晰和易于理解。它提供了一种方式,使得在实现多条件幂等性检查时,可以将关键信息组织在一起。 + * + * @author zhaowenhao + * @since 2023-05-14 + */ +@Getter +public class LockCondition { + + private final boolean enabled; + + private final String lockKey; + + private final QueryWrapper queryWrapper; + + private final String msg; + + + public LockCondition(boolean enabled, String lockKey, QueryWrapper queryWrapper, String msg) { + this.lockKey = lockKey; + this.queryWrapper = queryWrapper; + this.msg = msg; + this.enabled = enabled; + } + + public LockCondition(String lockKey, QueryWrapper queryWrapper, String msg) { + this.enabled = true; + this.lockKey = lockKey; + this.queryWrapper = queryWrapper; + this.msg = msg; + } + +} diff --git a/src/main/java/com/metalloop/common/core/lock/LockConditionReqDto.java b/src/main/java/com/metalloop/common/core/lock/LockConditionReqDto.java new file mode 100644 index 0000000..34cca60 --- /dev/null +++ b/src/main/java/com/metalloop/common/core/lock/LockConditionReqDto.java @@ -0,0 +1,56 @@ +package com.metalloop.common.core.lock; + +import com.metalloop.common.utils.QueryWrapperBuilder; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.function.Function; + +/** + * 幂等性请求 DTO + * + * @author zhaowenhao + * @since 2023-09-11 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class LockConditionReqDto implements Serializable { + /** + * 是否开启获取锁及检查(enabled):如果为 true,则执行获取锁及检查;如果为 false,则跳过获取锁及检查。 + */ + @Schema(description = "是否开启获取锁及检查") + private Boolean enabled; + + /** + * 锁定键(lockKey):用于分布式锁的键,唯一标识了应该被锁定的资源。 + */ + @Schema(description = "锁定键") + private String lockKey; + + /** + * 查询对象:定义了用于检查数据是否已存在的查询条件。 + */ + @Schema(description = "查询对象") + private Q query; + + /** + * 消息(msg):如果已存在符合查询条件的数据,那么这个消息将被用于抛出 IdempotencyException 异常 + */ + @Schema(description = "消息") + private String msg; + + /** + * 转为通用的 LockCondition 对象 + * + * @return LockCondition 对象 + */ + public LockCondition toLockCondition(Function queryMapper) { + return new LockCondition<>(enabled, lockKey, QueryWrapperBuilder.build(queryMapper.apply(query)), msg); + } +} diff --git a/src/main/java/com/metalloop/common/core/lock/ZLock.java b/src/main/java/com/metalloop/common/core/lock/ZLock.java new file mode 100644 index 0000000..3ecc222 --- /dev/null +++ b/src/main/java/com/metalloop/common/core/lock/ZLock.java @@ -0,0 +1,26 @@ +package com.metalloop.common.core.lock; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 锁对象抽象 + * + * @author zlt + * @date 2020/7/28 + *

+ * Blog: https://zlt2000.gitee.io + * Github: https://github.com/zlt2000 + */ +@AllArgsConstructor +public class ZLock implements AutoCloseable { + @Getter + private final Object lock; + + private final DistributedLock locker; + + @Override + public void close() throws Exception { + locker.unlock(lock); + } +} diff --git a/src/main/java/com/metalloop/common/enums/Direction.java b/src/main/java/com/metalloop/common/enums/Direction.java new file mode 100644 index 0000000..4805383 --- /dev/null +++ b/src/main/java/com/metalloop/common/enums/Direction.java @@ -0,0 +1,52 @@ +package com.metalloop.common.enums; + + +import java.util.Locale; + +/** + * 排序方式枚举 ASC-升序 DESC-降序 + * + * @author yy + */ +public enum Direction { + + /** + * 升序 + */ + ASC, + + /** + * 降序 + */ + DESC; + + /** + * 是否升序 + */ + public boolean isAscending() { + return this.equals(ASC); + } + + /** + * 是否降序 + */ + public boolean isDescending() { + return this.equals(DESC); + } + + /** + * 通过字符串获取排序枚举 + * + * @param value 字符串 + * @throws IllegalArgumentException 无法解析错误. + */ + public static Direction fromString(String value) { + + try { + return Direction.valueOf(value.toUpperCase(Locale.US)); + } catch (Exception e) { + throw new IllegalArgumentException(String.format( + "无效值 '%s'! 必须为 'desc' 或者 'asc' (大小写不敏感).", value), e); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/common/enums/LoginType.java b/src/main/java/com/metalloop/common/enums/LoginType.java new file mode 100644 index 0000000..30910a0 --- /dev/null +++ b/src/main/java/com/metalloop/common/enums/LoginType.java @@ -0,0 +1,74 @@ +package com.metalloop.common.enums; + +import cn.dev33.satoken.stp.StpLogic; +import cn.dev33.satoken.stp.StpUtil; +import lombok.Getter; + +import java.util.Arrays; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * 自定义账号类型,多账号体系时以此值区分,sa-token框架默认的账号类型值为login,可以根据需求自定义,但是必须 + * 在本类同包的下面增加对应的新的权限认证类,比如: StpXxxUtil.java。 + * 将cn.dev33.satoken.stp.StpUtil.java类的全部代码复制粘贴到 StpXxxUtil.java里。 + * 更改一下其 stpLogic,从此枚举类中获取。 + *

+ * 自定义的账号类型要记录到下面: + *

+ * admin: 管理员系统使用的账号类型 + *

+ * app: App 使用的账号类型,和login的区别是会话超时时间,app的会话超时时间长一些 + *

+ * self: 自助服务终端使用的账号类型,和login的区别是会话超时时间 + */ +@Getter +public enum LoginType { + + /** + * login + */ + DEFAULT(StpUtil.getLoginType(), StpUtil.getStpLogic()), + + /** + * admin + */ + ADMIN("admin", new StpLogic("admin")), + + /** + * self + */ + SELF("self", new StpLogic("self")), + + /** + * wechat + */ + WECHAT("wechat", new StpLogic("wechat")); + + private final String type; + private final StpLogic stpLogic; + + private static final Map TYPE_TO_ENUM = Arrays.stream(LoginType.values()) + .collect(Collectors.toMap(LoginType::getType, Function.identity())); + + private static final Map STPLOGIC_TO_ENUM = Arrays.stream(LoginType.values()) + .collect(Collectors.toMap(LoginType::getStpLogic, Function.identity())); + + LoginType(String type, StpLogic stpLogic) { + this.type = type; + this.stpLogic = stpLogic; + } + + public static LoginType of(String type) { + return Optional.ofNullable(TYPE_TO_ENUM.get(type)) + .orElseThrow(() -> new IllegalArgumentException("账号类型错误")); + } + + public static LoginType of(StpLogic stpLogic) { + return Optional.ofNullable(STPLOGIC_TO_ENUM.get(stpLogic)) + .orElseThrow(() -> new IllegalArgumentException("账号类型错误")); + } +} + diff --git a/src/main/java/com/metalloop/common/exception/AccountExpiredException.java b/src/main/java/com/metalloop/common/exception/AccountExpiredException.java new file mode 100644 index 0000000..74bd26e --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/AccountExpiredException.java @@ -0,0 +1,46 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.exception; + +/** + * 如果身份验证请求因为账号已过期而被拒绝,则抛出该异常。 + * + * @author zhaowenhao + * @since 2023-03-20 + */ +public class AccountExpiredException extends AccountStatusException { + + /** + * 构造带有指定消息的AccountExpiredException。 + * + * @param msg 详细信息 + */ + public AccountExpiredException(String msg) { + super(msg); + } + + /** + * 构造具有指定消息和根本原因的AccountExpiredException。 + * + * @param msg 详细信息 + * @param cause 根本原因 + */ + public AccountExpiredException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/src/main/java/com/metalloop/common/exception/AccountStatusException.java b/src/main/java/com/metalloop/common/exception/AccountStatusException.java new file mode 100644 index 0000000..d9fe27c --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/AccountStatusException.java @@ -0,0 +1,35 @@ +/* + * Copyright 2002-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.exception; + +/** + * 由特定账户状态(锁定、禁用等)引起的身份验证异常的基类。 + * + * @author zhaowenhao + * @since 2023-03-20 + */ +public abstract class AccountStatusException extends AuthenticationException { + + public AccountStatusException(String msg) { + super(msg); + } + + public AccountStatusException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/src/main/java/com/metalloop/common/exception/AuthenticationException.java b/src/main/java/com/metalloop/common/exception/AuthenticationException.java new file mode 100644 index 0000000..0ea4fc3 --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/AuthenticationException.java @@ -0,0 +1,30 @@ +package com.metalloop.common.exception; + +/** + * 任何原因无效的身份验证对象相关异常的抽象超类 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public abstract class AuthenticationException extends RuntimeException { + + /** + * 构造具有指定消息和根本原因的AuthenticationException 。 + * + * @param msg 详细信息 + * @param cause 根本原因 + */ + public AuthenticationException(String msg, Throwable cause) { + super(msg, cause); + } + + /** + * 构造具有指定消息且无根本原因的AuthenticationException 。 + * + * @param msg 详细信息 + */ + public AuthenticationException(String msg) { + super(msg); + } + +} diff --git a/src/main/java/com/metalloop/common/exception/BadCredentialsException.java b/src/main/java/com/metalloop/common/exception/BadCredentialsException.java new file mode 100644 index 0000000..db1ce4e --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/BadCredentialsException.java @@ -0,0 +1,45 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.exception; + +/** + * 如果身份验证请求因凭据无效而被拒绝,则抛出该异常。抛出这个异常,说明账号既没有被锁定也没有被禁用. + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public class BadCredentialsException extends AuthenticationException { + + /** + * 构造带有指定消息的BadCredentialsException 。 + * + * @param msg 详细信息 + */ + public BadCredentialsException(String msg) { + super(msg); + } + + /** + * 构造具有指定消息和根本原因的BadCredentialsException 。 + * + * @param msg 详细信息 + * @param cause 根本原因 + */ + public BadCredentialsException(String msg, Throwable cause) { + super(msg, cause); + } +} diff --git a/src/main/java/com/metalloop/common/exception/BusinessException.java b/src/main/java/com/metalloop/common/exception/BusinessException.java new file mode 100644 index 0000000..2893108 --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/BusinessException.java @@ -0,0 +1,74 @@ +package com.metalloop.common.exception; + + +import com.metalloop.common.exception.code.CodeMsg; +import com.metalloop.common.exception.code.ResponseCode; + +/** + * 业务异常 + * + * @author zhaowenhao + * @since 2022-12-27 + */ +public class BusinessException extends RuntimeException { + private static final long serialVersionUID = 6610083281801529147L; + + /** + * 错误码 + */ + private final Integer code; + + + public BusinessException(int code, String message) { + super(message); + this.code = code; + } + + public BusinessException(String message) { + this(ResponseCode.FAIL.getCode(), message); + } + + public BusinessException(CodeMsg codeMsg) { + this(codeMsg.getCode(), codeMsg.getMsg()); + } + + /** + * 获取错误码 + * + * @return 错误码 + */ + public Integer getCode() { + return code; + } + + /** + * 根据错误码和错误消息构建业务异常 + * + * @param code 错误码 + * @param message 错误消息 + * @return 业务异常 + */ + public static BusinessException with(int code, String message) { + return new BusinessException(code, message); + } + + /** + * 根据错误消息构建业务异常 + * + * @param message 错误消息 + * @return 业务异常 + */ + public static BusinessException message(String message) { + return new BusinessException(message); + } + + /** + * 根据错误码与错误消息顶级接口的实现类构建业务异常 + * + * @param codeMsg 错误码与错误消息顶级接口的实现类 + * @return 业务异常 + */ + public static BusinessException with(CodeMsg codeMsg) { + return new BusinessException(codeMsg); + } +} diff --git a/src/main/java/com/metalloop/common/exception/CredentialsExpiredException.java b/src/main/java/com/metalloop/common/exception/CredentialsExpiredException.java new file mode 100644 index 0000000..fcb22a6 --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/CredentialsExpiredException.java @@ -0,0 +1,46 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.exception; + +/** + * 如果身份验证请求因账户凭据已过期而被拒绝,则抛出该异常。 + * + * @author zhaowenhao + * @since 2023-03-20 + */ +public class CredentialsExpiredException extends AccountStatusException { + + /** + * 构造带有指定消息的CredentialsExpiredException 。 + * + * @param msg 详细消息 + */ + public CredentialsExpiredException(String msg) { + super(msg); + } + + /** + * 构造具有指定消息和根本原因的CredentialsExpiredException + * + * @param msg 详细消息 + * @param cause 根本原因 + */ + public CredentialsExpiredException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/src/main/java/com/metalloop/common/exception/DefaultExceptionAdvice.java b/src/main/java/com/metalloop/common/exception/DefaultExceptionAdvice.java new file mode 100644 index 0000000..82bcbea --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/DefaultExceptionAdvice.java @@ -0,0 +1,327 @@ +package com.metalloop.common.exception; + +import cn.dev33.satoken.exception.*; +import cn.hutool.core.exceptions.ExceptionUtil; +import cn.hutool.core.map.MapUtil; +import com.metalloop.common.exception.code.ResponseCode; +import com.metalloop.common.exception.model.ApiErrorLog; +import com.metalloop.common.model.Result; +import com.metalloop.common.utils.json.JsonUtils; +import jakarta.servlet.http.HttpServletRequest; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.MDC; +import org.springframework.util.Assert; +import org.springframework.validation.BindException; +import org.springframework.validation.FieldError; +import org.springframework.web.HttpMediaTypeNotSupportedException; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.nio.file.AccessDeniedException; +import java.sql.SQLException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 异常通用处理 + * + * @author zhaowenhao + * @since 2023-03-25 + */ +@ResponseBody +@Slf4j +public abstract class DefaultExceptionAdvice { + + /** + * 自定义消息包装正则表达式,用于提取自定义消息,特别是错误消息由框架接管,拼接了不友好的信息情况下的消息还原,比如参数校验异常 + */ + public static final Pattern CUSTOM_MESSAGE_PATTERN = Pattern.compile("\\{CustomMessage\\{([^}]+)}}"); + + /** + * IllegalArgumentException异常处理返回json + */ + @ExceptionHandler({IllegalArgumentException.class}) + public Result badRequestException(IllegalArgumentException e) { + return doHandle("参数解析失败", e); + } + + /** + * AccessDeniedException异常处理返回json + */ + @ExceptionHandler({AccessDeniedException.class}) + public Result badMethodExpressException(AccessDeniedException e) { + return doHandle("没有权限请求当前方法", e); + } + + /** + * + */ + @ExceptionHandler({HttpRequestMethodNotSupportedException.class}) + public Result handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) { + return doHandle("不支持当前请求方法", e); + } + + /** + * + */ + @ExceptionHandler({HttpMediaTypeNotSupportedException.class}) + public Result handleHttpMediaTypeNotSupportedException(HttpMediaTypeNotSupportedException e) { + return doHandle("不支持当前媒体类型", e); + } + + /** + * SQLException sql异常处理 + */ + @ExceptionHandler({SQLException.class}) + public Result handleSqlException(SQLException e) { + return doHandle("服务异常", e, true); + } + + /** + * BusinessException 业务异常处理 + */ + @ExceptionHandler(BusinessException.class) + public Result handleException(BusinessException e) { + log.error("业务异常", e); + return Result.fail(e.getCode(), e.getMessage()); + } + + /** + * ValidationFailedException 参数校验异常 + */ + @ExceptionHandler(ValidationFailedException.class) + public Result handleValidationFailedException(ValidationFailedException e) { + log.error("参数校验异常", e); + return Result.fail(e.getMessage()); + } + + /** + * IdempotencyException 幂等性异常 + */ + @ExceptionHandler(IdempotencyException.class) + public Result handleException(IdempotencyException e) { + log.error("幂等性异常", e); + return doHandle(e.getMessage(), e); + } + + /** + * 参数校验异常 + * + * @param e MethodArgumentNotValidException + * @return Result + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public Result handlerException(MethodArgumentNotValidException e) { + log.error("参数校验异常", e); + List fieldErrors = e.getBindingResult().getFieldErrors(); + String fieldErrorMsg = getFieldErrorMsg(fieldErrors); + return doHandle(fieldErrorMsg, e); + } + + /** + * 参数校验异常 + * + * @param e BindException + * @return Result + */ + @ExceptionHandler(BindException.class) + public Result handlerException(BindException e) { + log.error("参数校验异常", e); + List fieldErrors = e.getBindingResult().getFieldErrors(); + String fieldErrorMsg = getFieldErrorMsg(fieldErrors); + return doHandle(fieldErrorMsg, e); + } + + /** + * 认证异常 + * + * @param e AuthenticationException + * @return Result + */ + @ExceptionHandler(AuthenticationException.class) + public Result handlerException(AuthenticationException e) { + log.error("认证异常", e); + return doHandle(e.getMessage(), e); + } + + // region sa-token 异常处理 + + @ExceptionHandler(value = {NotLoginException.class}) + public Result handle(NotLoginException e) { + log.error("NotLoginException:{}", e.getMessage()); + return Result.fail(ResponseCode.NO_SESSION); + } + + @ExceptionHandler(value = {NotPermissionException.class}) + public Result handle(NotPermissionException e) { + log.error("NotPermissionException:{}", e.getMessage()); + return Result.fail(ResponseCode.ACCESS_UNAUTHORIZED); + } + + @ExceptionHandler(value = {NotRoleException.class}) + public Result handle(NotRoleException e) { + log.error("NotRoleException:{}", e.getMessage()); + return Result.fail(ResponseCode.ACCESS_UNAUTHORIZED); + } + + @ExceptionHandler(value = {NotSafeException.class}) + public Result handle(NotSafeException e) { + log.error("NotSafeException:{}", e.getMessage()); + return Result.fail(ResponseCode.ACCESS_UNAUTHORIZED); + } + + @ExceptionHandler(value = {SameTokenInvalidException.class}) + public Result handle(SameTokenInvalidException e) { + log.error("SameTokenInvalidException:{}", e.getMessage()); + return Result.fail(ResponseCode.TOKEN_INVALID); + } + + /** + * 处理Sa-Token的异常 + * + * @param e Sa-Token异常 + * @return Result + */ + @ExceptionHandler(value = {SaTokenException.class}) + public Result handle(SaTokenException e) { + log.error("认证异常", e); + return doHandle(e.getMessage(), e); + } + // endregion sa-token 异常处理 + + /** + * 所有未知异常统一处理 + */ + @ExceptionHandler(Exception.class) + public Result handleException(HttpServletRequest req, Exception ex) { + log.error("[defaultExceptionHandler]", ex); + // 插入异常日志 + this.createExceptionLog(req, ex); + // 返回 ERROR Result + return doHandle("系统繁忙", ex, true); + } + + /** + * 处理异常,默认不打印异常堆栈,并返回前端异常信息 + * + * @param msg 返给前端的异常信息 + * @param e 异常 + * @return 返回前端的响应体 + */ + private Result doHandle(String msg, Exception e) { + return doHandle(msg, e, false); + } + + /** + * 处理异常,并返回前端异常信息 + * + * @param msg 返给前端的异常信息 + * @param e 异常 + * @param ifPrintStackTrace 是否打印异常堆栈,系统级或未知异常建议打印 + * @return 返回前端的响应体 + */ + private Result doHandle(String msg, Exception e, boolean ifPrintStackTrace) { + if (ifPrintStackTrace) { + e.printStackTrace(); + } + log.error(msg, e); + return Result.fail(msg); + } + + /** + * 获取参数校验错误信息 + * + * @param fieldErrors fieldErrors + * @return 参数校验错误信息 + */ + private String getFieldErrorMsg(List fieldErrors) { + StringBuilder errorMsg = new StringBuilder("参数校验失败:"); + fieldErrors.forEach(fieldError -> { + String defaultMessage = fieldError.getDefaultMessage(); + String message = extractCustomMessageIfNecessary(defaultMessage); + errorMsg.append(fieldError.getField()).append("-").append(message).append(";"); + }); + return errorMsg.toString(); + } + + private void createExceptionLog(HttpServletRequest req, Throwable e) { + // 插入错误日志 + ApiErrorLog errorLog = new ApiErrorLog(); + try { + // 初始化 errorLog + initExceptionLog(errorLog, req, e); + // 执行插入 errorLog + appendErrorLog(errorLog); + } catch (Throwable th) { + log.error("[createExceptionLog][url({}) log({}) 发生异常]", req.getRequestURI(), JsonUtils.toJsonString(errorLog), th); + } + } + + /** + * 提取自定义消息如果有的话 + * + * @param message 原始消息,可能包含 {CustomMessage{...}} + * @return 提取后的自定义消息 + */ + private String extractCustomMessageIfNecessary(String message) { + Matcher matcher = CUSTOM_MESSAGE_PATTERN.matcher(message); + StringBuilder customMessages = new StringBuilder(); + boolean found = false; + + while (matcher.find()) { + customMessages.append(matcher.group(1)).append(";"); + found = true; + } + + if (found) { + // 移除最后的分号 + if (customMessages.length() > 0 && customMessages.charAt(customMessages.length() - 1) == ';') { + customMessages.setLength(customMessages.length() - 1); + } + return customMessages.toString(); + } + + // 如果没有匹配到自定义消息,返回原始消息 + return message; + } + + /** + * 插入错误日志, 子类实现 + * + * @param errorLog 错误日志 + */ + protected void appendErrorLog(ApiErrorLog errorLog) { + // 插入错误日志,默认不做任何事情 + } + + private void initExceptionLog(ApiErrorLog errorLog, HttpServletRequest request, Throwable e) { + // 设置异常字段 + errorLog.setExceptionName(e.getClass().getName()); + errorLog.setExceptionMessage(ExceptionUtil.getMessage(e)); + errorLog.setExceptionRootCauseMessage(ExceptionUtil.getRootCauseMessage(e)); + errorLog.setExceptionStackTrace(ExceptionUtil.stacktraceToString(e)); + StackTraceElement[] stackTraceElements = e.getStackTrace(); + Assert.notEmpty(stackTraceElements, "异常 stackTraceElements 不能为空"); + StackTraceElement stackTraceElement = stackTraceElements[0]; + errorLog.setExceptionClassName(stackTraceElement.getClassName()); + errorLog.setExceptionFileName(stackTraceElement.getFileName()); + errorLog.setExceptionMethodName(stackTraceElement.getMethodName()); + errorLog.setExceptionLineNumber(stackTraceElement.getLineNumber()); + // 设置其它字段 + errorLog.setTraceId(MDC.get("traceId")); + errorLog.setRequestUrl(request.getRequestURI()); +// Map requestParams = MapUtil.builder() +// .put("query", ServletUtil.getParamMap(request)) +// .put("body", ServletUtil.getBody(request)).build(); +// errorLog.setRequestParams(JsonUtils.toJsonString(requestParams)); +// errorLog.setRequestMethod(request.getMethod()); +// errorLog.setUserAgent(ServletUtils.getUserAgent(request)); +// errorLog.setUserIp(ServletUtil.getClientIP(request)); +// errorLog.setExceptionTime(LocalDateTime.now()); + } +} diff --git a/src/main/java/com/metalloop/common/exception/DisabledException.java b/src/main/java/com/metalloop/common/exception/DisabledException.java new file mode 100644 index 0000000..cbe419e --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/DisabledException.java @@ -0,0 +1,46 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.exception; + +/** + * 如果身份验证请求因账户被禁用而被拒绝,则抛出该异常。 + * + * @author zhaowenhao + * @since 2023-03-20 + */ +public class DisabledException extends AccountStatusException { + + /** + * 构造带有指定消息的DisabledException 。 + * + * @param msg 详细消息 + */ + public DisabledException(String msg) { + super(msg); + } + + /** + * 构造具有指定消息和根本原因的DisabledException 。 + * + * @param msg 详细消息 + * @param cause 根本原因 + */ + public DisabledException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/src/main/java/com/metalloop/common/exception/IdempotencyException.java b/src/main/java/com/metalloop/common/exception/IdempotencyException.java new file mode 100644 index 0000000..d02ed6a --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/IdempotencyException.java @@ -0,0 +1,14 @@ +package com.metalloop.common.exception; + +/** + * 幂等性异常 + * + * @author zlt + */ +public class IdempotencyException extends RuntimeException { + private static final long serialVersionUID = 6610083281801529147L; + + public IdempotencyException(String message) { + super(message); + } +} diff --git a/src/main/java/com/metalloop/common/exception/LockException.java b/src/main/java/com/metalloop/common/exception/LockException.java new file mode 100644 index 0000000..ba1cfce --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/LockException.java @@ -0,0 +1,14 @@ +package com.metalloop.common.exception; + +/** + * 分布式锁异常 + * + * @author zlt + */ +public class LockException extends RuntimeException { + private static final long serialVersionUID = 6610083281801529147L; + + public LockException(String message) { + super(message); + } +} diff --git a/src/main/java/com/metalloop/common/exception/LockedException.java b/src/main/java/com/metalloop/common/exception/LockedException.java new file mode 100644 index 0000000..ed1ad2e --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/LockedException.java @@ -0,0 +1,46 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.exception; + +/** + * 如果身份验证请求因账户被锁定而被拒绝,则抛出该异常。 + * + * @author zhaowenhao + * @since 2023-03-20 + */ +public class LockedException extends AccountStatusException { + + /** + * 构造一个带有指定消息的LockedException 。 + * + * @param msg 详细信息 + */ + public LockedException(String msg) { + super(msg); + } + + /** + * 构造具有指定消息和根本原因的LockedException 。 + * + * @param msg 详细信息 + * @param cause 根本原因 + */ + public LockedException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/src/main/java/com/metalloop/common/exception/UsernameNotFoundException.java b/src/main/java/com/metalloop/common/exception/UsernameNotFoundException.java new file mode 100644 index 0000000..461b7e2 --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/UsernameNotFoundException.java @@ -0,0 +1,47 @@ +/* + * Copyright 2004, 2005, 2006 Acegi Technology Pty Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.metalloop.common.exception; + +/** + * 如果UserDetailsService实现无法通过用户名找到用户,则抛出该异常。 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public class UsernameNotFoundException extends AuthenticationException { + + /** + * 构造带有指定消息的UsernameNotFoundException 。 + * + * @param msg 详细信息。 + */ + public UsernameNotFoundException(String msg) { + super(msg); + } + + /** + * 构造具有指定消息和根本原因的UsernameNotFoundException 。 + * 形参: + * + * @param msg 详细信息 + * @param cause 根本原因 + */ + public UsernameNotFoundException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/src/main/java/com/metalloop/common/exception/ValidationFailedException.java b/src/main/java/com/metalloop/common/exception/ValidationFailedException.java new file mode 100644 index 0000000..53fc316 --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/ValidationFailedException.java @@ -0,0 +1,34 @@ +package com.metalloop.common.exception; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * 参数校验失败异常 + * + * @author zhaowenhao + * @version 2023-05-04 + */ +public class ValidationFailedException extends RuntimeException { + private final Map> linkedEntities; + + public ValidationFailedException(String message) { + super(message); + this.linkedEntities = Collections.emptyMap(); + } + + public ValidationFailedException(String message, Map> linkedEntities) { + super(message); + this.linkedEntities = linkedEntities; + } + + public ValidationFailedException(String message, Throwable cause) { + super(message, cause); + this.linkedEntities = Collections.emptyMap(); + } + + public Map> getLinkedEntities() { + return linkedEntities; + } +} diff --git a/src/main/java/com/metalloop/common/exception/code/CodeMsg.java b/src/main/java/com/metalloop/common/exception/code/CodeMsg.java new file mode 100644 index 0000000..2817795 --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/code/CodeMsg.java @@ -0,0 +1,23 @@ +package com.metalloop.common.exception.code; + +/** + * 错误码与错误消息的顶级接口 + * + * @author zhaowenhao + * @since 2022-12-27 + */ +public interface CodeMsg { + /** + * 获取错误码 + * + * @return 获取错误码 + */ + Integer getCode(); + + /** + * 获取错误消息 + * + * @return 获取错误消息 + */ + String getMsg(); +} diff --git a/src/main/java/com/metalloop/common/exception/code/ResponseCode.java b/src/main/java/com/metalloop/common/exception/code/ResponseCode.java new file mode 100644 index 0000000..0be3fb2 --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/code/ResponseCode.java @@ -0,0 +1,124 @@ +package com.metalloop.common.exception.code; + +/** + * 通用错误码 + * + * @author Lei + * @since 2022/10/26 20:12 + */ +@SuppressWarnings("AlibabaEnumConstantsMustHaveComment") +public enum ResponseCode implements CodeMsg { + + SUCCESS(0, "操作成功"), + FAIL(1, "操作失败"), + + SYSTEM_BUSY(500001, "系统繁忙,请稍候再试"), + OPERATION_ERROR(500002, "操作失败"), + FIELD_BINDING_ERROR(400001, "请求字段参数校验失败"), + FIELD_FORMAT_ERROR(400002, "请求参数格式错误"), + FIELD_MISSING_ERROR(400003, "请求参数不完整或不对"), + REQUEST_BODY_MISSING(400004, "需要请求体"), + + ACCOUNT_CLIENT_ERROR(400000, "用户端错误"), + + ACCOUNT_REGISTER_ERROR(400100, "用户注册异常"), + ACCOUNT_EXISTS(400101, "用户名已存在"), + ACCOUNT_ERROR(400102, "用户名校验错误"), + ACCOUNT_CONTAINS_SENSITIVE(400103, "用户名包含敏感词 "), + ACCOUNT_CONTAINS_SPECIAL(400104, "用户名包含特殊字符"), + PASSWORD_ERROR(400105, "密码校验错误"), + PASSWORD_TOO_SHORT(400106, "密码长度不够"), + PASSWORD_TOO_WEAK(400107, "密码强度不够"), + VCODE_ERROR(400108, "校验码错误"), + SMS_VCODE_ERROR(400109, "短信校验码错误"), + EMAIL_VCODE_ERROR(400110, "邮件校验码错误"), + ID_NUMBER_FORMAT_ERROR(400111, "身份证号格式错误"), + PHONE_NUMBER_FORMAT_ERROR(400112, "手机号格式错误"), + ADDRESS_ERROR(400113, "地址错误"), + EMAIL_FORMAT_ERROR(400114, "邮箱格式错误"), + + ACCOUNT_LOGIN_EXCEPTION(400200, "用户登录异常"), + NOT_ACCOUNT(400201, "用户名不存在"), + ACCOUNT_IS_LOCKED(400202, "用户被锁定,请联系管理人员"), + ACCOUNT_HAS_EXPIRED(400203, "用户已作废"), + USERNAME_OR_PASSWORD_WRONG(400204, "用户名或密码错误"), + WRONG_PASSWORD(400205, "密码错误"), + WRONG_PASSWORDS_OVER_LIMIT(400206, "用户输入密码错误次数超限"), + ACCOUNT_LOGIN_EXPIRED(400207, "用户登录已过期"), + ACCOUNT_VCODE_ERROR(400208, "用户验证码错误"), + WRONG_VCODE_OVER_LIMIT(400209, "用户验证码错误次数超限"), + NO_AUTHORIZED(400210, "用户未获得第三方登录授权 "), + NO_SESSION(400211, "登录信息失效"), + CREDENTIALS_EXPIRED(400212, "登录凭证已过期,请重新登录"), + CREDENTIALS_EXCEPTION(400213, "登录凭证异常,请重新登录"), + ID_NUMBER_ERROR(400214, "身份证号错误"), + PHONE_NUMBER_ERROR(400215, "手机号错误"), + EMAIL_ERROR(400216, "邮箱错误"), + + ACCOUNT_ACCESS_EXCEPTION(400300, "用户访问权限异常"), + ACCESS_UNAUTHORIZED(400301, "访问未授权"), + NOT_TOKEN(400302, "未提供token"), + TOKEN_INVALID(400303, "token无效"), + TOKEN_TIMEOUT(400304, "token已过期"), + TOKEN_BE_REPLACED(400305, "token已被顶下线"), + TOKEN_KICK_OUT(400306, "token已被踢下线"), + TOKEN_OTHER(400307, "token异常"), + + PARAMETER_ERROR(400400, "用户请求参数错误"), + NOT_PARAMETER(400401, "请求必填参数为空"), + PARAMETER_VERIFICATION_ERROR(400402, "请求参数指定校验失败"), + PARAMETER_FORMAT_ERROR(400403, "请求参数格式错误"), + INCOMPLETE_PARAMETERS(400404, "请求参数不完整"), + NOT_REQUEST_BODY(400405, "无请求体"), + NOT_ID(400406, "id为空"), + NOT_ORGCODE(400407, "机构编码为空"), + NOT_SITECODE(400408, "站点编码为空"), + + PERMISSION_MANAGEMENT_EXCEPTION(400500, "权限管理异常"), + NOT_ORG(400501, "机构不存在"), + ORG_HAS_SUBORG(400502, "该机构存在下级机构,无法删除"), + ORGNAME_EXISTS(400503, "机构名已存在"), + ORG_LINKED_USER(400504, "机构关联用户,无法删除"), + ROLENAME_EXISTS(400505, "角色名已存在"), + ROLE_LINKED_USER(400506, "角色关联用户,无法删除"), + NOT_ROLE(400507, "角色为空"), + NOT_PERMISSION(400508, "权限为空"), + + REQUEST_SERVICE_EXCEPTION(400600, "用户请求服务异常"), + REQUEST_COUNT_OVER_LIMIT(400601, "请求次数超出限制 "), + REQUEST_CONCURRENCY_COUNT_OVER_LIMIT(400602, "请求并发数超出限制 "), + WEBSOCKET_CONNECTION_EXCEPTION(400603, "WebSocket 连接异常"), + WEBSOCKET_CONNECTION_DISCONNECTED(400604, "WebSocket 连接断开"), + USER_REPEATED_REQUEST(400605, "用户重复请求"), + + GATEWAY_ERROR(400700, "网关异常"), + GATEWAY_NOT_FOUND_SERVICE(400701, "服务未找到"), + GATEWAY_CONNECT_TIME_OUT(400702, "网关超时"), + UPLOAD_FILE_SIZE_LIMIT(400703, "上传文件大小超过限制"), + DUPLICATE_PRIMARY_KEY(400704, "唯一键冲突"); + + /** + * 错误码 + */ + private final Integer code; + + /** + * 错误消息 + */ + private final String msg; + + ResponseCode(int code, String msg) { + this.code = code; + this.msg = msg; + } + + @Override + public Integer getCode() { + return code; + } + + @Override + public String getMsg() { + return msg; + } +} diff --git a/src/main/java/com/metalloop/common/exception/model/ApiErrorLog.java b/src/main/java/com/metalloop/common/exception/model/ApiErrorLog.java new file mode 100644 index 0000000..fd2feac --- /dev/null +++ b/src/main/java/com/metalloop/common/exception/model/ApiErrorLog.java @@ -0,0 +1,107 @@ +package com.metalloop.common.exception.model; + +import lombok.Data; +// +//import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * API 错误日志 + * + * @author zhaowenhao + */ +@Data +public class ApiErrorLog { + + /** + * 链路编号 + */ + private String traceId; + /** + * 账号编号 + */ + private Long userId; + /** + * 用户类型 + */ + private Integer userType; + /** + * 应用名 + */ +// @NotNull(message = "应用名不能为空") + private String applicationName; + + /** + * 请求方法名 + */ +// @NotNull(message = "http 请求方法不能为空") + private String requestMethod; + /** + * 访问地址 + */ +// @NotNull(message = "访问地址不能为空") + private String requestUrl; + /** + * 请求参数 + */ + // @NotNull(message = "请求参数不能为空") + private String requestParams; + /** + * 用户 IP + */ + // @NotNull(message = "ip 不能为空") + private String userIp; + /** + * 浏览器 UA + */ + // @NotNull(message = "User-Agent 不能为空") + private String userAgent; + + /** + * 异常时间 + */ + // @NotNull(message = "异常时间不能为空") + private LocalDateTime exceptionTime; + /** + * 异常名 + */ + // @NotNull(message = "异常名不能为空") + private String exceptionName; + /** + * 异常发生的类全名 + */ + // @NotNull(message = "异常发生的类全名不能为空") + private String exceptionClassName; + /** + * 异常发生的类文件 + */ + // @NotNull(message = "异常发生的类文件不能为空") + private String exceptionFileName; + /** + * 异常发生的方法名 + */ + // @NotNull(message = "异常发生的方法名不能为空") + private String exceptionMethodName; + /** + * 异常发生的方法所在行 + */ + // @NotNull(message = "异常发生的方法所在行不能为空") + private Integer exceptionLineNumber; + /** + * 异常的栈轨迹异常的栈轨迹 + */ + // @NotNull(message = "异常的栈轨迹不能为空") + private String exceptionStackTrace; + /** + * 异常导致的根消息 + */ + // @NotNull(message = "异常导致的根消息不能为空") + private String exceptionRootCauseMessage; + /** + * 异常导致的消息 + */ + // @NotNull(message = "异常导致的消息不能为空") + private String exceptionMessage; + + +} diff --git a/src/main/java/com/metalloop/common/model/Result.java b/src/main/java/com/metalloop/common/model/Result.java new file mode 100644 index 0000000..8c5a7a2 --- /dev/null +++ b/src/main/java/com/metalloop/common/model/Result.java @@ -0,0 +1,107 @@ +package com.metalloop.common.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.metalloop.common.exception.code.ResponseCode; +import com.metalloop.common.exception.BusinessException; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Objects; + +/** + * 响应包装体 + * + * @author zhaowenhao + * @since 2022-12-27 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class Result implements Serializable { + + private T data; + private Integer code; + private String msg; + + public static Result ok() { + return of(null, ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMsg()); + } + + public static Result ok(T data) { + return of(data, ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMsg()); + } + + public static Result ok(T data, String msg) { + return of(data, ResponseCode.SUCCESS.getCode(), msg); + } + + public static Result fail() { + return of(null, ResponseCode.FAIL.getCode(), ResponseCode.FAIL.getMsg()); + } + + public static Result fail(String msg) { + return of(null, ResponseCode.FAIL.getCode(), msg); + } + + public static Result fail(int code, String msg) { + return of(null, code, msg); + } + + public static Result fail(ResponseCode responseCode) { + return of(null, responseCode.getCode(), responseCode.getMsg()); + } + + public static Result of(T data, int code, String msg) { + return new Result<>(data, code, msg); + } + + /** + * 判断是否成功 + * + * @param code 状态码 + * @return 是否成功 + */ + public static boolean isSuccess(Integer code) { + return Objects.equals(code, ResponseCode.SUCCESS.getCode()); + } + + /** + * 判断是否成功 + * + * @return 是否成功 + */ + @JsonIgnore + public boolean isSuccess() { + return isSuccess(code); + } + + @JsonIgnore + public boolean isError() { + return !isSuccess(); + } + + // ========= 和 Exception 异常体系集成 ========= + + /** + * 判断是否有异常。如果有,则抛出 {@link BusinessException} 异常 + */ + public void checkError() throws BusinessException { + if (isSuccess()) { + return; + } + // 业务异常 + throw new BusinessException(code, msg); + } + + /** + * 判断是否有异常。如果有,则抛出 {@link BusinessException} 异常 + * 如果没有,则返回 {@link #data} 数据 + */ + @JsonIgnore + public T getCheckedData() { + checkError(); + return data; + } +} diff --git a/src/main/java/com/metalloop/common/redis/RedisAutoConfigure.java b/src/main/java/com/metalloop/common/redis/RedisAutoConfigure.java new file mode 100644 index 0000000..b5a22fc --- /dev/null +++ b/src/main/java/com/metalloop/common/redis/RedisAutoConfigure.java @@ -0,0 +1,140 @@ +package com.metalloop.common.redis; + +import com.metalloop.common.redis.properties.CacheManagerProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.data.redis.RedisProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.stereotype.Component; + +import java.time.Duration; +import java.util.HashMap; +import java.util.Map; + +/** + * Redis 配置类,键强制为string序列化,值默认使用json序列化,同时支持java序列化、string序列化 + * 根据需求自行选择 + * 缓存默认启用 + * + * @author zhaowenhao + */ +@SuppressWarnings("DuplicatedCode") +@EnableConfigurationProperties({RedisProperties.class, CacheManagerProperties.class}) +@EnableCaching +@Component +public class RedisAutoConfigure { + @Autowired + private CacheManagerProperties cacheManagerProperties; + + @Bean + public RedisSerializer redisKeyStringSerializer() { + return RedisSerializer.string(); + } + + @Bean + public RedisSerializer redisValueJsonSerializer() { + return RedisSerializer.json(); + } + + @Bean + public RedisSerializer redisValueJavaSerializer() { + return RedisSerializer.java(); + } + + /** + * string-json RedisTemplate配置,默认使用 + * + * @param factory RedisConnectionFactory + * @param redisKeyStringSerializer RedisSerializer + */ + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory factory, RedisSerializer redisKeyStringSerializer, RedisSerializer redisValueJsonSerializer) { + RedisTemplate redisTemplate = new RedisTemplate<>(); + redisTemplate.setConnectionFactory(factory); + + redisTemplate.setDefaultSerializer(redisValueJsonSerializer); + redisTemplate.setKeySerializer(redisKeyStringSerializer); + redisTemplate.setHashKeySerializer(redisKeyStringSerializer); + redisTemplate.afterPropertiesSet(); + return redisTemplate; + } + + /** + * string-string RedisTemplate配置 + * + * @param redisConnectionFactory RedisConnectionFactory + */ + @Bean + @ConditionalOnMissingBean + public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory) { + StringRedisTemplate template = new StringRedisTemplate(); + template.setConnectionFactory(redisConnectionFactory); + return template; + } + + /** + * string-java RedisTemplate配置 + * + * @param factory RedisConnectionFactory + * @param redisKeyStringSerializer RedisSerializer + */ + @Bean + @ConditionalOnMissingBean(name = "javaRedisTemplate") + public RedisTemplate javaRedisTemplate(RedisConnectionFactory factory, RedisSerializer redisKeyStringSerializer, RedisSerializer redisValueJavaSerializer) { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(factory); + + template.setDefaultSerializer(redisValueJavaSerializer); + template.setKeySerializer(redisKeyStringSerializer); + template.setHashKeySerializer(redisKeyStringSerializer); + template.afterPropertiesSet(); + return template; + } + + @Bean(name = "cacheManager") + @Primary + public CacheManager cacheManager(RedisConnectionFactory redisConnectionFactory, RedisSerializer redisKeyStringSerializer, RedisSerializer redisValueJsonSerializer) { + RedisCacheConfiguration difConf = getDefConf(redisKeyStringSerializer, redisValueJsonSerializer).entryTtl(Duration.ofHours(1)); + + // 自定义的缓存过期时间配置 + int configSize = cacheManagerProperties.getConfigs() == null ? 0 : cacheManagerProperties.getConfigs().size(); + Map redisCacheConfigurationMap = new HashMap<>(configSize); + if (configSize > 0) { + cacheManagerProperties.getConfigs().forEach(e -> { + RedisCacheConfiguration conf = getDefConf(redisKeyStringSerializer, redisValueJsonSerializer).entryTtl(Duration.ofSeconds(e.getSecond())); + redisCacheConfigurationMap.put(e.getKey(), conf); + }); + } + + return RedisCacheManager.builder(redisConnectionFactory).cacheDefaults(difConf).withInitialCacheConfigurations(redisCacheConfigurationMap).build(); + } + + @Bean + public KeyGenerator keyGenerator() { + return (target, method, objects) -> { + StringBuilder sb = new StringBuilder(); + sb.append(target.getClass().getName()); + sb.append(":").append(method.getName()).append(":"); + for (Object obj : objects) { + sb.append(obj.toString()); + } + return sb.toString(); + }; + } + + private RedisCacheConfiguration getDefConf(RedisSerializer redisKeyStringSerializer, RedisSerializer redisValueJsonSerializer) { + return RedisCacheConfiguration.defaultCacheConfig().disableCachingNullValues().computePrefixWith(cacheName -> "cache".concat(":").concat(cacheName).concat(":")).serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(redisKeyStringSerializer)).serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(redisValueJsonSerializer)); + } +} diff --git a/src/main/java/com/metalloop/common/redis/lock/RedissonDistributedLock.java b/src/main/java/com/metalloop/common/redis/lock/RedissonDistributedLock.java new file mode 100644 index 0000000..5bda91e --- /dev/null +++ b/src/main/java/com/metalloop/common/redis/lock/RedissonDistributedLock.java @@ -0,0 +1,69 @@ +package com.metalloop.common.redis.lock; + + +import com.metalloop.common.constant.CommonConstant; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.ZLock; +import com.metalloop.common.exception.LockException; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +/** + * redisson分布式锁实现,基本锁功能的抽象实现 + * 本接口能满足绝大部分的需求,高级的锁功能,请自行扩展或直接使用原生api + * + * @author zhaowenhao + */ +@Component +public class RedissonDistributedLock implements DistributedLock { + @Autowired + private RedissonClient redisson; + + private ZLock getLock(String key, boolean isFair) { + RLock lock; + if (isFair) { + lock = redisson.getFairLock(CommonConstant.LOCK_KEY_PREFIX + ":" + key); + } else { + lock = redisson.getLock(CommonConstant.LOCK_KEY_PREFIX + ":" + key); + } + return new ZLock(lock, this); + } + + @Override + public ZLock lock(String key, long leaseTime, TimeUnit unit, boolean isFair) { + ZLock zLock = getLock(key, isFair); + RLock lock = (RLock) zLock.getLock(); + lock.lock(leaseTime, unit); + return zLock; + } + + @Override + public ZLock tryLock(String key, long waitTime, long leaseTime, TimeUnit unit, boolean isFair) throws InterruptedException { + ZLock zLock = getLock(key, isFair); + RLock lock = (RLock) zLock.getLock(); + if (lock.tryLock(waitTime, leaseTime, unit)) { + return zLock; + } + return null; + } + + @Override + public void unlock(Object lock) { + if (lock != null) { + if (lock instanceof RLock) { + RLock rLock = (RLock) lock; + if (rLock.isLocked()) { + rLock.unlock(); + } + } else { + throw new LockException("requires RLock type"); + } + } + } +} diff --git a/src/main/java/com/metalloop/common/redis/properties/CacheManagerProperties.java b/src/main/java/com/metalloop/common/redis/properties/CacheManagerProperties.java new file mode 100644 index 0000000..7f9f6bf --- /dev/null +++ b/src/main/java/com/metalloop/common/redis/properties/CacheManagerProperties.java @@ -0,0 +1,31 @@ +package com.metalloop.common.redis.properties; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.List; + +/** + * @author zlt + * @date 2019/1/6 + */ +@Setter +@Getter +@ConfigurationProperties(prefix = "tocc.cache-manager") +public class CacheManagerProperties { + private List configs; + + @Setter + @Getter + public static class CacheConfig { + /** + * cache key + */ + private String key; + /** + * 过期时间,sec + */ + private long second = 60; + } +} diff --git a/src/main/java/com/metalloop/common/redis/properties/RedissonLockAutoConfiguration.java b/src/main/java/com/metalloop/common/redis/properties/RedissonLockAutoConfiguration.java new file mode 100644 index 0000000..e46b793 --- /dev/null +++ b/src/main/java/com/metalloop/common/redis/properties/RedissonLockAutoConfiguration.java @@ -0,0 +1,27 @@ +package com.metalloop.common.redis.properties; + +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.redis.lock.RedissonDistributedLock; +import org.redisson.api.RedissonClient; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; + +@AutoConfiguration +@ConditionalOnClass(RedissonClient.class) +@ConditionalOnProperty( + prefix = "tocc.lock", + name = "lockerType", + havingValue = "REDIS", + matchIfMissing = true +) +public class RedissonLockAutoConfiguration { + + @Bean + @ConditionalOnMissingBean(DistributedLock.class) + public DistributedLock distributedLock() { + return new RedissonDistributedLock(); + } +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/common/redis/template/RedisRepository.java b/src/main/java/com/metalloop/common/redis/template/RedisRepository.java new file mode 100644 index 0000000..8eeef7b --- /dev/null +++ b/src/main/java/com/metalloop/common/redis/template/RedisRepository.java @@ -0,0 +1,577 @@ +package com.metalloop.common.redis.template; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.data.redis.connection.RedisClusterNode; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.RedisServerCommands; +import org.springframework.data.redis.connection.RedisStringCommands; +import org.springframework.data.redis.core.*; +import org.springframework.data.redis.core.types.Expiration; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationUtils; +import org.springframework.util.Assert; + +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * Redis Repository + * redis 基本操作 可扩展,基本够用了 + * + *

基于 Spring Boot 3.4.x(Spring Data Redis 3.4.x)API 编写。

+ * + * @author zhaowenhao + */ +@Slf4j +public class RedisRepository { + + /** + * Spring Redis Template + */ + private final RedisTemplate redisTemplate; + + public RedisRepository(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + /** + * 获取链接工厂 + */ + public RedisConnectionFactory getConnectionFactory() { + return this.redisTemplate.getConnectionFactory(); + } + + /** + * 获取 RedisTemplate 对象 + */ + public RedisTemplate getRedisTemplate() { + return redisTemplate; + } + + /** + * 清空DB + * + * @param node redis 节点 + */ + public void flushDB(RedisClusterNode node) { + this.redisTemplate.opsForCluster().flushDb(node); + } + + // ======================== 写入类操作 ======================== + + /** + * 添加到带有过期时间的缓存(byte[] 版本,直接写原始字节,不做任何序列化包装) + * + *

需要写原始字节,无法迁移到 {@code opsForValue()},故保留底层调用。 + * Spring Data Redis 3.4.x 中 {@code RedisConnection#set} 已标记废弃, + * 但尚无等价的带自定义序列化器的高层 API,故显式抑制警告。

+ * + * @param key redis 主键 + * @param value 值 + * @param time 过期时间(单位秒) + */ + @SuppressWarnings("deprecation") + public void setExpire(final byte[] key, final byte[] value, final long time) { + redisTemplate.execute((RedisCallback) connection -> + connection.set(key, value, + Expiration.seconds(time), + RedisStringCommands.SetOption.upsert())); + } + + /** + * 添加到带有过期时间的缓存(推荐,使用模板自身的序列化器) + * + * @param key redis 主键 + * @param value 值 + * @param time 过期时间 + * @param timeUnit 过期时间单位 + */ + public void setExpire(final String key, final Object value, final long time, final TimeUnit timeUnit) { + redisTemplate.opsForValue().set(key, value, time, timeUnit); + } + + /** + * 添加到带有过期时间的缓存(默认单位为秒) + * + * @param key redis 主键 + * @param value 值 + * @param time 过期时间(单位秒) + */ + public void setExpire(final String key, final Object value, final long time) { + this.setExpire(key, value, time, TimeUnit.SECONDS); + } + + /** + * 添加到带有过期时间的缓存(支持自定义 valueSerializer) + * + *

因需要独立的 {@code valueSerializer},无法迁移到 {@code opsForValue()} 高层 API, + * 故保留底层调用并抑制弃用警告。

+ * + * @param key redis 主键 + * @param value 值 + * @param time 过期时间 + * @param timeUnit 过期时间单位 + * @param valueSerializer 自定义值序列化器 + */ + @SuppressWarnings("deprecation") + public void setExpire(final String key, final Object value, final long time, + final TimeUnit timeUnit, RedisSerializer valueSerializer) { + byte[] rawKey = rawKey(key); + byte[] rawValue = rawValue(value, valueSerializer); + redisTemplate.execute((RedisCallback) connection -> + connection.set(rawKey, rawValue, + Expiration.from(time, timeUnit), + RedisStringCommands.SetOption.upsert())); + } + + /** + * 一次性添加数组到带过期时间的缓存(使用 Pipeline,减少网络往返) + * + * @param keys redis 主键数组 + * @param values 值数组 + * @param time 过期时间(单位秒) + */ + @SuppressWarnings("deprecation") + public void setExpire(final String[] keys, final Object[] values, final long time) { + redisTemplate.executePipelined((RedisCallback) connection -> { + RedisSerializer ks = keySerializer(); + RedisSerializer vs = valueSerializer(); + for (int i = 0; i < keys.length; i++) { + connection.set(Objects.requireNonNull(ks.serialize(keys[i])), Objects.requireNonNull(vs.serialize(values[i])), + Expiration.seconds(time), + RedisStringCommands.SetOption.upsert()); + } + return null; + }); + } + + /** + * 一次性添加数组到缓存(使用 Pipeline,减少网络往返) + * + * @param keys 主键数组 + * @param values 值数组 + */ + @SuppressWarnings("deprecation") + public void set(final String[] keys, final Object[] values) { + redisTemplate.executePipelined((RedisCallback) connection -> { + RedisSerializer ks = keySerializer(); + RedisSerializer vs = valueSerializer(); + for (int i = 0; i < keys.length; i++) { + connection.set(Objects.requireNonNull(ks.serialize(keys[i])), Objects.requireNonNull(vs.serialize(values[i]))); + } + return null; + }); + } + + /** + * 添加到缓存(无过期时间) + * + * @param key the key + * @param value the value + */ + public void set(final String key, final Object value) { + redisTemplate.opsForValue().set(key, value); + } + + // ======================== 读取类操作 ======================== + + /** + * 查询在以 keyPattern 开头的所有 key + * + *

注意:底层使用 KEYS 命令,生产环境数据量大时会阻塞 Redis,请谨慎使用。

+ * + * @param keyPattern the key pattern (会自动追加 "*") + * @return the set + */ + public Set keys(final String keyPattern) { + return redisTemplate.keys(keyPattern + "*"); + } + + /** + * 根据 key 获取原始字节 + * + * @param key the key + * @return the byte[] + */ + public byte[] get(final byte[] key) { + return redisTemplate.execute((RedisCallback) connection -> connection.get(key)); + } + + /** + * 根据 key 获取对象 + * + * @param key the key + * @return the object + */ + public Object get(final String key) { + return redisTemplate.opsForValue().get(key); + } + + /** + * 获取旧值并设置新值(原子操作,对应 Redis 的 SET key value GET 语义) + * + *

使用模板的 valueSerializer,请确保其与调用方期望一致。

+ * + * @param key the key + * @param value the value + * @return 旧值,若不存在返回 null + */ + public String getAndSet(final String key, String value) { + if (StringUtils.isEmpty(key)) { + log.error("非法入参"); + return null; + } + try { + Object oldValue = redisTemplate.opsForValue().getAndSet(key, value); + return oldValue == null ? null : oldValue.toString(); + } catch (Exception e) { + log.error("redisTemplate操作异常", e); + } + return null; + } + + /** + * 根据 key 获取对象(支持自定义 valueSerializer) + * + * @param key the key + * @param valueSerializer 序列化器 + * @return the object + */ + public Object get(final String key, RedisSerializer valueSerializer) { + byte[] rawKey = rawKey(key); + return redisTemplate.execute((RedisCallback) connection -> + deserializeValue(connection.stringCommands().get(rawKey), valueSerializer)); + } + + // ======================== Set 操作 ======================== + + /** + * 缓存 Set + * + * @param key 缓存键值 + * @param dataSet 缓存的数据 + * @return 缓存数据的对象 + */ + public BoundSetOperations setCacheSet(final String key, final Set dataSet) { + BoundSetOperations setOperation = redisTemplate.boundSetOps(key); + Iterator it = dataSet.iterator(); + while (it.hasNext()) { + setOperation.add(it.next()); + } + return setOperation; + } + + /** + * 获得缓存的 set + * + * @param key the key + * @return the set + */ + public Set getCacheSet(final String key) { + return redisTemplate.opsForSet().members(key); + } + + // ======================== Hash 操作 ======================== + + /** + * Ops for hash hash operations. + * + * @return the hash operations + */ + public HashOperations opsForHash() { + return redisTemplate.opsForHash(); + } + + /** + * 对 HashMap 设置值 + * + * @param key the key + * @param hashKey the hash key + * @param hashValue the hash value + */ + public void putHashValue(String key, String hashKey, Object hashValue) { + opsForHash().put(key, hashKey, hashValue); + } + + /** + * 获取单个 field 对应的值 + * + * @param key the key + * @param hashKey the hash key + * @return the hash values + */ + public Object getHashValues(String key, String hashKey) { + return opsForHash().get(key, hashKey); + } + + /** + * 根据 key 值删除 hash 字段 + * + * @param key the key + * @param hashKeys the hash keys + */ + public void delHashValues(String key, Object... hashKeys) { + opsForHash().delete(key, hashKeys); + } + + /** + * key 对应的整个 map + * + * @param key the key + * @return the hash value + */ + public Map getHashValue(String key) { + return opsForHash().entries(key); + } + + /** + * 批量添加 hash + * + * @param key the key + * @param map the map + */ + public void putHashValues(String key, Map map) { + opsForHash().putAll(key, map); + } + + // ======================== 通用操作 ======================== + + /** + * 集合数量 + * + * @return the long + */ + public long dbSize() { + Long size = redisTemplate.execute(RedisServerCommands::dbSize); + return size == null ? 0L : size; + } + + /** + * 清空 redis 存储的数据 + * + * @return the string + */ + public String flushDB() { + return redisTemplate.execute((RedisCallback) connection -> { + connection.flushDb(); + return "ok"; + }); + } + + /** + * 判断某个主键是否存在 + * + * @param key the key + * @return the boolean + */ + public boolean exists(final String key) { + return Boolean.TRUE.equals(redisTemplate.hasKey(key)); + } + + /** + * 批量删除 key + * + * @param keys the keys + * @return 实际删除的数量 + */ + public long del(final String... keys) { + if (keys == null || keys.length == 0) { + return 0L; + } + Long count = redisTemplate.delete(Arrays.asList(keys)); + return count == null ? 0L : count; + } + + /** + * 对某个主键对应的值加一, value 值必须是全数字的字符串 + * + * @param key the key + * @return the long + */ + public long incr(final String key) { + Long value = redisTemplate.opsForValue().increment(key); + return value == null ? 0L : value; + } + + // ======================== List 操作 ======================== + + /** + * redis List 引擎 + * + * @return the list operations + */ + public ListOperations opsForList() { + return redisTemplate.opsForList(); + } + + /** + * redis List 数据结构 : 将一个或多个值 value 插入到列表 key 的表头 + * + * @param key the key + * @param value the value + * @return the long + */ + public Long leftPush(String key, Object value) { + return opsForList().leftPush(key, value); + } + + /** + * redis List 数据结构 : 移除并返回列表 key 的头元素 + * + * @param key the key + * @return the object + */ + public Object leftPop(String key) { + return opsForList().leftPop(key); + } + + /** + * redis List 数据结构 : 将一个或多个值 value 插入到列表 key 的表尾(最右边)。 + * + * @param key the key + * @param value the value + * @return the long + */ + public Long in(String key, Object value) { + return opsForList().rightPush(key, value); + } + + /** + * redis List 数据结构 : 移除并返回列表 key 的末尾元素 + * + * @param key the key + * @return the object + */ + public Object rightPop(String key) { + return opsForList().rightPop(key); + } + + /** + * redis List 数据结构 : 返回列表 key 的长度 + * + * @param key the key + * @return the long + */ + public Long length(String key) { + return opsForList().size(key); + } + + /** + * redis List 数据结构 : 根据参数 i 的值,移除列表中与参数 value 相等的元素 + * + * @param key the key + * @param i the index + * @param value the value + */ + public void remove(String key, long i, Object value) { + opsForList().remove(key, i, value); + } + + /** + * redis List 数据结构 : 将列表 key 下标为 index 的元素的值设置为 value + * + * @param key the key + * @param index the index + * @param value the value + */ + public void set(String key, long index, Object value) { + opsForList().set(key, index, value); + } + + /** + * redis List 数据结构 : 返回列表 key 中指定区间内的元素 + * + * @param key the key + * @param start the start + * @param end the end + * @return the list + */ + public List getList(String key, int start, int end) { + return opsForList().range(key, start, end); + } + + /** + * redis List 数据结构 : 返回列表 key 中指定区间内的元素(自定义 valueSerializer) + * + * @param key the key + * @param start the start + * @param end the end + * @param valueSerializer 序列化器 + * @return the list + */ + public List getList(String key, int start, int end, RedisSerializer valueSerializer) { + byte[] rawKey = rawKey(key); + return redisTemplate.execute((RedisCallback>) connection -> + deserializeValues(connection.listCommands().lRange(rawKey, start, end), valueSerializer)); + } + + /** + * redis List 数据结构 : 批量存储 + * + * @param key the key + * @param list the list + * @return the long + */ + public Long leftPushAll(String key, List list) { + return opsForList().leftPushAll(key, list); + } + + /** + * redis List 数据结构 : 将值 value 插入到列表 key 当中,位于值 index 之前或之后,默认之后。 + * + * @param key the key + * @param index the index + * @param value the value + */ + public void insert(String key, long index, Object value) { + opsForList().set(key, index, value); + } + + // ======================== 私有工具方法 ======================== + + /** + * 获取 key 序列化器(统一类型转换,避免每次强转告警) + */ + @SuppressWarnings("unchecked") + private RedisSerializer keySerializer() { + return (RedisSerializer) redisTemplate.getKeySerializer(); + } + + /** + * 获取 value 序列化器(统一类型转换,避免每次强转告警) + */ + @SuppressWarnings("unchecked") + private RedisSerializer valueSerializer() { + return (RedisSerializer) redisTemplate.getValueSerializer(); + } + + private byte[] rawKey(Object key) { + Assert.notNull(key, "non null key required"); + if (key instanceof byte[]) { + return (byte[]) key; + } + return keySerializer().serialize(key); + } + + private byte[] rawValue(Object value, RedisSerializer valueSerializer) { + if (value instanceof byte[]) { + return (byte[]) value; + } + return valueSerializer.serialize(value); + } + + private List deserializeValues(List rawValues, RedisSerializer valueSerializer) { + if (valueSerializer == null) { + return (List) (List) rawValues; + } + return SerializationUtils.deserialize(rawValues, valueSerializer); + } + + private Object deserializeValue(byte[] value, RedisSerializer valueSerializer) { + if (valueSerializer == null) { + return value; + } + return valueSerializer.deserialize(value); + } +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/common/service/ISuperService.java b/src/main/java/com/metalloop/common/service/ISuperService.java new file mode 100644 index 0000000..55538e7 --- /dev/null +++ b/src/main/java/com/metalloop/common/service/ISuperService.java @@ -0,0 +1,186 @@ +package com.metalloop.common.service; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.utils.QueryWrapperBuilder; + + +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * service接口父类 + * + * @author zhaowenhao + * @since 2022-12-10 + */ +@SuppressWarnings("unchecked") +public interface ISuperService extends IService { + + /** + * 使用分布式锁确保保存操作的幂等性。该方法接受一个或多个 LockCondition 对象,对每个条件进行唯一性检查。 + * 所有的条件都必须满足(即对应的记录在数据库中不存在)才会保存实体,否则抛出 IdempotencyException 异常。 + * + * @param entity 需要保存的实体对象 + * @param locker 分布式锁对象 + * @param lockConditions 一个或多个锁条件,每个条件对应一个唯一性检查 + * @return 如果实体保存成功则返回 true,否则抛出异常 + * @throws LockException 如果无法获取锁或锁等待超时则抛出此异常 + * @throws IdempotencyException 如果任何唯一性检查失败则抛出此异常 + */ + boolean saveIdempotency(T entity, DistributedLock locker, LockCondition... lockConditions); + + /** + * 以幂等方式根据实体的ID进行更新。此方法使用分布式锁和锁定条件,以确保操作的幂等性和线程安全性。 + * + * @param entity 需要更新的实体。 + * @param locker 分布式锁。 + * @param lockConditions 在更新之前需要检查的锁定条件。 + * 每个条件包括一个锁定键,一个用于检查现有数据的查询包装器, + * 以及在存在重复数据时抛出异常的消息。 + * @return 如果更新操作成功,则返回true;否则返回false。 + * @throws LockException 如果分布式锁为null或无法获取。 + * @throws IdempotencyException 如果存在重复数据或在更新操作中发生其他异常。 + */ + boolean updateByIdIdempotency(T entity, DistributedLock locker, LockCondition... lockConditions); + + /** + * 这个方法提供了一个并发安全的方式来保存或更新给定的实体。 + * 如果实体已经存在,那么它会被更新,否则,它将会被保存。 + *

+ * 这个方法使用了分布式锁来确保并发安全,并且在执行前会检查是否存在满足条件的记录,从而确保操作的幂等性。 + * 锁和条件检查的行为可以通过 {@link LockCondition} 对象进行配置。 + * + * @param entity 要保存或更新的实体 + * @param lock 分布式锁对象,用于确保并发安全 + * @param lockConditions 锁条件对象数组,定义了锁和条件检查的行为 + * @return 如果操作成功,则返回 true,否则返回 false + * @throws IdempotencyException 如果存在满足条件的记录,或者找不到有效的 {@link TableId} 字段 + */ + boolean saveOrUpdateIdempotency(T entity, DistributedLock lock, LockCondition... lockConditions); + + /** + * 根据查询对象获取对象 + * + * @param query 查询对象 + * @param orQueryArray OR嵌套查询对象数组,如果有的话 + * @param 查询对象类型 + * @return 结果对象 + */ + default T get(Q query, Q... orQueryArray) { + return getOne(getWrapper(query, orQueryArray), Boolean.FALSE); + } + + /** + * 根据查询对象获取列表 + * + * @param 查询对象类型 + * @param query 查询对象 + * @param orQueryArray OR嵌套查询对象数组,如果有的话 + * @return 结果列表 + */ + default List list(Q query, Q... orQueryArray){ + return list(getWrapper(query, orQueryArray)); + } + + /** + * 根据查询对象获取列表,并执行分组,返回Map,适用于确定分组后只有一条数据的情况,否则保留最后一条 + * + * @param keyMapper 生成键的映射函数 + * @param query 查询对象 + * @param orQueryArray OR嵌套查询对象数组,如果有的话 + * @param 查询对象类型 + * @param 返回的Map中的key的类型 + * @return 结果Map + */ + default Map toMap(Function keyMapper, Q query, Q... orQueryArray) { + List list = list(getWrapper(query, orQueryArray)); + return list.stream() + .collect(Collectors.toMap(keyMapper, Function.identity(), (oldValue, newValue) -> newValue)); + } + + + /** + * 根据查询对象获取列表并执行分组,返回Map,每个键都有一个对象列表 + * + * @param keyMapper 生成键的映射函数 + * @param query 查询对象 + * @param orQueryArray OR嵌套查询对象数组,如果有的话 + * @param 查询对象类型 + * @param 返回的Map中的key的类型 + * @return 结果Map,其值是对象列表 + */ + default Map> toGroup(Function keyMapper, Q query, Q... orQueryArray) { + List list = list(getWrapper(query, orQueryArray)); + return list.stream() + .collect(Collectors.groupingBy(keyMapper)); + } + + /** + * 计数查询 + * + * @param query 查询对象 + * @param orQueryArray OR嵌套查询对象数组,如果有的话 + * @param 查询对象类型 + * @return 计数结果 + */ + default long count(Q query, Q... orQueryArray) { + return count(getWrapper(query, orQueryArray)); + } + + /** + * 分页查询 + * + * @param page 分页对象 + * @param query 查询对象 + * @param orQueryArray OR嵌套查询对象数组,如果有的话 + * @param 查询对象类型 + * @param 分页对象类型 + * @return 分页对象 + */ + default > E page(E page, Q query, Q... orQueryArray) { + return page(page, getWrapper(query, orQueryArray)); + } + + /** + * 根据查询对象修改记录 + * + * @param entity 实体对象 + * @param query 查询对象 + * @param orQueryArray OR嵌套查询对象数组,如果有的话 + * @param 查询对象类型 + * @return 是否成功 + */ + default boolean update(T entity, Q query, Q... orQueryArray) { + return update(entity, getWrapper(query, orQueryArray)); + } + + /** + * 根据查询对象删除记录 + * + * @param query 查询对象 + * @param orQueryArray OR嵌套查询对象数组,如果有的话 + * @param 查询对象类型 + * @return 是否成功 + */ + default boolean remove(Q query, Q... orQueryArray) { + return remove(getWrapper(query, orQueryArray)); + } + + /** + * 内部方法根据查询对象获取查询条件 + * + * @param query 查询对象 + * @param orQueryArray OR嵌套查询对象数组,如果有的话 + * @return 查询条件 + */ + default QueryWrapper getWrapper(Q query, Q... orQueryArray) { + return QueryWrapperBuilder.build(query, orQueryArray); + } +} diff --git a/src/main/java/com/metalloop/common/service/impl/SuperServiceImpl.java b/src/main/java/com/metalloop/common/service/impl/SuperServiceImpl.java new file mode 100644 index 0000000..2cf57d9 --- /dev/null +++ b/src/main/java/com/metalloop/common/service/impl/SuperServiceImpl.java @@ -0,0 +1,115 @@ +package com.metalloop.common.service.impl; + +import cn.hutool.core.text.CharSequenceUtil; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.TableInfo; +import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; +import com.baomidou.mybatisplus.core.toolkit.ReflectionKit; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.core.lock.ZLock; +import com.metalloop.common.exception.IdempotencyException; +import com.metalloop.common.exception.LockException; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.auth.model.po.SysPermission; + + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; + +/** + * service实现父类 + * + * @author zhaowenhao + * @since 2022-12-10 + *

+ */ +public abstract class SuperServiceImpl, T> extends ServiceImpl implements ISuperService { + + @SafeVarargs + @Override + public final boolean saveIdempotency(T entity, DistributedLock locker, LockCondition... lockConditions) { + if (locker == null) { + throw new LockException("DistributedLock is null"); + } + + List locks = new ArrayList<>(); + try { + checkRepeat(locker, locks, lockConditions); + return super.save(entity); + } catch (Exception e) { + throw new IdempotencyException(e.getMessage()); + } finally { + for (ZLock lock : locks) { + try { + lock.close(); + } catch (Exception ignored) { + } + } + } + } + + @SafeVarargs + @Override + public final boolean updateByIdIdempotency(T entity, DistributedLock locker, LockCondition... lockConditions) { + if (locker == null) { + throw new LockException("DistributedLock is null"); + } + + List locks = new ArrayList<>(); + try { + checkRepeat(locker, locks, lockConditions); + return super.updateById(entity); + } catch (Exception e) { + throw new IdempotencyException(e.getMessage()); + } finally { + for (ZLock lock : locks) { + try { + lock.close(); + } catch (Exception ignored) { + } + } + } + } + + private void checkRepeat(DistributedLock locker, List locks, LockCondition[] lockConditions) throws Exception { + for (LockCondition condition : lockConditions) { + if (condition.isEnabled()) { + ZLock lock = locker.tryLock(condition.getLockKey(), 10, 60, TimeUnit.SECONDS); + if (lock == null) { + throw new LockException("锁等待超时"); + } + locks.add(lock); + long count = super.count(condition.getQueryWrapper()); + if (count > 0) { + throw new IdempotencyException(condition.getMsg()); + } + } + } + } + + @SafeVarargs + @Override + public final boolean saveOrUpdateIdempotency(T entity, DistributedLock lock, LockCondition... lockConditions) { + if (null != entity) { + Class cls = entity.getClass(); + TableInfo tableInfo = TableInfoHelper.getTableInfo(cls); + if (null != tableInfo && CharSequenceUtil.isNotEmpty(tableInfo.getKeyProperty())) { + Object idVal = ReflectionKit.getFieldValue(entity, tableInfo.getKeyProperty()); + if (StringUtils.checkValNull(idVal) || Objects.isNull(getById((Serializable) idVal))) { + return this.saveIdempotency(entity, lock, lockConditions); + } else { + return updateByIdIdempotency(entity, lock, lockConditions); + } + } else { + throw new IdempotencyException("找不到有效的@TableId字段."); + } + } + return false; + } +} diff --git a/src/main/java/com/metalloop/common/utils/IPHelper.java b/src/main/java/com/metalloop/common/utils/IPHelper.java new file mode 100644 index 0000000..ecac187 --- /dev/null +++ b/src/main/java/com/metalloop/common/utils/IPHelper.java @@ -0,0 +1,68 @@ +package com.metalloop.common.utils; + +import jakarta.servlet.http.HttpServletRequest; + +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.UnknownHostException; + +/** + * @author lifan + * @date 2024/3/26 10:26 + */ +public class IPHelper { + + private static final String UNKNOWN = "unknown"; + + /** + * 获取用户的真实ip地址 如果有多个就取第一个 + * + * @param request http请求 + * @return 客户端ip + */ + public static String getIpAddr(HttpServletRequest request) { + + if (request == null) { + return null; + } + String ip = request.getHeader("X-Forwarded-For"); + + if (ip == null || ip.isEmpty() || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.isEmpty() || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.isEmpty() || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + + String[] ips = ip.split(","); + + return ips[0].trim(); + } + + /** + * 将IPV6转化为IPV4 否则采用原来的值 + * + * @param ipvAddress ip地址 + * @return 转化后的地址 + */ + public static String convertIPv6ToIPv4(String ipvAddress) { + try { + InetAddress inet6Address = InetAddress.getByName(ipvAddress); + if (inet6Address instanceof Inet6Address inet6) { + // 如果是IPv6地址 + byte[] ipv4Bytes = new byte[4]; + System.arraycopy(inet6.getAddress(), 12, ipv4Bytes, 0, 4); + InetAddress ipv4Address = InetAddress.getByAddress(ipv4Bytes); + return ipv4Address.getHostAddress(); + } + } catch (UnknownHostException e) { + e.printStackTrace(); + } + return ipvAddress; + } + + +} diff --git a/src/main/java/com/metalloop/common/utils/QueryWrapperBuilder.java b/src/main/java/com/metalloop/common/utils/QueryWrapperBuilder.java new file mode 100644 index 0000000..b17dac8 --- /dev/null +++ b/src/main/java/com/metalloop/common/utils/QueryWrapperBuilder.java @@ -0,0 +1,328 @@ +package com.metalloop.common.utils; + +import cn.hutool.core.text.CharSequenceUtil; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.core.conditions.interfaces.Compare; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.metalloop.common.enums.Direction; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.BeanWrapperImpl; +import org.springframework.beans.BeansException; +import org.springframework.lang.Nullable; + +import java.beans.PropertyDescriptor; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + * MyBatis-Plus QueryWrapper 条件构造器,从查询对象中构建查询条件 + * 条件构造遵循以下约定: + *

+ * 1.解析规则 + *

+ * 1.1.查询对象字段值非空(不是null和空字符串)才会加入查询条件 + *

+ * 1.2.查询对象字段对应的数据库字段,通过对应注解 @TableField(value = "client_id") 的value提取 + *

+ * 1.3.查询对象字段值类型是 Direction,用order by片段,如 Direction detectionTimeOrder = Direction.DESC 会转换为 order by detection_time desc + *

+ * 1.4.查询对象字段值类型是 {@link Collection},用in片段,如果以not开头或结尾,使用not in片段如 List<> notSiteCodes 会转换为 site_code not in (?,?,?),否则使用in片段如 List<> siteCodes 会转换为 site_code in (?,?,?)。另请注意:如果集合不为 null 但元素数量为零,不是不加入查询条件,而是加入一个不可能的值,如 in () 会报错,所以会加入 in ('__UNLIKELY_VALUE_300552__'),这样可以避免报错。同时保持字面的含义,即选择了 0 个值,查询结果也为 0 个 + *

+ * 1.5.查询对象字段名以start|lower|min|from开头或结尾,表示范围的下限,用>=片段,如 detectionTimeStart 会转换为 detection_time >= ? + *

+ * 1.6.查询对象字段名以end|upper|max|to开头或结尾,表示范围的上限,用<=片段,如 detectionTimeEnd 会转换为 detection_time <= ? + *

+ * 1.7.查询对象字段名以startEc|lowerEc|minEc|fromEc开头或结尾,Ec约定为‘exclusive’的缩写,表示范围的下限,但是不包含当前值,用>片段,如 detectionTimeStartEc 会转换为 detection_time > ? + *

+ * 1.8.查询对象字段名以endEc|upperEc|maxEc|toEc开头或结尾,Ec约定为‘exclusive’的缩写,表示范围的上限,但是不包含当前值,用<片段,如 detectionTimeEndEc 会转换为 detection_time < ? + *

+ * 1.9.prefix|suffix开头或结尾,表示前缀或后缀查询,用like片段,如 vehPlatePrefix 会转换为 veh_plate like ?% 或 vehPlateSuffix 会转换为 veh_plate like %? + *

+ * 1.10.查询对象字段名以notLike|notContains|notMatches|notMatch开头或结尾,表示否定模糊查询,用not like片段,如 vehPlateNotLike 会转换为 veh_plate not like %?% + *

+ * 1.11.查询对象字段名以like|contains|matches|match开头或结尾,表示模糊查询,用like片段,如 vehPlateLike 会转换为 veh_plate like %?% + *

+ * 1.12.查询对象字段名以fulltext开头或结尾,表示全文检索查询,用MATCH() AGAINST()片段,如 vehPlateFullText 会转换为 MATCH(veh_plate) AGAINST(?) + *

+ * 1.13.查询对象字段名以not开头或结尾,表示否定查询,用not片段,如 vehPlateNot 会转换为 veh_plate != ? + *

+ * 1.14.其他情况表示精确查询,用=片段,如busiNum 会转换为busi_num = ? + *

+ * 2.OR嵌套查询列表 + *

+ * 需要构建OR嵌套查询列表,解析规则同上,解析结果为嵌套查询,最终将转换为 and (site_code in (?,?,?) or detection_time >= ? or ...) + * + * @author zhaowenhao + * @since 2022-12-27 + */ +@SuppressWarnings({"AlibabaMethodTooLong", "DuplicatedCode"}) +public class QueryWrapperBuilder { + + /** + * Utility classes should not have a public or default constructor. + */ + private QueryWrapperBuilder() { + throw new IllegalStateException("Utility class"); + } + + /** + * 不可能的值,用于处理集合为空的情况 + */ + public static final String UNLIKELY_VALUE = "__UNLIKELY_VALUE_300552__"; + + /** + * 范围开始(不包含当前值)正则表达式 + */ + public static final Pattern EXCLUSIVE_RANGE_START_PATTERN = Pattern.compile("(.+(start|lower|min|from)ec)|((start|lower|min|from)ec.+)", Pattern.CASE_INSENSITIVE); + + /** + * 范围结束(不包含当前值)正则表达式 + */ + public static final Pattern EXCLUSIVE_RANGE_END_PATTERN = Pattern.compile("(.+(end|upper|max|to)ec)|((end|upper|max|to)ec.+)", Pattern.CASE_INSENSITIVE); + + /** + * 范围开始正则表达式 + */ + public static final Pattern RANGE_START_PATTERN = Pattern.compile("(.+(start|lower|min|from))|((start|lower|min|from).+)", Pattern.CASE_INSENSITIVE); + + /** + * 范围结束正则表达式 + */ + public static final Pattern RANGE_END_PATTERN = Pattern.compile("(.+(end|upper|max|to))|((end|upper|max|to).+)", Pattern.CASE_INSENSITIVE); + + /** + * 前缀查询 + */ + public static final Pattern PREFIX_PATTERN = Pattern.compile("(.+(prefix))|((prefix).+)", Pattern.CASE_INSENSITIVE); + + /** + * 后缀查询 + */ + public static final Pattern SUFFIX_PATTERN = Pattern.compile("(.+(suffix))|((suffix).+)", Pattern.CASE_INSENSITIVE); + + /** + * 模糊查询 + */ + public static final Pattern LIKE_PATTERN = Pattern.compile("(.+(like|contains|matches|match))|((like|contains|matches|match).+)", Pattern.CASE_INSENSITIVE); + + /** + * 否定模糊查询 + */ + public static final Pattern NOT_LIKE_PATTERN = Pattern.compile("(.+(not)(like|contains|matches|match))|((not)(like|contains|matches|match).+)", Pattern.CASE_INSENSITIVE); + + /** + * 全文检索查询 + */ + public static final Pattern FULL_TEXT_SEARCH_PATTERN = Pattern.compile("(.+(fulltext))|((fulltext).+)", Pattern.CASE_INSENSITIVE); + + /** + * 不等于查询 + */ + public static final Pattern NOT_PATTERN = Pattern.compile("(.+(not))|((not).+)", Pattern.CASE_INSENSITIVE); + + /** + * 特定JSON值查询 + */ + public static final Pattern JSON_CONTAINS_PATTERN = Pattern.compile("(.+(jsonContains))|((jsonContains).+)", Pattern.CASE_INSENSITIVE); + + @FunctionalInterface + public interface QueryStrategy { + default void apply(QueryWrapper queryWrapper, String column, Object value, boolean isOr) { + if (isOr) { + queryWrapper.or(); + } + apply(queryWrapper, column, value); + } + + void apply(QueryWrapper wrapper, String column, Object value); + } + + // region 封装正则表达式Map和策略Map + private static final Map STRATEGY_MAP = new HashMap<>(); + private static final Map PATTERN_MAP = new HashMap<>(); + + public static final String RANGE_START_PATTERN_KEY = "RANGE_START_PATTERN"; + + public static final String RANGE_END_PATTERN_KEY = "RANGE_END_PATTERN"; + + public static final String EXCLUSIVE_RANGE_START_PATTERN_KEY = "EXCLUSIVE_RANGE_START_PATTERN"; + + public static final String EXCLUSIVE_RANGE_END_PATTERN_KEY = "EXCLUSIVE_RANGE_END_PATTERN"; + + public static final String PREFIX_PATTERN_KEY = "PREFIX_PATTERN"; + + public static final String SUFFIX_PATTERN_KEY = "SUFFIX_PATTERN"; + + public static final String NOT_LIKE_PATTERN_KEY = "NOT_LIKE_PATTERN"; + + public static final String LIKE_PATTERN_KEY = "LIKE_PATTERN"; + + public static final String FULL_TEXT_SEARCH_PATTERN_KEY = "FULL_TEXT_SEARCH_PATTERN"; + + public static final String NOT_PATTERN_KEY = "NOT_PATTERN"; + + public static final String JSON_CONTAINS_PATTERN_KEY = "JSON_CONTAINS_PATTERN"; + + static { + PATTERN_MAP.put(RANGE_START_PATTERN_KEY, RANGE_START_PATTERN); + PATTERN_MAP.put(RANGE_END_PATTERN_KEY, RANGE_END_PATTERN); + PATTERN_MAP.put(EXCLUSIVE_RANGE_START_PATTERN_KEY, EXCLUSIVE_RANGE_START_PATTERN); + PATTERN_MAP.put(EXCLUSIVE_RANGE_END_PATTERN_KEY, EXCLUSIVE_RANGE_END_PATTERN); + PATTERN_MAP.put(PREFIX_PATTERN_KEY, PREFIX_PATTERN); + PATTERN_MAP.put(SUFFIX_PATTERN_KEY, SUFFIX_PATTERN); + PATTERN_MAP.put(NOT_LIKE_PATTERN_KEY, NOT_LIKE_PATTERN); + PATTERN_MAP.put(LIKE_PATTERN_KEY, LIKE_PATTERN); + PATTERN_MAP.put(FULL_TEXT_SEARCH_PATTERN_KEY, FULL_TEXT_SEARCH_PATTERN); + PATTERN_MAP.put(NOT_PATTERN_KEY, NOT_PATTERN); + + + STRATEGY_MAP.put(RANGE_START_PATTERN_KEY, Compare::ge); + STRATEGY_MAP.put(RANGE_END_PATTERN_KEY, Compare::le); + STRATEGY_MAP.put(EXCLUSIVE_RANGE_START_PATTERN_KEY, Compare::gt); + STRATEGY_MAP.put(EXCLUSIVE_RANGE_END_PATTERN_KEY, Compare::lt); + STRATEGY_MAP.put(PREFIX_PATTERN_KEY, Compare::likeRight); + STRATEGY_MAP.put(SUFFIX_PATTERN_KEY, Compare::likeLeft); + STRATEGY_MAP.put(NOT_LIKE_PATTERN_KEY, Compare::notLike); + STRATEGY_MAP.put(LIKE_PATTERN_KEY, Compare::like); + STRATEGY_MAP.put(FULL_TEXT_SEARCH_PATTERN_KEY, (queryWrapper, column, value) -> queryWrapper.apply("MATCH(" + column + ") AGAINST({0})", value)); + STRATEGY_MAP.put(NOT_PATTERN_KEY, Compare::ne); + STRATEGY_MAP.put(JSON_CONTAINS_PATTERN_KEY, (queryWrapper, column, value) -> + queryWrapper.apply("JSON_CONTAINS(" + column + ", CAST({0} AS JSON))", value) + ); + } + // endregion + + @SafeVarargs + public static QueryWrapper build(Q andQuery, Q... orQueryArray) { + if (andQuery == null) return null; + + QueryWrapper queryWrapper = new QueryWrapper<>(); + applyQuery(queryWrapper, andQuery, false); + + Optional.ofNullable(orQueryArray).ifPresent(array -> Arrays.stream(array) + .filter(Objects::nonNull) + .forEach(orQuery -> queryWrapper.and(qw -> applyQuery(qw, orQuery, true)))); + + return queryWrapper; + } + + private static void applyQuery(QueryWrapper queryWrapper, Q query, boolean isOr) { + Class aClass = query.getClass(); + PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(aClass); + final BeanWrapperImpl wrapper = new BeanWrapperImpl(query); + + for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { + String column = getColumn(aClass, propertyDescriptor); + String propertyName = propertyDescriptor.getName(); + Object propertyValue = wrapper.getPropertyValue(propertyName); + // 先处理特殊值:排序标志和集合 + if (propertyValue instanceof Direction) { + applyOrder(queryWrapper, column, propertyValue); + } else if (propertyValue instanceof Collection) { + // 如果集合为空,需要特殊处理为一个无意义的值,否则会导致 in () 报错 + if (((Collection) propertyValue).isEmpty()) { + propertyValue = Collections.singletonList(UNLIKELY_VALUE); + } + applyCollection(queryWrapper, column, propertyName, (Collection) propertyValue); + } else if (propertyValue != null && CharSequenceUtil.isNotBlank(propertyValue.toString())) { + applyStrategy(queryWrapper, column, propertyName, propertyValue, isOr); + } + } + } + + private static void applyOrder(QueryWrapper queryWrapper, String column, Object value) { + if (Direction.ASC.equals(value)) { + queryWrapper.orderByAsc(column); + } else { + queryWrapper.orderByDesc(column); + } + } + + private static void applyCollection(QueryWrapper queryWrapper, String column, String propertyName, Collection values) { + if (PATTERN_MAP.get(NOT_PATTERN_KEY).matcher(propertyName).matches()) { + queryWrapper.notIn(column, values); + } else { + queryWrapper.in(column, values); + } + } + + private static void applyStrategy(QueryWrapper queryWrapper, String column, String propertyName, Object propertyValue, boolean isOr) { + Optional matchedStrategy = findMatchingStrategy(propertyName); + if (matchedStrategy.isPresent() && !propertyName.equalsIgnoreCase(CharSequenceUtil.toCamelCase(column))) { + matchedStrategy.get().apply(queryWrapper, column, propertyValue, isOr); + } else { + applyDefaultStrategy(queryWrapper, column, propertyValue, isOr); + } + } + + private static Optional findMatchingStrategy(String propertyName) { + return STRATEGY_MAP.entrySet().stream() + .filter(entry -> { + Pattern pattern = PATTERN_MAP.get(entry.getKey()); + return pattern != null && pattern.matcher(propertyName).matches(); + }) + .findFirst() + .map(Map.Entry::getValue); + } + + private static void applyDefaultStrategy(QueryWrapper queryWrapper, String column, Object value, boolean isOr) { + if (isOr) { + queryWrapper.or().eq(column, value); + } else { + queryWrapper.eq(column, value); + } + } + + // region 处理缓存的Class的PropertyDescriptor和column的映射关系 + + static final ConcurrentMap, CachedColumnResults> CLASS_CACHED_COLUMN_RESULTS_MAP = + new ConcurrentHashMap<>(128); + private static final PropertyDescriptor[] EMPTY_PROPERTY_DESCRIPTOR_ARRAY = {}; + + public static PropertyDescriptor[] getPropertyDescriptors(Class clazz) throws BeansException { + return forClass(clazz).getPropertyDescriptors(); + } + + @Nullable + public static String getColumn(Class clazz, PropertyDescriptor pd) throws BeansException { + return forClass(clazz).getColumn(pd); + } + + static CachedColumnResults forClass(Class beanClass) throws BeansException { + CachedColumnResults results = CLASS_CACHED_COLUMN_RESULTS_MAP.get(beanClass); + if (results != null) { + return results; + } + + results = new CachedColumnResults(beanClass); + + CachedColumnResults existing = CLASS_CACHED_COLUMN_RESULTS_MAP.putIfAbsent(beanClass, results); + return (existing != null ? existing : results); + } + + public static final class CachedColumnResults { + + private final Map pdToColumnMap; + + private CachedColumnResults(Class beanClass) throws BeansException { + pdToColumnMap = Arrays.stream(beanClass.getDeclaredFields()) + .filter(field -> field.isAnnotationPresent(TableField.class)) + .collect(Collectors.toMap(field -> BeanUtils.getPropertyDescriptor(beanClass, field.getName()), + field -> field.getAnnotation(TableField.class).value())); + } + + @Nullable + String getColumn(PropertyDescriptor pd) { + return pdToColumnMap.get(pd); + } + + PropertyDescriptor[] getPropertyDescriptors() { + return this.pdToColumnMap.keySet().toArray(EMPTY_PROPERTY_DESCRIPTOR_ARRAY); + } + + } + // endregion +} diff --git a/src/main/java/com/metalloop/common/utils/RsaUtils.java b/src/main/java/com/metalloop/common/utils/RsaUtils.java new file mode 100644 index 0000000..4004aa7 --- /dev/null +++ b/src/main/java/com/metalloop/common/utils/RsaUtils.java @@ -0,0 +1,101 @@ +package com.metalloop.common.utils; + +import javax.crypto.Cipher; +import java.security.KeyFactory; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.Base64; + +/** + * RSA加解密工具类 + * + * @author zlt + * @date 2019/7/16 + */ +public class RsaUtils { + /** + * 默认"RSA"="RSA/ECB/PKCS1Padding" + */ + private static final String CIPHER_INSTANCE = "RSA/ECB/PKCS1Padding"; + + /** + * 公钥加密 + * + * @param content 要加密的内容 + * @param publicKey 公钥 + */ + public static String encrypt(String content, PublicKey publicKey) { + try { + return Base64.getEncoder().encodeToString(encrypt(content.getBytes(), publicKey)); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 公钥加密 + * + * @param content 要加密的内容 + * @param publicKey 公钥 + */ + public static byte[] encrypt(byte[] content, PublicKey publicKey) { + try { + Cipher cipher = Cipher.getInstance(CIPHER_INSTANCE); + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + return cipher.doFinal(content); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 私钥解密 + * + * @param content 要解密的内容 + * @param privateKey 私钥 + */ + public static String decrypt(String content, PrivateKey privateKey) throws Exception { + return new String(decrypt(Base64.getDecoder().decode(content), privateKey)); + } + + /** + * 私钥解密 + * + * @param content 要解密的内容 + * @param privateKey 私钥 + */ + public static byte[] decrypt(byte[] content, PrivateKey privateKey) throws Exception { + Cipher cipher = Cipher.getInstance(CIPHER_INSTANCE); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + return cipher.doFinal(content); + } + + /** + * String转公钥PublicKey + * + * @param key 公钥字符 + */ + public static RSAPublicKey getPublicKey(String key) throws Exception { + byte[] keyBytes = Base64.getDecoder().decode(key); + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + return (RSAPublicKey) keyFactory.generatePublic(keySpec); + } + + /** + * String转私钥PrivateKey + * + * @param key 私钥字符 + */ + public static PrivateKey getPrivateKey(String key) throws Exception { + byte[] keyBytes = Base64.getDecoder().decode(key); + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + return keyFactory.generatePrivate(keySpec); + } +} diff --git a/src/main/java/com/metalloop/common/utils/SpringUtil.java b/src/main/java/com/metalloop/common/utils/SpringUtil.java new file mode 100644 index 0000000..282c21c --- /dev/null +++ b/src/main/java/com/metalloop/common/utils/SpringUtil.java @@ -0,0 +1,36 @@ +package com.metalloop.common.utils; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.core.annotation.Order; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +/** + * spring获取bean工具类 + * + * @author 作者 owen E-mail: 624191343@qq.com + */ +@Component +@Order(0) +public class SpringUtil implements ApplicationContextAware { + + private static ApplicationContext applicationContext = null; + + public static T getBean(Class cla) { + return applicationContext.getBean(cla); + } + + public static T getBean(String name, Class cal) { + return applicationContext.getBean(name, cal); + } + + public static String getProperty(String key) { + return applicationContext.getBean(Environment.class).getProperty(key); + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) { + SpringUtil.applicationContext = applicationContext; + } +} diff --git a/src/main/java/com/metalloop/common/utils/json/JsonUtils.java b/src/main/java/com/metalloop/common/utils/json/JsonUtils.java new file mode 100644 index 0000000..9f30bf4 --- /dev/null +++ b/src/main/java/com/metalloop/common/utils/json/JsonUtils.java @@ -0,0 +1,144 @@ +package com.metalloop.common.utils.json; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import lombok.SneakyThrows; +import lombok.experimental.UtilityClass; +import lombok.extern.slf4j.Slf4j; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * JSON 工具类 + * + * @author zhaowenhao + */ +@UtilityClass +@Slf4j +public class JsonUtils { + + private static ObjectMapper objectMapper = new ObjectMapper(); + + static { + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + objectMapper.registerModules(new JavaTimeModule()); // 解决 LocalDateTime 的序列化 + } + + /** + * 初始化 objectMapper 属性 + *

+ * 通过这样的方式,使用 Spring 创建的 ObjectMapper Bean + * + * @param objectMapper ObjectMapper 对象 + */ + public static void init(ObjectMapper objectMapper) { + JsonUtils.objectMapper = objectMapper; + } + + @SneakyThrows + public static String toJsonString(Object object) { + return objectMapper.writeValueAsString(object); + } + + @SneakyThrows + public static byte[] toJsonByte(Object object) { + return objectMapper.writeValueAsBytes(object); + } + + @SneakyThrows + public static String toJsonPrettyString(Object object) { + return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(object); + } + + public static T parseObject(String text, Class clazz) { + if (StrUtil.isEmpty(text)) { + return null; + } + try { + return objectMapper.readValue(text, clazz); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + /** + * 将字符串解析成指定类型的对象 + * 使用 {@link #parseObject(String, Class)} 时,在@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) 的场景下, + * 如果 text 没有 class 属性,则会报错。此时,使用这个方法,可以解决。 + * + * @param text 字符串 + * @param clazz 类型 + * @return 对象 + */ + public static T parseObject2(String text, Class clazz) { + if (StrUtil.isEmpty(text)) { + return null; + } + return JSONUtil.toBean(text, clazz); + } + + public static T parseObject(byte[] bytes, Class clazz) { + if (ArrayUtil.isEmpty(bytes)) { + return null; + } + try { + return objectMapper.readValue(bytes, clazz); + } catch (IOException e) { + log.error("json parse err,json:{}", bytes, e); + throw new RuntimeException(e); + } + } + + public static T parseObject(String text, TypeReference typeReference) { + try { + return objectMapper.readValue(text, typeReference); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static List parseArray(String text, Class clazz) { + if (StrUtil.isEmpty(text)) { + return new ArrayList<>(); + } + try { + return objectMapper.readValue(text, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz)); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static JsonNode parseTree(String text) { + try { + return objectMapper.readTree(text); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static JsonNode parseTree(byte[] text) { + try { + return objectMapper.readTree(text); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static boolean isJson(String text) { + return JSONUtil.isTypeJSON(text); + } + +} diff --git a/src/main/java/com/metalloop/framework/satoken/SaTokenInterceptorConfig.java b/src/main/java/com/metalloop/framework/satoken/SaTokenInterceptorConfig.java new file mode 100644 index 0000000..9b90321 --- /dev/null +++ b/src/main/java/com/metalloop/framework/satoken/SaTokenInterceptorConfig.java @@ -0,0 +1,26 @@ +package com.metalloop.framework.satoken; + +import cn.dev33.satoken.interceptor.SaInterceptor; +import cn.dev33.satoken.router.SaRouter; +import cn.dev33.satoken.stp.StpUtil; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class SaTokenInterceptorConfig implements WebMvcConfigurer { + + @Override + public void addInterceptors(InterceptorRegistry registry) { + // 注册 Sa-Token 全局拦截器 + registry.addInterceptor(new SaInterceptor(handler -> { + // 排除登录、注册、验证码等公开接口 + SaRouter.match("/api/**") + .notMatch("/api/auth/login") + .notMatch("/api/auth/register") + .notMatch("/api/auth/captcha") + .notMatch("/api/public/**") + .check(r -> StpUtil.checkLogin()); + })).addPathPatterns("/api/**"); + } +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/framework/satoken/StpInterfaceImpl.java b/src/main/java/com/metalloop/framework/satoken/StpInterfaceImpl.java new file mode 100644 index 0000000..304050b --- /dev/null +++ b/src/main/java/com/metalloop/framework/satoken/StpInterfaceImpl.java @@ -0,0 +1,37 @@ +package com.metalloop.framework.satoken; + +import cn.dev33.satoken.stp.StpInterface; +//import com.metalloop.modules.permission.service.PermissionService; +//import com.metalloop.modules.permission.service.RoleService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * Sa-Token 权限数据源实现 + * 框架会自动调用此接口获取当前登录用户的角色和权限码 + */ +@Component +@RequiredArgsConstructor +public class StpInterfaceImpl implements StpInterface { + +// private final RoleService roleService; +// private final PermissionService permissionService; + + @Override + public List getPermissionList(Object loginId, String loginType) { + // 根据用户 ID 获取该用户所有权限码(code 字段) + Long userId = Long.parseLong(loginId.toString()); +// return permissionService.listPermissionCodesByUserId(userId); + return List.of(); + } + + @Override + public List getRoleList(Object loginId, String loginType) { + // 根据用户 ID 获取该用户所有角色名称 + Long userId = Long.parseLong(loginId.toString()); +// return roleService.listRoleNamesByUserId(userId); + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/framework/satoken/admin/StpAdminUtil.java b/src/main/java/com/metalloop/framework/satoken/admin/StpAdminUtil.java new file mode 100644 index 0000000..df9edc7 --- /dev/null +++ b/src/main/java/com/metalloop/framework/satoken/admin/StpAdminUtil.java @@ -0,0 +1,1235 @@ +/* + * Copyright 2020-2099 sa-token.cc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.metalloop.framework.satoken.admin; + +import cn.dev33.satoken.SaManager; +import cn.dev33.satoken.fun.SaFunction; +import cn.dev33.satoken.listener.SaTokenEventCenter; +import cn.dev33.satoken.session.SaSession; +import cn.dev33.satoken.session.TokenSign; +import cn.dev33.satoken.stp.SaLoginModel; +import cn.dev33.satoken.stp.SaTokenInfo; +import cn.dev33.satoken.stp.StpLogic; +import com.metalloop.common.enums.LoginType; + +import java.util.List; + +/** + * Sa-Token 权限认证工具类的二次封装,修改了账号类型,支持权限管理系统的认证 + * + * @author zhaowenhao + * @since 2023-06-21 + */ +public class StpAdminUtil { + + private StpAdminUtil() { + } + + /** + * 多账号体系下的类型标识 + */ + public static final String TYPE = LoginType.ADMIN.getType(); + + /** + * 底层使用的 StpLogic 对象 + */ + public static StpLogic stpLogic = LoginType.ADMIN.getStpLogic(); + + /** + * 获取当前 StpLogic 的账号类型 + * + * @return / + */ + public static String getLoginType() { + return stpLogic.getLoginType(); + } + + /** + * 安全的重置 StpLogic 对象 + * + *
1、更改此账户的 StpLogic 对象 + *
2、put 到全局 StpLogic 集合中 + *
3、发送日志 + * + * @param newStpLogic / + */ + public static void setStpLogic(StpLogic newStpLogic) { + // 1、重置此账户的 StpLogic 对象 + stpLogic = newStpLogic; + + // 2、添加到全局 StpLogic 集合中 + // 以便可以通过 SaManager.getStpLogic(type) 的方式来全局获取到这个 StpLogic + SaManager.putStpLogic(newStpLogic); + + // 3、$$ 发布事件:更新了 stpLogic 对象 + SaTokenEventCenter.doSetStpLogic(stpLogic); + } + + /** + * 获取 StpLogic 对象 + * + * @return / + */ + public static StpLogic getStpLogic() { + return stpLogic; + } + + + // ------------------- 获取 token 相关 ------------------- + + /** + * 返回 token 名称,此名称在以下地方体现:Cookie 保存 token 时的名称、提交 token 时参数的名称、存储 token 时的 key 前缀 + * + * @return / + */ + public static String getTokenName() { + return stpLogic.getTokenName(); + } + + /** + * 在当前会话写入指定 token 值 + * + * @param tokenValue token 值 + */ + public static void setTokenValue(String tokenValue) { + stpLogic.setTokenValue(tokenValue); + } + + /** + * 在当前会话写入指定 token 值 + * + * @param tokenValue token 值 + * @param cookieTimeout Cookie存活时间(秒) + */ + public static void setTokenValue(String tokenValue, int cookieTimeout) { + stpLogic.setTokenValue(tokenValue, cookieTimeout); + } + + /** + * 在当前会话写入指定 token 值 + * + * @param tokenValue token 值 + * @param loginModel 登录参数 + */ + public static void setTokenValue(String tokenValue, SaLoginModel loginModel) { + stpLogic.setTokenValue(tokenValue, loginModel); + } + + /** + * 获取当前请求的 token 值 + * + * @return 当前tokenValue + */ + public static String getTokenValue() { + return stpLogic.getTokenValue(); + } + + /** + * 获取当前请求的 token 值 (不裁剪前缀) + * + * @return / + */ + public static String getTokenValueNotCut() { + return stpLogic.getTokenValueNotCut(); + } + + /** + * 获取当前会话的 token 参数信息 + * + * @return token 参数信息 + */ + public static SaTokenInfo getTokenInfo() { + return stpLogic.getTokenInfo(); + } + + + // ------------------- 登录相关操作 ------------------- + + // --- 登录 + + /** + * 会话登录 + * + * @param id 账号id,建议的类型:(long | int | String) + */ + public static void login(Object id) { + stpLogic.login(id); + } + + /** + * 会话登录,并指定登录设备类型 + * + * @param id 账号id,建议的类型:(long | int | String) + * @param device 设备类型 + */ + public static void login(Object id, String device) { + stpLogic.login(id, device); + } + + /** + * 会话登录,并指定是否 [记住我] + * + * @param id 账号id,建议的类型:(long | int | String) + * @param isLastingCookie 是否为持久Cookie,值为 true 时记住我,值为 false 时关闭浏览器需要重新登录 + */ + public static void login(Object id, boolean isLastingCookie) { + stpLogic.login(id, isLastingCookie); + } + + /** + * 会话登录,并指定此次登录 token 的有效期, 单位:秒 + * + * @param id 账号id,建议的类型:(long | int | String) + * @param timeout 此次登录 token 的有效期, 单位:秒 + */ + public static void login(Object id, long timeout) { + stpLogic.login(id, timeout); + } + + /** + * 会话登录,并指定所有登录参数 Model + * + * @param id 账号id,建议的类型:(long | int | String) + * @param loginModel 此次登录的参数Model + */ + public static void login(Object id, SaLoginModel loginModel) { + stpLogic.login(id, loginModel); + } + + /** + * 创建指定账号 id 的登录会话数据 + * + * @param id 账号id,建议的类型:(long | int | String) + * @return 返回会话令牌 + */ + public static String createLoginSession(Object id) { + return stpLogic.createLoginSession(id); + } + + /** + * 创建指定账号 id 的登录会话数据 + * + * @param id 账号id,建议的类型:(long | int | String) + * @param loginModel 此次登录的参数Model + * @return 返回会话令牌 + */ + public static String createLoginSession(Object id, SaLoginModel loginModel) { + return stpLogic.createLoginSession(id, loginModel); + } + + // --- 注销 + + /** + * 在当前客户端会话注销 + */ + public static void logout() { + stpLogic.logout(); + } + + /** + * 会话注销,根据账号id + * + * @param loginId 账号id + */ + public static void logout(Object loginId) { + stpLogic.logout(loginId); + } + + /** + * 会话注销,根据账号id 和 设备类型 + * + * @param loginId 账号id + * @param device 设备类型 (填 null 代表注销该账号的所有设备类型) + */ + public static void logout(Object loginId, String device) { + stpLogic.logout(loginId, device); + } + + /** + * 会话注销,根据指定 Token + * + * @param tokenValue 指定 token + */ + public static void logoutByTokenValue(String tokenValue) { + stpLogic.logoutByTokenValue(tokenValue); + } + + /** + * 踢人下线,根据账号id + *

当对方再次访问系统时,会抛出 NotLoginException 异常,场景值=-5

+ * + * @param loginId 账号id + */ + public static void kickout(Object loginId) { + stpLogic.kickout(loginId); + } + + /** + * 踢人下线,根据账号id 和 设备类型 + *

当对方再次访问系统时,会抛出 NotLoginException 异常,场景值=-5

+ * + * @param loginId 账号id + * @param device 设备类型 (填 null 代表踢出该账号的所有设备类型) + */ + public static void kickout(Object loginId, String device) { + stpLogic.kickout(loginId, device); + } + + /** + * 踢人下线,根据指定 token + *

当对方再次访问系统时,会抛出 NotLoginException 异常,场景值=-5

+ * + * @param tokenValue 指定 token + */ + public static void kickoutByTokenValue(String tokenValue) { + stpLogic.kickoutByTokenValue(tokenValue); + } + + /** + * 顶人下线,根据账号id 和 设备类型 + *

当对方再次访问系统时,会抛出 NotLoginException 异常,场景值=-4

+ * + * @param loginId 账号id + * @param device 设备类型 (填 null 代表顶替该账号的所有设备类型) + */ + public static void replaced(Object loginId, String device) { + stpLogic.replaced(loginId, device); + } + + // 会话查询 + + /** + * 判断当前会话是否已经登录 + * + * @return 已登录返回 true,未登录返回 false + */ + public static boolean isLogin() { + return stpLogic.isLogin(); + } + + /** + * 判断指定账号是否已经登录 + * + * @return 已登录返回 true,未登录返回 false + */ + public static boolean isLogin(Object loginId) { + return stpLogic.isLogin(loginId); + } + + /** + * 检验当前会话是否已经登录,如未登录,则抛出异常 + */ + public static void checkLogin() { + stpLogic.checkLogin(); + } + + /** + * 获取当前会话账号id,如果未登录,则抛出异常 + * + * @return 账号id + */ + public static Object getLoginId() { + return stpLogic.getLoginId(); + } + + /** + * 获取当前会话账号id, 如果未登录,则返回默认值 + * + * @param 返回类型 + * @param defaultValue 默认值 + * @return 登录id + */ + public static T getLoginId(T defaultValue) { + return stpLogic.getLoginId(defaultValue); + } + + /** + * 获取当前会话账号id, 如果未登录,则返回null + * + * @return 账号id + */ + public static Object getLoginIdDefaultNull() { + return stpLogic.getLoginIdDefaultNull(); + } + + /** + * 获取当前会话账号id, 并转换为 String 类型 + * + * @return 账号id + */ + public static String getLoginIdAsString() { + return stpLogic.getLoginIdAsString(); + } + + /** + * 获取当前会话账号id, 并转换为 int 类型 + * + * @return 账号id + */ + public static int getLoginIdAsInt() { + return stpLogic.getLoginIdAsInt(); + } + + /** + * 获取当前会话账号id, 并转换为 long 类型 + * + * @return 账号id + */ + public static long getLoginIdAsLong() { + return stpLogic.getLoginIdAsLong(); + } + + /** + * 获取指定 token 对应的账号id,如果未登录,则返回 null + * + * @param tokenValue token + * @return 账号id + */ + public static Object getLoginIdByToken(String tokenValue) { + return stpLogic.getLoginIdByToken(tokenValue); + } + + /** + * 获取当前 Token 的扩展信息(此函数只在jwt模式下生效) + * + * @param key 键值 + * @return 对应的扩展数据 + */ + public static Object getExtra(String key) { + return stpLogic.getExtra(key); + } + + /** + * 获取指定 Token 的扩展信息(此函数只在jwt模式下生效) + * + * @param tokenValue 指定的 Token 值 + * @param key 键值 + * @return 对应的扩展数据 + */ + public static Object getExtra(String tokenValue, String key) { + return stpLogic.getExtra(tokenValue, key); + } + + + // ------------------- Account-Session 相关 ------------------- + + /** + * 获取指定账号 id 的 Account-Session, 如果该 SaSession 尚未创建,isCreate=是否新建并返回 + * + * @param loginId 账号id + * @param isCreate 是否新建 + * @return SaSession 对象 + */ + public static SaSession getSessionByLoginId(Object loginId, boolean isCreate) { + return stpLogic.getSessionByLoginId(loginId, isCreate); + } + + /** + * 获取指定 key 的 SaSession, 如果该 SaSession 尚未创建,则返回 null + * + * @param sessionId SessionId + * @return Session对象 + */ + public static SaSession getSessionBySessionId(String sessionId) { + return stpLogic.getSessionBySessionId(sessionId); + } + + /** + * 获取指定账号 id 的 Account-Session,如果该 SaSession 尚未创建,则新建并返回 + * + * @param loginId 账号id + * @return SaSession 对象 + */ + public static SaSession getSessionByLoginId(Object loginId) { + return stpLogic.getSessionByLoginId(loginId); + } + + /** + * 获取当前已登录账号的 Account-Session, 如果该 SaSession 尚未创建,isCreate=是否新建并返回 + * + * @param isCreate 是否新建 + * @return Session对象 + */ + public static SaSession getSession(boolean isCreate) { + return stpLogic.getSession(isCreate); + } + + /** + * 获取当前已登录账号的 Account-Session,如果该 SaSession 尚未创建,则新建并返回 + * + * @return Session对象 + */ + public static SaSession getSession() { + return stpLogic.getSession(); + } + + + // ------------------- Token-Session 相关 ------------------- + + /** + * 获取指定 token 的 Token-Session,如果该 SaSession 尚未创建,则新建并返回 + * + * @param tokenValue Token值 + * @return Session对象 + */ + public static SaSession getTokenSessionByToken(String tokenValue) { + return stpLogic.getTokenSessionByToken(tokenValue); + } + + /** + * 获取当前 token 的 Token-Session,如果该 SaSession 尚未创建,则新建并返回 + * + * @return Session对象 + */ + public static SaSession getTokenSession() { + return stpLogic.getTokenSession(); + } + + /** + * 获取当前匿名 Token-Session (可在未登录情况下使用的Token-Session) + * + * @return Token-Session 对象 + */ + public static SaSession getAnonTokenSession() { + return stpLogic.getAnonTokenSession(); + } + + + // ------------------- Active-Timeout token 最低活跃度 验证相关 ------------------- + + /** + * 续签当前 token:(将 [最后操作时间] 更新为当前时间戳) + *

+ * 请注意: 即使 token 已被冻结 也可续签成功, + * 如果此场景下需要提示续签失败,可在此之前调用 checkActiveTimeout() 强制检查是否冻结即可 + *

+ */ + public static void updateLastActiveToNow() { + stpLogic.updateLastActiveToNow(); + } + + /** + * 检查当前 token 是否已被冻结,如果是则抛出异常 + */ + public static void checkActiveTimeout() { + stpLogic.checkActiveTimeout(); + } + + + // ------------------- 过期时间相关 ------------------- + + /** + * 获取当前会话 token 剩余有效时间(单位: 秒,返回 -1 代表永久有效,-2 代表没有这个值) + * + * @return token剩余有效时间 + */ + public static long getTokenTimeout() { + return stpLogic.getTokenTimeout(); + } + + /** + * 获取指定 token 剩余有效时间(单位: 秒,返回 -1 代表永久有效,-2 代表没有这个值) + * + * @param token 指定token + * @return token剩余有效时间 + */ + public static long getTokenTimeout(String token) { + return stpLogic.getTokenTimeout(token); + } + + /** + * 获取当前登录账号的 Account-Session 剩余有效时间(单位: 秒,返回 -1 代表永久有效,-2 代表没有这个值) + * + * @return token剩余有效时间 + */ + public static long getSessionTimeout() { + return stpLogic.getSessionTimeout(); + } + + /** + * 获取当前 token 的 Token-Session 剩余有效时间(单位: 秒,返回 -1 代表永久有效,-2 代表没有这个值) + * + * @return token剩余有效时间 + */ + public static long getTokenSessionTimeout() { + return stpLogic.getTokenSessionTimeout(); + } + + /** + * 获取当前 token 剩余活跃有效期:当前 token 距离被冻结还剩多少时间(单位: 秒,返回 -1 代表永不冻结,-2 代表没有这个值或 token 已被冻结了) + * + * @return / + */ + public static long getTokenActiveTimeout() { + return stpLogic.getTokenActiveTimeout(); + } + + /** + * 对当前 token 的 timeout 值进行续期 + * + * @param timeout 要修改成为的有效时间 (单位: 秒) + */ + public static void renewTimeout(long timeout) { + stpLogic.renewTimeout(timeout); + } + + /** + * 对指定 token 的 timeout 值进行续期 + * + * @param tokenValue 指定 token + * @param timeout 要修改成为的有效时间 (单位: 秒,填 -1 代表要续为永久有效) + */ + public static void renewTimeout(String tokenValue, long timeout) { + stpLogic.renewTimeout(tokenValue, timeout); + } + + + // ------------------- 角色认证操作 ------------------- + + /** + * 获取:当前账号的角色集合 + * + * @return / + */ + public static List getRoleList() { + return stpLogic.getRoleList(); + } + + /** + * 获取:指定账号的角色集合 + * + * @param loginId 指定账号id + * @return / + */ + public static List getRoleList(Object loginId) { + return stpLogic.getRoleList(loginId); + } + + /** + * 判断:当前账号是否拥有指定角色, 返回 true 或 false + * + * @param role 角色 + * @return / + */ + public static boolean hasRole(String role) { + return stpLogic.hasRole(role); + } + + /** + * 判断:指定账号是否含有指定角色标识, 返回 true 或 false + * + * @param loginId 账号id + * @param role 角色标识 + * @return 是否含有指定角色标识 + */ + public static boolean hasRole(Object loginId, String role) { + return stpLogic.hasRole(loginId, role); + } + + /** + * 判断:当前账号是否含有指定角色标识 [ 指定多个,必须全部验证通过 ] + * + * @param roleArray 角色标识数组 + * @return true或false + */ + public static boolean hasRoleAnd(String... roleArray) { + return stpLogic.hasRoleAnd(roleArray); + } + + /** + * 判断:当前账号是否含有指定角色标识 [ 指定多个,只要其一验证通过即可 ] + * + * @param roleArray 角色标识数组 + * @return true或false + */ + public static boolean hasRoleOr(String... roleArray) { + return stpLogic.hasRoleOr(roleArray); + } + + /** + * 校验:当前账号是否含有指定角色标识, 如果验证未通过,则抛出异常: NotRoleException + * + * @param role 角色标识 + */ + public static void checkRole(String role) { + stpLogic.checkRole(role); + } + + /** + * 校验:当前账号是否含有指定角色标识 [ 指定多个,必须全部验证通过 ] + * + * @param roleArray 角色标识数组 + */ + public static void checkRoleAnd(String... roleArray) { + stpLogic.checkRoleAnd(roleArray); + } + + /** + * 校验:当前账号是否含有指定角色标识 [ 指定多个,只要其一验证通过即可 ] + * + * @param roleArray 角色标识数组 + */ + public static void checkRoleOr(String... roleArray) { + stpLogic.checkRoleOr(roleArray); + } + + + // ------------------- 权限认证操作 ------------------- + + /** + * 获取:当前账号的权限码集合 + * + * @return / + */ + public static List getPermissionList() { + return stpLogic.getPermissionList(); + } + + /** + * 获取:指定账号的权限码集合 + * + * @param loginId 指定账号id + * @return / + */ + public static List getPermissionList(Object loginId) { + return stpLogic.getPermissionList(loginId); + } + + /** + * 判断:当前账号是否含有指定权限, 返回 true 或 false + * + * @param permission 权限码 + * @return 是否含有指定权限 + */ + public static boolean hasPermission(String permission) { + return stpLogic.hasPermission(permission); + } + + /** + * 判断:指定账号 id 是否含有指定权限, 返回 true 或 false + * + * @param loginId 账号 id + * @param permission 权限码 + * @return 是否含有指定权限 + */ + public static boolean hasPermission(Object loginId, String permission) { + return stpLogic.hasPermission(loginId, permission); + } + + /** + * 判断:当前账号是否含有指定权限 [ 指定多个,必须全部具有 ] + * + * @param permissionArray 权限码数组 + * @return true 或 false + */ + public static boolean hasPermissionAnd(String... permissionArray) { + return stpLogic.hasPermissionAnd(permissionArray); + } + + /** + * 判断:当前账号是否含有指定权限 [ 指定多个,只要其一验证通过即可 ] + * + * @param permissionArray 权限码数组 + * @return true 或 false + */ + public static boolean hasPermissionOr(String... permissionArray) { + return stpLogic.hasPermissionOr(permissionArray); + } + + /** + * 校验:当前账号是否含有指定权限, 如果验证未通过,则抛出异常: NotPermissionException + * + * @param permission 权限码 + */ + public static void checkPermission(String permission) { + stpLogic.checkPermission(permission); + } + + /** + * 校验:当前账号是否含有指定权限 [ 指定多个,必须全部验证通过 ] + * + * @param permissionArray 权限码数组 + */ + public static void checkPermissionAnd(String... permissionArray) { + stpLogic.checkPermissionAnd(permissionArray); + } + + /** + * 校验:当前账号是否含有指定权限 [ 指定多个,只要其一验证通过即可 ] + * + * @param permissionArray 权限码数组 + */ + public static void checkPermissionOr(String... permissionArray) { + stpLogic.checkPermissionOr(permissionArray); + } + + + // ------------------- id 反查 token 相关操作 ------------------- + + /** + * 获取指定账号 id 的 token + *

+ * 在配置为允许并发登录时,此方法只会返回队列的最后一个 token, + * 如果你需要返回此账号 id 的所有 token,请调用 getTokenValueListByLoginId + *

+ * + * @param loginId 账号id + * @return token值 + */ + public static String getTokenValueByLoginId(Object loginId) { + return stpLogic.getTokenValueByLoginId(loginId); + } + + /** + * 获取指定账号 id 指定设备类型端的 token + *

+ * 在配置为允许并发登录时,此方法只会返回队列的最后一个 token, + * 如果你需要返回此账号 id 的所有 token,请调用 getTokenValueListByLoginId + *

+ * + * @param loginId 账号id + * @param device 设备类型,填 null 代表不限设备类型 + * @return token值 + */ + public static String getTokenValueByLoginId(Object loginId, String device) { + return stpLogic.getTokenValueByLoginId(loginId, device); + } + + /** + * 获取指定账号 id 的 token 集合 + * + * @param loginId 账号id + * @return 此 loginId 的所有相关 token + */ + public static List getTokenValueListByLoginId(Object loginId) { + return stpLogic.getTokenValueListByLoginId(loginId); + } + + /** + * 获取指定账号 id 指定设备类型端的 token 集合 + * + * @param loginId 账号id + * @param device 设备类型,填 null 代表不限设备类型 + * @return 此 loginId 的所有登录 token + */ + public static List getTokenValueListByLoginId(Object loginId, String device) { + return stpLogic.getTokenValueListByLoginId(loginId, device); + } + + /** + * 获取指定账号 id 指定设备类型端的 tokenSign 集合 + * + * @param loginId 账号id + * @param device 设备类型,填 null 代表不限设备类型 + * @return 此 loginId 的所有登录 tokenSign + */ + public static List getTokenSignListByLoginId(Object loginId, String device) { + return stpLogic.getTokenSignListByLoginId(loginId, device); + } + + /** + * 返回当前会话的登录设备类型 + * + * @return 当前令牌的登录设备类型 + */ + public static String getLoginDevice() { + return stpLogic.getLoginDevice(); + } + + + // ------------------- 会话管理 ------------------- + + /** + * 根据条件查询缓存中所有的 token + * + * @param keyword 关键字 + * @param start 开始处索引 + * @param size 获取数量 (-1代表一直获取到末尾) + * @param sortType 排序类型(true=正序,false=反序) + * @return token集合 + */ + public static List searchTokenValue(String keyword, int start, int size, boolean sortType) { + return stpLogic.searchTokenValue(keyword, start, size, sortType); + } + + /** + * 根据条件查询缓存中所有的 SessionId + * + * @param keyword 关键字 + * @param start 开始处索引 + * @param size 获取数量 (-1代表一直获取到末尾) + * @param sortType 排序类型(true=正序,false=反序) + * @return sessionId集合 + */ + public static List searchSessionId(String keyword, int start, int size, boolean sortType) { + return stpLogic.searchSessionId(keyword, start, size, sortType); + } + + /** + * 根据条件查询缓存中所有的 Token-Session-Id + * + * @param keyword 关键字 + * @param start 开始处索引 + * @param size 获取数量 (-1代表一直获取到末尾) + * @param sortType 排序类型(true=正序,false=反序) + * @return sessionId集合 + */ + public static List searchTokenSessionId(String keyword, int start, int size, boolean sortType) { + return stpLogic.searchTokenSessionId(keyword, start, size, sortType); + } + + + // ------------------- 账号封禁 ------------------- + + /** + * 封禁:指定账号 + *

此方法不会直接将此账号id踢下线,如需封禁后立即掉线,请追加调用 StpUtil.logout(id) + * + * @param loginId 指定账号id + * @param time 封禁时间, 单位: 秒 (-1=永久封禁) + */ + public static void disable(Object loginId, long time) { + stpLogic.disable(loginId, time); + } + + /** + * 判断:指定账号是否已被封禁 (true=已被封禁, false=未被封禁) + * + * @param loginId 账号id + * @return / + */ + public static boolean isDisable(Object loginId) { + return stpLogic.isDisable(loginId); + } + + /** + * 校验:指定账号是否已被封禁,如果被封禁则抛出异常 + * + * @param loginId 账号id + */ + public static void checkDisable(Object loginId) { + stpLogic.checkDisable(loginId); + } + + /** + * 获取:指定账号剩余封禁时间,单位:秒(-1=永久封禁,-2=未被封禁) + * + * @param loginId 账号id + * @return / + */ + public static long getDisableTime(Object loginId) { + return stpLogic.getDisableTime(loginId); + } + + /** + * 解封:指定账号 + * + * @param loginId 账号id + */ + public static void untieDisable(Object loginId) { + stpLogic.untieDisable(loginId); + } + + + // ------------------- 分类封禁 ------------------- + + /** + * 封禁:指定账号的指定服务 + *

此方法不会直接将此账号id踢下线,如需封禁后立即掉线,请追加调用 StpUtil.logout(id) + * + * @param loginId 指定账号id + * @param service 指定服务 + * @param time 封禁时间, 单位: 秒 (-1=永久封禁) + */ + public static void disable(Object loginId, String service, long time) { + stpLogic.disable(loginId, service, time); + } + + /** + * 判断:指定账号的指定服务 是否已被封禁(true=已被封禁, false=未被封禁) + * + * @param loginId 账号id + * @param service 指定服务 + * @return / + */ + public static boolean isDisable(Object loginId, String service) { + return stpLogic.isDisable(loginId, service); + } + + /** + * 校验:指定账号 指定服务 是否已被封禁,如果被封禁则抛出异常 + * + * @param loginId 账号id + * @param services 指定服务,可以指定多个 + */ + public static void checkDisable(Object loginId, String... services) { + stpLogic.checkDisable(loginId, services); + } + + /** + * 获取:指定账号 指定服务 剩余封禁时间,单位:秒(-1=永久封禁,-2=未被封禁) + * + * @param loginId 账号id + * @param service 指定服务 + * @return see note + */ + public static long getDisableTime(Object loginId, String service) { + return stpLogic.getDisableTime(loginId, service); + } + + /** + * 解封:指定账号、指定服务 + * + * @param loginId 账号id + * @param services 指定服务,可以指定多个 + */ + public static void untieDisable(Object loginId, String... services) { + stpLogic.untieDisable(loginId, services); + } + + + // ------------------- 阶梯封禁 ------------------- + + /** + * 封禁:指定账号,并指定封禁等级 + * + * @param loginId 指定账号id + * @param level 指定封禁等级 + * @param time 封禁时间, 单位: 秒 (-1=永久封禁) + */ + public static void disableLevel(Object loginId, int level, long time) { + stpLogic.disableLevel(loginId, level, time); + } + + /** + * 封禁:指定账号的指定服务,并指定封禁等级 + * + * @param loginId 指定账号id + * @param service 指定封禁服务 + * @param level 指定封禁等级 + * @param time 封禁时间, 单位: 秒 (-1=永久封禁) + */ + public static void disableLevel(Object loginId, String service, int level, long time) { + stpLogic.disableLevel(loginId, service, level, time); + } + + /** + * 判断:指定账号是否已被封禁到指定等级 + * + * @param loginId 指定账号id + * @param level 指定封禁等级 + * @return / + */ + public static boolean isDisableLevel(Object loginId, int level) { + return stpLogic.isDisableLevel(loginId, level); + } + + /** + * 判断:指定账号的指定服务,是否已被封禁到指定等级 + * + * @param loginId 指定账号id + * @param service 指定封禁服务 + * @param level 指定封禁等级 + * @return / + */ + public static boolean isDisableLevel(Object loginId, String service, int level) { + return stpLogic.isDisableLevel(loginId, service, level); + } + + /** + * 校验:指定账号是否已被封禁到指定等级(如果已经达到,则抛出异常) + * + * @param loginId 指定账号id + * @param level 封禁等级 (只有 封禁等级 ≥ 此值 才会抛出异常) + */ + public static void checkDisableLevel(Object loginId, int level) { + stpLogic.checkDisableLevel(loginId, level); + } + + /** + * 校验:指定账号的指定服务,是否已被封禁到指定等级(如果已经达到,则抛出异常) + * + * @param loginId 指定账号id + * @param service 指定封禁服务 + * @param level 封禁等级 (只有 封禁等级 ≥ 此值 才会抛出异常) + */ + public static void checkDisableLevel(Object loginId, String service, int level) { + stpLogic.checkDisableLevel(loginId, service, level); + } + + /** + * 获取:指定账号被封禁的等级,如果未被封禁则返回-2 + * + * @param loginId 指定账号id + * @return / + */ + public static int getDisableLevel(Object loginId) { + return stpLogic.getDisableLevel(loginId); + } + + /** + * 获取:指定账号的 指定服务 被封禁的等级,如果未被封禁则返回-2 + * + * @param loginId 指定账号id + * @param service 指定封禁服务 + * @return / + */ + public static int getDisableLevel(Object loginId, String service) { + return stpLogic.getDisableLevel(loginId, service); + } + + + // ------------------- 临时身份切换 ------------------- + + /** + * 临时切换身份为指定账号id + * + * @param loginId 指定loginId + */ + public static void switchTo(Object loginId) { + stpLogic.switchTo(loginId); + } + + /** + * 结束临时切换身份 + */ + public static void endSwitch() { + stpLogic.endSwitch(); + } + + /** + * 判断当前请求是否正处于 [ 身份临时切换 ] 中 + * + * @return / + */ + public static boolean isSwitch() { + return stpLogic.isSwitch(); + } + + /** + * 在一个 lambda 代码段里,临时切换身份为指定账号id,lambda 结束后自动恢复 + * + * @param loginId 指定账号id + * @param function 要执行的方法 + */ + public static void switchTo(Object loginId, SaFunction function) { + stpLogic.switchTo(loginId, function); + } + + + // ------------------- 二级认证 ------------------- + + /** + * 在当前会话 开启二级认证 + * + * @param safeTime 维持时间 (单位: 秒) + */ + public static void openSafe(long safeTime) { + stpLogic.openSafe(safeTime); + } + + /** + * 在当前会话 开启二级认证 + * + * @param service 业务标识 + * @param safeTime 维持时间 (单位: 秒) + */ + public static void openSafe(String service, long safeTime) { + stpLogic.openSafe(service, safeTime); + } + + /** + * 判断:当前会话是否处于二级认证时间内 + * + * @return true=二级认证已通过, false=尚未进行二级认证或认证已超时 + */ + public static boolean isSafe() { + return stpLogic.isSafe(); + } + + /** + * 判断:当前会话 是否处于指定业务的二级认证时间内 + * + * @param service 业务标识 + * @return true=二级认证已通过, false=尚未进行二级认证或认证已超时 + */ + public static boolean isSafe(String service) { + return stpLogic.isSafe(service); + } + + /** + * 判断:指定 token 是否处于二级认证时间内 + * + * @param tokenValue Token 值 + * @param service 业务标识 + * @return true=二级认证已通过, false=尚未进行二级认证或认证已超时 + */ + public static boolean isSafe(String tokenValue, String service) { + return stpLogic.isSafe(tokenValue, service); + } + + /** + * 校验:当前会话是否已通过二级认证,如未通过则抛出异常 + */ + public static void checkSafe() { + stpLogic.checkSafe(); + } + + /** + * 校验:检查当前会话是否已通过指定业务的二级认证,如未通过则抛出异常 + * + * @param service 业务标识 + */ + public static void checkSafe(String service) { + stpLogic.checkSafe(service); + } + + /** + * 获取:当前会话的二级认证剩余有效时间(单位: 秒, 返回-2代表尚未通过二级认证) + * + * @return 剩余有效时间 + */ + public static long getSafeTime() { + return stpLogic.getSafeTime(); + } + + /** + * 获取:当前会话的二级认证剩余有效时间(单位: 秒, 返回-2代表尚未通过二级认证) + * + * @param service 业务标识 + * @return 剩余有效时间 + */ + public static long getSafeTime(String service) { + return stpLogic.getSafeTime(service); + } + + /** + * 在当前会话 结束二级认证 + */ + public static void closeSafe() { + stpLogic.closeSafe(); + } + + /** + * 在当前会话 结束指定业务标识的二级认证 + * + * @param service 业务标识 + */ + public static void closeSafe(String service) { + stpLogic.closeSafe(service); + } + +} diff --git a/src/main/java/com/metalloop/framework/satoken/admin/config/SaTokenAdminConfiguration.java b/src/main/java/com/metalloop/framework/satoken/admin/config/SaTokenAdminConfiguration.java new file mode 100644 index 0000000..dbf7b43 --- /dev/null +++ b/src/main/java/com/metalloop/framework/satoken/admin/config/SaTokenAdminConfiguration.java @@ -0,0 +1,34 @@ +package com.metalloop.framework.satoken.admin.config; + +import cn.dev33.satoken.config.SaTokenConfig; +import com.metalloop.framework.satoken.admin.StpAdminUtil; +import jakarta.annotation.PostConstruct; +import org.springframework.beans.BeanUtils; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + + +/** + * Admin Sa-Token 配置类,目标是提供一个支持配置的开箱即用的StpAdminUtil + * + * @author zhaowenhao + * @since 2023-11-17 + */ +@Configuration +@EnableConfigurationProperties(SaTokenAdminProperties.class) +public class SaTokenAdminConfiguration { + private final SaTokenAdminProperties saTokenAdminProperties; + + public SaTokenAdminConfiguration(SaTokenAdminProperties saTokenAdminProperties) { + this.saTokenAdminProperties = saTokenAdminProperties; + } + + // 使用注入的 SaTokenAdminProperties 来配置 StpUtil 或其他组件 + @PostConstruct + public void init() { + SaTokenConfig config = new SaTokenConfig(); + // 拷贝属性 + BeanUtils.copyProperties(saTokenAdminProperties, config); + StpAdminUtil.getStpLogic().setConfig(config); + } +} diff --git a/src/main/java/com/metalloop/framework/satoken/admin/config/SaTokenAdminProperties.java b/src/main/java/com/metalloop/framework/satoken/admin/config/SaTokenAdminProperties.java new file mode 100644 index 0000000..ef49af7 --- /dev/null +++ b/src/main/java/com/metalloop/framework/satoken/admin/config/SaTokenAdminProperties.java @@ -0,0 +1,561 @@ +package com.metalloop.framework.satoken.admin.config; + +import cn.dev33.satoken.config.SaCookieConfig; +import cn.dev33.satoken.config.SaSignConfig; +import cn.dev33.satoken.util.SaFoxUtil; +import lombok.Getter; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.io.Serializable; + +/** + * 复制自 Sa-Token cn.dev33.satoken.config.SaTokenConfig,升级版本时需要注意重新复制,目的是为了使用两套配置, + * 但是又不能影响原框架的注入问题 + * + * @author zhaowenhao + * @since 2023-11-20 + */ +@Getter +@ConfigurationProperties(prefix = "sa-token.admin") +public class SaTokenAdminProperties implements Serializable { + + private static final long serialVersionUID = -6541180061782004705L; + + /** + * token 名称 (同时也是: cookie 名称、提交 token 时参数的名称、存储 token 时的 key 前缀) + * -- GETTER -- + *

+ * token 名称 (同时也是: cookie 名称、提交 token 时参数的名称、存储 token 时的 key 前缀) + */ + private String tokenName = "satoken"; + + /** + * token 有效期(单位:秒) 默认30天,-1 代表永久有效 + * -- GETTER -- + *

+ * token 有效期(单位:秒) 默认30天,-1 代表永久有效 + */ + private long timeout = 60 * 60 * 24 * 30; + + /** + * token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结 + * (例如可以设置为 1800 代表 30 分钟内无操作就冻结) + * -- GETTER -- + *

+ * token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结 + * (例如可以设置为 1800 代表 30 分钟内无操作就冻结) + */ + private long activeTimeout = -1; + + /** + * 是否启用动态 activeTimeout 功能,如不需要请设置为 false,节省缓存请求次数 + * -- GETTER -- + *

+ * 是否启用动态 activeTimeout 功能,如不需要请设置为 false,节省缓存请求次数 + */ + private Boolean dynamicActiveTimeout = false; + + /** + * 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录) + * -- GETTER -- + *

+ * 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录) + */ + private Boolean isConcurrent = true; + + /** + * 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token) + * -- GETTER -- + *

+ * 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个token, 为 false 时每次登录新建一个 token) + */ + private Boolean isShare = true; + + /** + * 同一账号最大登录数量,-1代表不限 (只有在 isConcurrent=true, isShare=false 时此配置项才有意义) + * -- GETTER -- + *

+ * 同一账号最大登录数量,-1代表不限 (只有在 isConcurrent=true, isShare=false 时此配置项才有意义) + */ + private int maxLoginCount = 12; + + /** + * 在每次创建 token 时的最高循环次数,用于保证 token 唯一性(-1=不循环尝试,直接使用) + * -- GETTER -- + *

+ * 在每次创建 token 时的最高循环次数,用于保证 token 唯一性(-1=不循环尝试,直接使用) + */ + private int maxTryTimes = 12; + + /** + * 是否尝试从请求体里读取 token + * -- GETTER -- + *

+ * 是否尝试从请求体里读取 token + */ + private Boolean isReadBody = true; + + /** + * 是否尝试从 header 里读取 token + * -- GETTER -- + *

+ * 是否尝试从 header 里读取 token + */ + private Boolean isReadHeader = true; + + /** + * 是否尝试从 cookie 里读取 token + * -- GETTER -- + *

+ * 是否尝试从 cookie 里读取 token + */ + private Boolean isReadCookie = true; + + /** + * 是否在登录后将 token 写入到响应头 + * -- GETTER -- + *

+ * 是否在登录后将 token 写入到响应头 + */ + private Boolean isWriteHeader = false; + + /** + * token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik) + * -- GETTER -- + *

+ * token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik) + */ + private String tokenStyle = "uuid"; + + /** + * 默认 SaTokenDao 实现类中,每次清理过期数据间隔的时间(单位: 秒),默认值30秒,设置为 -1 代表不启动定时清理 + * -- GETTER -- + *

+ * 默认 SaTokenDao 实现类中,每次清理过期数据间隔的时间(单位: 秒),默认值30秒,设置为 -1 代表不启动定时清理 + */ + private int dataRefreshPeriod = 30; + + /** + * 获取 Token-Session 时是否必须登录(如果配置为true,会在每次获取 getTokenSession() 时校验当前是否登录) + * -- GETTER -- + *

+ * 获取 Token-Session 时是否必须登录(如果配置为true,会在每次获取 getTokenSession() 时校验当前是否登录) + */ + private Boolean tokenSessionCheckLogin = true; + + /** + * 是否打开自动续签 activeTimeout (如果此值为 true, 框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作) + * -- GETTER -- + *

+ * 是否打开自动续签 activeTimeout (如果此值为 true, 框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作) + */ + private Boolean autoRenew = true; + + /** + * token 前缀, 前端提交 token 时应该填写的固定前缀,格式样例(satoken: Bearer xxxx-xxxx-xxxx-xxxx) + * -- GETTER -- + *

+ * token 前缀, 前端提交 token 时应该填写的固定前缀,格式样例(satoken: Bearer xxxx-xxxx-xxxx-xxxx) + */ + private String tokenPrefix; + + /** + * 是否在初始化配置时在控制台打印版本字符画 + * -- GETTER -- + *

+ * 是否在初始化配置时在控制台打印版本字符画 + */ + private Boolean isPrint = true; + + /** + * 是否打印操作日志 + * -- GETTER -- + *

+ * 是否打印操作日志 + */ + private Boolean isLog = false; + + /** + * 日志等级(trace、debug、info、warn、error、fatal),此值与 logLevelInt 联动 + * -- GETTER -- + *

+ * 日志等级(trace、debug、info、warn、error、fatal),此值与 logLevelInt 联动 + */ + private String logLevel = "trace"; + + /** + * 日志等级 int 值(1=trace、2=debug、3=info、4=warn、5=error、6=fatal),此值与 logLevel 联动 + * -- GETTER -- + *

+ * 日志等级 int 值(1=trace、2=debug、3=info、4=warn、5=error、6=fatal),此值与 logLevel 联动 + */ + private int logLevelInt = 1; + + /** + * 是否打印彩色日志 + * -- GETTER -- + * 获取:是否打印彩色日志 + *

+ * isColorLog 是否打印彩色日志 + */ + private Boolean isColorLog = null; + + /** + * jwt秘钥(只有集成 jwt 相关模块时此参数才会生效) + * -- GETTER -- + *

+ * jwt秘钥(只有集成 jwt 相关模块时此参数才会生效) + */ + private String jwtSecretKey; + + /** + * Http Basic 认证的默认账号和密码 + * -- GETTER -- + *

+ * Http Basic 认证的默认账号和密码 + */ + private String basic = ""; + + /** + * 配置当前项目的网络访问地址 + * -- GETTER -- + *

+ * 配置当前项目的网络访问地址 + */ + private String currDomain; + + /** + * Same-Token 的有效期 (单位: 秒) + * -- GETTER -- + *

+ * Same-Token 的有效期 (单位: 秒) + */ + private long sameTokenTimeout = 60 * 60 * 24; + + /** + * 是否校验 Same-Token(部分rpc插件有效) + * -- GETTER -- + *

+ * 是否校验Same-Token(部分rpc插件有效) + */ + private Boolean checkSameToken = false; + + /** + * Cookie配置对象 + * -- GETTER -- + *

+ * Cookie 全局配置对象 + */ + public SaCookieConfig cookie = new SaCookieConfig(); + + /** + * API 签名配置对象 + * -- GETTER -- + *

+ * API 签名全局配置对象 + */ + public SaSignConfig sign = new SaSignConfig(); + + + /** + * @param tokenName token 名称 (同时也是: cookie 名称、提交 token 时参数的名称、存储 token 时的 key 前缀) + * 对象自身 + */ + public SaTokenAdminProperties setTokenName(String tokenName) { + this.tokenName = tokenName; + return this; + } + + /** + * @param timeout token 有效期(单位:秒) 默认30天,-1 代表永久有效 + * 对象自身 + */ + public SaTokenAdminProperties setTimeout(long timeout) { + this.timeout = timeout; + return this; + } + + /** + * @param activeTimeout token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结 + * (例如可以设置为 1800 代表 30 分钟内无操作就冻结) + * 对象自身 + */ + public SaTokenAdminProperties setActiveTimeout(long activeTimeout) { + this.activeTimeout = activeTimeout; + return this; + } + + /** + * @param dynamicActiveTimeout 是否启用动态 activeTimeout 功能,如不需要请设置为 false,节省缓存请求次数 + * 对象自身 + */ + public SaTokenAdminProperties setDynamicActiveTimeout(Boolean dynamicActiveTimeout) { + this.dynamicActiveTimeout = dynamicActiveTimeout; + return this; + } + + /** + * @param isConcurrent 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录) + * 对象自身 + */ + public SaTokenAdminProperties setIsConcurrent(Boolean isConcurrent) { + this.isConcurrent = isConcurrent; + return this; + } + + /** + * @param isShare 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个token, 为 false 时每次登录新建一个 token) + * 对象自身 + */ + public SaTokenAdminProperties setIsShare(Boolean isShare) { + this.isShare = isShare; + return this; + } + + /** + * @param maxLoginCount 同一账号最大登录数量,-1代表不限 (只有在 isConcurrent=true, isShare=false 时此配置项才有意义) + * 对象自身 + */ + public SaTokenAdminProperties setMaxLoginCount(int maxLoginCount) { + this.maxLoginCount = maxLoginCount; + return this; + } + + /** + * @param maxTryTimes 在每次创建 token 时的最高循环次数,用于保证 token 唯一性(-1=不循环尝试,直接使用) + * 对象自身 + */ + public SaTokenAdminProperties setMaxTryTimes(int maxTryTimes) { + this.maxTryTimes = maxTryTimes; + return this; + } + + /** + * @param isReadBody 是否尝试从请求体里读取 token + * 对象自身 + */ + public SaTokenAdminProperties setIsReadBody(Boolean isReadBody) { + this.isReadBody = isReadBody; + return this; + } + + /** + * @param isReadHeader 是否尝试从 header 里读取 token + * 对象自身 + */ + public SaTokenAdminProperties setIsReadHeader(Boolean isReadHeader) { + this.isReadHeader = isReadHeader; + return this; + } + + /** + * @param isReadCookie 是否尝试从 cookie 里读取 token + * 对象自身 + */ + public SaTokenAdminProperties setIsReadCookie(Boolean isReadCookie) { + this.isReadCookie = isReadCookie; + return this; + } + + /** + * @param isWriteHeader 是否在登录后将 token 写入到响应头 + * 对象自身 + */ + public SaTokenAdminProperties setIsWriteHeader(Boolean isWriteHeader) { + this.isWriteHeader = isWriteHeader; + return this; + } + + /** + * @param tokenStyle token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik) + * 对象自身 + */ + public SaTokenAdminProperties setTokenStyle(String tokenStyle) { + this.tokenStyle = tokenStyle; + return this; + } + + /** + * @param dataRefreshPeriod 默认 SaTokenDao 实现类中,每次清理过期数据间隔的时间(单位: 秒),默认值30秒,设置为 -1 代表不启动定时清理 + * 对象自身 + */ + public SaTokenAdminProperties setDataRefreshPeriod(int dataRefreshPeriod) { + this.dataRefreshPeriod = dataRefreshPeriod; + return this; + } + + /** + * @param tokenSessionCheckLogin 获取 Token-Session 时是否必须登录(如果配置为true,会在每次获取 getTokenSession() 时校验当前是否登录) + * 对象自身 + */ + public SaTokenAdminProperties setTokenSessionCheckLogin(Boolean tokenSessionCheckLogin) { + this.tokenSessionCheckLogin = tokenSessionCheckLogin; + return this; + } + + /** + * @param autoRenew 是否打开自动续签 activeTimeout (如果此值为 true, 框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作) + * 对象自身 + */ + public SaTokenAdminProperties setAutoRenew(Boolean autoRenew) { + this.autoRenew = autoRenew; + return this; + } + + /** + * @param tokenPrefix token 前缀, 前端提交 token 时应该填写的固定前缀,格式样例(satoken: Bearer xxxx-xxxx-xxxx-xxxx) + * 对象自身 + */ + public SaTokenAdminProperties setTokenPrefix(String tokenPrefix) { + this.tokenPrefix = tokenPrefix; + return this; + } + + /** + * @param isPrint 是否在初始化配置时在控制台打印版本字符画 + * 对象自身 + */ + public SaTokenAdminProperties setIsPrint(Boolean isPrint) { + this.isPrint = isPrint; + return this; + } + + /** + * @param isLog 是否打印操作日志 + * 对象自身 + */ + public SaTokenAdminProperties setIsLog(Boolean isLog) { + this.isLog = isLog; + return this; + } + + /** + * @param logLevel 日志等级(trace、debug、info、warn、error、fatal),此值与 logLevelInt 联动 + * 对象自身 + */ + public SaTokenAdminProperties setLogLevel(String logLevel) { + this.logLevel = logLevel; + this.logLevelInt = SaFoxUtil.translateLogLevelToInt(logLevel); + return this; + } + + /** + * @param logLevelInt 日志等级 int 值(1=trace、2=debug、3=info、4=warn、5=error、6=fatal),此值与 logLevel 联动 + * 对象自身 + */ + public SaTokenAdminProperties setLogLevelInt(int logLevelInt) { + this.logLevelInt = logLevelInt; + this.logLevel = SaFoxUtil.translateLogLevelToString(logLevelInt); + return this; + } + + /** + * 设置:是否打印彩色日志 + * + * @param isColorLog 是否打印彩色日志 + * 对象自身 + */ + public SaTokenAdminProperties setIsColorLog(Boolean isColorLog) { + this.isColorLog = isColorLog; + return this; + } + + /** + * @param jwtSecretKey jwt秘钥(只有集成 jwt 相关模块时此参数才会生效) + * 对象自身 + */ + public SaTokenAdminProperties setJwtSecretKey(String jwtSecretKey) { + this.jwtSecretKey = jwtSecretKey; + return this; + } + + /** + * @param basic Http Basic 认证的默认账号和密码 + * 对象自身 + */ + public SaTokenAdminProperties setBasic(String basic) { + this.basic = basic; + return this; + } + + /** + * @param currDomain 配置当前项目的网络访问地址 + * 对象自身 + */ + public SaTokenAdminProperties setCurrDomain(String currDomain) { + this.currDomain = currDomain; + return this; + } + + /** + * @param sameTokenTimeout Same-Token 的有效期 (单位: 秒) + * 对象自身 + */ + public SaTokenAdminProperties setSameTokenTimeout(long sameTokenTimeout) { + this.sameTokenTimeout = sameTokenTimeout; + return this; + } + + /** + * @param checkSameToken 是否校验Same-Token(部分rpc插件有效) + * 对象自身 + */ + public SaTokenAdminProperties setCheckSameToken(Boolean checkSameToken) { + this.checkSameToken = checkSameToken; + return this; + } + + /** + * @param cookie Cookie 全局配置对象 + * 对象自身 + */ + public SaTokenAdminProperties setCookie(SaCookieConfig cookie) { + this.cookie = cookie; + return this; + } + + /** + * @param sign API 签名全局配置对象 + * 对象自身 + */ + public SaTokenAdminProperties setSign(SaSignConfig sign) { + this.sign = sign; + return this; + } + + @Override + public String toString() { + return "SaTokenConfig [" + + "tokenName=" + tokenName + + ", timeout=" + timeout + + ", activeTimeout=" + activeTimeout + + ", dynamicActiveTimeout=" + dynamicActiveTimeout + + ", isConcurrent=" + isConcurrent + + ", isShare=" + isShare + + ", maxLoginCount=" + maxLoginCount + + ", maxTryTimes=" + maxTryTimes + + ", isReadBody=" + isReadBody + + ", isReadHeader=" + isReadHeader + + ", isReadCookie=" + isReadCookie + + ", isWriteHeader=" + isWriteHeader + + ", tokenStyle=" + tokenStyle + + ", dataRefreshPeriod=" + dataRefreshPeriod + + ", tokenSessionCheckLogin=" + tokenSessionCheckLogin + + ", autoRenew=" + autoRenew + + ", tokenPrefix=" + tokenPrefix + + ", isPrint=" + isPrint + + ", isLog=" + isLog + + ", logLevel=" + logLevel + + ", logLevelInt=" + logLevelInt + + ", isColorLog=" + isColorLog + + ", jwtSecretKey=" + jwtSecretKey + + ", basic=" + basic + + ", currDomain=" + currDomain + + ", sameTokenTimeout=" + sameTokenTimeout + + ", checkSameToken=" + checkSameToken + + ", cookie=" + cookie + + ", sign=" + sign + + "]"; + } + +} diff --git a/src/main/java/com/metalloop/framework/satoken/self/StpSelfUtil.java b/src/main/java/com/metalloop/framework/satoken/self/StpSelfUtil.java new file mode 100644 index 0000000..00930e3 --- /dev/null +++ b/src/main/java/com/metalloop/framework/satoken/self/StpSelfUtil.java @@ -0,0 +1,1235 @@ +/* + * Copyright 2020-2099 sa-token.cc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.metalloop.framework.satoken.self; + +import cn.dev33.satoken.SaManager; +import cn.dev33.satoken.fun.SaFunction; +import cn.dev33.satoken.listener.SaTokenEventCenter; +import cn.dev33.satoken.session.SaSession; +import cn.dev33.satoken.session.TokenSign; +import cn.dev33.satoken.stp.SaLoginModel; +import cn.dev33.satoken.stp.SaTokenInfo; +import cn.dev33.satoken.stp.StpLogic; +import com.metalloop.common.enums.LoginType; + +import java.util.List; + +/** + * Sa-Token 权限认证工具类的二次封装,修改了账号类型,支持 自助服务终端 客户端的认证 + * + * @author zhaowenhao + * @since 2023-06-21 + */ +public class StpSelfUtil { + + private StpSelfUtil() { + } + + /** + * 多账号体系下的类型标识 + */ + public static final String TYPE = LoginType.SELF.getType(); + + /** + * 底层使用的 StpLogic 对象 + */ + public static StpLogic stpLogic = LoginType.SELF.getStpLogic(); + + /** + * 获取当前 StpLogic 的账号类型 + * + * @return / + */ + public static String getLoginType() { + return stpLogic.getLoginType(); + } + + /** + * 安全的重置 StpLogic 对象 + * + *
1、更改此账户的 StpLogic 对象 + *
2、put 到全局 StpLogic 集合中 + *
3、发送日志 + * + * @param newStpLogic / + */ + public static void setStpLogic(StpLogic newStpLogic) { + // 1、重置此账户的 StpLogic 对象 + stpLogic = newStpLogic; + + // 2、添加到全局 StpLogic 集合中 + // 以便可以通过 SaManager.getStpLogic(type) 的方式来全局获取到这个 StpLogic + SaManager.putStpLogic(newStpLogic); + + // 3、$$ 发布事件:更新了 stpLogic 对象 + SaTokenEventCenter.doSetStpLogic(stpLogic); + } + + /** + * 获取 StpLogic 对象 + * + * @return / + */ + public static StpLogic getStpLogic() { + return stpLogic; + } + + + // ------------------- 获取 token 相关 ------------------- + + /** + * 返回 token 名称,此名称在以下地方体现:Cookie 保存 token 时的名称、提交 token 时参数的名称、存储 token 时的 key 前缀 + * + * @return / + */ + public static String getTokenName() { + return stpLogic.getTokenName(); + } + + /** + * 在当前会话写入指定 token 值 + * + * @param tokenValue token 值 + */ + public static void setTokenValue(String tokenValue) { + stpLogic.setTokenValue(tokenValue); + } + + /** + * 在当前会话写入指定 token 值 + * + * @param tokenValue token 值 + * @param cookieTimeout Cookie存活时间(秒) + */ + public static void setTokenValue(String tokenValue, int cookieTimeout) { + stpLogic.setTokenValue(tokenValue, cookieTimeout); + } + + /** + * 在当前会话写入指定 token 值 + * + * @param tokenValue token 值 + * @param loginModel 登录参数 + */ + public static void setTokenValue(String tokenValue, SaLoginModel loginModel) { + stpLogic.setTokenValue(tokenValue, loginModel); + } + + /** + * 获取当前请求的 token 值 + * + * @return 当前tokenValue + */ + public static String getTokenValue() { + return stpLogic.getTokenValue(); + } + + /** + * 获取当前请求的 token 值 (不裁剪前缀) + * + * @return / + */ + public static String getTokenValueNotCut() { + return stpLogic.getTokenValueNotCut(); + } + + /** + * 获取当前会话的 token 参数信息 + * + * @return token 参数信息 + */ + public static SaTokenInfo getTokenInfo() { + return stpLogic.getTokenInfo(); + } + + + // ------------------- 登录相关操作 ------------------- + + // --- 登录 + + /** + * 会话登录 + * + * @param id 账号id,建议的类型:(long | int | String) + */ + public static void login(Object id) { + stpLogic.login(id); + } + + /** + * 会话登录,并指定登录设备类型 + * + * @param id 账号id,建议的类型:(long | int | String) + * @param device 设备类型 + */ + public static void login(Object id, String device) { + stpLogic.login(id, device); + } + + /** + * 会话登录,并指定是否 [记住我] + * + * @param id 账号id,建议的类型:(long | int | String) + * @param isLastingCookie 是否为持久Cookie,值为 true 时记住我,值为 false 时关闭浏览器需要重新登录 + */ + public static void login(Object id, boolean isLastingCookie) { + stpLogic.login(id, isLastingCookie); + } + + /** + * 会话登录,并指定此次登录 token 的有效期, 单位:秒 + * + * @param id 账号id,建议的类型:(long | int | String) + * @param timeout 此次登录 token 的有效期, 单位:秒 + */ + public static void login(Object id, long timeout) { + stpLogic.login(id, timeout); + } + + /** + * 会话登录,并指定所有登录参数 Model + * + * @param id 账号id,建议的类型:(long | int | String) + * @param loginModel 此次登录的参数Model + */ + public static void login(Object id, SaLoginModel loginModel) { + stpLogic.login(id, loginModel); + } + + /** + * 创建指定账号 id 的登录会话数据 + * + * @param id 账号id,建议的类型:(long | int | String) + * @return 返回会话令牌 + */ + public static String createLoginSession(Object id) { + return stpLogic.createLoginSession(id); + } + + /** + * 创建指定账号 id 的登录会话数据 + * + * @param id 账号id,建议的类型:(long | int | String) + * @param loginModel 此次登录的参数Model + * @return 返回会话令牌 + */ + public static String createLoginSession(Object id, SaLoginModel loginModel) { + return stpLogic.createLoginSession(id, loginModel); + } + + // --- 注销 + + /** + * 在当前客户端会话注销 + */ + public static void logout() { + stpLogic.logout(); + } + + /** + * 会话注销,根据账号id + * + * @param loginId 账号id + */ + public static void logout(Object loginId) { + stpLogic.logout(loginId); + } + + /** + * 会话注销,根据账号id 和 设备类型 + * + * @param loginId 账号id + * @param device 设备类型 (填 null 代表注销该账号的所有设备类型) + */ + public static void logout(Object loginId, String device) { + stpLogic.logout(loginId, device); + } + + /** + * 会话注销,根据指定 Token + * + * @param tokenValue 指定 token + */ + public static void logoutByTokenValue(String tokenValue) { + stpLogic.logoutByTokenValue(tokenValue); + } + + /** + * 踢人下线,根据账号id + *

当对方再次访问系统时,会抛出 NotLoginException 异常,场景值=-5

+ * + * @param loginId 账号id + */ + public static void kickout(Object loginId) { + stpLogic.kickout(loginId); + } + + /** + * 踢人下线,根据账号id 和 设备类型 + *

当对方再次访问系统时,会抛出 NotLoginException 异常,场景值=-5

+ * + * @param loginId 账号id + * @param device 设备类型 (填 null 代表踢出该账号的所有设备类型) + */ + public static void kickout(Object loginId, String device) { + stpLogic.kickout(loginId, device); + } + + /** + * 踢人下线,根据指定 token + *

当对方再次访问系统时,会抛出 NotLoginException 异常,场景值=-5

+ * + * @param tokenValue 指定 token + */ + public static void kickoutByTokenValue(String tokenValue) { + stpLogic.kickoutByTokenValue(tokenValue); + } + + /** + * 顶人下线,根据账号id 和 设备类型 + *

当对方再次访问系统时,会抛出 NotLoginException 异常,场景值=-4

+ * + * @param loginId 账号id + * @param device 设备类型 (填 null 代表顶替该账号的所有设备类型) + */ + public static void replaced(Object loginId, String device) { + stpLogic.replaced(loginId, device); + } + + // 会话查询 + + /** + * 判断当前会话是否已经登录 + * + * @return 已登录返回 true,未登录返回 false + */ + public static boolean isLogin() { + return stpLogic.isLogin(); + } + + /** + * 判断指定账号是否已经登录 + * + * @return 已登录返回 true,未登录返回 false + */ + public static boolean isLogin(Object loginId) { + return stpLogic.isLogin(loginId); + } + + /** + * 检验当前会话是否已经登录,如未登录,则抛出异常 + */ + public static void checkLogin() { + stpLogic.checkLogin(); + } + + /** + * 获取当前会话账号id,如果未登录,则抛出异常 + * + * @return 账号id + */ + public static Object getLoginId() { + return stpLogic.getLoginId(); + } + + /** + * 获取当前会话账号id, 如果未登录,则返回默认值 + * + * @param 返回类型 + * @param defaultValue 默认值 + * @return 登录id + */ + public static T getLoginId(T defaultValue) { + return stpLogic.getLoginId(defaultValue); + } + + /** + * 获取当前会话账号id, 如果未登录,则返回null + * + * @return 账号id + */ + public static Object getLoginIdDefaultNull() { + return stpLogic.getLoginIdDefaultNull(); + } + + /** + * 获取当前会话账号id, 并转换为 String 类型 + * + * @return 账号id + */ + public static String getLoginIdAsString() { + return stpLogic.getLoginIdAsString(); + } + + /** + * 获取当前会话账号id, 并转换为 int 类型 + * + * @return 账号id + */ + public static int getLoginIdAsInt() { + return stpLogic.getLoginIdAsInt(); + } + + /** + * 获取当前会话账号id, 并转换为 long 类型 + * + * @return 账号id + */ + public static long getLoginIdAsLong() { + return stpLogic.getLoginIdAsLong(); + } + + /** + * 获取指定 token 对应的账号id,如果未登录,则返回 null + * + * @param tokenValue token + * @return 账号id + */ + public static Object getLoginIdByToken(String tokenValue) { + return stpLogic.getLoginIdByToken(tokenValue); + } + + /** + * 获取当前 Token 的扩展信息(此函数只在jwt模式下生效) + * + * @param key 键值 + * @return 对应的扩展数据 + */ + public static Object getExtra(String key) { + return stpLogic.getExtra(key); + } + + /** + * 获取指定 Token 的扩展信息(此函数只在jwt模式下生效) + * + * @param tokenValue 指定的 Token 值 + * @param key 键值 + * @return 对应的扩展数据 + */ + public static Object getExtra(String tokenValue, String key) { + return stpLogic.getExtra(tokenValue, key); + } + + + // ------------------- Account-Session 相关 ------------------- + + /** + * 获取指定账号 id 的 Account-Session, 如果该 SaSession 尚未创建,isCreate=是否新建并返回 + * + * @param loginId 账号id + * @param isCreate 是否新建 + * @return SaSession 对象 + */ + public static SaSession getSessionByLoginId(Object loginId, boolean isCreate) { + return stpLogic.getSessionByLoginId(loginId, isCreate); + } + + /** + * 获取指定 key 的 SaSession, 如果该 SaSession 尚未创建,则返回 null + * + * @param sessionId SessionId + * @return Session对象 + */ + public static SaSession getSessionBySessionId(String sessionId) { + return stpLogic.getSessionBySessionId(sessionId); + } + + /** + * 获取指定账号 id 的 Account-Session,如果该 SaSession 尚未创建,则新建并返回 + * + * @param loginId 账号id + * @return SaSession 对象 + */ + public static SaSession getSessionByLoginId(Object loginId) { + return stpLogic.getSessionByLoginId(loginId); + } + + /** + * 获取当前已登录账号的 Account-Session, 如果该 SaSession 尚未创建,isCreate=是否新建并返回 + * + * @param isCreate 是否新建 + * @return Session对象 + */ + public static SaSession getSession(boolean isCreate) { + return stpLogic.getSession(isCreate); + } + + /** + * 获取当前已登录账号的 Account-Session,如果该 SaSession 尚未创建,则新建并返回 + * + * @return Session对象 + */ + public static SaSession getSession() { + return stpLogic.getSession(); + } + + + // ------------------- Token-Session 相关 ------------------- + + /** + * 获取指定 token 的 Token-Session,如果该 SaSession 尚未创建,则新建并返回 + * + * @param tokenValue Token值 + * @return Session对象 + */ + public static SaSession getTokenSessionByToken(String tokenValue) { + return stpLogic.getTokenSessionByToken(tokenValue); + } + + /** + * 获取当前 token 的 Token-Session,如果该 SaSession 尚未创建,则新建并返回 + * + * @return Session对象 + */ + public static SaSession getTokenSession() { + return stpLogic.getTokenSession(); + } + + /** + * 获取当前匿名 Token-Session (可在未登录情况下使用的Token-Session) + * + * @return Token-Session 对象 + */ + public static SaSession getAnonTokenSession() { + return stpLogic.getAnonTokenSession(); + } + + + // ------------------- Active-Timeout token 最低活跃度 验证相关 ------------------- + + /** + * 续签当前 token:(将 [最后操作时间] 更新为当前时间戳) + *

+ * 请注意: 即使 token 已被冻结 也可续签成功, + * 如果此场景下需要提示续签失败,可在此之前调用 checkActiveTimeout() 强制检查是否冻结即可 + *

+ */ + public static void updateLastActiveToNow() { + stpLogic.updateLastActiveToNow(); + } + + /** + * 检查当前 token 是否已被冻结,如果是则抛出异常 + */ + public static void checkActiveTimeout() { + stpLogic.checkActiveTimeout(); + } + + + // ------------------- 过期时间相关 ------------------- + + /** + * 获取当前会话 token 剩余有效时间(单位: 秒,返回 -1 代表永久有效,-2 代表没有这个值) + * + * @return token剩余有效时间 + */ + public static long getTokenTimeout() { + return stpLogic.getTokenTimeout(); + } + + /** + * 获取指定 token 剩余有效时间(单位: 秒,返回 -1 代表永久有效,-2 代表没有这个值) + * + * @param token 指定token + * @return token剩余有效时间 + */ + public static long getTokenTimeout(String token) { + return stpLogic.getTokenTimeout(token); + } + + /** + * 获取当前登录账号的 Account-Session 剩余有效时间(单位: 秒,返回 -1 代表永久有效,-2 代表没有这个值) + * + * @return token剩余有效时间 + */ + public static long getSessionTimeout() { + return stpLogic.getSessionTimeout(); + } + + /** + * 获取当前 token 的 Token-Session 剩余有效时间(单位: 秒,返回 -1 代表永久有效,-2 代表没有这个值) + * + * @return token剩余有效时间 + */ + public static long getTokenSessionTimeout() { + return stpLogic.getTokenSessionTimeout(); + } + + /** + * 获取当前 token 剩余活跃有效期:当前 token 距离被冻结还剩多少时间(单位: 秒,返回 -1 代表永不冻结,-2 代表没有这个值或 token 已被冻结了) + * + * @return / + */ + public static long getTokenActiveTimeout() { + return stpLogic.getTokenActiveTimeout(); + } + + /** + * 对当前 token 的 timeout 值进行续期 + * + * @param timeout 要修改成为的有效时间 (单位: 秒) + */ + public static void renewTimeout(long timeout) { + stpLogic.renewTimeout(timeout); + } + + /** + * 对指定 token 的 timeout 值进行续期 + * + * @param tokenValue 指定 token + * @param timeout 要修改成为的有效时间 (单位: 秒,填 -1 代表要续为永久有效) + */ + public static void renewTimeout(String tokenValue, long timeout) { + stpLogic.renewTimeout(tokenValue, timeout); + } + + + // ------------------- 角色认证操作 ------------------- + + /** + * 获取:当前账号的角色集合 + * + * @return / + */ + public static List getRoleList() { + return stpLogic.getRoleList(); + } + + /** + * 获取:指定账号的角色集合 + * + * @param loginId 指定账号id + * @return / + */ + public static List getRoleList(Object loginId) { + return stpLogic.getRoleList(loginId); + } + + /** + * 判断:当前账号是否拥有指定角色, 返回 true 或 false + * + * @param role 角色 + * @return / + */ + public static boolean hasRole(String role) { + return stpLogic.hasRole(role); + } + + /** + * 判断:指定账号是否含有指定角色标识, 返回 true 或 false + * + * @param loginId 账号id + * @param role 角色标识 + * @return 是否含有指定角色标识 + */ + public static boolean hasRole(Object loginId, String role) { + return stpLogic.hasRole(loginId, role); + } + + /** + * 判断:当前账号是否含有指定角色标识 [ 指定多个,必须全部验证通过 ] + * + * @param roleArray 角色标识数组 + * @return true或false + */ + public static boolean hasRoleAnd(String... roleArray) { + return stpLogic.hasRoleAnd(roleArray); + } + + /** + * 判断:当前账号是否含有指定角色标识 [ 指定多个,只要其一验证通过即可 ] + * + * @param roleArray 角色标识数组 + * @return true或false + */ + public static boolean hasRoleOr(String... roleArray) { + return stpLogic.hasRoleOr(roleArray); + } + + /** + * 校验:当前账号是否含有指定角色标识, 如果验证未通过,则抛出异常: NotRoleException + * + * @param role 角色标识 + */ + public static void checkRole(String role) { + stpLogic.checkRole(role); + } + + /** + * 校验:当前账号是否含有指定角色标识 [ 指定多个,必须全部验证通过 ] + * + * @param roleArray 角色标识数组 + */ + public static void checkRoleAnd(String... roleArray) { + stpLogic.checkRoleAnd(roleArray); + } + + /** + * 校验:当前账号是否含有指定角色标识 [ 指定多个,只要其一验证通过即可 ] + * + * @param roleArray 角色标识数组 + */ + public static void checkRoleOr(String... roleArray) { + stpLogic.checkRoleOr(roleArray); + } + + + // ------------------- 权限认证操作 ------------------- + + /** + * 获取:当前账号的权限码集合 + * + * @return / + */ + public static List getPermissionList() { + return stpLogic.getPermissionList(); + } + + /** + * 获取:指定账号的权限码集合 + * + * @param loginId 指定账号id + * @return / + */ + public static List getPermissionList(Object loginId) { + return stpLogic.getPermissionList(loginId); + } + + /** + * 判断:当前账号是否含有指定权限, 返回 true 或 false + * + * @param permission 权限码 + * @return 是否含有指定权限 + */ + public static boolean hasPermission(String permission) { + return stpLogic.hasPermission(permission); + } + + /** + * 判断:指定账号 id 是否含有指定权限, 返回 true 或 false + * + * @param loginId 账号 id + * @param permission 权限码 + * @return 是否含有指定权限 + */ + public static boolean hasPermission(Object loginId, String permission) { + return stpLogic.hasPermission(loginId, permission); + } + + /** + * 判断:当前账号是否含有指定权限 [ 指定多个,必须全部具有 ] + * + * @param permissionArray 权限码数组 + * @return true 或 false + */ + public static boolean hasPermissionAnd(String... permissionArray) { + return stpLogic.hasPermissionAnd(permissionArray); + } + + /** + * 判断:当前账号是否含有指定权限 [ 指定多个,只要其一验证通过即可 ] + * + * @param permissionArray 权限码数组 + * @return true 或 false + */ + public static boolean hasPermissionOr(String... permissionArray) { + return stpLogic.hasPermissionOr(permissionArray); + } + + /** + * 校验:当前账号是否含有指定权限, 如果验证未通过,则抛出异常: NotPermissionException + * + * @param permission 权限码 + */ + public static void checkPermission(String permission) { + stpLogic.checkPermission(permission); + } + + /** + * 校验:当前账号是否含有指定权限 [ 指定多个,必须全部验证通过 ] + * + * @param permissionArray 权限码数组 + */ + public static void checkPermissionAnd(String... permissionArray) { + stpLogic.checkPermissionAnd(permissionArray); + } + + /** + * 校验:当前账号是否含有指定权限 [ 指定多个,只要其一验证通过即可 ] + * + * @param permissionArray 权限码数组 + */ + public static void checkPermissionOr(String... permissionArray) { + stpLogic.checkPermissionOr(permissionArray); + } + + + // ------------------- id 反查 token 相关操作 ------------------- + + /** + * 获取指定账号 id 的 token + *

+ * 在配置为允许并发登录时,此方法只会返回队列的最后一个 token, + * 如果你需要返回此账号 id 的所有 token,请调用 getTokenValueListByLoginId + *

+ * + * @param loginId 账号id + * @return token值 + */ + public static String getTokenValueByLoginId(Object loginId) { + return stpLogic.getTokenValueByLoginId(loginId); + } + + /** + * 获取指定账号 id 指定设备类型端的 token + *

+ * 在配置为允许并发登录时,此方法只会返回队列的最后一个 token, + * 如果你需要返回此账号 id 的所有 token,请调用 getTokenValueListByLoginId + *

+ * + * @param loginId 账号id + * @param device 设备类型,填 null 代表不限设备类型 + * @return token值 + */ + public static String getTokenValueByLoginId(Object loginId, String device) { + return stpLogic.getTokenValueByLoginId(loginId, device); + } + + /** + * 获取指定账号 id 的 token 集合 + * + * @param loginId 账号id + * @return 此 loginId 的所有相关 token + */ + public static List getTokenValueListByLoginId(Object loginId) { + return stpLogic.getTokenValueListByLoginId(loginId); + } + + /** + * 获取指定账号 id 指定设备类型端的 token 集合 + * + * @param loginId 账号id + * @param device 设备类型,填 null 代表不限设备类型 + * @return 此 loginId 的所有登录 token + */ + public static List getTokenValueListByLoginId(Object loginId, String device) { + return stpLogic.getTokenValueListByLoginId(loginId, device); + } + + /** + * 获取指定账号 id 指定设备类型端的 tokenSign 集合 + * + * @param loginId 账号id + * @param device 设备类型,填 null 代表不限设备类型 + * @return 此 loginId 的所有登录 tokenSign + */ + public static List getTokenSignListByLoginId(Object loginId, String device) { + return stpLogic.getTokenSignListByLoginId(loginId, device); + } + + /** + * 返回当前会话的登录设备类型 + * + * @return 当前令牌的登录设备类型 + */ + public static String getLoginDevice() { + return stpLogic.getLoginDevice(); + } + + + // ------------------- 会话管理 ------------------- + + /** + * 根据条件查询缓存中所有的 token + * + * @param keyword 关键字 + * @param start 开始处索引 + * @param size 获取数量 (-1代表一直获取到末尾) + * @param sortType 排序类型(true=正序,false=反序) + * @return token集合 + */ + public static List searchTokenValue(String keyword, int start, int size, boolean sortType) { + return stpLogic.searchTokenValue(keyword, start, size, sortType); + } + + /** + * 根据条件查询缓存中所有的 SessionId + * + * @param keyword 关键字 + * @param start 开始处索引 + * @param size 获取数量 (-1代表一直获取到末尾) + * @param sortType 排序类型(true=正序,false=反序) + * @return sessionId集合 + */ + public static List searchSessionId(String keyword, int start, int size, boolean sortType) { + return stpLogic.searchSessionId(keyword, start, size, sortType); + } + + /** + * 根据条件查询缓存中所有的 Token-Session-Id + * + * @param keyword 关键字 + * @param start 开始处索引 + * @param size 获取数量 (-1代表一直获取到末尾) + * @param sortType 排序类型(true=正序,false=反序) + * @return sessionId集合 + */ + public static List searchTokenSessionId(String keyword, int start, int size, boolean sortType) { + return stpLogic.searchTokenSessionId(keyword, start, size, sortType); + } + + + // ------------------- 账号封禁 ------------------- + + /** + * 封禁:指定账号 + *

此方法不会直接将此账号id踢下线,如需封禁后立即掉线,请追加调用 StpUtil.logout(id) + * + * @param loginId 指定账号id + * @param time 封禁时间, 单位: 秒 (-1=永久封禁) + */ + public static void disable(Object loginId, long time) { + stpLogic.disable(loginId, time); + } + + /** + * 判断:指定账号是否已被封禁 (true=已被封禁, false=未被封禁) + * + * @param loginId 账号id + * @return / + */ + public static boolean isDisable(Object loginId) { + return stpLogic.isDisable(loginId); + } + + /** + * 校验:指定账号是否已被封禁,如果被封禁则抛出异常 + * + * @param loginId 账号id + */ + public static void checkDisable(Object loginId) { + stpLogic.checkDisable(loginId); + } + + /** + * 获取:指定账号剩余封禁时间,单位:秒(-1=永久封禁,-2=未被封禁) + * + * @param loginId 账号id + * @return / + */ + public static long getDisableTime(Object loginId) { + return stpLogic.getDisableTime(loginId); + } + + /** + * 解封:指定账号 + * + * @param loginId 账号id + */ + public static void untieDisable(Object loginId) { + stpLogic.untieDisable(loginId); + } + + + // ------------------- 分类封禁 ------------------- + + /** + * 封禁:指定账号的指定服务 + *

此方法不会直接将此账号id踢下线,如需封禁后立即掉线,请追加调用 StpUtil.logout(id) + * + * @param loginId 指定账号id + * @param service 指定服务 + * @param time 封禁时间, 单位: 秒 (-1=永久封禁) + */ + public static void disable(Object loginId, String service, long time) { + stpLogic.disable(loginId, service, time); + } + + /** + * 判断:指定账号的指定服务 是否已被封禁(true=已被封禁, false=未被封禁) + * + * @param loginId 账号id + * @param service 指定服务 + * @return / + */ + public static boolean isDisable(Object loginId, String service) { + return stpLogic.isDisable(loginId, service); + } + + /** + * 校验:指定账号 指定服务 是否已被封禁,如果被封禁则抛出异常 + * + * @param loginId 账号id + * @param services 指定服务,可以指定多个 + */ + public static void checkDisable(Object loginId, String... services) { + stpLogic.checkDisable(loginId, services); + } + + /** + * 获取:指定账号 指定服务 剩余封禁时间,单位:秒(-1=永久封禁,-2=未被封禁) + * + * @param loginId 账号id + * @param service 指定服务 + * @return see note + */ + public static long getDisableTime(Object loginId, String service) { + return stpLogic.getDisableTime(loginId, service); + } + + /** + * 解封:指定账号、指定服务 + * + * @param loginId 账号id + * @param services 指定服务,可以指定多个 + */ + public static void untieDisable(Object loginId, String... services) { + stpLogic.untieDisable(loginId, services); + } + + + // ------------------- 阶梯封禁 ------------------- + + /** + * 封禁:指定账号,并指定封禁等级 + * + * @param loginId 指定账号id + * @param level 指定封禁等级 + * @param time 封禁时间, 单位: 秒 (-1=永久封禁) + */ + public static void disableLevel(Object loginId, int level, long time) { + stpLogic.disableLevel(loginId, level, time); + } + + /** + * 封禁:指定账号的指定服务,并指定封禁等级 + * + * @param loginId 指定账号id + * @param service 指定封禁服务 + * @param level 指定封禁等级 + * @param time 封禁时间, 单位: 秒 (-1=永久封禁) + */ + public static void disableLevel(Object loginId, String service, int level, long time) { + stpLogic.disableLevel(loginId, service, level, time); + } + + /** + * 判断:指定账号是否已被封禁到指定等级 + * + * @param loginId 指定账号id + * @param level 指定封禁等级 + * @return / + */ + public static boolean isDisableLevel(Object loginId, int level) { + return stpLogic.isDisableLevel(loginId, level); + } + + /** + * 判断:指定账号的指定服务,是否已被封禁到指定等级 + * + * @param loginId 指定账号id + * @param service 指定封禁服务 + * @param level 指定封禁等级 + * @return / + */ + public static boolean isDisableLevel(Object loginId, String service, int level) { + return stpLogic.isDisableLevel(loginId, service, level); + } + + /** + * 校验:指定账号是否已被封禁到指定等级(如果已经达到,则抛出异常) + * + * @param loginId 指定账号id + * @param level 封禁等级 (只有 封禁等级 ≥ 此值 才会抛出异常) + */ + public static void checkDisableLevel(Object loginId, int level) { + stpLogic.checkDisableLevel(loginId, level); + } + + /** + * 校验:指定账号的指定服务,是否已被封禁到指定等级(如果已经达到,则抛出异常) + * + * @param loginId 指定账号id + * @param service 指定封禁服务 + * @param level 封禁等级 (只有 封禁等级 ≥ 此值 才会抛出异常) + */ + public static void checkDisableLevel(Object loginId, String service, int level) { + stpLogic.checkDisableLevel(loginId, service, level); + } + + /** + * 获取:指定账号被封禁的等级,如果未被封禁则返回-2 + * + * @param loginId 指定账号id + * @return / + */ + public static int getDisableLevel(Object loginId) { + return stpLogic.getDisableLevel(loginId); + } + + /** + * 获取:指定账号的 指定服务 被封禁的等级,如果未被封禁则返回-2 + * + * @param loginId 指定账号id + * @param service 指定封禁服务 + * @return / + */ + public static int getDisableLevel(Object loginId, String service) { + return stpLogic.getDisableLevel(loginId, service); + } + + + // ------------------- 临时身份切换 ------------------- + + /** + * 临时切换身份为指定账号id + * + * @param loginId 指定loginId + */ + public static void switchTo(Object loginId) { + stpLogic.switchTo(loginId); + } + + /** + * 结束临时切换身份 + */ + public static void endSwitch() { + stpLogic.endSwitch(); + } + + /** + * 判断当前请求是否正处于 [ 身份临时切换 ] 中 + * + * @return / + */ + public static boolean isSwitch() { + return stpLogic.isSwitch(); + } + + /** + * 在一个 lambda 代码段里,临时切换身份为指定账号id,lambda 结束后自动恢复 + * + * @param loginId 指定账号id + * @param function 要执行的方法 + */ + public static void switchTo(Object loginId, SaFunction function) { + stpLogic.switchTo(loginId, function); + } + + + // ------------------- 二级认证 ------------------- + + /** + * 在当前会话 开启二级认证 + * + * @param safeTime 维持时间 (单位: 秒) + */ + public static void openSafe(long safeTime) { + stpLogic.openSafe(safeTime); + } + + /** + * 在当前会话 开启二级认证 + * + * @param service 业务标识 + * @param safeTime 维持时间 (单位: 秒) + */ + public static void openSafe(String service, long safeTime) { + stpLogic.openSafe(service, safeTime); + } + + /** + * 判断:当前会话是否处于二级认证时间内 + * + * @return true=二级认证已通过, false=尚未进行二级认证或认证已超时 + */ + public static boolean isSafe() { + return stpLogic.isSafe(); + } + + /** + * 判断:当前会话 是否处于指定业务的二级认证时间内 + * + * @param service 业务标识 + * @return true=二级认证已通过, false=尚未进行二级认证或认证已超时 + */ + public static boolean isSafe(String service) { + return stpLogic.isSafe(service); + } + + /** + * 判断:指定 token 是否处于二级认证时间内 + * + * @param tokenValue Token 值 + * @param service 业务标识 + * @return true=二级认证已通过, false=尚未进行二级认证或认证已超时 + */ + public static boolean isSafe(String tokenValue, String service) { + return stpLogic.isSafe(tokenValue, service); + } + + /** + * 校验:当前会话是否已通过二级认证,如未通过则抛出异常 + */ + public static void checkSafe() { + stpLogic.checkSafe(); + } + + /** + * 校验:检查当前会话是否已通过指定业务的二级认证,如未通过则抛出异常 + * + * @param service 业务标识 + */ + public static void checkSafe(String service) { + stpLogic.checkSafe(service); + } + + /** + * 获取:当前会话的二级认证剩余有效时间(单位: 秒, 返回-2代表尚未通过二级认证) + * + * @return 剩余有效时间 + */ + public static long getSafeTime() { + return stpLogic.getSafeTime(); + } + + /** + * 获取:当前会话的二级认证剩余有效时间(单位: 秒, 返回-2代表尚未通过二级认证) + * + * @param service 业务标识 + * @return 剩余有效时间 + */ + public static long getSafeTime(String service) { + return stpLogic.getSafeTime(service); + } + + /** + * 在当前会话 结束二级认证 + */ + public static void closeSafe() { + stpLogic.closeSafe(); + } + + /** + * 在当前会话 结束指定业务标识的二级认证 + * + * @param service 业务标识 + */ + public static void closeSafe(String service) { + stpLogic.closeSafe(service); + } + +} diff --git a/src/main/java/com/metalloop/framework/satoken/self/config/SaTokenSelfConfiguration.java b/src/main/java/com/metalloop/framework/satoken/self/config/SaTokenSelfConfiguration.java new file mode 100644 index 0000000..9799a9d --- /dev/null +++ b/src/main/java/com/metalloop/framework/satoken/self/config/SaTokenSelfConfiguration.java @@ -0,0 +1,34 @@ +package com.metalloop.framework.satoken.self.config; + +import cn.dev33.satoken.config.SaTokenConfig; +import com.metalloop.framework.satoken.self.StpSelfUtil; +import jakarta.annotation.PostConstruct; +import org.springframework.beans.BeanUtils; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + + +/** + * 自助服务终端 Sa-Token 配置类,目标是提供一个支持配置的开箱即用的StpSelfUtil + * + * @author zhaowenhao + * @since 2023-11-17 + */ +@Configuration +@EnableConfigurationProperties(SaTokenSelfProperties.class) +public class SaTokenSelfConfiguration { + private final SaTokenSelfProperties saTokenSelfProperties; + + public SaTokenSelfConfiguration(SaTokenSelfProperties saTokenSelfProperties) { + this.saTokenSelfProperties = saTokenSelfProperties; + } + + // 使用注入的 SaTokenSelfProperties 来配置 StpUtil 或其他组件 + @PostConstruct + public void init() { + SaTokenConfig config = new SaTokenConfig(); + // 拷贝属性 + BeanUtils.copyProperties(saTokenSelfProperties, config); + StpSelfUtil.getStpLogic().setConfig(config); + } +} diff --git a/src/main/java/com/metalloop/framework/satoken/self/config/SaTokenSelfProperties.java b/src/main/java/com/metalloop/framework/satoken/self/config/SaTokenSelfProperties.java new file mode 100644 index 0000000..21eb326 --- /dev/null +++ b/src/main/java/com/metalloop/framework/satoken/self/config/SaTokenSelfProperties.java @@ -0,0 +1,561 @@ +package com.metalloop.framework.satoken.self.config; + +import cn.dev33.satoken.config.SaCookieConfig; +import cn.dev33.satoken.config.SaSignConfig; +import cn.dev33.satoken.util.SaFoxUtil; +import lombok.Getter; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.io.Serializable; + +/** + * 复制自 Sa-Token cn.dev33.satoken.config.SaTokenConfig,升级版本时需要注意重新复制,目的是为了使用两套配置, + * 但是又不能影响原框架的注入问题 + * + * @author zhaowenhao + * @since 2023-11-20 + */ +@Getter +@ConfigurationProperties(prefix = "sa-token.self") +public class SaTokenSelfProperties implements Serializable { + + private static final long serialVersionUID = -6541180061782004705L; + + /** + * token 名称 (同时也是: cookie 名称、提交 token 时参数的名称、存储 token 时的 key 前缀) + * -- GETTER -- + *

+ * token 名称 (同时也是: cookie 名称、提交 token 时参数的名称、存储 token 时的 key 前缀) + */ + private String tokenName = "satoken"; + + /** + * token 有效期(单位:秒) 默认30天,-1 代表永久有效 + * -- GETTER -- + *

+ * token 有效期(单位:秒) 默认30天,-1 代表永久有效 + */ + private long timeout = 60 * 60 * 24 * 30; + + /** + * token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结 + * (例如可以设置为 1800 代表 30 分钟内无操作就冻结) + * -- GETTER -- + *

+ * token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结 + * (例如可以设置为 1800 代表 30 分钟内无操作就冻结) + */ + private long activeTimeout = -1; + + /** + * 是否启用动态 activeTimeout 功能,如不需要请设置为 false,节省缓存请求次数 + * -- GETTER -- + *

+ * 是否启用动态 activeTimeout 功能,如不需要请设置为 false,节省缓存请求次数 + */ + private Boolean dynamicActiveTimeout = false; + + /** + * 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录) + * -- GETTER -- + *

+ * 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录) + */ + private Boolean isConcurrent = true; + + /** + * 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token) + * -- GETTER -- + *

+ * 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个token, 为 false 时每次登录新建一个 token) + */ + private Boolean isShare = true; + + /** + * 同一账号最大登录数量,-1代表不限 (只有在 isConcurrent=true, isShare=false 时此配置项才有意义) + * -- GETTER -- + *

+ * 同一账号最大登录数量,-1代表不限 (只有在 isConcurrent=true, isShare=false 时此配置项才有意义) + */ + private int maxLoginCount = 12; + + /** + * 在每次创建 token 时的最高循环次数,用于保证 token 唯一性(-1=不循环尝试,直接使用) + * -- GETTER -- + *

+ * 在每次创建 token 时的最高循环次数,用于保证 token 唯一性(-1=不循环尝试,直接使用) + */ + private int maxTryTimes = 12; + + /** + * 是否尝试从请求体里读取 token + * -- GETTER -- + *

+ * 是否尝试从请求体里读取 token + */ + private Boolean isReadBody = true; + + /** + * 是否尝试从 header 里读取 token + * -- GETTER -- + *

+ * 是否尝试从 header 里读取 token + */ + private Boolean isReadHeader = true; + + /** + * 是否尝试从 cookie 里读取 token + * -- GETTER -- + *

+ * 是否尝试从 cookie 里读取 token + */ + private Boolean isReadCookie = true; + + /** + * 是否在登录后将 token 写入到响应头 + * -- GETTER -- + *

+ * 是否在登录后将 token 写入到响应头 + */ + private Boolean isWriteHeader = false; + + /** + * token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik) + * -- GETTER -- + *

+ * token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik) + */ + private String tokenStyle = "uuid"; + + /** + * 默认 SaTokenDao 实现类中,每次清理过期数据间隔的时间(单位: 秒),默认值30秒,设置为 -1 代表不启动定时清理 + * -- GETTER -- + *

+ * 默认 SaTokenDao 实现类中,每次清理过期数据间隔的时间(单位: 秒),默认值30秒,设置为 -1 代表不启动定时清理 + */ + private int dataRefreshPeriod = 30; + + /** + * 获取 Token-Session 时是否必须登录(如果配置为true,会在每次获取 getTokenSession() 时校验当前是否登录) + * -- GETTER -- + *

+ * 获取 Token-Session 时是否必须登录(如果配置为true,会在每次获取 getTokenSession() 时校验当前是否登录) + */ + private Boolean tokenSessionCheckLogin = true; + + /** + * 是否打开自动续签 activeTimeout (如果此值为 true, 框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作) + * -- GETTER -- + *

+ * 是否打开自动续签 activeTimeout (如果此值为 true, 框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作) + */ + private Boolean autoRenew = true; + + /** + * token 前缀, 前端提交 token 时应该填写的固定前缀,格式样例(satoken: Bearer xxxx-xxxx-xxxx-xxxx) + * -- GETTER -- + *

+ * token 前缀, 前端提交 token 时应该填写的固定前缀,格式样例(satoken: Bearer xxxx-xxxx-xxxx-xxxx) + */ + private String tokenPrefix; + + /** + * 是否在初始化配置时在控制台打印版本字符画 + * -- GETTER -- + *

+ * 是否在初始化配置时在控制台打印版本字符画 + */ + private Boolean isPrint = true; + + /** + * 是否打印操作日志 + * -- GETTER -- + *

+ * 是否打印操作日志 + */ + private Boolean isLog = false; + + /** + * 日志等级(trace、debug、info、warn、error、fatal),此值与 logLevelInt 联动 + * -- GETTER -- + *

+ * 日志等级(trace、debug、info、warn、error、fatal),此值与 logLevelInt 联动 + */ + private String logLevel = "trace"; + + /** + * 日志等级 int 值(1=trace、2=debug、3=info、4=warn、5=error、6=fatal),此值与 logLevel 联动 + * -- GETTER -- + *

+ * 日志等级 int 值(1=trace、2=debug、3=info、4=warn、5=error、6=fatal),此值与 logLevel 联动 + */ + private int logLevelInt = 1; + + /** + * 是否打印彩色日志 + * -- GETTER -- + * 获取:是否打印彩色日志 + *

+ * isColorLog 是否打印彩色日志 + */ + private Boolean isColorLog = null; + + /** + * jwt秘钥(只有集成 jwt 相关模块时此参数才会生效) + * -- GETTER -- + *

+ * jwt秘钥(只有集成 jwt 相关模块时此参数才会生效) + */ + private String jwtSecretKey; + + /** + * Http Basic 认证的默认账号和密码 + * -- GETTER -- + *

+ * Http Basic 认证的默认账号和密码 + */ + private String basic = ""; + + /** + * 配置当前项目的网络访问地址 + * -- GETTER -- + *

+ * 配置当前项目的网络访问地址 + */ + private String currDomain; + + /** + * Same-Token 的有效期 (单位: 秒) + * -- GETTER -- + *

+ * Same-Token 的有效期 (单位: 秒) + */ + private long sameTokenTimeout = 60 * 60 * 24; + + /** + * 是否校验 Same-Token(部分rpc插件有效) + * -- GETTER -- + *

+ * 是否校验Same-Token(部分rpc插件有效) + */ + private Boolean checkSameToken = false; + + /** + * Cookie配置对象 + * -- GETTER -- + *

+ * Cookie 全局配置对象 + */ + public SaCookieConfig cookie = new SaCookieConfig(); + + /** + * API 签名配置对象 + * -- GETTER -- + *

+ * API 签名全局配置对象 + */ + public SaSignConfig sign = new SaSignConfig(); + + + /** + * @param tokenName token 名称 (同时也是: cookie 名称、提交 token 时参数的名称、存储 token 时的 key 前缀) + * 对象自身 + */ + public SaTokenSelfProperties setTokenName(String tokenName) { + this.tokenName = tokenName; + return this; + } + + /** + * @param timeout token 有效期(单位:秒) 默认30天,-1 代表永久有效 + * 对象自身 + */ + public SaTokenSelfProperties setTimeout(long timeout) { + this.timeout = timeout; + return this; + } + + /** + * @param activeTimeout token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结 + * (例如可以设置为 1800 代表 30 分钟内无操作就冻结) + * 对象自身 + */ + public SaTokenSelfProperties setActiveTimeout(long activeTimeout) { + this.activeTimeout = activeTimeout; + return this; + } + + /** + * @param dynamicActiveTimeout 是否启用动态 activeTimeout 功能,如不需要请设置为 false,节省缓存请求次数 + * 对象自身 + */ + public SaTokenSelfProperties setDynamicActiveTimeout(Boolean dynamicActiveTimeout) { + this.dynamicActiveTimeout = dynamicActiveTimeout; + return this; + } + + /** + * @param isConcurrent 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录) + * 对象自身 + */ + public SaTokenSelfProperties setIsConcurrent(Boolean isConcurrent) { + this.isConcurrent = isConcurrent; + return this; + } + + /** + * @param isShare 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个token, 为 false 时每次登录新建一个 token) + * 对象自身 + */ + public SaTokenSelfProperties setIsShare(Boolean isShare) { + this.isShare = isShare; + return this; + } + + /** + * @param maxLoginCount 同一账号最大登录数量,-1代表不限 (只有在 isConcurrent=true, isShare=false 时此配置项才有意义) + * 对象自身 + */ + public SaTokenSelfProperties setMaxLoginCount(int maxLoginCount) { + this.maxLoginCount = maxLoginCount; + return this; + } + + /** + * @param maxTryTimes 在每次创建 token 时的最高循环次数,用于保证 token 唯一性(-1=不循环尝试,直接使用) + * 对象自身 + */ + public SaTokenSelfProperties setMaxTryTimes(int maxTryTimes) { + this.maxTryTimes = maxTryTimes; + return this; + } + + /** + * @param isReadBody 是否尝试从请求体里读取 token + * 对象自身 + */ + public SaTokenSelfProperties setIsReadBody(Boolean isReadBody) { + this.isReadBody = isReadBody; + return this; + } + + /** + * @param isReadHeader 是否尝试从 header 里读取 token + * 对象自身 + */ + public SaTokenSelfProperties setIsReadHeader(Boolean isReadHeader) { + this.isReadHeader = isReadHeader; + return this; + } + + /** + * @param isReadCookie 是否尝试从 cookie 里读取 token + * 对象自身 + */ + public SaTokenSelfProperties setIsReadCookie(Boolean isReadCookie) { + this.isReadCookie = isReadCookie; + return this; + } + + /** + * @param isWriteHeader 是否在登录后将 token 写入到响应头 + * 对象自身 + */ + public SaTokenSelfProperties setIsWriteHeader(Boolean isWriteHeader) { + this.isWriteHeader = isWriteHeader; + return this; + } + + /** + * @param tokenStyle token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik) + * 对象自身 + */ + public SaTokenSelfProperties setTokenStyle(String tokenStyle) { + this.tokenStyle = tokenStyle; + return this; + } + + /** + * @param dataRefreshPeriod 默认 SaTokenDao 实现类中,每次清理过期数据间隔的时间(单位: 秒),默认值30秒,设置为 -1 代表不启动定时清理 + * 对象自身 + */ + public SaTokenSelfProperties setDataRefreshPeriod(int dataRefreshPeriod) { + this.dataRefreshPeriod = dataRefreshPeriod; + return this; + } + + /** + * @param tokenSessionCheckLogin 获取 Token-Session 时是否必须登录(如果配置为true,会在每次获取 getTokenSession() 时校验当前是否登录) + * 对象自身 + */ + public SaTokenSelfProperties setTokenSessionCheckLogin(Boolean tokenSessionCheckLogin) { + this.tokenSessionCheckLogin = tokenSessionCheckLogin; + return this; + } + + /** + * @param autoRenew 是否打开自动续签 activeTimeout (如果此值为 true, 框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作) + * 对象自身 + */ + public SaTokenSelfProperties setAutoRenew(Boolean autoRenew) { + this.autoRenew = autoRenew; + return this; + } + + /** + * @param tokenPrefix token 前缀, 前端提交 token 时应该填写的固定前缀,格式样例(satoken: Bearer xxxx-xxxx-xxxx-xxxx) + * 对象自身 + */ + public SaTokenSelfProperties setTokenPrefix(String tokenPrefix) { + this.tokenPrefix = tokenPrefix; + return this; + } + + /** + * @param isPrint 是否在初始化配置时在控制台打印版本字符画 + * 对象自身 + */ + public SaTokenSelfProperties setIsPrint(Boolean isPrint) { + this.isPrint = isPrint; + return this; + } + + /** + * @param isLog 是否打印操作日志 + * 对象自身 + */ + public SaTokenSelfProperties setIsLog(Boolean isLog) { + this.isLog = isLog; + return this; + } + + /** + * @param logLevel 日志等级(trace、debug、info、warn、error、fatal),此值与 logLevelInt 联动 + * 对象自身 + */ + public SaTokenSelfProperties setLogLevel(String logLevel) { + this.logLevel = logLevel; + this.logLevelInt = SaFoxUtil.translateLogLevelToInt(logLevel); + return this; + } + + /** + * @param logLevelInt 日志等级 int 值(1=trace、2=debug、3=info、4=warn、5=error、6=fatal),此值与 logLevel 联动 + * 对象自身 + */ + public SaTokenSelfProperties setLogLevelInt(int logLevelInt) { + this.logLevelInt = logLevelInt; + this.logLevel = SaFoxUtil.translateLogLevelToString(logLevelInt); + return this; + } + + /** + * 设置:是否打印彩色日志 + * + * @param isColorLog 是否打印彩色日志 + * 对象自身 + */ + public SaTokenSelfProperties setIsColorLog(Boolean isColorLog) { + this.isColorLog = isColorLog; + return this; + } + + /** + * @param jwtSecretKey jwt秘钥(只有集成 jwt 相关模块时此参数才会生效) + * 对象自身 + */ + public SaTokenSelfProperties setJwtSecretKey(String jwtSecretKey) { + this.jwtSecretKey = jwtSecretKey; + return this; + } + + /** + * @param basic Http Basic 认证的默认账号和密码 + * 对象自身 + */ + public SaTokenSelfProperties setBasic(String basic) { + this.basic = basic; + return this; + } + + /** + * @param currDomain 配置当前项目的网络访问地址 + * 对象自身 + */ + public SaTokenSelfProperties setCurrDomain(String currDomain) { + this.currDomain = currDomain; + return this; + } + + /** + * @param sameTokenTimeout Same-Token 的有效期 (单位: 秒) + * 对象自身 + */ + public SaTokenSelfProperties setSameTokenTimeout(long sameTokenTimeout) { + this.sameTokenTimeout = sameTokenTimeout; + return this; + } + + /** + * @param checkSameToken 是否校验Same-Token(部分rpc插件有效) + * 对象自身 + */ + public SaTokenSelfProperties setCheckSameToken(Boolean checkSameToken) { + this.checkSameToken = checkSameToken; + return this; + } + + /** + * @param cookie Cookie 全局配置对象 + * 对象自身 + */ + public SaTokenSelfProperties setCookie(SaCookieConfig cookie) { + this.cookie = cookie; + return this; + } + + /** + * @param sign API 签名全局配置对象 + * 对象自身 + */ + public SaTokenSelfProperties setSign(SaSignConfig sign) { + this.sign = sign; + return this; + } + + @Override + public String toString() { + return "SaTokenConfig [" + + "tokenName=" + tokenName + + ", timeout=" + timeout + + ", activeTimeout=" + activeTimeout + + ", dynamicActiveTimeout=" + dynamicActiveTimeout + + ", isConcurrent=" + isConcurrent + + ", isShare=" + isShare + + ", maxLoginCount=" + maxLoginCount + + ", maxTryTimes=" + maxTryTimes + + ", isReadBody=" + isReadBody + + ", isReadHeader=" + isReadHeader + + ", isReadCookie=" + isReadCookie + + ", isWriteHeader=" + isWriteHeader + + ", tokenStyle=" + tokenStyle + + ", dataRefreshPeriod=" + dataRefreshPeriod + + ", tokenSessionCheckLogin=" + tokenSessionCheckLogin + + ", autoRenew=" + autoRenew + + ", tokenPrefix=" + tokenPrefix + + ", isPrint=" + isPrint + + ", isLog=" + isLog + + ", logLevel=" + logLevel + + ", logLevelInt=" + logLevelInt + + ", isColorLog=" + isColorLog + + ", jwtSecretKey=" + jwtSecretKey + + ", basic=" + basic + + ", currDomain=" + currDomain + + ", sameTokenTimeout=" + sameTokenTimeout + + ", checkSameToken=" + checkSameToken + + ", cookie=" + cookie + + ", sign=" + sign + + "]"; + } + +} diff --git a/src/main/java/com/metalloop/framework/swagger/OpenApiConfig.java b/src/main/java/com/metalloop/framework/swagger/OpenApiConfig.java new file mode 100644 index 0000000..1cfea89 --- /dev/null +++ b/src/main/java/com/metalloop/framework/swagger/OpenApiConfig.java @@ -0,0 +1,40 @@ +package com.metalloop.framework.swagger; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Springdoc OpenAPI 配置类 + * 用于定制 API 文档信息及全局安全认证方案 + */ +@Configuration +public class OpenApiConfig { + + @Bean + public OpenAPI customOpenAPI() { + return new OpenAPI() + // 设置 API 基本信息 + .info(new Info() + .title("有色再生资源交易平台 API") + .version("1.0") + .description("METALLOOP 后端接口文档") + ) + // 声明全局安全要求(在 Swagger UI 中显示 Authorize 按钮) + .addSecurityItem(new SecurityRequirement().addList("Sa-Token")) + // 定义安全方案(API Key 方式) + .components(new Components() + .addSecuritySchemes("Sa-Token", + new SecurityScheme() + .type(SecurityScheme.Type.APIKEY) + .in(SecurityScheme.In.HEADER) + .name("metalloop-token") // 与 Sa-Token 配置的 token-name 保持一致 + .description("Sa-Token 认证令牌,登录后获取") + ) + ); + } +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/auth/controller/AuthController.java b/src/main/java/com/metalloop/modules/auth/controller/AuthController.java new file mode 100644 index 0000000..3478570 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/controller/AuthController.java @@ -0,0 +1,285 @@ +package com.metalloop.modules.auth.controller; + +import cn.dev33.satoken.session.SaSession; +import com.metalloop.common.auth.Authentication; +import com.metalloop.common.auth.handler.LoginSuccessHandler; +import com.metalloop.common.auth.handler.LogoutSuccessHandler; +import com.metalloop.common.auth.handler.PasswordCheckFailureHandler; +import com.metalloop.common.auth.handler.VerifyCodeHandler; +import com.metalloop.common.auth.model.AuthenticationMiniAppRequest; +import com.metalloop.common.auth.password.PasswordDecryptor; +import com.metalloop.common.auth.sso.SsoCodeService; +import com.metalloop.common.auth.sso.model.SsoUserInfo; +import com.metalloop.common.auth.userdetails.UserDetails; +import com.metalloop.common.auth.userdetails.UserDetailsService; +import com.metalloop.common.constant.SecurityConstants; +import com.metalloop.common.enums.LoginType; +import com.metalloop.common.exception.*; +import com.metalloop.common.model.Result; +import com.metalloop.common.utils.IPHelper; +import com.metalloop.modules.auth.model.req.AuthenticationRequest; +import jakarta.servlet.http.HttpServletRequest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + + + +/** + * 认证授权端点 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public class AuthController { + + private final Log logger = LogFactory.getLog(getClass()); + + private final LoginType loginType; + + private final UserDetailsService userDetailsService; + + private final LoginSuccessHandler loginSuccessHandler; + private final LogoutSuccessHandler logoutSuccessHandler; + + private final PasswordDecryptor passwordDecryptor; + + private final PasswordEncoder passwordEncoder; + + private final VerifyCodeHandler verifyCodeHandler; + + private final PasswordCheckFailureHandler passwordCheckFailureHandler; + + /** + * 单点登陆授权码服务 + */ + private SsoCodeService ssoCodeService; + + /** + * 单点登陆授权码超时时间,单位:秒 + */ + private int ssoCodeTimeOut = 300; + + public void initSso(SsoCodeService ssoCodeService, int ssoCodeTimeOut) { + this.ssoCodeService = ssoCodeService; + this.ssoCodeTimeOut = ssoCodeTimeOut; + } + + public AuthController(LoginType loginType, UserDetailsService userDetailsService, LoginSuccessHandler loginSuccessHandler, + LogoutSuccessHandler logoutSuccessHandler, PasswordDecryptor passwordDecryptor, PasswordEncoder passwordEncoder + , VerifyCodeHandler verifyCodeHandler, PasswordCheckFailureHandler passwordCheckFailureHandler) { + this.loginType = loginType; + this.userDetailsService = userDetailsService; + this.loginSuccessHandler = loginSuccessHandler; + this.logoutSuccessHandler = logoutSuccessHandler; + this.passwordDecryptor = passwordDecryptor; + this.passwordEncoder = passwordEncoder; + this.verifyCodeHandler = verifyCodeHandler; + this.passwordCheckFailureHandler = passwordCheckFailureHandler; + } + + @ResponseBody + public Object getVerifyCode(@RequestBody @Validated AuthenticationRequest request, HttpServletRequest httpServletRequest) { + // 用户名、密码校验 + UserDetails userDetails = loginVerify(request, httpServletRequest); + if (verifyCodeHandler.createVerifyCode(userDetails.getPhoneNum())) { + return Result.ok("发送验证码成功"); + } else { + return Result.fail("发送验证码失败"); + } + } + + + @ResponseBody + public Object login(@RequestBody @Validated AuthenticationRequest request, HttpServletRequest httpServletRequest) { + + // 用户名、密码校验 + UserDetails userDetails = loginVerify(request, httpServletRequest); + + // 在sa-token中进行登录操作 + loginType.getStpLogic().login(userDetails.getUserId()); + String accessToken = loginType.getStpLogic().getTokenValue(); + SaSession session = loginType.getStpLogic().getSession(); + + // 将登录成功的认证信息封装至session中 + Authentication authentication = Authentication.withUserDetails(userDetails).accessToken(accessToken).build(); + session.set(SecurityConstants.SESSION_KEY_AUTHENTICATION, authentication); + + // 登录成功响应结果处理器 + return loginSuccessHandler.onSuccess(authentication); + } + + + /** + * 用户名、密码校验 + */ + private UserDetails loginVerify(AuthenticationRequest request, HttpServletRequest servletRequest) { + String username = request.getUsername(); + String password = request.getPassword(); + + // 获取用户ip + String ip = IPHelper.getIpAddr(servletRequest); + + // 从 UserDetailsService 加载用户并验证用户名和密码 + UserDetails userDetails; + try { + userDetails = userDetailsService.loadUserByUsername(username); + } catch (UsernameNotFoundException ex) { + this.logger.debug("未找到用户: '" + username + "'"); + throw new BadCredentialsException("用户名或密码错误"); + } + if (userDetails == null) { + this.logger.debug("未找到用户: '" + username + "'"); + throw new BadCredentialsException("用户名或密码错误"); + } + + // 验证用户账号状态 + if (!userDetails.isAccountNonLocked()) { + this.logger.debug("账号被锁定"); + passwordCheckFailureHandler.checkAccountLockStatus(ip, userDetails); + } + if (!userDetails.isEnabled()) { + this.logger.debug("账号被禁用"); + throw new DisabledException("账号被禁用"); + } + if (!userDetails.isAccountNonExpired()) { + this.logger.debug("账号已过期"); + throw new AccountExpiredException("账号已过期"); + } + if (!userDetails.isCredentialsNonExpired()) { + this.logger.debug("密码已过期"); + throw new CredentialsExpiredException("密码已过期"); + } + + // 验证密码 + String presentedPassword = password; + + // 密码解密 + if (passwordDecryptor != null) { + presentedPassword = passwordDecryptor.decrypt(presentedPassword); + } + + // 密码匹配 + if (!passwordEncoder.matches(presentedPassword, userDetails.getPassword())) { + logger.debug("密码错误"); + throw new BadCredentialsException("用户名或密码错误"); + } + + return userDetails; + } + + /** + * 用户名、密码校验 + */ + private UserDetails loginVerifyForMiniApp(AuthenticationMiniAppRequest request, HttpServletRequest servletRequest) { + String username = request.getUsername(); + String password = request.getPassword(); + + // 获取用户ip + String ip = IPHelper.getIpAddr(servletRequest); + + // 从 UserDetailsService 加载用户并验证用户名和密码 + UserDetails userDetails; + try { + userDetails = userDetailsService.loadUserByUsername(username); + } catch (UsernameNotFoundException ex) { + this.logger.debug("未找到用户: '" + username + "'"); + throw new BadCredentialsException("用户名或密码错误"); + } + if (userDetails == null) { + this.logger.debug("未找到用户: '" + username + "'"); + throw new BadCredentialsException("用户名或密码错误"); + } + + // 验证用户账号状态 + if (!userDetails.isAccountNonLocked()) { + this.logger.debug("账号被锁定"); + passwordCheckFailureHandler.checkAccountLockStatus(ip, userDetails); + } + if (!userDetails.isEnabled()) { + this.logger.debug("账号被禁用"); + throw new DisabledException("账号被禁用"); + } + if (!userDetails.isAccountNonExpired()) { + this.logger.debug("账号已过期"); + throw new AccountExpiredException("账号已过期"); + } + if (!userDetails.isCredentialsNonExpired()) { + this.logger.debug("密码已过期"); + throw new CredentialsExpiredException("密码已过期"); + } + + // 验证密码 + String presentedPassword = password; + + // 密码解密 + if (passwordDecryptor != null) { + presentedPassword = passwordDecryptor.decrypt(presentedPassword); + } + + // 密码匹配 + if (!passwordEncoder.matches(presentedPassword, userDetails.getPassword())) { + logger.debug("密码错误"); + throw new BadCredentialsException("用户名或密码错误"); + } + + return userDetails; + } + + @ResponseBody + public Object logout() { + Object o = loginType.getStpLogic().getSession().get(SecurityConstants.SESSION_KEY_AUTHENTICATION); + Authentication authentication = null; + if (o instanceof Authentication) { + authentication = (Authentication) o; + } + loginType.getStpLogic().logout(); + // 登出成功响应结果处理器 + return logoutSuccessHandler.onSuccess(authentication); + } + + @ResponseBody + public Object miniAppLogout() { + Object o = loginType.getStpLogic().getSession().get(SecurityConstants.SESSION_KEY_AUTHENTICATION); + Authentication authentication = null; + if (o instanceof Authentication) { + authentication = (Authentication) o; + } + loginType.getStpLogic().logout(); + // 登出成功响应结果处理器 + return logoutSuccessHandler.onSuccess(authentication); + } + + @ResponseBody + public Object getSsoCode() { + // 验证当前会话是否有效 + if (loginType.getStpLogic().isLogin()) { + Object o = loginType.getStpLogic().getSession().get(SecurityConstants.SESSION_KEY_AUTHENTICATION); + Authentication authentication = null; + if (o instanceof Authentication) { + authentication = (Authentication) o; + } + if (authentication != null) { + // 签发授权码 + String authorizationCode = ssoCodeService.generateCode(authentication.getUserId(), ssoCodeTimeOut); + return Result.ok(authorizationCode); + } + } + return Result.fail("当前会话无效"); + + } + + @ResponseBody + public Object getSsoUserInfo(@RequestParam("code") String code) { + // 验证授权码并获取绑定的用户信息 + SsoUserInfo userInfo = ssoCodeService.validateCode(code); + + // 登录成功响应结果处理器 + return Result.ok(userInfo); + } + +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/auth/controller/RsaPublicKeyController.java b/src/main/java/com/metalloop/modules/auth/controller/RsaPublicKeyController.java new file mode 100644 index 0000000..9f5939d --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/controller/RsaPublicKeyController.java @@ -0,0 +1,37 @@ +package com.metalloop.modules.auth.controller; + +import com.metalloop.common.auth.encrypt.KeyProperties; +import com.metalloop.common.auth.encrypt.KeyStoreKeyFactory; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.security.KeyPair; +import java.security.PublicKey; +import java.security.interfaces.RSAPublicKey; +import java.util.Base64; + +/** + * 获取公钥端点 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +public class RsaPublicKeyController { + + private final KeyProperties keyProperties; + + public RsaPublicKeyController(KeyProperties keyProperties) { + this.keyProperties = keyProperties; + } + + @ResponseBody + public String getPublicKey() { + if (keyProperties != null) { + KeyPair keyPair = new KeyStoreKeyFactory(keyProperties.getKeyStore().getLocation(), keyProperties.getKeyStore().getSecret().toCharArray()).getKeyPair(keyProperties.getKeyStore().getAlias()); + PublicKey publicKey = keyPair.getPublic(); + RSAPublicKey rsaPublicKey = (RSAPublicKey) publicKey; + byte[] publicKeyBytes = rsaPublicKey.getEncoded(); + return Base64.getEncoder().encodeToString(publicKeyBytes); + } + return "获取失败"; + } +} diff --git a/src/main/java/com/metalloop/modules/auth/converter/SysEnterpriseConverter.java b/src/main/java/com/metalloop/modules/auth/converter/SysEnterpriseConverter.java new file mode 100644 index 0000000..18bd5cc --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/converter/SysEnterpriseConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.req.SysEnterpriseQueryReqDto; +import com.metalloop.modules.auth.model.req.SysEnterpriseReqDto; +import com.metalloop.modules.auth.model.resp.SysEnterpriseRespDto; +import com.metalloop.modules.auth.model.po.SysEnterprise; +import com.metalloop.modules.auth.model.query.SysEnterpriseQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 企业信息主转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface SysEnterpriseConverter { + + SysEnterpriseConverter INSTANCE = Mappers.getMapper(SysEnterpriseConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param sysEnterprise 实体 + * @return 转换后的数据 + */ + SysEnterpriseRespDto toRespDto(SysEnterprise sysEnterprise); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param sysEnterprises 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List sysEnterprises); + + /** + * 请求 DTO 转换为实体 + * + * @param sysEnterpriseReqDto 请求 DTO + * @return 转换后的数据 + */ + SysEnterprise fromReqDto(SysEnterpriseReqDto sysEnterpriseReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param sysEnterpriseReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List sysEnterpriseReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param sysEnterpriseQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + SysEnterpriseQuery fromQueryReqDtoToQuery(SysEnterpriseQueryReqDto sysEnterpriseQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/auth/converter/SysEnterpriseImageConverter.java b/src/main/java/com/metalloop/modules/auth/converter/SysEnterpriseImageConverter.java new file mode 100644 index 0000000..7b747ad --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/converter/SysEnterpriseImageConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.req.SysEnterpriseImageQueryReqDto; +import com.metalloop.modules.auth.model.req.SysEnterpriseImageReqDto; +import com.metalloop.modules.auth.model.resp.SysEnterpriseImageRespDto; +import com.metalloop.modules.auth.model.po.SysEnterpriseImage; +import com.metalloop.modules.auth.model.query.SysEnterpriseImageQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 企业图片附件转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface SysEnterpriseImageConverter { + + SysEnterpriseImageConverter INSTANCE = Mappers.getMapper(SysEnterpriseImageConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param sysEnterpriseImage 实体 + * @return 转换后的数据 + */ + SysEnterpriseImageRespDto toRespDto(SysEnterpriseImage sysEnterpriseImage); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param sysEnterpriseImages 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List sysEnterpriseImages); + + /** + * 请求 DTO 转换为实体 + * + * @param sysEnterpriseImageReqDto 请求 DTO + * @return 转换后的数据 + */ + SysEnterpriseImage fromReqDto(SysEnterpriseImageReqDto sysEnterpriseImageReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param sysEnterpriseImageReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List sysEnterpriseImageReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param sysEnterpriseImageQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + SysEnterpriseImageQuery fromQueryReqDtoToQuery(SysEnterpriseImageQueryReqDto sysEnterpriseImageQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/auth/converter/SysPermissionConverter.java b/src/main/java/com/metalloop/modules/auth/converter/SysPermissionConverter.java new file mode 100644 index 0000000..5dcc39f --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/converter/SysPermissionConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.req.SysPermissionQueryReqDto; +import com.metalloop.modules.auth.model.req.SysPermissionReqDto; +import com.metalloop.modules.auth.model.resp.SysPermissionRespDto; +import com.metalloop.modules.auth.model.po.SysPermission; +import com.metalloop.modules.auth.model.query.SysPermissionQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 权限转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface SysPermissionConverter { + + SysPermissionConverter INSTANCE = Mappers.getMapper(SysPermissionConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param sysPermission 实体 + * @return 转换后的数据 + */ + SysPermissionRespDto toRespDto(SysPermission sysPermission); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param sysPermissions 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List sysPermissions); + + /** + * 请求 DTO 转换为实体 + * + * @param sysPermissionReqDto 请求 DTO + * @return 转换后的数据 + */ + SysPermission fromReqDto(SysPermissionReqDto sysPermissionReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param sysPermissionReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List sysPermissionReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param sysPermissionQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + SysPermissionQuery fromQueryReqDtoToQuery(SysPermissionQueryReqDto sysPermissionQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/auth/converter/SysRoleConverter.java b/src/main/java/com/metalloop/modules/auth/converter/SysRoleConverter.java new file mode 100644 index 0000000..77f9d5e --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/converter/SysRoleConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.req.SysRoleQueryReqDto; +import com.metalloop.modules.auth.model.req.SysRoleReqDto; +import com.metalloop.modules.auth.model.resp.SysRoleRespDto; +import com.metalloop.modules.auth.model.po.SysRole; +import com.metalloop.modules.auth.model.query.SysRoleQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 角色转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface SysRoleConverter { + + SysRoleConverter INSTANCE = Mappers.getMapper(SysRoleConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param sysRole 实体 + * @return 转换后的数据 + */ + SysRoleRespDto toRespDto(SysRole sysRole); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param sysRoles 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List sysRoles); + + /** + * 请求 DTO 转换为实体 + * + * @param sysRoleReqDto 请求 DTO + * @return 转换后的数据 + */ + SysRole fromReqDto(SysRoleReqDto sysRoleReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param sysRoleReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List sysRoleReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param sysRoleQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + SysRoleQuery fromQueryReqDtoToQuery(SysRoleQueryReqDto sysRoleQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/auth/converter/SysRolePermissionConverter.java b/src/main/java/com/metalloop/modules/auth/converter/SysRolePermissionConverter.java new file mode 100644 index 0000000..d9b1908 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/converter/SysRolePermissionConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.req.SysRolePermissionQueryReqDto; +import com.metalloop.modules.auth.model.req.SysRolePermissionReqDto; +import com.metalloop.modules.auth.model.resp.SysRolePermissionRespDto; +import com.metalloop.modules.auth.model.po.SysRolePermission; +import com.metalloop.modules.auth.model.query.SysRolePermissionQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 角色-权限关联转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface SysRolePermissionConverter { + + SysRolePermissionConverter INSTANCE = Mappers.getMapper(SysRolePermissionConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param sysRolePermission 实体 + * @return 转换后的数据 + */ + SysRolePermissionRespDto toRespDto(SysRolePermission sysRolePermission); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param sysRolePermissions 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List sysRolePermissions); + + /** + * 请求 DTO 转换为实体 + * + * @param sysRolePermissionReqDto 请求 DTO + * @return 转换后的数据 + */ + SysRolePermission fromReqDto(SysRolePermissionReqDto sysRolePermissionReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param sysRolePermissionReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List sysRolePermissionReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param sysRolePermissionQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + SysRolePermissionQuery fromQueryReqDtoToQuery(SysRolePermissionQueryReqDto sysRolePermissionQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/auth/converter/SysUserConverter.java b/src/main/java/com/metalloop/modules/auth/converter/SysUserConverter.java new file mode 100644 index 0000000..e2df880 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/converter/SysUserConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.req.SysUserQueryReqDto; +import com.metalloop.modules.auth.model.req.SysUserReqDto; +import com.metalloop.modules.auth.model.resp.SysUserRespDto; +import com.metalloop.modules.auth.model.po.SysUser; +import com.metalloop.modules.auth.model.query.SysUserQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 用户转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface SysUserConverter { + + SysUserConverter INSTANCE = Mappers.getMapper(SysUserConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param sysUser 实体 + * @return 转换后的数据 + */ + SysUserRespDto toRespDto(SysUser sysUser); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param sysUsers 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List sysUsers); + + /** + * 请求 DTO 转换为实体 + * + * @param sysUserReqDto 请求 DTO + * @return 转换后的数据 + */ + SysUser fromReqDto(SysUserReqDto sysUserReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param sysUserReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List sysUserReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param sysUserQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + SysUserQuery fromQueryReqDtoToQuery(SysUserQueryReqDto sysUserQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/auth/converter/SysUserRoleConverter.java b/src/main/java/com/metalloop/modules/auth/converter/SysUserRoleConverter.java new file mode 100644 index 0000000..2dd5ddf --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/converter/SysUserRoleConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.req.SysUserRoleQueryReqDto; +import com.metalloop.modules.auth.model.req.SysUserRoleReqDto; +import com.metalloop.modules.auth.model.resp.SysUserRoleRespDto; +import com.metalloop.modules.auth.model.po.SysUserRole; +import com.metalloop.modules.auth.model.query.SysUserRoleQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 用户与角色关联转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface SysUserRoleConverter { + + SysUserRoleConverter INSTANCE = Mappers.getMapper(SysUserRoleConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param sysUserRole 实体 + * @return 转换后的数据 + */ + SysUserRoleRespDto toRespDto(SysUserRole sysUserRole); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param sysUserRoles 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List sysUserRoles); + + /** + * 请求 DTO 转换为实体 + * + * @param sysUserRoleReqDto 请求 DTO + * @return 转换后的数据 + */ + SysUserRole fromReqDto(SysUserRoleReqDto sysUserRoleReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param sysUserRoleReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List sysUserRoleReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param sysUserRoleQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + SysUserRoleQuery fromQueryReqDtoToQuery(SysUserRoleQueryReqDto sysUserRoleQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/auth/mapper/SysEnterpriseImageMapper.java b/src/main/java/com/metalloop/modules/auth/mapper/SysEnterpriseImageMapper.java new file mode 100644 index 0000000..3ccc190 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/mapper/SysEnterpriseImageMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.auth.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.auth.model.po.SysEnterpriseImage; +import org.apache.ibatis.annotations.Mapper; + +/** + * 企业图片附件 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface SysEnterpriseImageMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/auth/mapper/SysEnterpriseMapper.java b/src/main/java/com/metalloop/modules/auth/mapper/SysEnterpriseMapper.java new file mode 100644 index 0000000..872dc34 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/mapper/SysEnterpriseMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.auth.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.auth.model.po.SysEnterprise; +import org.apache.ibatis.annotations.Mapper; + +/** + * 企业信息主 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface SysEnterpriseMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/auth/mapper/SysPermissionMapper.java b/src/main/java/com/metalloop/modules/auth/mapper/SysPermissionMapper.java new file mode 100644 index 0000000..35c2693 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/mapper/SysPermissionMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.auth.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.auth.model.po.SysPermission; +import org.apache.ibatis.annotations.Mapper; + +/** + * 权限 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface SysPermissionMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/auth/mapper/SysRoleMapper.java b/src/main/java/com/metalloop/modules/auth/mapper/SysRoleMapper.java new file mode 100644 index 0000000..5156eda --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/mapper/SysRoleMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.auth.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.auth.model.po.SysRole; +import org.apache.ibatis.annotations.Mapper; + +/** + * 角色 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface SysRoleMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/auth/mapper/SysRolePermissionMapper.java b/src/main/java/com/metalloop/modules/auth/mapper/SysRolePermissionMapper.java new file mode 100644 index 0000000..fa19a41 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/mapper/SysRolePermissionMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.auth.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.auth.model.po.SysRolePermission; +import org.apache.ibatis.annotations.Mapper; + +/** + * 角色-权限关联 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface SysRolePermissionMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/auth/mapper/SysUserMapper.java b/src/main/java/com/metalloop/modules/auth/mapper/SysUserMapper.java new file mode 100644 index 0000000..d79418f --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/mapper/SysUserMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.auth.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.auth.model.po.SysUser; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface SysUserMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/auth/mapper/SysUserRoleMapper.java b/src/main/java/com/metalloop/modules/auth/mapper/SysUserRoleMapper.java new file mode 100644 index 0000000..d78f3c9 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/mapper/SysUserRoleMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.auth.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.auth.model.po.SysUserRole; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户与角色关联 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface SysUserRoleMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/auth/model/po/SysEnterprise.java b/src/main/java/com/metalloop/modules/auth/model/po/SysEnterprise.java new file mode 100644 index 0000000..8318b2a --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/po/SysEnterprise.java @@ -0,0 +1,202 @@ +package com.metalloop.modules.auth.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业信息主 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业信息主") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "sys_enterprise") +public class SysEnterprise implements Serializable { + + /** + * 企业ID(主键) + */ + @Schema(description = "企业ID(主键)") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业名称 + */ + @Schema(description = "企业名称") + @TableField(value = "enterprise_name") + private String enterpriseName; + + /** + * 企业地址 + */ + @Schema(description = "企业地址") + @TableField(value = "enterprise_address") + private String enterpriseAddress; + + /** + * 仓库地址 + */ + @Schema(description = "仓库地址") + @TableField(value = "warehouse_address") + private String warehouseAddress; + + /** + * 联系人 + */ + @Schema(description = "联系人") + @TableField(value = "contact_person") + private String contactPerson; + + /** + * 法人代表 + */ + @Schema(description = "法人代表") + @TableField(value = "legal_person") + private String legalPerson; + + /** + * 电话1 + */ + @Schema(description = "电话1") + @TableField(value = "phone1") + private String phone1; + + /** + * 电话2 + */ + @Schema(description = "电话2") + @TableField(value = "phone2") + private String phone2; + + /** + * 电话3 + */ + @Schema(description = "电话3") + @TableField(value = "phone3") + private String phone3; + + /** + * 经营模式 + */ + @Schema(description = "经营模式") + @TableField(value = "business_model") + private String businessModel; + + /** + * 企业简介 + */ + @Schema(description = "企业简介") + @TableField(value = "profile_intro") + private String profileIntro; + + /** + * 标题图片URL + */ + @Schema(description = "标题图片URL") + @TableField(value = "title_img_url") + private String titleImgUrl; + + /** + * 简介图片URL + */ + @Schema(description = "简介图片URL") + @TableField(value = "intro_img_url") + private String introImgUrl; + + /** + * 营业执照URL + */ + @Schema(description = "营业执照URL") + @TableField(value = "business_license_url") + private String businessLicenseUrl; + + /** + * 法人身份证正面URL + */ + @Schema(description = "法人身份证正面URL") + @TableField(value = "legal_id_front_url") + private String legalIdFrontUrl; + + /** + * 法人身份证反面URL + */ + @Schema(description = "法人身份证反面URL") + @TableField(value = "legal_id_back_url") + private String legalIdBackUrl; + + /** + * OCR识别统一信用社ID(或统一信用代码) + */ + @Schema(description = "OCR识别统一信用社ID(或统一信用代码)") + @TableField(value = "ocr_credit_code_id") + private String ocrCreditCodeId; + + /** + * 法人身份证号 + */ + @Schema(description = "法人身份证号") + @TableField(value = "id_card_number") + private String idCardNumber; + + /** + * 信用额度 + */ + @Schema(description = "信用额度") + @TableField(value = "credit_limit") + private java.math.BigDecimal creditLimit; + + /** + * 认证状态(0-待提交,1-审核中,2-已通过,3-已驳回) + */ + @Schema(description = "认证状态(0-待提交,1-审核中,2-已通过,3-已驳回)") + @TableField(value = "audit_status") + private Boolean auditStatus; + + /** + * 认证资料提交时间 + */ + @Schema(description = "认证资料提交时间") + @TableField(value = "submit_time") + private java.util.Date submitTime; + + /** + * 认证审核完成时间 + */ + @Schema(description = "认证审核完成时间") + @TableField(value = "audit_time") + private java.util.Date auditTime; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + @TableField(value = "reject_reason") + private String rejectReason; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "created_at", fill = FieldFill.INSERT) + private java.util.Date createdAt; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE) + private java.util.Date updatedAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/po/SysEnterpriseImage.java b/src/main/java/com/metalloop/modules/auth/model/po/SysEnterpriseImage.java new file mode 100644 index 0000000..46c99fa --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/po/SysEnterpriseImage.java @@ -0,0 +1,62 @@ +package com.metalloop.modules.auth.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业图片附件 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业图片附件") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "sys_enterprise_image") +public class SysEnterpriseImage implements Serializable { + + /** + * 图片ID(主键) + */ + @Schema(description = "图片ID(主键)") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + @TableField(value = "enterprise_id") + private Integer enterpriseId; + + /** + * 图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品) + */ + @Schema(description = "图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品)") + @TableField(value = "image_type") + private Boolean imageType; + + /** + * 图片存储URL + */ + @Schema(description = "图片存储URL") + @TableField(value = "image_url") + private String imageUrl; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "created_at", fill = FieldFill.INSERT) + private java.util.Date createdAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/po/SysPermission.java b/src/main/java/com/metalloop/modules/auth/model/po/SysPermission.java new file mode 100644 index 0000000..53a167b --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/po/SysPermission.java @@ -0,0 +1,153 @@ +package com.metalloop.modules.auth.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 权限 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "权限") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "sys_permission") +public class SysPermission implements Serializable { + + /** + * 权限ID + */ + @Schema(description = "权限ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 菜单名称 + */ + @Schema(description = "菜单名称") + @TableField(value = "name") + private String name; + + /** + * 权限标识(唯一,用于后端鉴权) + */ + @Schema(description = "权限标识(唯一,用于后端鉴权)") + @TableField(value = "code") + private String code; + + /** + * 菜单类型;0-系统 1-目录 2-菜单 3-按钮 + */ + @Schema(description = "菜单类型;0-系统 1-目录 2-菜单 3-按钮") + @TableField(value = "type") + private Boolean type; + + /** + * 显示顺序 + */ + @Schema(description = "显示顺序") + @TableField(value = "sort") + private Integer sort; + + /** + * 父权限ID + */ + @Schema(description = "父权限ID") + @TableField(value = "parent_id") + private Long parentId; + + /** + * 菜单图标 + */ + @Schema(description = "菜单图标") + @TableField(value = "icon") + private String icon; + + /** + * 后端接口地址(辅助) + */ + @Schema(description = "后端接口地址(辅助)") + @TableField(value = "api_path") + private String apiPath; + + /** + * 前端路由地址 + */ + @Schema(description = "前端路由地址") + @TableField(value = "route_path") + private String routePath; + + /** + * 前端组件路径 + */ + @Schema(description = "前端组件路径") + @TableField(value = "component") + private String component; + + /** + * 前端组件名 + */ + @Schema(description = "前端组件名") + @TableField(value = "component_name") + private String componentName; + + /** + * 描述 + */ + @Schema(description = "描述") + @TableField(value = "description") + private String description; + + /** + * 启用状态(0-禁用 1-启用) + */ + @Schema(description = "启用状态(0-禁用 1-启用)") + @TableField(value = "enabled") + private Boolean enabled; + + /** + * 创建用户ID + */ + @Schema(description = "创建用户ID") + @TableField(value = "create_user", fill = FieldFill.INSERT) + private Long createUser; + + /** + * 修改用户ID + */ + @Schema(description = "修改用户ID") + @TableField(value = "update_user", fill = FieldFill.INSERT_UPDATE) + private Long updateUser; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private java.util.Date updateTime; + + /** + * 数据状态(0-正常 1-已删) + */ + @Schema(description = "数据状态(0-正常 1-已删)") + @TableField(value = "data_status") + private Boolean dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/po/SysRole.java b/src/main/java/com/metalloop/modules/auth/model/po/SysRole.java new file mode 100644 index 0000000..0a18fa0 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/po/SysRole.java @@ -0,0 +1,104 @@ +package com.metalloop.modules.auth.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "sys_role") +public class SysRole implements Serializable { + + /** + * 角色id + */ + @Schema(description = "角色id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 角色名称 + */ + @Schema(description = "角色名称") + @TableField(value = "name") + private String name; + + /** + * 角色权限字符串 + */ + @Schema(description = "角色权限字符串") + @TableField(value = "code") + private String code; + + /** + * 启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false + */ + @Schema(description = "启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false") + @TableField(value = "enabled") + private Boolean enabled; + + /** + * 角色描述 + */ + @Schema(description = "角色描述") + @TableField(value = "description") + private String description; + + /** + * 创建人;用户表ID + */ + @Schema(description = "创建人;用户表ID") + @TableField(value = "create_user", fill = FieldFill.INSERT) + private Long createUser; + + /** + * 创建人所属机构;组织机构表ID + */ + @Schema(description = "创建人所属机构;组织机构表ID") + @TableField(value = "create_org") + private Long createOrg; + + /** + * 创建时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "创建时间;yyyy-MM-dd HH:mm:ss") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private java.util.Date createTime; + + /** + * 修改时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "修改时间;yyyy-MM-dd HH:mm:ss") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private java.util.Date updateTime; + + /** + * 修改用户ID;对应用户表的ID字段 + */ + @Schema(description = "修改用户ID;对应用户表的ID字段") + @TableField(value = "update_user", fill = FieldFill.INSERT_UPDATE) + private Long updateUser; + + /** + * 数据状态;0-正常 1-已删 默认值为0 + */ + @Schema(description = "数据状态;0-正常 1-已删 默认值为0") + @TableField(value = "data_status") + private String dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/po/SysRolePermission.java b/src/main/java/com/metalloop/modules/auth/model/po/SysRolePermission.java new file mode 100644 index 0000000..97adc3c --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/po/SysRolePermission.java @@ -0,0 +1,51 @@ +package com.metalloop.modules.auth.model.po; + +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 io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色-权限关联 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色-权限关联") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "sys_role_permission") +public class SysRolePermission implements Serializable { + + /** + * 自增编号 + */ + @Schema(description = "自增编号") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + @TableField(value = "role_id") + private Long roleId; + + /** + * 权限ID + */ + @Schema(description = "权限ID") + @TableField(value = "permission_id") + private Long permissionId; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/po/SysUser.java b/src/main/java/com/metalloop/modules/auth/model/po/SysUser.java new file mode 100644 index 0000000..b27dc8f --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/po/SysUser.java @@ -0,0 +1,93 @@ +package com.metalloop.modules.auth.model.po; + +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 io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "sys_user") +public class SysUser implements Serializable { + + /** + * 用户ID(主键) + */ + @Schema(description = "用户ID(主键)") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 用户名(登录账号) + */ + @Schema(description = "用户名(登录账号)") + @TableField(value = "username") + private String username; + + /** + * 密码(存储哈希值) + */ + @Schema(description = "密码(存储哈希值)") + @TableField(value = "password") + private String password; + + /** + * 认证状态(0-未认证,1-认证中,2-已认证) + */ + @Schema(description = "认证状态(0-未认证,1-认证中,2-已认证)") + @TableField(value = "auth_status") + private Boolean authStatus; + + /** + * 关联的企业ID(外键,指向企业表) + */ + @Schema(description = "关联的企业ID(外键,指向企业表)") + @TableField(value = "enterprise_id") + private Integer enterpriseId; + + /** + * 手机号 + */ + @Schema(description = "手机号") + @TableField(value = "phone") + private String phone; + + /** + * 邮箱 + */ + @Schema(description = "邮箱") + @TableField(value = "email") + private String email; + + /** + * 用户状态(0-禁用,1-正常) + */ + @Schema(description = "用户状态(0-禁用,1-正常)") + @TableField(value = "user_status") + private Boolean userStatus; + + /** + * 注册时间 + */ + @Schema(description = "注册时间") + @TableField(value = "reg_time") + private java.util.Date regTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/po/SysUserRole.java b/src/main/java/com/metalloop/modules/auth/model/po/SysUserRole.java new file mode 100644 index 0000000..24c653a --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/po/SysUserRole.java @@ -0,0 +1,55 @@ +package com.metalloop.modules.auth.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户与角色关联 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户与角色关联") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "sys_user_role") +public class SysUserRole implements Serializable { + + /** + * 用户ID + */ + @Schema(description = "用户ID") + @TableField(value = "user_id") + private Integer userId; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + @TableField(value = "role_id") + private Integer roleId; + + /** + * 分配时间 + */ + @Schema(description = "分配时间") + @TableField(value = "created_at", fill = FieldFill.INSERT) + private java.util.Date createdAt; + + /** + * + */ + @Schema(description = "") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/query/SysEnterpriseImageQuery.java b/src/main/java/com/metalloop/modules/auth/model/query/SysEnterpriseImageQuery.java new file mode 100644 index 0000000..176a9db --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/query/SysEnterpriseImageQuery.java @@ -0,0 +1,61 @@ +package com.metalloop.modules.auth.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业图片附件查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业图片附件查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SysEnterpriseImageQuery implements Serializable { + + /** + * 图片ID(主键) + */ + @Schema(description = "图片ID(主键)") + @TableField(value = "id") + private Long id; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + @TableField(value = "enterprise_id") + private Integer enterpriseId; + + /** + * 图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品) + */ + @Schema(description = "图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品)") + @TableField(value = "image_type") + private Boolean imageType; + + /** + * 图片存储URL + */ + @Schema(description = "图片存储URL") + @TableField(value = "image_url") + private String imageUrl; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "created_at") + private java.util.Date createdAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/query/SysEnterpriseQuery.java b/src/main/java/com/metalloop/modules/auth/model/query/SysEnterpriseQuery.java new file mode 100644 index 0000000..17396fd --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/query/SysEnterpriseQuery.java @@ -0,0 +1,201 @@ +package com.metalloop.modules.auth.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业信息主查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业信息主查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SysEnterpriseQuery implements Serializable { + + /** + * 企业ID(主键) + */ + @Schema(description = "企业ID(主键)") + @TableField(value = "id") + private Long id; + + /** + * 企业名称 + */ + @Schema(description = "企业名称") + @TableField(value = "enterprise_name") + private String enterpriseName; + + /** + * 企业地址 + */ + @Schema(description = "企业地址") + @TableField(value = "enterprise_address") + private String enterpriseAddress; + + /** + * 仓库地址 + */ + @Schema(description = "仓库地址") + @TableField(value = "warehouse_address") + private String warehouseAddress; + + /** + * 联系人 + */ + @Schema(description = "联系人") + @TableField(value = "contact_person") + private String contactPerson; + + /** + * 法人代表 + */ + @Schema(description = "法人代表") + @TableField(value = "legal_person") + private String legalPerson; + + /** + * 电话1 + */ + @Schema(description = "电话1") + @TableField(value = "phone1") + private String phone1; + + /** + * 电话2 + */ + @Schema(description = "电话2") + @TableField(value = "phone2") + private String phone2; + + /** + * 电话3 + */ + @Schema(description = "电话3") + @TableField(value = "phone3") + private String phone3; + + /** + * 经营模式 + */ + @Schema(description = "经营模式") + @TableField(value = "business_model") + private String businessModel; + + /** + * 企业简介 + */ + @Schema(description = "企业简介") + @TableField(value = "profile_intro") + private String profileIntro; + + /** + * 标题图片URL + */ + @Schema(description = "标题图片URL") + @TableField(value = "title_img_url") + private String titleImgUrl; + + /** + * 简介图片URL + */ + @Schema(description = "简介图片URL") + @TableField(value = "intro_img_url") + private String introImgUrl; + + /** + * 营业执照URL + */ + @Schema(description = "营业执照URL") + @TableField(value = "business_license_url") + private String businessLicenseUrl; + + /** + * 法人身份证正面URL + */ + @Schema(description = "法人身份证正面URL") + @TableField(value = "legal_id_front_url") + private String legalIdFrontUrl; + + /** + * 法人身份证反面URL + */ + @Schema(description = "法人身份证反面URL") + @TableField(value = "legal_id_back_url") + private String legalIdBackUrl; + + /** + * OCR识别统一信用社ID(或统一信用代码) + */ + @Schema(description = "OCR识别统一信用社ID(或统一信用代码)") + @TableField(value = "ocr_credit_code_id") + private String ocrCreditCodeId; + + /** + * 法人身份证号 + */ + @Schema(description = "法人身份证号") + @TableField(value = "id_card_number") + private String idCardNumber; + + /** + * 信用额度 + */ + @Schema(description = "信用额度") + @TableField(value = "credit_limit") + private java.math.BigDecimal creditLimit; + + /** + * 认证状态(0-待提交,1-审核中,2-已通过,3-已驳回) + */ + @Schema(description = "认证状态(0-待提交,1-审核中,2-已通过,3-已驳回)") + @TableField(value = "audit_status") + private Boolean auditStatus; + + /** + * 认证资料提交时间 + */ + @Schema(description = "认证资料提交时间") + @TableField(value = "submit_time") + private java.util.Date submitTime; + + /** + * 认证审核完成时间 + */ + @Schema(description = "认证审核完成时间") + @TableField(value = "audit_time") + private java.util.Date auditTime; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + @TableField(value = "reject_reason") + private String rejectReason; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "created_at") + private java.util.Date createdAt; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(value = "updated_at") + private java.util.Date updatedAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/query/SysPermissionQuery.java b/src/main/java/com/metalloop/modules/auth/model/query/SysPermissionQuery.java new file mode 100644 index 0000000..42ed906 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/query/SysPermissionQuery.java @@ -0,0 +1,152 @@ +package com.metalloop.modules.auth.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 权限查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "权限查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SysPermissionQuery implements Serializable { + + /** + * 权限ID + */ + @Schema(description = "权限ID") + @TableField(value = "id") + private Long id; + + /** + * 菜单名称 + */ + @Schema(description = "菜单名称") + @TableField(value = "name") + private String name; + + /** + * 权限标识(唯一,用于后端鉴权) + */ + @Schema(description = "权限标识(唯一,用于后端鉴权)") + @TableField(value = "code") + private String code; + + /** + * 菜单类型;0-系统 1-目录 2-菜单 3-按钮 + */ + @Schema(description = "菜单类型;0-系统 1-目录 2-菜单 3-按钮") + @TableField(value = "type") + private Boolean type; + + /** + * 显示顺序 + */ + @Schema(description = "显示顺序") + @TableField(value = "sort") + private Integer sort; + + /** + * 父权限ID + */ + @Schema(description = "父权限ID") + @TableField(value = "parent_id") + private Long parentId; + + /** + * 菜单图标 + */ + @Schema(description = "菜单图标") + @TableField(value = "icon") + private String icon; + + /** + * 后端接口地址(辅助) + */ + @Schema(description = "后端接口地址(辅助)") + @TableField(value = "api_path") + private String apiPath; + + /** + * 前端路由地址 + */ + @Schema(description = "前端路由地址") + @TableField(value = "route_path") + private String routePath; + + /** + * 前端组件路径 + */ + @Schema(description = "前端组件路径") + @TableField(value = "component") + private String component; + + /** + * 前端组件名 + */ + @Schema(description = "前端组件名") + @TableField(value = "component_name") + private String componentName; + + /** + * 描述 + */ + @Schema(description = "描述") + @TableField(value = "description") + private String description; + + /** + * 启用状态(0-禁用 1-启用) + */ + @Schema(description = "启用状态(0-禁用 1-启用)") + @TableField(value = "enabled") + private Boolean enabled; + + /** + * 创建用户ID + */ + @Schema(description = "创建用户ID") + @TableField(value = "create_user") + private Long createUser; + + /** + * 修改用户ID + */ + @Schema(description = "修改用户ID") + @TableField(value = "update_user") + private Long updateUser; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(value = "update_time") + private java.util.Date updateTime; + + /** + * 数据状态(0-正常 1-已删) + */ + @Schema(description = "数据状态(0-正常 1-已删)") + @TableField(value = "data_status") + private Boolean dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/query/SysRolePermissionQuery.java b/src/main/java/com/metalloop/modules/auth/model/query/SysRolePermissionQuery.java new file mode 100644 index 0000000..5ff14c0 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/query/SysRolePermissionQuery.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.auth.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色-权限关联查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色-权限关联查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SysRolePermissionQuery implements Serializable { + + /** + * 自增编号 + */ + @Schema(description = "自增编号") + @TableField(value = "id") + private Long id; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + @TableField(value = "role_id") + private Long roleId; + + /** + * 权限ID + */ + @Schema(description = "权限ID") + @TableField(value = "permission_id") + private Long permissionId; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/query/SysRoleQuery.java b/src/main/java/com/metalloop/modules/auth/model/query/SysRoleQuery.java new file mode 100644 index 0000000..70faee8 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/query/SysRoleQuery.java @@ -0,0 +1,103 @@ +package com.metalloop.modules.auth.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SysRoleQuery implements Serializable { + + /** + * 角色id + */ + @Schema(description = "角色id") + @TableField(value = "id") + private Long id; + + /** + * 角色名称 + */ + @Schema(description = "角色名称") + @TableField(value = "name") + private String name; + + /** + * 角色权限字符串 + */ + @Schema(description = "角色权限字符串") + @TableField(value = "code") + private String code; + + /** + * 启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false + */ + @Schema(description = "启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false") + @TableField(value = "enabled") + private Boolean enabled; + + /** + * 角色描述 + */ + @Schema(description = "角色描述") + @TableField(value = "description") + private String description; + + /** + * 创建人;用户表ID + */ + @Schema(description = "创建人;用户表ID") + @TableField(value = "create_user") + private Long createUser; + + /** + * 创建人所属机构;组织机构表ID + */ + @Schema(description = "创建人所属机构;组织机构表ID") + @TableField(value = "create_org") + private Long createOrg; + + /** + * 创建时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "创建时间;yyyy-MM-dd HH:mm:ss") + @TableField(value = "create_time") + private java.util.Date createTime; + + /** + * 修改时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "修改时间;yyyy-MM-dd HH:mm:ss") + @TableField(value = "update_time") + private java.util.Date updateTime; + + /** + * 修改用户ID;对应用户表的ID字段 + */ + @Schema(description = "修改用户ID;对应用户表的ID字段") + @TableField(value = "update_user") + private Long updateUser; + + /** + * 数据状态;0-正常 1-已删 默认值为0 + */ + @Schema(description = "数据状态;0-正常 1-已删 默认值为0") + @TableField(value = "data_status") + private String dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/query/SysUserQuery.java b/src/main/java/com/metalloop/modules/auth/model/query/SysUserQuery.java new file mode 100644 index 0000000..068f2f9 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/query/SysUserQuery.java @@ -0,0 +1,89 @@ +package com.metalloop.modules.auth.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SysUserQuery implements Serializable { + + /** + * 用户ID(主键) + */ + @Schema(description = "用户ID(主键)") + @TableField(value = "id") + private Long id; + + /** + * 用户名(登录账号) + */ + @Schema(description = "用户名(登录账号)") + @TableField(value = "username") + private String username; + + /** + * 密码(存储哈希值) + */ + @Schema(description = "密码(存储哈希值)") + @TableField(value = "password") + private String password; + + /** + * 认证状态(0-未认证,1-认证中,2-已认证) + */ + @Schema(description = "认证状态(0-未认证,1-认证中,2-已认证)") + @TableField(value = "auth_status") + private Boolean authStatus; + + /** + * 关联的企业ID(外键,指向企业表) + */ + @Schema(description = "关联的企业ID(外键,指向企业表)") + @TableField(value = "enterprise_id") + private Integer enterpriseId; + + /** + * 手机号 + */ + @Schema(description = "手机号") + @TableField(value = "phone") + private String phone; + + /** + * 邮箱 + */ + @Schema(description = "邮箱") + @TableField(value = "email") + private String email; + + /** + * 用户状态(0-禁用,1-正常) + */ + @Schema(description = "用户状态(0-禁用,1-正常)") + @TableField(value = "user_status") + private Boolean userStatus; + + /** + * 注册时间 + */ + @Schema(description = "注册时间") + @TableField(value = "reg_time") + private java.util.Date regTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/query/SysUserRoleQuery.java b/src/main/java/com/metalloop/modules/auth/model/query/SysUserRoleQuery.java new file mode 100644 index 0000000..70b484c --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/query/SysUserRoleQuery.java @@ -0,0 +1,54 @@ +package com.metalloop.modules.auth.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户与角色关联查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户与角色关联查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SysUserRoleQuery implements Serializable { + + /** + * 用户ID + */ + @Schema(description = "用户ID") + @TableField(value = "user_id") + private Integer userId; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + @TableField(value = "role_id") + private Integer roleId; + + /** + * 分配时间 + */ + @Schema(description = "分配时间") + @TableField(value = "created_at") + private java.util.Date createdAt; + + /** + * + */ + @Schema(description = "") + @TableField(value = "id") + private Long id; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/AuthenticationRequest.java b/src/main/java/com/metalloop/modules/auth/model/req/AuthenticationRequest.java new file mode 100644 index 0000000..84cc5ae --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/AuthenticationRequest.java @@ -0,0 +1,32 @@ +package com.metalloop.modules.auth.model.req; + +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + + +/** + * 认证请求 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@Data +public class AuthenticationRequest { + + /** + * 用户名 + */ + @NotBlank(message = "用户名不能为空") + private String username; + + /** + * 密码 + */ + @NotBlank(message = "密码不能为空") + private String password; + + /** + * 验证码 + */ + private String verifyCode; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageLockConditionReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageLockConditionReqDto.java new file mode 100644 index 0000000..aa48bbb --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.auth.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 企业图片附件及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseImageLockConditionReqDto implements Serializable { + + /** + * 企业图片附件实体 + */ + @Schema(description = "企业图片附件实体") + private SysEnterpriseImageReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImagePageQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImagePageQueryReqDto.java new file mode 100644 index 0000000..f288cc7 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImagePageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.auth.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业图片附件分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "企业图片附件分页查询请求 DTO") +public class SysEnterpriseImagePageQueryReqDto extends SysEnterpriseImageQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageQueryReqDto.java new file mode 100644 index 0000000..97479d4 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageQueryReqDto.java @@ -0,0 +1,55 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业图片附件查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业图片附件查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseImageQueryReqDto implements Serializable { + + /** + * 图片ID(主键) + */ + @Schema(description = "图片ID(主键)") + private Long id; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + private Integer enterpriseId; + + /** + * 图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品) + */ + @Schema(description = "图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品)") + private Boolean imageType; + + /** + * 图片存储URL + */ + @Schema(description = "图片存储URL") + private String imageUrl; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createdAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageReqDto.java new file mode 100644 index 0000000..ad2c592 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageReqDto.java @@ -0,0 +1,55 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业图片附件请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业图片附件请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseImageReqDto implements Serializable { + + /** + * 图片ID(主键) + */ + @Schema(description = "图片ID(主键)") + private Long id; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + private Integer enterpriseId; + + /** + * 图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品) + */ + @Schema(description = "图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品)") + private Boolean imageType; + + /** + * 图片存储URL + */ + @Schema(description = "图片存储URL") + private String imageUrl; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createdAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageUpdateByQueryReqDto.java new file mode 100644 index 0000000..003e29f --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseImageUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业图片附件根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业图片附件根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseImageUpdateByQueryReqDto implements Serializable { + + /** + * 企业图片附件实体 + */ + @Schema(description = "企业图片附件实体") + private SysEnterpriseImageReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private SysEnterpriseImageQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseLockConditionReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseLockConditionReqDto.java new file mode 100644 index 0000000..76e5029 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.auth.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 企业信息主及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseLockConditionReqDto implements Serializable { + + /** + * 企业信息主实体 + */ + @Schema(description = "企业信息主实体") + private SysEnterpriseReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterprisePageQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterprisePageQueryReqDto.java new file mode 100644 index 0000000..de6189a --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterprisePageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.auth.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业信息主分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "企业信息主分页查询请求 DTO") +public class SysEnterprisePageQueryReqDto extends SysEnterpriseQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseQueryReqDto.java new file mode 100644 index 0000000..1d2a061 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseQueryReqDto.java @@ -0,0 +1,175 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业信息主查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业信息主查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseQueryReqDto implements Serializable { + + /** + * 企业ID(主键) + */ + @Schema(description = "企业ID(主键)") + private Long id; + + /** + * 企业名称 + */ + @Schema(description = "企业名称") + private String enterpriseName; + + /** + * 企业地址 + */ + @Schema(description = "企业地址") + private String enterpriseAddress; + + /** + * 仓库地址 + */ + @Schema(description = "仓库地址") + private String warehouseAddress; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contactPerson; + + /** + * 法人代表 + */ + @Schema(description = "法人代表") + private String legalPerson; + + /** + * 电话1 + */ + @Schema(description = "电话1") + private String phone1; + + /** + * 电话2 + */ + @Schema(description = "电话2") + private String phone2; + + /** + * 电话3 + */ + @Schema(description = "电话3") + private String phone3; + + /** + * 经营模式 + */ + @Schema(description = "经营模式") + private String businessModel; + + /** + * 企业简介 + */ + @Schema(description = "企业简介") + private String profileIntro; + + /** + * 标题图片URL + */ + @Schema(description = "标题图片URL") + private String titleImgUrl; + + /** + * 简介图片URL + */ + @Schema(description = "简介图片URL") + private String introImgUrl; + + /** + * 营业执照URL + */ + @Schema(description = "营业执照URL") + private String businessLicenseUrl; + + /** + * 法人身份证正面URL + */ + @Schema(description = "法人身份证正面URL") + private String legalIdFrontUrl; + + /** + * 法人身份证反面URL + */ + @Schema(description = "法人身份证反面URL") + private String legalIdBackUrl; + + /** + * OCR识别统一信用社ID(或统一信用代码) + */ + @Schema(description = "OCR识别统一信用社ID(或统一信用代码)") + private String ocrCreditCodeId; + + /** + * 法人身份证号 + */ + @Schema(description = "法人身份证号") + private String idCardNumber; + + /** + * 信用额度 + */ + @Schema(description = "信用额度") + private java.math.BigDecimal creditLimit; + + /** + * 认证状态(0-待提交,1-审核中,2-已通过,3-已驳回) + */ + @Schema(description = "认证状态(0-待提交,1-审核中,2-已通过,3-已驳回)") + private Boolean auditStatus; + + /** + * 认证资料提交时间 + */ + @Schema(description = "认证资料提交时间") + private java.util.Date submitTime; + + /** + * 认证审核完成时间 + */ + @Schema(description = "认证审核完成时间") + private java.util.Date auditTime; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + private String rejectReason; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createdAt; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updatedAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseReqDto.java new file mode 100644 index 0000000..9bf8366 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseReqDto.java @@ -0,0 +1,175 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业信息主请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业信息主请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseReqDto implements Serializable { + + /** + * 企业ID(主键) + */ + @Schema(description = "企业ID(主键)") + private Long id; + + /** + * 企业名称 + */ + @Schema(description = "企业名称") + private String enterpriseName; + + /** + * 企业地址 + */ + @Schema(description = "企业地址") + private String enterpriseAddress; + + /** + * 仓库地址 + */ + @Schema(description = "仓库地址") + private String warehouseAddress; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contactPerson; + + /** + * 法人代表 + */ + @Schema(description = "法人代表") + private String legalPerson; + + /** + * 电话1 + */ + @Schema(description = "电话1") + private String phone1; + + /** + * 电话2 + */ + @Schema(description = "电话2") + private String phone2; + + /** + * 电话3 + */ + @Schema(description = "电话3") + private String phone3; + + /** + * 经营模式 + */ + @Schema(description = "经营模式") + private String businessModel; + + /** + * 企业简介 + */ + @Schema(description = "企业简介") + private String profileIntro; + + /** + * 标题图片URL + */ + @Schema(description = "标题图片URL") + private String titleImgUrl; + + /** + * 简介图片URL + */ + @Schema(description = "简介图片URL") + private String introImgUrl; + + /** + * 营业执照URL + */ + @Schema(description = "营业执照URL") + private String businessLicenseUrl; + + /** + * 法人身份证正面URL + */ + @Schema(description = "法人身份证正面URL") + private String legalIdFrontUrl; + + /** + * 法人身份证反面URL + */ + @Schema(description = "法人身份证反面URL") + private String legalIdBackUrl; + + /** + * OCR识别统一信用社ID(或统一信用代码) + */ + @Schema(description = "OCR识别统一信用社ID(或统一信用代码)") + private String ocrCreditCodeId; + + /** + * 法人身份证号 + */ + @Schema(description = "法人身份证号") + private String idCardNumber; + + /** + * 信用额度 + */ + @Schema(description = "信用额度") + private java.math.BigDecimal creditLimit; + + /** + * 认证状态(0-待提交,1-审核中,2-已通过,3-已驳回) + */ + @Schema(description = "认证状态(0-待提交,1-审核中,2-已通过,3-已驳回)") + private Boolean auditStatus; + + /** + * 认证资料提交时间 + */ + @Schema(description = "认证资料提交时间") + private java.util.Date submitTime; + + /** + * 认证审核完成时间 + */ + @Schema(description = "认证审核完成时间") + private java.util.Date auditTime; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + private String rejectReason; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createdAt; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updatedAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseUpdateByQueryReqDto.java new file mode 100644 index 0000000..25ea2c6 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysEnterpriseUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业信息主根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业信息主根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseUpdateByQueryReqDto implements Serializable { + + /** + * 企业信息主实体 + */ + @Schema(description = "企业信息主实体") + private SysEnterpriseReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private SysEnterpriseQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionLockConditionReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionLockConditionReqDto.java new file mode 100644 index 0000000..a400671 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.auth.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 权限及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysPermissionLockConditionReqDto implements Serializable { + + /** + * 权限实体 + */ + @Schema(description = "权限实体") + private SysPermissionReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionPageQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionPageQueryReqDto.java new file mode 100644 index 0000000..912e181 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionPageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.auth.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 权限分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "权限分页查询请求 DTO") +public class SysPermissionPageQueryReqDto extends SysPermissionQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionQueryReqDto.java new file mode 100644 index 0000000..a9880bf --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionQueryReqDto.java @@ -0,0 +1,133 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 权限查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "权限查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysPermissionQueryReqDto implements Serializable { + + /** + * 权限ID + */ + @Schema(description = "权限ID") + private Long id; + + /** + * 菜单名称 + */ + @Schema(description = "菜单名称") + private String name; + + /** + * 权限标识(唯一,用于后端鉴权) + */ + @Schema(description = "权限标识(唯一,用于后端鉴权)") + private String code; + + /** + * 菜单类型;0-系统 1-目录 2-菜单 3-按钮 + */ + @Schema(description = "菜单类型;0-系统 1-目录 2-菜单 3-按钮") + private Boolean type; + + /** + * 显示顺序 + */ + @Schema(description = "显示顺序") + private Integer sort; + + /** + * 父权限ID + */ + @Schema(description = "父权限ID") + private Long parentId; + + /** + * 菜单图标 + */ + @Schema(description = "菜单图标") + private String icon; + + /** + * 后端接口地址(辅助) + */ + @Schema(description = "后端接口地址(辅助)") + private String apiPath; + + /** + * 前端路由地址 + */ + @Schema(description = "前端路由地址") + private String routePath; + + /** + * 前端组件路径 + */ + @Schema(description = "前端组件路径") + private String component; + + /** + * 前端组件名 + */ + @Schema(description = "前端组件名") + private String componentName; + + /** + * 描述 + */ + @Schema(description = "描述") + private String description; + + /** + * 启用状态(0-禁用 1-启用) + */ + @Schema(description = "启用状态(0-禁用 1-启用)") + private Boolean enabled; + + /** + * 创建用户ID + */ + @Schema(description = "创建用户ID") + private Long createUser; + + /** + * 修改用户ID + */ + @Schema(description = "修改用户ID") + private Long updateUser; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private java.util.Date updateTime; + + /** + * 数据状态(0-正常 1-已删) + */ + @Schema(description = "数据状态(0-正常 1-已删)") + private Boolean dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionReqDto.java new file mode 100644 index 0000000..40c4521 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionReqDto.java @@ -0,0 +1,133 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 权限请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "权限请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysPermissionReqDto implements Serializable { + + /** + * 权限ID + */ + @Schema(description = "权限ID") + private Long id; + + /** + * 菜单名称 + */ + @Schema(description = "菜单名称") + private String name; + + /** + * 权限标识(唯一,用于后端鉴权) + */ + @Schema(description = "权限标识(唯一,用于后端鉴权)") + private String code; + + /** + * 菜单类型;0-系统 1-目录 2-菜单 3-按钮 + */ + @Schema(description = "菜单类型;0-系统 1-目录 2-菜单 3-按钮") + private Boolean type; + + /** + * 显示顺序 + */ + @Schema(description = "显示顺序") + private Integer sort; + + /** + * 父权限ID + */ + @Schema(description = "父权限ID") + private Long parentId; + + /** + * 菜单图标 + */ + @Schema(description = "菜单图标") + private String icon; + + /** + * 后端接口地址(辅助) + */ + @Schema(description = "后端接口地址(辅助)") + private String apiPath; + + /** + * 前端路由地址 + */ + @Schema(description = "前端路由地址") + private String routePath; + + /** + * 前端组件路径 + */ + @Schema(description = "前端组件路径") + private String component; + + /** + * 前端组件名 + */ + @Schema(description = "前端组件名") + private String componentName; + + /** + * 描述 + */ + @Schema(description = "描述") + private String description; + + /** + * 启用状态(0-禁用 1-启用) + */ + @Schema(description = "启用状态(0-禁用 1-启用)") + private Boolean enabled; + + /** + * 创建用户ID + */ + @Schema(description = "创建用户ID") + private Long createUser; + + /** + * 修改用户ID + */ + @Schema(description = "修改用户ID") + private Long updateUser; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private java.util.Date updateTime; + + /** + * 数据状态(0-正常 1-已删) + */ + @Schema(description = "数据状态(0-正常 1-已删)") + private Boolean dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionUpdateByQueryReqDto.java new file mode 100644 index 0000000..c66d5f5 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysPermissionUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 权限根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "权限根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysPermissionUpdateByQueryReqDto implements Serializable { + + /** + * 权限实体 + */ + @Schema(description = "权限实体") + private SysPermissionReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private SysPermissionQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRoleLockConditionReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRoleLockConditionReqDto.java new file mode 100644 index 0000000..bdea528 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRoleLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.auth.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 角色及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRoleLockConditionReqDto implements Serializable { + + /** + * 角色实体 + */ + @Schema(description = "角色实体") + private SysRoleReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRolePageQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePageQueryReqDto.java new file mode 100644 index 0000000..68fee90 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.auth.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "角色分页查询请求 DTO") +public class SysRolePageQueryReqDto extends SysRoleQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionLockConditionReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionLockConditionReqDto.java new file mode 100644 index 0000000..5339018 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.auth.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 角色-权限关联及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRolePermissionLockConditionReqDto implements Serializable { + + /** + * 角色-权限关联实体 + */ + @Schema(description = "角色-权限关联实体") + private SysRolePermissionReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionPageQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionPageQueryReqDto.java new file mode 100644 index 0000000..f6f5f83 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionPageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.auth.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色-权限关联分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "角色-权限关联分页查询请求 DTO") +public class SysRolePermissionPageQueryReqDto extends SysRolePermissionQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionQueryReqDto.java new file mode 100644 index 0000000..370239f --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionQueryReqDto.java @@ -0,0 +1,43 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色-权限关联查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色-权限关联查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRolePermissionQueryReqDto implements Serializable { + + /** + * 自增编号 + */ + @Schema(description = "自增编号") + private Long id; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + private Long roleId; + + /** + * 权限ID + */ + @Schema(description = "权限ID") + private Long permissionId; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionReqDto.java new file mode 100644 index 0000000..f8a6c37 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionReqDto.java @@ -0,0 +1,43 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色-权限关联请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色-权限关联请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRolePermissionReqDto implements Serializable { + + /** + * 自增编号 + */ + @Schema(description = "自增编号") + private Long id; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + private Long roleId; + + /** + * 权限ID + */ + @Schema(description = "权限ID") + private Long permissionId; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionUpdateByQueryReqDto.java new file mode 100644 index 0000000..9abae50 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRolePermissionUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色-权限关联根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色-权限关联根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRolePermissionUpdateByQueryReqDto implements Serializable { + + /** + * 角色-权限关联实体 + */ + @Schema(description = "角色-权限关联实体") + private SysRolePermissionReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private SysRolePermissionQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRoleQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRoleQueryReqDto.java new file mode 100644 index 0000000..224fbdd --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRoleQueryReqDto.java @@ -0,0 +1,91 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRoleQueryReqDto implements Serializable { + + /** + * 角色id + */ + @Schema(description = "角色id") + private Long id; + + /** + * 角色名称 + */ + @Schema(description = "角色名称") + private String name; + + /** + * 角色权限字符串 + */ + @Schema(description = "角色权限字符串") + private String code; + + /** + * 启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false + */ + @Schema(description = "启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false") + private Boolean enabled; + + /** + * 角色描述 + */ + @Schema(description = "角色描述") + private String description; + + /** + * 创建人;用户表ID + */ + @Schema(description = "创建人;用户表ID") + private Long createUser; + + /** + * 创建人所属机构;组织机构表ID + */ + @Schema(description = "创建人所属机构;组织机构表ID") + private Long createOrg; + + /** + * 创建时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "创建时间;yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + + /** + * 修改时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "修改时间;yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + + /** + * 修改用户ID;对应用户表的ID字段 + */ + @Schema(description = "修改用户ID;对应用户表的ID字段") + private Long updateUser; + + /** + * 数据状态;0-正常 1-已删 默认值为0 + */ + @Schema(description = "数据状态;0-正常 1-已删 默认值为0") + private String dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRoleReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRoleReqDto.java new file mode 100644 index 0000000..9916f6f --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRoleReqDto.java @@ -0,0 +1,91 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRoleReqDto implements Serializable { + + /** + * 角色id + */ + @Schema(description = "角色id") + private Long id; + + /** + * 角色名称 + */ + @Schema(description = "角色名称") + private String name; + + /** + * 角色权限字符串 + */ + @Schema(description = "角色权限字符串") + private String code; + + /** + * 启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false + */ + @Schema(description = "启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false") + private Boolean enabled; + + /** + * 角色描述 + */ + @Schema(description = "角色描述") + private String description; + + /** + * 创建人;用户表ID + */ + @Schema(description = "创建人;用户表ID") + private Long createUser; + + /** + * 创建人所属机构;组织机构表ID + */ + @Schema(description = "创建人所属机构;组织机构表ID") + private Long createOrg; + + /** + * 创建时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "创建时间;yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + + /** + * 修改时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "修改时间;yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + + /** + * 修改用户ID;对应用户表的ID字段 + */ + @Schema(description = "修改用户ID;对应用户表的ID字段") + private Long updateUser; + + /** + * 数据状态;0-正常 1-已删 默认值为0 + */ + @Schema(description = "数据状态;0-正常 1-已删 默认值为0") + private String dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysRoleUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysRoleUpdateByQueryReqDto.java new file mode 100644 index 0000000..687b6f6 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysRoleUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRoleUpdateByQueryReqDto implements Serializable { + + /** + * 角色实体 + */ + @Schema(description = "角色实体") + private SysRoleReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private SysRoleQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserLockConditionReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserLockConditionReqDto.java new file mode 100644 index 0000000..845f8f2 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.auth.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 用户及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserLockConditionReqDto implements Serializable { + + /** + * 用户实体 + */ + @Schema(description = "用户实体") + private SysUserReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserPageQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserPageQueryReqDto.java new file mode 100644 index 0000000..e9a5c0c --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserPageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.auth.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "用户分页查询请求 DTO") +public class SysUserPageQueryReqDto extends SysUserQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserQueryReqDto.java new file mode 100644 index 0000000..2a3be9b --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserQueryReqDto.java @@ -0,0 +1,79 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserQueryReqDto implements Serializable { + + /** + * 用户ID(主键) + */ + @Schema(description = "用户ID(主键)") + private Long id; + + /** + * 用户名(登录账号) + */ + @Schema(description = "用户名(登录账号)") + private String username; + + /** + * 密码(存储哈希值) + */ + @Schema(description = "密码(存储哈希值)") + private String password; + + /** + * 认证状态(0-未认证,1-认证中,2-已认证) + */ + @Schema(description = "认证状态(0-未认证,1-认证中,2-已认证)") + private Boolean authStatus; + + /** + * 关联的企业ID(外键,指向企业表) + */ + @Schema(description = "关联的企业ID(外键,指向企业表)") + private Integer enterpriseId; + + /** + * 手机号 + */ + @Schema(description = "手机号") + private String phone; + + /** + * 邮箱 + */ + @Schema(description = "邮箱") + private String email; + + /** + * 用户状态(0-禁用,1-正常) + */ + @Schema(description = "用户状态(0-禁用,1-正常)") + private Boolean userStatus; + + /** + * 注册时间 + */ + @Schema(description = "注册时间") + private java.util.Date regTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserReqDto.java new file mode 100644 index 0000000..017dd17 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserReqDto.java @@ -0,0 +1,79 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserReqDto implements Serializable { + + /** + * 用户ID(主键) + */ + @Schema(description = "用户ID(主键)") + private Long id; + + /** + * 用户名(登录账号) + */ + @Schema(description = "用户名(登录账号)") + private String username; + + /** + * 密码(存储哈希值) + */ + @Schema(description = "密码(存储哈希值)") + private String password; + + /** + * 认证状态(0-未认证,1-认证中,2-已认证) + */ + @Schema(description = "认证状态(0-未认证,1-认证中,2-已认证)") + private Boolean authStatus; + + /** + * 关联的企业ID(外键,指向企业表) + */ + @Schema(description = "关联的企业ID(外键,指向企业表)") + private Integer enterpriseId; + + /** + * 手机号 + */ + @Schema(description = "手机号") + private String phone; + + /** + * 邮箱 + */ + @Schema(description = "邮箱") + private String email; + + /** + * 用户状态(0-禁用,1-正常) + */ + @Schema(description = "用户状态(0-禁用,1-正常)") + private Boolean userStatus; + + /** + * 注册时间 + */ + @Schema(description = "注册时间") + private java.util.Date regTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleLockConditionReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleLockConditionReqDto.java new file mode 100644 index 0000000..5bc6351 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.auth.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 用户与角色关联及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserRoleLockConditionReqDto implements Serializable { + + /** + * 用户与角色关联实体 + */ + @Schema(description = "用户与角色关联实体") + private SysUserRoleReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserRolePageQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRolePageQueryReqDto.java new file mode 100644 index 0000000..d1f25a5 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRolePageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.auth.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户与角色关联分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "用户与角色关联分页查询请求 DTO") +public class SysUserRolePageQueryReqDto extends SysUserRoleQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleQueryReqDto.java new file mode 100644 index 0000000..2c1c0c4 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleQueryReqDto.java @@ -0,0 +1,49 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户与角色关联查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户与角色关联查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserRoleQueryReqDto implements Serializable { + + /** + * 用户ID + */ + @Schema(description = "用户ID") + private Integer userId; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + private Integer roleId; + + /** + * 分配时间 + */ + @Schema(description = "分配时间") + private java.util.Date createdAt; + + /** + * + */ + @Schema(description = "") + private Long id; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleReqDto.java new file mode 100644 index 0000000..619f505 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleReqDto.java @@ -0,0 +1,49 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户与角色关联请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户与角色关联请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserRoleReqDto implements Serializable { + + /** + * 用户ID + */ + @Schema(description = "用户ID") + private Integer userId; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + private Integer roleId; + + /** + * 分配时间 + */ + @Schema(description = "分配时间") + private java.util.Date createdAt; + + /** + * + */ + @Schema(description = "") + private Long id; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleUpdateByQueryReqDto.java new file mode 100644 index 0000000..6abf60b --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserRoleUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户与角色关联根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户与角色关联根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserRoleUpdateByQueryReqDto implements Serializable { + + /** + * 用户与角色关联实体 + */ + @Schema(description = "用户与角色关联实体") + private SysUserRoleReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private SysUserRoleQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/req/SysUserUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/auth/model/req/SysUserUpdateByQueryReqDto.java new file mode 100644 index 0000000..147e211 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/req/SysUserUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.auth.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserUpdateByQueryReqDto implements Serializable { + + /** + * 用户实体 + */ + @Schema(description = "用户实体") + private SysUserReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private SysUserQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/resp/AuthenticationResponse.java b/src/main/java/com/metalloop/modules/auth/model/resp/AuthenticationResponse.java new file mode 100644 index 0000000..18bdf5f --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/resp/AuthenticationResponse.java @@ -0,0 +1,29 @@ +package com.metalloop.modules.auth.model.resp; + +import lombok.Data; + +/** + * 认证响应 + * + * @author zhaowenhao + * @since 2023-03-19 + */ +@Data +public class AuthenticationResponse { + + /** + * 访问令牌 + */ + private String accessToken; + + /** + * 用户登录名 + */ + private String username; + + /** + * 用户ID + */ + private String userId; + +} diff --git a/src/main/java/com/metalloop/modules/auth/model/resp/SysEnterpriseImageRespDto.java b/src/main/java/com/metalloop/modules/auth/model/resp/SysEnterpriseImageRespDto.java new file mode 100644 index 0000000..442963c --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/resp/SysEnterpriseImageRespDto.java @@ -0,0 +1,55 @@ +package com.metalloop.modules.auth.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业图片附件响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业图片附件响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseImageRespDto implements Serializable { + + /** + * 图片ID(主键) + */ + @Schema(description = "图片ID(主键)") + private Long id; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + private Integer enterpriseId; + + /** + * 图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品) + */ + @Schema(description = "图片类型(0-公司环境,1-资质证书,2-生产设备,3-主营产品)") + private Boolean imageType; + + /** + * 图片存储URL + */ + @Schema(description = "图片存储URL") + private String imageUrl; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createdAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/resp/SysEnterpriseRespDto.java b/src/main/java/com/metalloop/modules/auth/model/resp/SysEnterpriseRespDto.java new file mode 100644 index 0000000..4c8bd33 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/resp/SysEnterpriseRespDto.java @@ -0,0 +1,175 @@ +package com.metalloop.modules.auth.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业信息主响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业信息主响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysEnterpriseRespDto implements Serializable { + + /** + * 企业ID(主键) + */ + @Schema(description = "企业ID(主键)") + private Long id; + + /** + * 企业名称 + */ + @Schema(description = "企业名称") + private String enterpriseName; + + /** + * 企业地址 + */ + @Schema(description = "企业地址") + private String enterpriseAddress; + + /** + * 仓库地址 + */ + @Schema(description = "仓库地址") + private String warehouseAddress; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contactPerson; + + /** + * 法人代表 + */ + @Schema(description = "法人代表") + private String legalPerson; + + /** + * 电话1 + */ + @Schema(description = "电话1") + private String phone1; + + /** + * 电话2 + */ + @Schema(description = "电话2") + private String phone2; + + /** + * 电话3 + */ + @Schema(description = "电话3") + private String phone3; + + /** + * 经营模式 + */ + @Schema(description = "经营模式") + private String businessModel; + + /** + * 企业简介 + */ + @Schema(description = "企业简介") + private String profileIntro; + + /** + * 标题图片URL + */ + @Schema(description = "标题图片URL") + private String titleImgUrl; + + /** + * 简介图片URL + */ + @Schema(description = "简介图片URL") + private String introImgUrl; + + /** + * 营业执照URL + */ + @Schema(description = "营业执照URL") + private String businessLicenseUrl; + + /** + * 法人身份证正面URL + */ + @Schema(description = "法人身份证正面URL") + private String legalIdFrontUrl; + + /** + * 法人身份证反面URL + */ + @Schema(description = "法人身份证反面URL") + private String legalIdBackUrl; + + /** + * OCR识别统一信用社ID(或统一信用代码) + */ + @Schema(description = "OCR识别统一信用社ID(或统一信用代码)") + private String ocrCreditCodeId; + + /** + * 法人身份证号 + */ + @Schema(description = "法人身份证号") + private String idCardNumber; + + /** + * 信用额度 + */ + @Schema(description = "信用额度") + private java.math.BigDecimal creditLimit; + + /** + * 认证状态(0-待提交,1-审核中,2-已通过,3-已驳回) + */ + @Schema(description = "认证状态(0-待提交,1-审核中,2-已通过,3-已驳回)") + private Boolean auditStatus; + + /** + * 认证资料提交时间 + */ + @Schema(description = "认证资料提交时间") + private java.util.Date submitTime; + + /** + * 认证审核完成时间 + */ + @Schema(description = "认证审核完成时间") + private java.util.Date auditTime; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + private String rejectReason; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createdAt; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updatedAt; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/resp/SysPermissionRespDto.java b/src/main/java/com/metalloop/modules/auth/model/resp/SysPermissionRespDto.java new file mode 100644 index 0000000..3a63e48 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/resp/SysPermissionRespDto.java @@ -0,0 +1,133 @@ +package com.metalloop.modules.auth.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 权限响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "权限响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysPermissionRespDto implements Serializable { + + /** + * 权限ID + */ + @Schema(description = "权限ID") + private Long id; + + /** + * 菜单名称 + */ + @Schema(description = "菜单名称") + private String name; + + /** + * 权限标识(唯一,用于后端鉴权) + */ + @Schema(description = "权限标识(唯一,用于后端鉴权)") + private String code; + + /** + * 菜单类型;0-系统 1-目录 2-菜单 3-按钮 + */ + @Schema(description = "菜单类型;0-系统 1-目录 2-菜单 3-按钮") + private Boolean type; + + /** + * 显示顺序 + */ + @Schema(description = "显示顺序") + private Integer sort; + + /** + * 父权限ID + */ + @Schema(description = "父权限ID") + private Long parentId; + + /** + * 菜单图标 + */ + @Schema(description = "菜单图标") + private String icon; + + /** + * 后端接口地址(辅助) + */ + @Schema(description = "后端接口地址(辅助)") + private String apiPath; + + /** + * 前端路由地址 + */ + @Schema(description = "前端路由地址") + private String routePath; + + /** + * 前端组件路径 + */ + @Schema(description = "前端组件路径") + private String component; + + /** + * 前端组件名 + */ + @Schema(description = "前端组件名") + private String componentName; + + /** + * 描述 + */ + @Schema(description = "描述") + private String description; + + /** + * 启用状态(0-禁用 1-启用) + */ + @Schema(description = "启用状态(0-禁用 1-启用)") + private Boolean enabled; + + /** + * 创建用户ID + */ + @Schema(description = "创建用户ID") + private Long createUser; + + /** + * 修改用户ID + */ + @Schema(description = "修改用户ID") + private Long updateUser; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private java.util.Date updateTime; + + /** + * 数据状态(0-正常 1-已删) + */ + @Schema(description = "数据状态(0-正常 1-已删)") + private Boolean dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/resp/SysRolePermissionRespDto.java b/src/main/java/com/metalloop/modules/auth/model/resp/SysRolePermissionRespDto.java new file mode 100644 index 0000000..b0eafe0 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/resp/SysRolePermissionRespDto.java @@ -0,0 +1,43 @@ +package com.metalloop.modules.auth.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色-权限关联响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色-权限关联响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRolePermissionRespDto implements Serializable { + + /** + * 自增编号 + */ + @Schema(description = "自增编号") + private Long id; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + private Long roleId; + + /** + * 权限ID + */ + @Schema(description = "权限ID") + private Long permissionId; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/resp/SysRoleRespDto.java b/src/main/java/com/metalloop/modules/auth/model/resp/SysRoleRespDto.java new file mode 100644 index 0000000..18d17d9 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/resp/SysRoleRespDto.java @@ -0,0 +1,91 @@ +package com.metalloop.modules.auth.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 角色响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "角色响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysRoleRespDto implements Serializable { + + /** + * 角色id + */ + @Schema(description = "角色id") + private Long id; + + /** + * 角色名称 + */ + @Schema(description = "角色名称") + private String name; + + /** + * 角色权限字符串 + */ + @Schema(description = "角色权限字符串") + private String code; + + /** + * 启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false + */ + @Schema(description = "启用状态:指示角色是启用还是禁用。禁用角色无法进行授权。如果已启用,则为true,否则为false") + private Boolean enabled; + + /** + * 角色描述 + */ + @Schema(description = "角色描述") + private String description; + + /** + * 创建人;用户表ID + */ + @Schema(description = "创建人;用户表ID") + private Long createUser; + + /** + * 创建人所属机构;组织机构表ID + */ + @Schema(description = "创建人所属机构;组织机构表ID") + private Long createOrg; + + /** + * 创建时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "创建时间;yyyy-MM-dd HH:mm:ss") + private java.util.Date createTime; + + /** + * 修改时间;yyyy-MM-dd HH:mm:ss + */ + @Schema(description = "修改时间;yyyy-MM-dd HH:mm:ss") + private java.util.Date updateTime; + + /** + * 修改用户ID;对应用户表的ID字段 + */ + @Schema(description = "修改用户ID;对应用户表的ID字段") + private Long updateUser; + + /** + * 数据状态;0-正常 1-已删 默认值为0 + */ + @Schema(description = "数据状态;0-正常 1-已删 默认值为0") + private String dataStatus; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/resp/SysUserRespDto.java b/src/main/java/com/metalloop/modules/auth/model/resp/SysUserRespDto.java new file mode 100644 index 0000000..5990cc5 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/resp/SysUserRespDto.java @@ -0,0 +1,79 @@ +package com.metalloop.modules.auth.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserRespDto implements Serializable { + + /** + * 用户ID(主键) + */ + @Schema(description = "用户ID(主键)") + private Long id; + + /** + * 用户名(登录账号) + */ + @Schema(description = "用户名(登录账号)") + private String username; + + /** + * 密码(存储哈希值) + */ + @Schema(description = "密码(存储哈希值)") + private String password; + + /** + * 认证状态(0-未认证,1-认证中,2-已认证) + */ + @Schema(description = "认证状态(0-未认证,1-认证中,2-已认证)") + private Boolean authStatus; + + /** + * 关联的企业ID(外键,指向企业表) + */ + @Schema(description = "关联的企业ID(外键,指向企业表)") + private Integer enterpriseId; + + /** + * 手机号 + */ + @Schema(description = "手机号") + private String phone; + + /** + * 邮箱 + */ + @Schema(description = "邮箱") + private String email; + + /** + * 用户状态(0-禁用,1-正常) + */ + @Schema(description = "用户状态(0-禁用,1-正常)") + private Boolean userStatus; + + /** + * 注册时间 + */ + @Schema(description = "注册时间") + private java.util.Date regTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/model/resp/SysUserRoleRespDto.java b/src/main/java/com/metalloop/modules/auth/model/resp/SysUserRoleRespDto.java new file mode 100644 index 0000000..64997a5 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/model/resp/SysUserRoleRespDto.java @@ -0,0 +1,49 @@ +package com.metalloop.modules.auth.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户与角色关联响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "用户与角色关联响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysUserRoleRespDto implements Serializable { + + /** + * 用户ID + */ + @Schema(description = "用户ID") + private Integer userId; + + /** + * 角色ID + */ + @Schema(description = "角色ID") + private Integer roleId; + + /** + * 分配时间 + */ + @Schema(description = "分配时间") + private java.util.Date createdAt; + + /** + * + */ + @Schema(description = "") + private Long id; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/auth/service/SysEnterpriseImageService.java b/src/main/java/com/metalloop/modules/auth/service/SysEnterpriseImageService.java new file mode 100644 index 0000000..53fd083 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/SysEnterpriseImageService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.auth.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.auth.model.po.SysEnterpriseImage; +import com.metalloop.modules.auth.model.query.SysEnterpriseImageQuery; + +import java.util.List; +import java.util.Map; + +/** + * 企业图片附件 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface SysEnterpriseImageService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建企业图片附件 + * + * @param sysEnterpriseImage 企业图片附件 + * @return 创建后的企业图片附件 + */ + SysEnterpriseImage create(SysEnterpriseImage sysEnterpriseImage); + + /** + * 批量创建企业图片附件 + * + * @param sysEnterpriseImages 企业图片附件列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List sysEnterpriseImages); + + /** + * 获取全部企业图片附件列表 + * + * @return 全部企业图片附件列表 + */ + List listAll(); + + /** + * 批量更新企业图片附件 + * + * @param sysEnterpriseImages 企业图片附件列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List sysEnterpriseImages); + + /** + * 通过ID删除企业图片附件 + * + * @param id 企业图片附件ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除企业图片附件 + * + * @param ids 企业图片附件ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建企业图片附件 + * + * @param entity 企业图片附件 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(SysEnterpriseImage entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新企业图片附件 + * + * @param entity 企业图片附件 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(SysEnterpriseImage entity, LockCondition... conditions); + + /** + * 创建或更新企业图片附件(幂等性) + * + * @param entity 企业图片附件 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(SysEnterpriseImage entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取企业图片附件 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 企业图片附件分页 + */ + Page pageByQuery(long current, long size, SysEnterpriseImageQuery query); + + /** + * 分页获取全部企业图片附件 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部企业图片附件分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和企业图片附件的映射 + * + * @return ID和企业图片附件的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和企业图片附件的映射 + * + * @param ids 企业图片附件ID列表 + * @return ID和企业图片附件的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和企业图片附件 列表的分组 + * + * @return ID和企业图片附件 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和企业图片附件 列表的分组 + * + * @param ids 企业图片附件ID列表 + * @return ID和企业图片附件 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部企业图片附件数量 + * + * @return 全部企业图片附件数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysEnterpriseImageQuery + + /** + * 通过查询条件修改企业图片附件 + * + * @param entity 企业图片附件 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(SysEnterpriseImage entity, SysEnterpriseImageQuery query); + + /** + * 通过查询条件删除企业图片附件 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(SysEnterpriseImageQuery query); + + /** + * 通过查询条件获取企业图片附件 + * + * @param query 查询条件 + * @return 企业图片附件 + */ + SysEnterpriseImage getByQuery(SysEnterpriseImageQuery query); + + /** + * 通过查询条件获取企业图片附件列表 + * + * @param query 查询条件 + * @return 企业图片附件列表 + */ + List listByQuery(SysEnterpriseImageQuery query); + + /** + * 通过查询条件获取ID和企业图片附件的映射 + * + * @param query 查询条件 + * @return ID和企业图片附件的映射 + */ + Map getIdMapByQuery(SysEnterpriseImageQuery query); + + /** + * 通过查询条件获取分组的企业图片附件 + * + * @param query 查询条件 + * @return 企业图片附件分组 + */ + Map> getIdGroupByQuery(SysEnterpriseImageQuery query); + + /** + * 通过查询条件获取企业图片附件数量 + * + * @param query 查询条件 + * @return 企业图片附件数量 + */ + Long countByQuery(SysEnterpriseImageQuery query); + + /** + * 检查是否存在符合查询条件的企业图片附件 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(SysEnterpriseImageQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/SysEnterpriseService.java b/src/main/java/com/metalloop/modules/auth/service/SysEnterpriseService.java new file mode 100644 index 0000000..1619e15 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/SysEnterpriseService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.auth.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.auth.model.po.SysEnterprise; +import com.metalloop.modules.auth.model.query.SysEnterpriseQuery; + +import java.util.List; +import java.util.Map; + +/** + * 企业信息主 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface SysEnterpriseService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建企业信息主 + * + * @param sysEnterprise 企业信息主 + * @return 创建后的企业信息主 + */ + SysEnterprise create(SysEnterprise sysEnterprise); + + /** + * 批量创建企业信息主 + * + * @param sysEnterprises 企业信息主列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List sysEnterprises); + + /** + * 获取全部企业信息主列表 + * + * @return 全部企业信息主列表 + */ + List listAll(); + + /** + * 批量更新企业信息主 + * + * @param sysEnterprises 企业信息主列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List sysEnterprises); + + /** + * 通过ID删除企业信息主 + * + * @param id 企业信息主ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除企业信息主 + * + * @param ids 企业信息主ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建企业信息主 + * + * @param entity 企业信息主 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(SysEnterprise entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新企业信息主 + * + * @param entity 企业信息主 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(SysEnterprise entity, LockCondition... conditions); + + /** + * 创建或更新企业信息主(幂等性) + * + * @param entity 企业信息主 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(SysEnterprise entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取企业信息主 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 企业信息主分页 + */ + Page pageByQuery(long current, long size, SysEnterpriseQuery query); + + /** + * 分页获取全部企业信息主 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部企业信息主分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和企业信息主的映射 + * + * @return ID和企业信息主的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和企业信息主的映射 + * + * @param ids 企业信息主ID列表 + * @return ID和企业信息主的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和企业信息主 列表的分组 + * + * @return ID和企业信息主 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和企业信息主 列表的分组 + * + * @param ids 企业信息主ID列表 + * @return ID和企业信息主 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部企业信息主数量 + * + * @return 全部企业信息主数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysEnterpriseQuery + + /** + * 通过查询条件修改企业信息主 + * + * @param entity 企业信息主 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(SysEnterprise entity, SysEnterpriseQuery query); + + /** + * 通过查询条件删除企业信息主 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(SysEnterpriseQuery query); + + /** + * 通过查询条件获取企业信息主 + * + * @param query 查询条件 + * @return 企业信息主 + */ + SysEnterprise getByQuery(SysEnterpriseQuery query); + + /** + * 通过查询条件获取企业信息主列表 + * + * @param query 查询条件 + * @return 企业信息主列表 + */ + List listByQuery(SysEnterpriseQuery query); + + /** + * 通过查询条件获取ID和企业信息主的映射 + * + * @param query 查询条件 + * @return ID和企业信息主的映射 + */ + Map getIdMapByQuery(SysEnterpriseQuery query); + + /** + * 通过查询条件获取分组的企业信息主 + * + * @param query 查询条件 + * @return 企业信息主分组 + */ + Map> getIdGroupByQuery(SysEnterpriseQuery query); + + /** + * 通过查询条件获取企业信息主数量 + * + * @param query 查询条件 + * @return 企业信息主数量 + */ + Long countByQuery(SysEnterpriseQuery query); + + /** + * 检查是否存在符合查询条件的企业信息主 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(SysEnterpriseQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/SysPermissionService.java b/src/main/java/com/metalloop/modules/auth/service/SysPermissionService.java new file mode 100644 index 0000000..4c54359 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/SysPermissionService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.auth.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.auth.model.po.SysPermission; +import com.metalloop.modules.auth.model.query.SysPermissionQuery; + +import java.util.List; +import java.util.Map; + +/** + * 权限 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface SysPermissionService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建权限 + * + * @param sysPermission 权限 + * @return 创建后的权限 + */ + SysPermission create(SysPermission sysPermission); + + /** + * 批量创建权限 + * + * @param sysPermissions 权限列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List sysPermissions); + + /** + * 获取全部权限列表 + * + * @return 全部权限列表 + */ + List listAll(); + + /** + * 批量更新权限 + * + * @param sysPermissions 权限列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List sysPermissions); + + /** + * 通过ID删除权限 + * + * @param id 权限ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除权限 + * + * @param ids 权限ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建权限 + * + * @param entity 权限 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(SysPermission entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新权限 + * + * @param entity 权限 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(SysPermission entity, LockCondition... conditions); + + /** + * 创建或更新权限(幂等性) + * + * @param entity 权限 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(SysPermission entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取权限 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 权限分页 + */ + Page pageByQuery(long current, long size, SysPermissionQuery query); + + /** + * 分页获取全部权限 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部权限分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和权限的映射 + * + * @return ID和权限的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和权限的映射 + * + * @param ids 权限ID列表 + * @return ID和权限的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和权限 列表的分组 + * + * @return ID和权限 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和权限 列表的分组 + * + * @param ids 权限ID列表 + * @return ID和权限 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部权限数量 + * + * @return 全部权限数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysPermissionQuery + + /** + * 通过查询条件修改权限 + * + * @param entity 权限 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(SysPermission entity, SysPermissionQuery query); + + /** + * 通过查询条件删除权限 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(SysPermissionQuery query); + + /** + * 通过查询条件获取权限 + * + * @param query 查询条件 + * @return 权限 + */ + SysPermission getByQuery(SysPermissionQuery query); + + /** + * 通过查询条件获取权限列表 + * + * @param query 查询条件 + * @return 权限列表 + */ + List listByQuery(SysPermissionQuery query); + + /** + * 通过查询条件获取ID和权限的映射 + * + * @param query 查询条件 + * @return ID和权限的映射 + */ + Map getIdMapByQuery(SysPermissionQuery query); + + /** + * 通过查询条件获取分组的权限 + * + * @param query 查询条件 + * @return 权限分组 + */ + Map> getIdGroupByQuery(SysPermissionQuery query); + + /** + * 通过查询条件获取权限数量 + * + * @param query 查询条件 + * @return 权限数量 + */ + Long countByQuery(SysPermissionQuery query); + + /** + * 检查是否存在符合查询条件的权限 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(SysPermissionQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/SysRolePermissionService.java b/src/main/java/com/metalloop/modules/auth/service/SysRolePermissionService.java new file mode 100644 index 0000000..7e71d17 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/SysRolePermissionService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.auth.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.auth.model.po.SysRolePermission; +import com.metalloop.modules.auth.model.query.SysRolePermissionQuery; + +import java.util.List; +import java.util.Map; + +/** + * 角色-权限关联 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface SysRolePermissionService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建角色-权限关联 + * + * @param sysRolePermission 角色-权限关联 + * @return 创建后的角色-权限关联 + */ + SysRolePermission create(SysRolePermission sysRolePermission); + + /** + * 批量创建角色-权限关联 + * + * @param sysRolePermissions 角色-权限关联列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List sysRolePermissions); + + /** + * 获取全部角色-权限关联列表 + * + * @return 全部角色-权限关联列表 + */ + List listAll(); + + /** + * 批量更新角色-权限关联 + * + * @param sysRolePermissions 角色-权限关联列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List sysRolePermissions); + + /** + * 通过ID删除角色-权限关联 + * + * @param id 角色-权限关联ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除角色-权限关联 + * + * @param ids 角色-权限关联ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建角色-权限关联 + * + * @param entity 角色-权限关联 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(SysRolePermission entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新角色-权限关联 + * + * @param entity 角色-权限关联 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(SysRolePermission entity, LockCondition... conditions); + + /** + * 创建或更新角色-权限关联(幂等性) + * + * @param entity 角色-权限关联 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(SysRolePermission entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取角色-权限关联 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 角色-权限关联分页 + */ + Page pageByQuery(long current, long size, SysRolePermissionQuery query); + + /** + * 分页获取全部角色-权限关联 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部角色-权限关联分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和角色-权限关联的映射 + * + * @return ID和角色-权限关联的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和角色-权限关联的映射 + * + * @param ids 角色-权限关联ID列表 + * @return ID和角色-权限关联的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和角色-权限关联 列表的分组 + * + * @return ID和角色-权限关联 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和角色-权限关联 列表的分组 + * + * @param ids 角色-权限关联ID列表 + * @return ID和角色-权限关联 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部角色-权限关联数量 + * + * @return 全部角色-权限关联数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysRolePermissionQuery + + /** + * 通过查询条件修改角色-权限关联 + * + * @param entity 角色-权限关联 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(SysRolePermission entity, SysRolePermissionQuery query); + + /** + * 通过查询条件删除角色-权限关联 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(SysRolePermissionQuery query); + + /** + * 通过查询条件获取角色-权限关联 + * + * @param query 查询条件 + * @return 角色-权限关联 + */ + SysRolePermission getByQuery(SysRolePermissionQuery query); + + /** + * 通过查询条件获取角色-权限关联列表 + * + * @param query 查询条件 + * @return 角色-权限关联列表 + */ + List listByQuery(SysRolePermissionQuery query); + + /** + * 通过查询条件获取ID和角色-权限关联的映射 + * + * @param query 查询条件 + * @return ID和角色-权限关联的映射 + */ + Map getIdMapByQuery(SysRolePermissionQuery query); + + /** + * 通过查询条件获取分组的角色-权限关联 + * + * @param query 查询条件 + * @return 角色-权限关联分组 + */ + Map> getIdGroupByQuery(SysRolePermissionQuery query); + + /** + * 通过查询条件获取角色-权限关联数量 + * + * @param query 查询条件 + * @return 角色-权限关联数量 + */ + Long countByQuery(SysRolePermissionQuery query); + + /** + * 检查是否存在符合查询条件的角色-权限关联 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(SysRolePermissionQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/SysRoleService.java b/src/main/java/com/metalloop/modules/auth/service/SysRoleService.java new file mode 100644 index 0000000..28d282b --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/SysRoleService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.auth.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.auth.model.po.SysRole; +import com.metalloop.modules.auth.model.query.SysRoleQuery; + +import java.util.List; +import java.util.Map; + +/** + * 角色 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface SysRoleService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建角色 + * + * @param sysRole 角色 + * @return 创建后的角色 + */ + SysRole create(SysRole sysRole); + + /** + * 批量创建角色 + * + * @param sysRoles 角色列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List sysRoles); + + /** + * 获取全部角色列表 + * + * @return 全部角色列表 + */ + List listAll(); + + /** + * 批量更新角色 + * + * @param sysRoles 角色列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List sysRoles); + + /** + * 通过ID删除角色 + * + * @param id 角色ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除角色 + * + * @param ids 角色ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建角色 + * + * @param entity 角色 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(SysRole entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新角色 + * + * @param entity 角色 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(SysRole entity, LockCondition... conditions); + + /** + * 创建或更新角色(幂等性) + * + * @param entity 角色 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(SysRole entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取角色 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 角色分页 + */ + Page pageByQuery(long current, long size, SysRoleQuery query); + + /** + * 分页获取全部角色 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部角色分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和角色的映射 + * + * @return ID和角色的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和角色的映射 + * + * @param ids 角色ID列表 + * @return ID和角色的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和角色 列表的分组 + * + * @return ID和角色 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和角色 列表的分组 + * + * @param ids 角色ID列表 + * @return ID和角色 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部角色数量 + * + * @return 全部角色数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysRoleQuery + + /** + * 通过查询条件修改角色 + * + * @param entity 角色 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(SysRole entity, SysRoleQuery query); + + /** + * 通过查询条件删除角色 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(SysRoleQuery query); + + /** + * 通过查询条件获取角色 + * + * @param query 查询条件 + * @return 角色 + */ + SysRole getByQuery(SysRoleQuery query); + + /** + * 通过查询条件获取角色列表 + * + * @param query 查询条件 + * @return 角色列表 + */ + List listByQuery(SysRoleQuery query); + + /** + * 通过查询条件获取ID和角色的映射 + * + * @param query 查询条件 + * @return ID和角色的映射 + */ + Map getIdMapByQuery(SysRoleQuery query); + + /** + * 通过查询条件获取分组的角色 + * + * @param query 查询条件 + * @return 角色分组 + */ + Map> getIdGroupByQuery(SysRoleQuery query); + + /** + * 通过查询条件获取角色数量 + * + * @param query 查询条件 + * @return 角色数量 + */ + Long countByQuery(SysRoleQuery query); + + /** + * 检查是否存在符合查询条件的角色 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(SysRoleQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/SysUserRoleService.java b/src/main/java/com/metalloop/modules/auth/service/SysUserRoleService.java new file mode 100644 index 0000000..a4b0be1 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/SysUserRoleService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.auth.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.auth.model.po.SysUserRole; +import com.metalloop.modules.auth.model.query.SysUserRoleQuery; + +import java.util.List; +import java.util.Map; + +/** + * 用户与角色关联 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface SysUserRoleService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建用户与角色关联 + * + * @param sysUserRole 用户与角色关联 + * @return 创建后的用户与角色关联 + */ + SysUserRole create(SysUserRole sysUserRole); + + /** + * 批量创建用户与角色关联 + * + * @param sysUserRoles 用户与角色关联列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List sysUserRoles); + + /** + * 获取全部用户与角色关联列表 + * + * @return 全部用户与角色关联列表 + */ + List listAll(); + + /** + * 批量更新用户与角色关联 + * + * @param sysUserRoles 用户与角色关联列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List sysUserRoles); + + /** + * 通过ID删除用户与角色关联 + * + * @param id 用户与角色关联ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除用户与角色关联 + * + * @param ids 用户与角色关联ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建用户与角色关联 + * + * @param entity 用户与角色关联 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(SysUserRole entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新用户与角色关联 + * + * @param entity 用户与角色关联 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(SysUserRole entity, LockCondition... conditions); + + /** + * 创建或更新用户与角色关联(幂等性) + * + * @param entity 用户与角色关联 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(SysUserRole entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取用户与角色关联 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 用户与角色关联分页 + */ + Page pageByQuery(long current, long size, SysUserRoleQuery query); + + /** + * 分页获取全部用户与角色关联 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部用户与角色关联分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和用户与角色关联的映射 + * + * @return ID和用户与角色关联的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和用户与角色关联的映射 + * + * @param ids 用户与角色关联ID列表 + * @return ID和用户与角色关联的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和用户与角色关联 列表的分组 + * + * @return ID和用户与角色关联 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和用户与角色关联 列表的分组 + * + * @param ids 用户与角色关联ID列表 + * @return ID和用户与角色关联 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部用户与角色关联数量 + * + * @return 全部用户与角色关联数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysUserRoleQuery + + /** + * 通过查询条件修改用户与角色关联 + * + * @param entity 用户与角色关联 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(SysUserRole entity, SysUserRoleQuery query); + + /** + * 通过查询条件删除用户与角色关联 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(SysUserRoleQuery query); + + /** + * 通过查询条件获取用户与角色关联 + * + * @param query 查询条件 + * @return 用户与角色关联 + */ + SysUserRole getByQuery(SysUserRoleQuery query); + + /** + * 通过查询条件获取用户与角色关联列表 + * + * @param query 查询条件 + * @return 用户与角色关联列表 + */ + List listByQuery(SysUserRoleQuery query); + + /** + * 通过查询条件获取ID和用户与角色关联的映射 + * + * @param query 查询条件 + * @return ID和用户与角色关联的映射 + */ + Map getIdMapByQuery(SysUserRoleQuery query); + + /** + * 通过查询条件获取分组的用户与角色关联 + * + * @param query 查询条件 + * @return 用户与角色关联分组 + */ + Map> getIdGroupByQuery(SysUserRoleQuery query); + + /** + * 通过查询条件获取用户与角色关联数量 + * + * @param query 查询条件 + * @return 用户与角色关联数量 + */ + Long countByQuery(SysUserRoleQuery query); + + /** + * 检查是否存在符合查询条件的用户与角色关联 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(SysUserRoleQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/SysUserService.java b/src/main/java/com/metalloop/modules/auth/service/SysUserService.java new file mode 100644 index 0000000..4638fef --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/SysUserService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.auth.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.auth.model.po.SysUser; +import com.metalloop.modules.auth.model.query.SysUserQuery; + +import java.util.List; +import java.util.Map; + +/** + * 用户 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface SysUserService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建用户 + * + * @param sysUser 用户 + * @return 创建后的用户 + */ + SysUser create(SysUser sysUser); + + /** + * 批量创建用户 + * + * @param sysUsers 用户列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List sysUsers); + + /** + * 获取全部用户列表 + * + * @return 全部用户列表 + */ + List listAll(); + + /** + * 批量更新用户 + * + * @param sysUsers 用户列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List sysUsers); + + /** + * 通过ID删除用户 + * + * @param id 用户ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除用户 + * + * @param ids 用户ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建用户 + * + * @param entity 用户 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(SysUser entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新用户 + * + * @param entity 用户 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(SysUser entity, LockCondition... conditions); + + /** + * 创建或更新用户(幂等性) + * + * @param entity 用户 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(SysUser entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取用户 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 用户分页 + */ + Page pageByQuery(long current, long size, SysUserQuery query); + + /** + * 分页获取全部用户 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部用户分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和用户的映射 + * + * @return ID和用户的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和用户的映射 + * + * @param ids 用户ID列表 + * @return ID和用户的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和用户 列表的分组 + * + * @return ID和用户 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和用户 列表的分组 + * + * @param ids 用户ID列表 + * @return ID和用户 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部用户数量 + * + * @return 全部用户数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysUserQuery + + /** + * 通过查询条件修改用户 + * + * @param entity 用户 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(SysUser entity, SysUserQuery query); + + /** + * 通过查询条件删除用户 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(SysUserQuery query); + + /** + * 通过查询条件获取用户 + * + * @param query 查询条件 + * @return 用户 + */ + SysUser getByQuery(SysUserQuery query); + + /** + * 通过查询条件获取用户列表 + * + * @param query 查询条件 + * @return 用户列表 + */ + List listByQuery(SysUserQuery query); + + /** + * 通过查询条件获取ID和用户的映射 + * + * @param query 查询条件 + * @return ID和用户的映射 + */ + Map getIdMapByQuery(SysUserQuery query); + + /** + * 通过查询条件获取分组的用户 + * + * @param query 查询条件 + * @return 用户分组 + */ + Map> getIdGroupByQuery(SysUserQuery query); + + /** + * 通过查询条件获取用户数量 + * + * @param query 查询条件 + * @return 用户数量 + */ + Long countByQuery(SysUserQuery query); + + /** + * 检查是否存在符合查询条件的用户 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(SysUserQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/impl/SysEnterpriseImageServiceImpl.java b/src/main/java/com/metalloop/modules/auth/service/impl/SysEnterpriseImageServiceImpl.java new file mode 100644 index 0000000..3127833 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/impl/SysEnterpriseImageServiceImpl.java @@ -0,0 +1,169 @@ +package com.metalloop.modules.auth.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.auth.mapper.SysEnterpriseImageMapper; +import com.metalloop.modules.auth.model.po.SysEnterpriseImage; +import com.metalloop.modules.auth.model.query.SysEnterpriseImageQuery; +import com.metalloop.modules.auth.service.SysEnterpriseImageService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * 企业图片附件 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class SysEnterpriseImageServiceImpl extends SuperServiceImpl implements SysEnterpriseImageService { + + @Resource + private DistributedLock distributedLock; + + @Resource + SysEnterpriseImageMapper sysEnterpriseImageMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public SysEnterpriseImage create(SysEnterpriseImage sysEnterpriseImage) { + save(sysEnterpriseImage); + return sysEnterpriseImage; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List sysEnterpriseImages) { + return saveBatch(sysEnterpriseImages); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List sysEnterpriseImages) { + return updateBatchById(sysEnterpriseImages); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(SysEnterpriseImage entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(SysEnterpriseImage entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(SysEnterpriseImage entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, SysEnterpriseImageQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysEnterpriseImageQuery + + @Override + public Boolean updateByQuery(SysEnterpriseImage entity, SysEnterpriseImageQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(SysEnterpriseImageQuery query) { + return remove(query); + } + + @Override + public SysEnterpriseImage getByQuery(SysEnterpriseImageQuery query) { + return get(query); + } + + @Override + public List listByQuery(SysEnterpriseImageQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(SysEnterpriseImageQuery query) { + return toMap(SysEnterpriseImage::getId, query); + } + + @Override + public Map> getIdGroupByQuery(SysEnterpriseImageQuery query) { + return toGroup(SysEnterpriseImage::getId, query); + } + + @Override + public Long countByQuery(SysEnterpriseImageQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(SysEnterpriseImageQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/impl/SysEnterpriseServiceImpl.java b/src/main/java/com/metalloop/modules/auth/service/impl/SysEnterpriseServiceImpl.java new file mode 100644 index 0000000..456b460 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/impl/SysEnterpriseServiceImpl.java @@ -0,0 +1,173 @@ +package com.metalloop.modules.auth.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.auth.mapper.SysEnterpriseImageMapper; +import com.metalloop.modules.auth.mapper.SysEnterpriseMapper; +import com.metalloop.modules.auth.model.po.SysEnterprise; +import com.metalloop.modules.auth.model.po.SysEnterpriseImage; +import com.metalloop.modules.auth.model.query.SysEnterpriseImageQuery; +import com.metalloop.modules.auth.model.query.SysEnterpriseQuery; +import com.metalloop.modules.auth.service.SysEnterpriseImageService; +import com.metalloop.modules.auth.service.SysEnterpriseService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * 企业信息主 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class SysEnterpriseServiceImpl extends SuperServiceImpl implements SysEnterpriseService { + + @Resource + private DistributedLock distributedLock; + + @Resource + SysEnterpriseMapper sysEnterpriseMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public SysEnterprise create(SysEnterprise sysEnterprise) { + save(sysEnterprise); + return sysEnterprise; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List sysEnterprises) { + return saveBatch(sysEnterprises); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List sysEnterprises) { + return updateBatchById(sysEnterprises); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(SysEnterprise entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(SysEnterprise entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(SysEnterprise entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, SysEnterpriseQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysEnterpriseQuery + + @Override + public Boolean updateByQuery(SysEnterprise entity, SysEnterpriseQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(SysEnterpriseQuery query) { + return remove(query); + } + + @Override + public SysEnterprise getByQuery(SysEnterpriseQuery query) { + return get(query); + } + + @Override + public List listByQuery(SysEnterpriseQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(SysEnterpriseQuery query) { + return toMap(SysEnterprise::getId, query); + } + + @Override + public Map> getIdGroupByQuery(SysEnterpriseQuery query) { + return toGroup(SysEnterprise::getId, query); + } + + @Override + public Long countByQuery(SysEnterpriseQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(SysEnterpriseQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/impl/SysPermissionServiceImpl.java b/src/main/java/com/metalloop/modules/auth/service/impl/SysPermissionServiceImpl.java new file mode 100644 index 0000000..90e3b64 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/impl/SysPermissionServiceImpl.java @@ -0,0 +1,167 @@ +package com.metalloop.modules.auth.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.auth.mapper.SysPermissionMapper; +import com.metalloop.modules.auth.model.po.SysPermission; +import com.metalloop.modules.auth.model.query.SysPermissionQuery; +import com.metalloop.modules.auth.service.SysPermissionService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 权限 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class SysPermissionServiceImpl extends SuperServiceImpl implements SysPermissionService { + + @Resource + private DistributedLock distributedLock; + + @Resource + SysPermissionMapper sysPermissionMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public SysPermission create(SysPermission sysPermission) { + save(sysPermission); + return sysPermission; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List sysPermissions) { + return saveBatch(sysPermissions); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List sysPermissions) { + return updateBatchById(sysPermissions); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(SysPermission entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + public final Boolean updateByIdIdempotency(SysPermission entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + public final Boolean saveOrUpdateIdempotency(SysPermission entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, SysPermissionQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysPermissionQuery + + @Override + public Boolean updateByQuery(SysPermission entity, SysPermissionQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(SysPermissionQuery query) { + return remove(query); + } + + @Override + public SysPermission getByQuery(SysPermissionQuery query) { + return get(query); + } + + @Override + public List listByQuery(SysPermissionQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(SysPermissionQuery query) { + return toMap(SysPermission::getId, query); + } + + @Override + public Map> getIdGroupByQuery(SysPermissionQuery query) { + return toGroup(SysPermission::getId, query); + } + + @Override + public Long countByQuery(SysPermissionQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(SysPermissionQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/impl/SysRolePermissionServiceImpl.java b/src/main/java/com/metalloop/modules/auth/service/impl/SysRolePermissionServiceImpl.java new file mode 100644 index 0000000..9f8fa56 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/impl/SysRolePermissionServiceImpl.java @@ -0,0 +1,170 @@ +package com.metalloop.modules.auth.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.auth.mapper.SysRolePermissionMapper; +import com.metalloop.modules.auth.model.po.SysRolePermission; +import com.metalloop.modules.auth.model.query.SysRolePermissionQuery; +import com.metalloop.modules.auth.service.SysRolePermissionService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * 角色-权限关联 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class SysRolePermissionServiceImpl extends SuperServiceImpl implements SysRolePermissionService { + + @Resource + private DistributedLock distributedLock; + + @Resource + SysRolePermissionMapper sysRolePermissionMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public SysRolePermission create(SysRolePermission sysRolePermission) { + save(sysRolePermission); + return sysRolePermission; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List sysRolePermissions) { + return saveBatch(sysRolePermissions); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List sysRolePermissions) { + return updateBatchById(sysRolePermissions); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(SysRolePermission entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(SysRolePermission entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(SysRolePermission entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, SysRolePermissionQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysRolePermissionQuery + + @Override + public Boolean updateByQuery(SysRolePermission entity, SysRolePermissionQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(SysRolePermissionQuery query) { + return remove(query); + } + + @Override + public SysRolePermission getByQuery(SysRolePermissionQuery query) { + return get(query); + } + + @Override + public List listByQuery(SysRolePermissionQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(SysRolePermissionQuery query) { + return toMap(SysRolePermission::getId, query); + } + + @Override + public Map> getIdGroupByQuery(SysRolePermissionQuery query) { + return toGroup(SysRolePermission::getId, query); + } + + @Override + public Long countByQuery(SysRolePermissionQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(SysRolePermissionQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/impl/SysRoleServiceImpl.java b/src/main/java/com/metalloop/modules/auth/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000..bcd78b5 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,173 @@ +package com.metalloop.modules.auth.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.auth.mapper.SysRoleMapper; +import com.metalloop.modules.auth.model.po.SysPermission; +import com.metalloop.modules.auth.model.po.SysRole; +import com.metalloop.modules.auth.model.query.SysRoleQuery; +import com.metalloop.modules.auth.service.SysRoleService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * 角色 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class SysRoleServiceImpl extends SuperServiceImpl implements SysRoleService { + + @Resource + private DistributedLock distributedLock; + + @Resource + SysRoleMapper sysRoleMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public SysRole create(SysRole sysRole) { + save(sysRole); + return sysRole; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List sysRoles) { + return saveBatch(sysRoles); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List sysRoles) { + return updateBatchById(sysRoles); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(SysRole entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(SysRole entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(SysRole entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, SysRoleQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysRoleQuery + + @Override + public Boolean updateByQuery(SysRole entity, SysRoleQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(SysRoleQuery query) { + return remove(query); + } + + @Override + public SysRole getByQuery(SysRoleQuery query) { + return get(query); + } + + @Override + public List listByQuery(SysRoleQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(SysRoleQuery query) { + return toMap(SysRole::getId, query); + } + + @Override + public Map> getIdGroupByQuery(SysRoleQuery query) { + return toGroup(SysRole::getId, query); + } + + @Override + public Long countByQuery(SysRoleQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(SysRoleQuery query) { + long count = count(query); + return count > 0; + } + + + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/impl/SysUserRoleServiceImpl.java b/src/main/java/com/metalloop/modules/auth/service/impl/SysUserRoleServiceImpl.java new file mode 100644 index 0000000..94afb91 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/impl/SysUserRoleServiceImpl.java @@ -0,0 +1,170 @@ +package com.metalloop.modules.auth.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.auth.mapper.SysUserRoleMapper; +import com.metalloop.modules.auth.model.po.SysUserRole; +import com.metalloop.modules.auth.model.query.SysUserRoleQuery; +import com.metalloop.modules.auth.service.SysUserRoleService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import jakarta.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * 用户与角色关联 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class SysUserRoleServiceImpl extends SuperServiceImpl implements SysUserRoleService { + + @Resource + private DistributedLock distributedLock; + + @Resource + SysUserRoleMapper sysUserRoleMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public SysUserRole create(SysUserRole sysUserRole) { + save(sysUserRole); + return sysUserRole; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List sysUserRoles) { + return saveBatch(sysUserRoles); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List sysUserRoles) { + return updateBatchById(sysUserRoles); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(SysUserRole entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(SysUserRole entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(SysUserRole entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, SysUserRoleQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysUserRoleQuery + + @Override + public Boolean updateByQuery(SysUserRole entity, SysUserRoleQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(SysUserRoleQuery query) { + return remove(query); + } + + @Override + public SysUserRole getByQuery(SysUserRoleQuery query) { + return get(query); + } + + @Override + public List listByQuery(SysUserRoleQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(SysUserRoleQuery query) { + return toMap(SysUserRole::getId, query); + } + + @Override + public Map> getIdGroupByQuery(SysUserRoleQuery query) { + return toGroup(SysUserRole::getId, query); + } + + @Override + public Long countByQuery(SysUserRoleQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(SysUserRoleQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/auth/service/impl/SysUserServiceImpl.java b/src/main/java/com/metalloop/modules/auth/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000..b01e154 --- /dev/null +++ b/src/main/java/com/metalloop/modules/auth/service/impl/SysUserServiceImpl.java @@ -0,0 +1,169 @@ +package com.metalloop.modules.auth.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.auth.mapper.SysUserMapper; +import com.metalloop.modules.auth.model.po.SysUser; +import com.metalloop.modules.auth.model.query.SysUserQuery; +import com.metalloop.modules.auth.service.SysUserService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 用户 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class SysUserServiceImpl extends SuperServiceImpl implements SysUserService { + + @Resource + private DistributedLock distributedLock; + + @Resource + SysUserMapper sysUserMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public SysUser create(SysUser sysUser) { + save(sysUser); + return sysUser; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List sysUsers) { + return saveBatch(sysUsers); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List sysUsers) { + return updateBatchById(sysUsers); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(SysUser entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(SysUser entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(SysUser entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, SysUserQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup(e -> String.valueOf(e.getId()), list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup(e -> String.valueOf(e.getId()), listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如SysUserQuery + + @Override + public Boolean updateByQuery(SysUser entity, SysUserQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(SysUserQuery query) { + return remove(query); + } + + @Override + public SysUser getByQuery(SysUserQuery query) { + return get(query); + } + + @Override + public List listByQuery(SysUserQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(SysUserQuery query) { + return toMap(SysUser::getId, query); + } + + @Override + public Map> getIdGroupByQuery(SysUserQuery query) { + return toGroup(SysUser::getId, query); + } + + @Override + public Long countByQuery(SysUserQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(SysUserQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverter.java b/src/main/java/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverter.java new file mode 100644 index 0000000..145038c --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.req.BizEnterpriseProductQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizEnterpriseProductReqDto; +import com.metalloop.modules.bussiness.model.resp.BizEnterpriseProductRespDto; +import com.metalloop.modules.bussiness.model.po.BizEnterpriseProduct; +import com.metalloop.modules.bussiness.model.query.BizEnterpriseProductQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 企业经营产品转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface BizEnterpriseProductConverter { + + BizEnterpriseProductConverter INSTANCE = Mappers.getMapper(BizEnterpriseProductConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param bizEnterpriseProduct 实体 + * @return 转换后的数据 + */ + BizEnterpriseProductRespDto toRespDto(BizEnterpriseProduct bizEnterpriseProduct); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param bizEnterpriseProducts 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List bizEnterpriseProducts); + + /** + * 请求 DTO 转换为实体 + * + * @param bizEnterpriseProductReqDto 请求 DTO + * @return 转换后的数据 + */ + BizEnterpriseProduct fromReqDto(BizEnterpriseProductReqDto bizEnterpriseProductReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param bizEnterpriseProductReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List bizEnterpriseProductReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param bizEnterpriseProductQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + BizEnterpriseProductQuery fromQueryReqDtoToQuery(BizEnterpriseProductQueryReqDto bizEnterpriseProductQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/bussiness/converter/BizMaterialConverter.java b/src/main/java/com/metalloop/modules/bussiness/converter/BizMaterialConverter.java new file mode 100644 index 0000000..07d77ef --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/converter/BizMaterialConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.req.BizMaterialQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizMaterialReqDto; +import com.metalloop.modules.bussiness.model.resp.BizMaterialRespDto; +import com.metalloop.modules.bussiness.model.po.BizMaterial; +import com.metalloop.modules.bussiness.model.query.BizMaterialQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 业务-材质基础转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface BizMaterialConverter { + + BizMaterialConverter INSTANCE = Mappers.getMapper(BizMaterialConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param bizMaterial 实体 + * @return 转换后的数据 + */ + BizMaterialRespDto toRespDto(BizMaterial bizMaterial); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param bizMaterials 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List bizMaterials); + + /** + * 请求 DTO 转换为实体 + * + * @param bizMaterialReqDto 请求 DTO + * @return 转换后的数据 + */ + BizMaterial fromReqDto(BizMaterialReqDto bizMaterialReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param bizMaterialReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List bizMaterialReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param bizMaterialQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + BizMaterialQuery fromQueryReqDtoToQuery(BizMaterialQueryReqDto bizMaterialQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverter.java b/src/main/java/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverter.java new file mode 100644 index 0000000..85f6e7f --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.req.BizPurchaseRequestQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizPurchaseRequestReqDto; +import com.metalloop.modules.bussiness.model.resp.BizPurchaseRequestRespDto; +import com.metalloop.modules.bussiness.model.po.BizPurchaseRequest; +import com.metalloop.modules.bussiness.model.query.BizPurchaseRequestQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 业务-求购信息转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface BizPurchaseRequestConverter { + + BizPurchaseRequestConverter INSTANCE = Mappers.getMapper(BizPurchaseRequestConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param bizPurchaseRequest 实体 + * @return 转换后的数据 + */ + BizPurchaseRequestRespDto toRespDto(BizPurchaseRequest bizPurchaseRequest); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param bizPurchaseRequests 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List bizPurchaseRequests); + + /** + * 请求 DTO 转换为实体 + * + * @param bizPurchaseRequestReqDto 请求 DTO + * @return 转换后的数据 + */ + BizPurchaseRequest fromReqDto(BizPurchaseRequestReqDto bizPurchaseRequestReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param bizPurchaseRequestReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List bizPurchaseRequestReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param bizPurchaseRequestQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + BizPurchaseRequestQuery fromQueryReqDtoToQuery(BizPurchaseRequestQueryReqDto bizPurchaseRequestQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverter.java b/src/main/java/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverter.java new file mode 100644 index 0000000..3feeee6 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.req.BizSupplyInfoQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizSupplyInfoReqDto; +import com.metalloop.modules.bussiness.model.resp.BizSupplyInfoRespDto; +import com.metalloop.modules.bussiness.model.po.BizSupplyInfo; +import com.metalloop.modules.bussiness.model.query.BizSupplyInfoQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 业务-发布信息转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface BizSupplyInfoConverter { + + BizSupplyInfoConverter INSTANCE = Mappers.getMapper(BizSupplyInfoConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param bizSupplyInfo 实体 + * @return 转换后的数据 + */ + BizSupplyInfoRespDto toRespDto(BizSupplyInfo bizSupplyInfo); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param bizSupplyInfos 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List bizSupplyInfos); + + /** + * 请求 DTO 转换为实体 + * + * @param bizSupplyInfoReqDto 请求 DTO + * @return 转换后的数据 + */ + BizSupplyInfo fromReqDto(BizSupplyInfoReqDto bizSupplyInfoReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param bizSupplyInfoReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List bizSupplyInfoReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param bizSupplyInfoQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + BizSupplyInfoQuery fromQueryReqDtoToQuery(BizSupplyInfoQueryReqDto bizSupplyInfoQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/bussiness/converter/BizVarietyConverter.java b/src/main/java/com/metalloop/modules/bussiness/converter/BizVarietyConverter.java new file mode 100644 index 0000000..9111100 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/converter/BizVarietyConverter.java @@ -0,0 +1,65 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.req.BizVarietyQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizVarietyReqDto; +import com.metalloop.modules.bussiness.model.resp.BizVarietyRespDto; +import com.metalloop.modules.bussiness.model.po.BizVariety; +import com.metalloop.modules.bussiness.model.query.BizVarietyQuery; +import org.mapstruct.Builder; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 业务-产品品种转换器 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("UnmappedTargetProperties") +@Mapper(builder = @Builder(disableBuilder = true)) +public interface BizVarietyConverter { + + BizVarietyConverter INSTANCE = Mappers.getMapper(BizVarietyConverter.class); + + /** + * 实体转换为响应 DTO + * + * @param bizVariety 实体 + * @return 转换后的数据 + */ + BizVarietyRespDto toRespDto(BizVariety bizVariety); + + /** + * 实体列表转换为响应 DTO 列表 + * + * @param bizVarietys 实体列表 + * @return 转换后的数据 + */ + List toRespDto(List bizVarietys); + + /** + * 请求 DTO 转换为实体 + * + * @param bizVarietyReqDto 请求 DTO + * @return 转换后的数据 + */ + BizVariety fromReqDto(BizVarietyReqDto bizVarietyReqDto); + + /** + * 请求 DTO 列表转换为实体列表 + * + * @param bizVarietyReqDtos 请求 DTO 列表 + * @return 转换后的数据 + */ + List fromReqDto(List bizVarietyReqDtos); + + /** + * 查询请求 DTO 转换为查询对象 + * + * @param bizVarietyQueryReqDto 查询请求DTO + * @return 转换后的数据 + */ + BizVarietyQuery fromQueryReqDtoToQuery(BizVarietyQueryReqDto bizVarietyQueryReqDto); +} diff --git a/src/main/java/com/metalloop/modules/bussiness/mapper/BizEnterpriseProductMapper.java b/src/main/java/com/metalloop/modules/bussiness/mapper/BizEnterpriseProductMapper.java new file mode 100644 index 0000000..4b0fa06 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/mapper/BizEnterpriseProductMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.bussiness.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.bussiness.model.po.BizEnterpriseProduct; +import org.apache.ibatis.annotations.Mapper; + +/** + * 企业经营产品 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface BizEnterpriseProductMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/bussiness/mapper/BizMaterialMapper.java b/src/main/java/com/metalloop/modules/bussiness/mapper/BizMaterialMapper.java new file mode 100644 index 0000000..8ef043d --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/mapper/BizMaterialMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.bussiness.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.bussiness.model.po.BizMaterial; +import org.apache.ibatis.annotations.Mapper; + +/** + * 业务-材质基础 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface BizMaterialMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/bussiness/mapper/BizPurchaseRequestMapper.java b/src/main/java/com/metalloop/modules/bussiness/mapper/BizPurchaseRequestMapper.java new file mode 100644 index 0000000..b10c0e3 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/mapper/BizPurchaseRequestMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.bussiness.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.bussiness.model.po.BizPurchaseRequest; +import org.apache.ibatis.annotations.Mapper; + +/** + * 业务-求购信息 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface BizPurchaseRequestMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/bussiness/mapper/BizSupplyInfoMapper.java b/src/main/java/com/metalloop/modules/bussiness/mapper/BizSupplyInfoMapper.java new file mode 100644 index 0000000..e6c1aa5 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/mapper/BizSupplyInfoMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.bussiness.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.bussiness.model.po.BizSupplyInfo; +import org.apache.ibatis.annotations.Mapper; + +/** + * 业务-发布信息 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface BizSupplyInfoMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/bussiness/mapper/BizVarietyMapper.java b/src/main/java/com/metalloop/modules/bussiness/mapper/BizVarietyMapper.java new file mode 100644 index 0000000..f7f5e12 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/mapper/BizVarietyMapper.java @@ -0,0 +1,15 @@ +package com.metalloop.modules.bussiness.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.metalloop.modules.bussiness.model.po.BizVariety; +import org.apache.ibatis.annotations.Mapper; + +/** + * 业务-产品品种 Mapper + * + * @author yy + * @since 2026-09-10 + */ +@Mapper +public interface BizVarietyMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/metalloop/modules/bussiness/model/po/BizEnterpriseProduct.java b/src/main/java/com/metalloop/modules/bussiness/model/po/BizEnterpriseProduct.java new file mode 100644 index 0000000..2a74ba7 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/po/BizEnterpriseProduct.java @@ -0,0 +1,97 @@ +package com.metalloop.modules.bussiness.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业经营产品 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业经营产品") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "biz_enterprise_product") +public class BizEnterpriseProduct implements Serializable { + + /** + * 记录ID(主键) + */ + @Schema(description = "记录ID(主键)") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 企业ID(关联 ent_enterprise 表) + */ + @Schema(description = "企业ID(关联 ent_enterprise 表)") + @TableField(value = "enterprise_id") + private Long enterpriseId; + + /** + * 品种ID(关联 biz_variety 表) + */ + @Schema(description = "品种ID(关联 biz_variety 表)") + @TableField(value = "variety_id") + private Long varietyId; + + /** + * 材质ID(关联 biz_material 表) + */ + @Schema(description = "材质ID(关联 biz_material 表)") + @TableField(value = "material_id") + private Long materialId; + + /** + * 单价 + */ + @Schema(description = "单价") + @TableField(value = "unit_price") + private java.math.BigDecimal unitPrice; + + /** + * 可供应重量 + */ + @Schema(description = "可供应重量") + @TableField(value = "weight") + private java.math.BigDecimal weight; + + /** + * 状态(0-下架/停售,1-上架/在售) + */ + @Schema(description = "状态(0-下架/停售,1-上架/在售)") + @TableField(value = "status") + private Boolean status; + + /** + * 备注说明(如:含税价、交货期等) + */ + @Schema(description = "备注说明(如:含税价、交货期等)") + @TableField(value = "remark") + private String remark; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/po/BizMaterial.java b/src/main/java/com/metalloop/modules/bussiness/model/po/BizMaterial.java new file mode 100644 index 0000000..88e6623 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/po/BizMaterial.java @@ -0,0 +1,69 @@ +package com.metalloop.modules.bussiness.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-材质基础 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-材质基础") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "biz_material") +public class BizMaterial implements Serializable { + + /** + * 材质ID + */ + @Schema(description = "材质ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 材质名称 + */ + @Schema(description = "材质名称") + @TableField(value = "material_name") + private String materialName; + + /** + * 材质编码 + */ + @Schema(description = "材质编码") + @TableField(value = "material_code") + private String materialCode; + + /** + * 材质描述 + */ + @Schema(description = "材质描述") + @TableField(value = "description") + private String description; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/po/BizPurchaseRequest.java b/src/main/java/com/metalloop/modules/bussiness/model/po/BizPurchaseRequest.java new file mode 100644 index 0000000..6b57341 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/po/BizPurchaseRequest.java @@ -0,0 +1,209 @@ +package com.metalloop.modules.bussiness.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-求购信息 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-求购信息") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "biz_purchase_request") +public class BizPurchaseRequest implements Serializable { + + /** + * 求购信息ID(主键) + */ + @Schema(description = "求购信息ID(主键)") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 发布人用户ID(关联 sys_user 表) + */ + @Schema(description = "发布人用户ID(关联 sys_user 表)") + @TableField(value = "create_user_id") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + @TableField(value = "enterprise_id") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + @TableField(value = "element_type") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + @TableField(value = "product_category") + private String productCategory; + + /** + * 商品材质(如:紫铜、黄铜、A00) + */ + @Schema(description = "商品材质(如:紫铜、黄铜、A00)") + @TableField(value = "material") + private String material; + + /** + * 求购标题 + */ + @Schema(description = "求购标题") + @TableField(value = "title") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + @TableField(value = "description") + private String description; + + /** + * 求购数量( + */ + @Schema(description = "求购数量(") + @TableField(value = "quantity") + private java.math.BigDecimal quantity; + + /** + * 期望单价 + */ + @Schema(description = "期望单价") + @TableField(value = "unit_price") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + @TableField(value = "contact_person") + private String contactPerson; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + @TableField(value = "contact_phone") + private String contactPhone; + + /** + * 交货期 + */ + @Schema(description = "交货期") + @TableField(value = "delivery_date") + private java.util.Date deliveryDate; + + /** + * 交货地点 + */ + @Schema(description = "交货地点") + @TableField(value = "delivery_location") + private String deliveryLocation; + + /** + * 图片URL + */ + @Schema(description = "图片URL") + @TableField(value = "image_url") + private String imageUrl; + + /** + * 审核状态(0-待审核,1-已通过,2-已驳回) + */ + @Schema(description = "审核状态(0-待审核,1-已通过,2-已驳回)") + @TableField(value = "audit_status") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + @TableField(value = "publish_time") + private java.util.Date publishTime; + + /** + * 过期时间(信息有效期截止) + */ + @Schema(description = "过期时间(信息有效期截止)") + @TableField(value = "expire_time") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + @TableField(value = "account_period_mode") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + @TableField(value = "deposit_ratio") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + @TableField(value = "final_payment_deadline") + private String finalPaymentDeadline; + + /** + * 上下架状态(0-已下架,1-展示中) + */ + @Schema(description = "上下架状态(0-已下架,1-展示中)") + @TableField(value = "status") + private Boolean status; + + /** + * 审核驳回原因(audit_status=2时填写) + */ + @Schema(description = "审核驳回原因(audit_status=2时填写)") + @TableField(value = "reject_reason") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + @TableField(value = "update_user_id") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/po/BizSupplyInfo.java b/src/main/java/com/metalloop/modules/bussiness/model/po/BizSupplyInfo.java new file mode 100644 index 0000000..fd51cdf --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/po/BizSupplyInfo.java @@ -0,0 +1,202 @@ +package com.metalloop.modules.bussiness.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-发布信息 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-发布信息") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "biz_supply_info") +public class BizSupplyInfo implements Serializable { + + /** + * 发布信息ID + */ + @Schema(description = "发布信息ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 发布人用户ID + */ + @Schema(description = "发布人用户ID") + @TableField(value = "create_user_id") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + @TableField(value = "enterprise_id") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + @TableField(value = "element_type") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + @TableField(value = "product_category") + private String productCategory; + + /** + * 商品材质 + */ + @Schema(description = "商品材质") + @TableField(value = "material") + private String material; + + /** + * 发布标题 + */ + @Schema(description = "发布标题") + @TableField(value = "title") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + @TableField(value = "description") + private String description; + + /** + * 数量 + */ + @Schema(description = "数量") + @TableField(value = "quantity") + private java.math.BigDecimal quantity; + + /** + * 单价 + */ + @Schema(description = "单价") + @TableField(value = "unit_price") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + @TableField(value = "contact_person") + private String contactPerson; + + /** + * 电话 + */ + @Schema(description = "电话") + @TableField(value = "contact_phone") + private String contactPhone; + + /** + * 发货地点 + */ + @Schema(description = "发货地点") + @TableField(value = "delivery_location") + private String deliveryLocation; + + /** + * 图片 + */ + @Schema(description = "图片") + @TableField(value = "image_url") + private String imageUrl; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @TableField(value = "audit_status") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + @TableField(value = "publish_time") + private java.util.Date publishTime; + + /** + * 过期时间 + */ + @Schema(description = "过期时间") + @TableField(value = "expire_time") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + @TableField(value = "account_period_mode") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + @TableField(value = "deposit_ratio") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + @TableField(value = "final_payment_deadline") + private String finalPaymentDeadline; + + /** + * 上下架状态 + */ + @Schema(description = "上下架状态") + @TableField(value = "status") + private Boolean status; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + @TableField(value = "reject_reason") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + @TableField(value = "update_user_id") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/po/BizVariety.java b/src/main/java/com/metalloop/modules/bussiness/model/po/BizVariety.java new file mode 100644 index 0000000..0f20422 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/po/BizVariety.java @@ -0,0 +1,97 @@ +package com.metalloop.modules.bussiness.model.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-产品品种 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-产品品种") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "biz_variety") +public class BizVariety implements Serializable { + + /** + * 品种ID(主键) + */ + @Schema(description = "品种ID(主键)") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 品种名称 + */ + @Schema(description = "品种名称") + @TableField(value = "variety_name") + private String varietyName; + + /** + * 品种等级 + */ + @Schema(description = "品种等级") + @TableField(value = "variety_grade") + private String varietyGrade; + + /** + * 父级品种ID + */ + @Schema(description = "父级品种ID") + @TableField(value = "parent_id") + private Long parentId; + + /** + * 品种主体材质 + */ + @Schema(description = "品种主体材质") + @TableField(value = "variety_material") + private String varietyMaterial; + + /** + * 品种补充说明 + */ + @Schema(description = "品种补充说明") + @TableField(value = "description") + private String description; + + /** + * 排序权重 + */ + @Schema(description = "排序权重") + @TableField(value = "sort") + private Integer sort; + + /** + * 状态(0-禁用,1-启用) + */ + @Schema(description = "状态(0-禁用,1-启用)") + @TableField(value = "status") + private Boolean status; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/query/BizEnterpriseProductQuery.java b/src/main/java/com/metalloop/modules/bussiness/model/query/BizEnterpriseProductQuery.java new file mode 100644 index 0000000..41434a8 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/query/BizEnterpriseProductQuery.java @@ -0,0 +1,96 @@ +package com.metalloop.modules.bussiness.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业经营产品查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业经营产品查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class BizEnterpriseProductQuery implements Serializable { + + /** + * 记录ID(主键) + */ + @Schema(description = "记录ID(主键)") + @TableField(value = "id") + private Long id; + + /** + * 企业ID(关联 ent_enterprise 表) + */ + @Schema(description = "企业ID(关联 ent_enterprise 表)") + @TableField(value = "enterprise_id") + private Long enterpriseId; + + /** + * 品种ID(关联 biz_variety 表) + */ + @Schema(description = "品种ID(关联 biz_variety 表)") + @TableField(value = "variety_id") + private Long varietyId; + + /** + * 材质ID(关联 biz_material 表) + */ + @Schema(description = "材质ID(关联 biz_material 表)") + @TableField(value = "material_id") + private Long materialId; + + /** + * 单价 + */ + @Schema(description = "单价") + @TableField(value = "unit_price") + private java.math.BigDecimal unitPrice; + + /** + * 可供应重量 + */ + @Schema(description = "可供应重量") + @TableField(value = "weight") + private java.math.BigDecimal weight; + + /** + * 状态(0-下架/停售,1-上架/在售) + */ + @Schema(description = "状态(0-下架/停售,1-上架/在售)") + @TableField(value = "status") + private Boolean status; + + /** + * 备注说明(如:含税价、交货期等) + */ + @Schema(description = "备注说明(如:含税价、交货期等)") + @TableField(value = "remark") + private String remark; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(value = "update_time") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/query/BizMaterialQuery.java b/src/main/java/com/metalloop/modules/bussiness/model/query/BizMaterialQuery.java new file mode 100644 index 0000000..43c8ac0 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/query/BizMaterialQuery.java @@ -0,0 +1,68 @@ +package com.metalloop.modules.bussiness.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-材质基础查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-材质基础查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class BizMaterialQuery implements Serializable { + + /** + * 材质ID + */ + @Schema(description = "材质ID") + @TableField(value = "id") + private Long id; + + /** + * 材质名称 + */ + @Schema(description = "材质名称") + @TableField(value = "material_name") + private String materialName; + + /** + * 材质编码 + */ + @Schema(description = "材质编码") + @TableField(value = "material_code") + private String materialCode; + + /** + * 材质描述 + */ + @Schema(description = "材质描述") + @TableField(value = "description") + private String description; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(value = "update_time") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/query/BizPurchaseRequestQuery.java b/src/main/java/com/metalloop/modules/bussiness/model/query/BizPurchaseRequestQuery.java new file mode 100644 index 0000000..b43dead --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/query/BizPurchaseRequestQuery.java @@ -0,0 +1,208 @@ +package com.metalloop.modules.bussiness.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-求购信息查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-求购信息查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class BizPurchaseRequestQuery implements Serializable { + + /** + * 求购信息ID(主键) + */ + @Schema(description = "求购信息ID(主键)") + @TableField(value = "id") + private Long id; + + /** + * 发布人用户ID(关联 sys_user 表) + */ + @Schema(description = "发布人用户ID(关联 sys_user 表)") + @TableField(value = "create_user_id") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + @TableField(value = "enterprise_id") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + @TableField(value = "element_type") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + @TableField(value = "product_category") + private String productCategory; + + /** + * 商品材质(如:紫铜、黄铜、A00) + */ + @Schema(description = "商品材质(如:紫铜、黄铜、A00)") + @TableField(value = "material") + private String material; + + /** + * 求购标题 + */ + @Schema(description = "求购标题") + @TableField(value = "title") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + @TableField(value = "description") + private String description; + + /** + * 求购数量( + */ + @Schema(description = "求购数量(") + @TableField(value = "quantity") + private java.math.BigDecimal quantity; + + /** + * 期望单价 + */ + @Schema(description = "期望单价") + @TableField(value = "unit_price") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + @TableField(value = "contact_person") + private String contactPerson; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + @TableField(value = "contact_phone") + private String contactPhone; + + /** + * 交货期 + */ + @Schema(description = "交货期") + @TableField(value = "delivery_date") + private java.util.Date deliveryDate; + + /** + * 交货地点 + */ + @Schema(description = "交货地点") + @TableField(value = "delivery_location") + private String deliveryLocation; + + /** + * 图片URL + */ + @Schema(description = "图片URL") + @TableField(value = "image_url") + private String imageUrl; + + /** + * 审核状态(0-待审核,1-已通过,2-已驳回) + */ + @Schema(description = "审核状态(0-待审核,1-已通过,2-已驳回)") + @TableField(value = "audit_status") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + @TableField(value = "publish_time") + private java.util.Date publishTime; + + /** + * 过期时间(信息有效期截止) + */ + @Schema(description = "过期时间(信息有效期截止)") + @TableField(value = "expire_time") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + @TableField(value = "account_period_mode") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + @TableField(value = "deposit_ratio") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + @TableField(value = "final_payment_deadline") + private String finalPaymentDeadline; + + /** + * 上下架状态(0-已下架,1-展示中) + */ + @Schema(description = "上下架状态(0-已下架,1-展示中)") + @TableField(value = "status") + private Boolean status; + + /** + * 审核驳回原因(audit_status=2时填写) + */ + @Schema(description = "审核驳回原因(audit_status=2时填写)") + @TableField(value = "reject_reason") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + @TableField(value = "update_user_id") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(value = "update_time") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/query/BizSupplyInfoQuery.java b/src/main/java/com/metalloop/modules/bussiness/model/query/BizSupplyInfoQuery.java new file mode 100644 index 0000000..9e8f854 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/query/BizSupplyInfoQuery.java @@ -0,0 +1,201 @@ +package com.metalloop.modules.bussiness.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-发布信息查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-发布信息查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class BizSupplyInfoQuery implements Serializable { + + /** + * 发布信息ID + */ + @Schema(description = "发布信息ID") + @TableField(value = "id") + private Long id; + + /** + * 发布人用户ID + */ + @Schema(description = "发布人用户ID") + @TableField(value = "create_user_id") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + @TableField(value = "enterprise_id") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + @TableField(value = "element_type") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + @TableField(value = "product_category") + private String productCategory; + + /** + * 商品材质 + */ + @Schema(description = "商品材质") + @TableField(value = "material") + private String material; + + /** + * 发布标题 + */ + @Schema(description = "发布标题") + @TableField(value = "title") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + @TableField(value = "description") + private String description; + + /** + * 数量 + */ + @Schema(description = "数量") + @TableField(value = "quantity") + private java.math.BigDecimal quantity; + + /** + * 单价 + */ + @Schema(description = "单价") + @TableField(value = "unit_price") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + @TableField(value = "contact_person") + private String contactPerson; + + /** + * 电话 + */ + @Schema(description = "电话") + @TableField(value = "contact_phone") + private String contactPhone; + + /** + * 发货地点 + */ + @Schema(description = "发货地点") + @TableField(value = "delivery_location") + private String deliveryLocation; + + /** + * 图片 + */ + @Schema(description = "图片") + @TableField(value = "image_url") + private String imageUrl; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + @TableField(value = "audit_status") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + @TableField(value = "publish_time") + private java.util.Date publishTime; + + /** + * 过期时间 + */ + @Schema(description = "过期时间") + @TableField(value = "expire_time") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + @TableField(value = "account_period_mode") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + @TableField(value = "deposit_ratio") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + @TableField(value = "final_payment_deadline") + private String finalPaymentDeadline; + + /** + * 上下架状态 + */ + @Schema(description = "上下架状态") + @TableField(value = "status") + private Boolean status; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + @TableField(value = "reject_reason") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + @TableField(value = "update_user_id") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + @TableField(value = "update_time") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/query/BizVarietyQuery.java b/src/main/java/com/metalloop/modules/bussiness/model/query/BizVarietyQuery.java new file mode 100644 index 0000000..420e931 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/query/BizVarietyQuery.java @@ -0,0 +1,96 @@ +package com.metalloop.modules.bussiness.model.query; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-产品品种查询对象 + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-产品品种查询对象") +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class BizVarietyQuery implements Serializable { + + /** + * 品种ID(主键) + */ + @Schema(description = "品种ID(主键)") + @TableField(value = "id") + private Long id; + + /** + * 品种名称 + */ + @Schema(description = "品种名称") + @TableField(value = "variety_name") + private String varietyName; + + /** + * 品种等级 + */ + @Schema(description = "品种等级") + @TableField(value = "variety_grade") + private String varietyGrade; + + /** + * 父级品种ID + */ + @Schema(description = "父级品种ID") + @TableField(value = "parent_id") + private Long parentId; + + /** + * 品种主体材质 + */ + @Schema(description = "品种主体材质") + @TableField(value = "variety_material") + private String varietyMaterial; + + /** + * 品种补充说明 + */ + @Schema(description = "品种补充说明") + @TableField(value = "description") + private String description; + + /** + * 排序权重 + */ + @Schema(description = "排序权重") + @TableField(value = "sort") + private Integer sort; + + /** + * 状态(0-禁用,1-启用) + */ + @Schema(description = "状态(0-禁用,1-启用)") + @TableField(value = "status") + private Boolean status; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + @TableField(value = "create_time") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + @TableField(value = "update_time") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductLockConditionReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductLockConditionReqDto.java new file mode 100644 index 0000000..224eaea --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductLockConditionReqDto.java @@ -0,0 +1,37 @@ +package com.metalloop.modules.bussiness.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 企业经营产品及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizEnterpriseProductLockConditionReqDto implements Serializable { + + /** + * 企业经营产品实体 + */ + @Schema(description = "企业经营产品实体") + private BizEnterpriseProductReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductPageQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductPageQueryReqDto.java new file mode 100644 index 0000000..7667228 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductPageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.bussiness.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业经营产品分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "企业经营产品分页查询请求 DTO") +public class BizEnterpriseProductPageQueryReqDto extends BizEnterpriseProductQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductQueryReqDto.java new file mode 100644 index 0000000..6608bb7 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductQueryReqDto.java @@ -0,0 +1,85 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业经营产品查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业经营产品查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizEnterpriseProductQueryReqDto implements Serializable { + + /** + * 记录ID(主键) + */ + @Schema(description = "记录ID(主键)") + private Long id; + + /** + * 企业ID(关联 ent_enterprise 表) + */ + @Schema(description = "企业ID(关联 ent_enterprise 表)") + private Long enterpriseId; + + /** + * 品种ID(关联 biz_variety 表) + */ + @Schema(description = "品种ID(关联 biz_variety 表)") + private Long varietyId; + + /** + * 材质ID(关联 biz_material 表) + */ + @Schema(description = "材质ID(关联 biz_material 表)") + private Long materialId; + + /** + * 单价 + */ + @Schema(description = "单价") + private java.math.BigDecimal unitPrice; + + /** + * 可供应重量 + */ + @Schema(description = "可供应重量") + private java.math.BigDecimal weight; + + /** + * 状态(0-下架/停售,1-上架/在售) + */ + @Schema(description = "状态(0-下架/停售,1-上架/在售)") + private Boolean status; + + /** + * 备注说明(如:含税价、交货期等) + */ + @Schema(description = "备注说明(如:含税价、交货期等)") + private String remark; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductReqDto.java new file mode 100644 index 0000000..f4fd655 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductReqDto.java @@ -0,0 +1,85 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业经营产品请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业经营产品请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizEnterpriseProductReqDto implements Serializable { + + /** + * 记录ID(主键) + */ + @Schema(description = "记录ID(主键)") + private Long id; + + /** + * 企业ID(关联 ent_enterprise 表) + */ + @Schema(description = "企业ID(关联 ent_enterprise 表)") + private Long enterpriseId; + + /** + * 品种ID(关联 biz_variety 表) + */ + @Schema(description = "品种ID(关联 biz_variety 表)") + private Long varietyId; + + /** + * 材质ID(关联 biz_material 表) + */ + @Schema(description = "材质ID(关联 biz_material 表)") + private Long materialId; + + /** + * 单价 + */ + @Schema(description = "单价") + private java.math.BigDecimal unitPrice; + + /** + * 可供应重量 + */ + @Schema(description = "可供应重量") + private java.math.BigDecimal weight; + + /** + * 状态(0-下架/停售,1-上架/在售) + */ + @Schema(description = "状态(0-下架/停售,1-上架/在售)") + private Boolean status; + + /** + * 备注说明(如:含税价、交货期等) + */ + @Schema(description = "备注说明(如:含税价、交货期等)") + private String remark; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductUpdateByQueryReqDto.java new file mode 100644 index 0000000..c445556 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业经营产品根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业经营产品根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizEnterpriseProductUpdateByQueryReqDto implements Serializable { + + /** + * 企业经营产品实体 + */ + @Schema(description = "企业经营产品实体") + private BizEnterpriseProductReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private BizEnterpriseProductQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialLockConditionReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialLockConditionReqDto.java new file mode 100644 index 0000000..4609985 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.bussiness.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 业务-材质基础及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizMaterialLockConditionReqDto implements Serializable { + + /** + * 业务-材质基础实体 + */ + @Schema(description = "业务-材质基础实体") + private BizMaterialReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialPageQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialPageQueryReqDto.java new file mode 100644 index 0000000..8b5f5a1 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialPageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.bussiness.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-材质基础分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "业务-材质基础分页查询请求 DTO") +public class BizMaterialPageQueryReqDto extends BizMaterialQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialQueryReqDto.java new file mode 100644 index 0000000..f498895 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialQueryReqDto.java @@ -0,0 +1,61 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-材质基础查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-材质基础查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizMaterialQueryReqDto implements Serializable { + + /** + * 材质ID + */ + @Schema(description = "材质ID") + private Long id; + + /** + * 材质名称 + */ + @Schema(description = "材质名称") + private String materialName; + + /** + * 材质编码 + */ + @Schema(description = "材质编码") + private String materialCode; + + /** + * 材质描述 + */ + @Schema(description = "材质描述") + private String description; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialReqDto.java new file mode 100644 index 0000000..bc4c375 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialReqDto.java @@ -0,0 +1,61 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-材质基础请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-材质基础请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizMaterialReqDto implements Serializable { + + /** + * 材质ID + */ + @Schema(description = "材质ID") + private Long id; + + /** + * 材质名称 + */ + @Schema(description = "材质名称") + private String materialName; + + /** + * 材质编码 + */ + @Schema(description = "材质编码") + private String materialCode; + + /** + * 材质描述 + */ + @Schema(description = "材质描述") + private String description; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialUpdateByQueryReqDto.java new file mode 100644 index 0000000..7eeb37c --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizMaterialUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-材质基础根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-材质基础根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizMaterialUpdateByQueryReqDto implements Serializable { + + /** + * 业务-材质基础实体 + */ + @Schema(description = "业务-材质基础实体") + private BizMaterialReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private BizMaterialQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestLockConditionReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestLockConditionReqDto.java new file mode 100644 index 0000000..f0099fd --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.bussiness.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 业务-求购信息及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizPurchaseRequestLockConditionReqDto implements Serializable { + + /** + * 业务-求购信息实体 + */ + @Schema(description = "业务-求购信息实体") + private BizPurchaseRequestReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestPageQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestPageQueryReqDto.java new file mode 100644 index 0000000..e004da5 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestPageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.bussiness.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-求购信息分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "业务-求购信息分页查询请求 DTO") +public class BizPurchaseRequestPageQueryReqDto extends BizPurchaseRequestQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestQueryReqDto.java new file mode 100644 index 0000000..a9a6ac8 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestQueryReqDto.java @@ -0,0 +1,181 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-求购信息查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-求购信息查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizPurchaseRequestQueryReqDto implements Serializable { + + /** + * 求购信息ID(主键) + */ + @Schema(description = "求购信息ID(主键)") + private Long id; + + /** + * 发布人用户ID(关联 sys_user 表) + */ + @Schema(description = "发布人用户ID(关联 sys_user 表)") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + private String productCategory; + + /** + * 商品材质(如:紫铜、黄铜、A00) + */ + @Schema(description = "商品材质(如:紫铜、黄铜、A00)") + private String material; + + /** + * 求购标题 + */ + @Schema(description = "求购标题") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + private String description; + + /** + * 求购数量( + */ + @Schema(description = "求购数量(") + private java.math.BigDecimal quantity; + + /** + * 期望单价 + */ + @Schema(description = "期望单价") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contactPerson; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String contactPhone; + + /** + * 交货期 + */ + @Schema(description = "交货期") + private java.util.Date deliveryDate; + + /** + * 交货地点 + */ + @Schema(description = "交货地点") + private String deliveryLocation; + + /** + * 图片URL + */ + @Schema(description = "图片URL") + private String imageUrl; + + /** + * 审核状态(0-待审核,1-已通过,2-已驳回) + */ + @Schema(description = "审核状态(0-待审核,1-已通过,2-已驳回)") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + private java.util.Date publishTime; + + /** + * 过期时间(信息有效期截止) + */ + @Schema(description = "过期时间(信息有效期截止)") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + private String finalPaymentDeadline; + + /** + * 上下架状态(0-已下架,1-展示中) + */ + @Schema(description = "上下架状态(0-已下架,1-展示中)") + private Boolean status; + + /** + * 审核驳回原因(audit_status=2时填写) + */ + @Schema(description = "审核驳回原因(audit_status=2时填写)") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestReqDto.java new file mode 100644 index 0000000..df0af49 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestReqDto.java @@ -0,0 +1,181 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-求购信息请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-求购信息请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizPurchaseRequestReqDto implements Serializable { + + /** + * 求购信息ID(主键) + */ + @Schema(description = "求购信息ID(主键)") + private Long id; + + /** + * 发布人用户ID(关联 sys_user 表) + */ + @Schema(description = "发布人用户ID(关联 sys_user 表)") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + private String productCategory; + + /** + * 商品材质(如:紫铜、黄铜、A00) + */ + @Schema(description = "商品材质(如:紫铜、黄铜、A00)") + private String material; + + /** + * 求购标题 + */ + @Schema(description = "求购标题") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + private String description; + + /** + * 求购数量( + */ + @Schema(description = "求购数量(") + private java.math.BigDecimal quantity; + + /** + * 期望单价 + */ + @Schema(description = "期望单价") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contactPerson; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String contactPhone; + + /** + * 交货期 + */ + @Schema(description = "交货期") + private java.util.Date deliveryDate; + + /** + * 交货地点 + */ + @Schema(description = "交货地点") + private String deliveryLocation; + + /** + * 图片URL + */ + @Schema(description = "图片URL") + private String imageUrl; + + /** + * 审核状态(0-待审核,1-已通过,2-已驳回) + */ + @Schema(description = "审核状态(0-待审核,1-已通过,2-已驳回)") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + private java.util.Date publishTime; + + /** + * 过期时间(信息有效期截止) + */ + @Schema(description = "过期时间(信息有效期截止)") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + private String finalPaymentDeadline; + + /** + * 上下架状态(0-已下架,1-展示中) + */ + @Schema(description = "上下架状态(0-已下架,1-展示中)") + private Boolean status; + + /** + * 审核驳回原因(audit_status=2时填写) + */ + @Schema(description = "审核驳回原因(audit_status=2时填写)") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestUpdateByQueryReqDto.java new file mode 100644 index 0000000..15ee51b --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-求购信息根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-求购信息根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizPurchaseRequestUpdateByQueryReqDto implements Serializable { + + /** + * 业务-求购信息实体 + */ + @Schema(description = "业务-求购信息实体") + private BizPurchaseRequestReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private BizPurchaseRequestQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoLockConditionReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoLockConditionReqDto.java new file mode 100644 index 0000000..116562c --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoLockConditionReqDto.java @@ -0,0 +1,36 @@ +package com.metalloop.modules.bussiness.model.req; + +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 业务-发布信息及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizSupplyInfoLockConditionReqDto implements Serializable { + + /** + * 业务-发布信息实体 + */ + @Schema(description = "业务-发布信息实体") + private BizSupplyInfoReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoPageQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoPageQueryReqDto.java new file mode 100644 index 0000000..40efcba --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoPageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.bussiness.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-发布信息分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "业务-发布信息分页查询请求 DTO") +public class BizSupplyInfoPageQueryReqDto extends BizSupplyInfoQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoQueryReqDto.java new file mode 100644 index 0000000..c04ba0a --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoQueryReqDto.java @@ -0,0 +1,175 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-发布信息查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-发布信息查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizSupplyInfoQueryReqDto implements Serializable { + + /** + * 发布信息ID + */ + @Schema(description = "发布信息ID") + private Long id; + + /** + * 发布人用户ID + */ + @Schema(description = "发布人用户ID") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + private String productCategory; + + /** + * 商品材质 + */ + @Schema(description = "商品材质") + private String material; + + /** + * 发布标题 + */ + @Schema(description = "发布标题") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + private String description; + + /** + * 数量 + */ + @Schema(description = "数量") + private java.math.BigDecimal quantity; + + /** + * 单价 + */ + @Schema(description = "单价") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contactPerson; + + /** + * 电话 + */ + @Schema(description = "电话") + private String contactPhone; + + /** + * 发货地点 + */ + @Schema(description = "发货地点") + private String deliveryLocation; + + /** + * 图片 + */ + @Schema(description = "图片") + private String imageUrl; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + private java.util.Date publishTime; + + /** + * 过期时间 + */ + @Schema(description = "过期时间") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + private String finalPaymentDeadline; + + /** + * 上下架状态 + */ + @Schema(description = "上下架状态") + private Boolean status; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoReqDto.java new file mode 100644 index 0000000..c813f35 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoReqDto.java @@ -0,0 +1,175 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-发布信息请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-发布信息请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizSupplyInfoReqDto implements Serializable { + + /** + * 发布信息ID + */ + @Schema(description = "发布信息ID") + private Long id; + + /** + * 发布人用户ID + */ + @Schema(description = "发布人用户ID") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + private String productCategory; + + /** + * 商品材质 + */ + @Schema(description = "商品材质") + private String material; + + /** + * 发布标题 + */ + @Schema(description = "发布标题") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + private String description; + + /** + * 数量 + */ + @Schema(description = "数量") + private java.math.BigDecimal quantity; + + /** + * 单价 + */ + @Schema(description = "单价") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contactPerson; + + /** + * 电话 + */ + @Schema(description = "电话") + private String contactPhone; + + /** + * 发货地点 + */ + @Schema(description = "发货地点") + private String deliveryLocation; + + /** + * 图片 + */ + @Schema(description = "图片") + private String imageUrl; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + private java.util.Date publishTime; + + /** + * 过期时间 + */ + @Schema(description = "过期时间") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + private String finalPaymentDeadline; + + /** + * 上下架状态 + */ + @Schema(description = "上下架状态") + private Boolean status; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoUpdateByQueryReqDto.java new file mode 100644 index 0000000..81dedac --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizSupplyInfoUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-发布信息根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-发布信息根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizSupplyInfoUpdateByQueryReqDto implements Serializable { + + /** + * 业务-发布信息实体 + */ + @Schema(description = "业务-发布信息实体") + private BizSupplyInfoReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private BizSupplyInfoQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyLockConditionReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyLockConditionReqDto.java new file mode 100644 index 0000000..7b861cb --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyLockConditionReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.bussiness.model.req; +import com.metalloop.common.core.lock.LockConditionReqDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 业务-产品品种及幂等性锁定条件组合 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizVarietyLockConditionReqDto implements Serializable { + + /** + * 业务-产品品种实体 + */ + @Schema(description = "业务-产品品种实体") + private BizVarietyReqDto entity; + + /** + * 锁定条件 + */ + @Schema(description = "锁定条件") + private List> conditions; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyPageQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyPageQueryReqDto.java new file mode 100644 index 0000000..a2a0027 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyPageQueryReqDto.java @@ -0,0 +1,47 @@ +package com.metalloop.modules.bussiness.model.req; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-产品品种分页查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@EqualsAndHashCode(callSuper = true) +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "业务-产品品种分页查询请求 DTO") +public class BizVarietyPageQueryReqDto extends BizVarietyQueryReqDto implements Serializable { + // region 分页参数接收区域 + /** + * 当前页 + */ + @Schema(description = "当前页,默认 1") + private Long current = 1L; + + /** + * 每页显示条数,默认 10 + */ + @Schema(description = "每页显示条数,默认 10") + private Long size = 10L; + + /** + * 生成 mybatis plus 的分页对象 + * + * @param 分页元素类型 + * @return 分页对象 + */ + public Page page() { + return Page.of(current, size); + } + // ednRegion +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyQueryReqDto.java new file mode 100644 index 0000000..932e48b --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyQueryReqDto.java @@ -0,0 +1,85 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-产品品种查询请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-产品品种查询请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizVarietyQueryReqDto implements Serializable { + + /** + * 品种ID(主键) + */ + @Schema(description = "品种ID(主键)") + private Long id; + + /** + * 品种名称 + */ + @Schema(description = "品种名称") + private String varietyName; + + /** + * 品种等级 + */ + @Schema(description = "品种等级") + private String varietyGrade; + + /** + * 父级品种ID + */ + @Schema(description = "父级品种ID") + private Long parentId; + + /** + * 品种主体材质 + */ + @Schema(description = "品种主体材质") + private String varietyMaterial; + + /** + * 品种补充说明 + */ + @Schema(description = "品种补充说明") + private String description; + + /** + * 排序权重 + */ + @Schema(description = "排序权重") + private Integer sort; + + /** + * 状态(0-禁用,1-启用) + */ + @Schema(description = "状态(0-禁用,1-启用)") + private Boolean status; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyReqDto.java new file mode 100644 index 0000000..85b83ac --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyReqDto.java @@ -0,0 +1,85 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-产品品种请求 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-产品品种请求 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizVarietyReqDto implements Serializable { + + /** + * 品种ID(主键) + */ + @Schema(description = "品种ID(主键)") + private Long id; + + /** + * 品种名称 + */ + @Schema(description = "品种名称") + private String varietyName; + + /** + * 品种等级 + */ + @Schema(description = "品种等级") + private String varietyGrade; + + /** + * 父级品种ID + */ + @Schema(description = "父级品种ID") + private Long parentId; + + /** + * 品种主体材质 + */ + @Schema(description = "品种主体材质") + private String varietyMaterial; + + /** + * 品种补充说明 + */ + @Schema(description = "品种补充说明") + private String description; + + /** + * 排序权重 + */ + @Schema(description = "排序权重") + private Integer sort; + + /** + * 状态(0-禁用,1-启用) + */ + @Schema(description = "状态(0-禁用,1-启用)") + private Boolean status; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyUpdateByQueryReqDto.java b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyUpdateByQueryReqDto.java new file mode 100644 index 0000000..ac10d5f --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/req/BizVarietyUpdateByQueryReqDto.java @@ -0,0 +1,35 @@ +package com.metalloop.modules.bussiness.model.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-产品品种根据查询修改 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-产品品种根据查询修改 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizVarietyUpdateByQueryReqDto implements Serializable { + + /** + * 业务-产品品种实体 + */ + @Schema(description = "业务-产品品种实体") + private BizVarietyReqDto entity; + + /** + * 查询请求 DTO + */ + @Schema(description = "查询请求 DTO") + private BizVarietyQueryReqDto queryReqDto; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/resp/BizEnterpriseProductRespDto.java b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizEnterpriseProductRespDto.java new file mode 100644 index 0000000..30a0840 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizEnterpriseProductRespDto.java @@ -0,0 +1,85 @@ +package com.metalloop.modules.bussiness.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 企业经营产品响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "企业经营产品响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizEnterpriseProductRespDto implements Serializable { + + /** + * 记录ID(主键) + */ + @Schema(description = "记录ID(主键)") + private Long id; + + /** + * 企业ID(关联 ent_enterprise 表) + */ + @Schema(description = "企业ID(关联 ent_enterprise 表)") + private Long enterpriseId; + + /** + * 品种ID(关联 biz_variety 表) + */ + @Schema(description = "品种ID(关联 biz_variety 表)") + private Long varietyId; + + /** + * 材质ID(关联 biz_material 表) + */ + @Schema(description = "材质ID(关联 biz_material 表)") + private Long materialId; + + /** + * 单价 + */ + @Schema(description = "单价") + private java.math.BigDecimal unitPrice; + + /** + * 可供应重量 + */ + @Schema(description = "可供应重量") + private java.math.BigDecimal weight; + + /** + * 状态(0-下架/停售,1-上架/在售) + */ + @Schema(description = "状态(0-下架/停售,1-上架/在售)") + private Boolean status; + + /** + * 备注说明(如:含税价、交货期等) + */ + @Schema(description = "备注说明(如:含税价、交货期等)") + private String remark; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/resp/BizMaterialRespDto.java b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizMaterialRespDto.java new file mode 100644 index 0000000..1788c17 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizMaterialRespDto.java @@ -0,0 +1,61 @@ +package com.metalloop.modules.bussiness.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-材质基础响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-材质基础响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizMaterialRespDto implements Serializable { + + /** + * 材质ID + */ + @Schema(description = "材质ID") + private Long id; + + /** + * 材质名称 + */ + @Schema(description = "材质名称") + private String materialName; + + /** + * 材质编码 + */ + @Schema(description = "材质编码") + private String materialCode; + + /** + * 材质描述 + */ + @Schema(description = "材质描述") + private String description; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/resp/BizPurchaseRequestRespDto.java b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizPurchaseRequestRespDto.java new file mode 100644 index 0000000..9a79ff1 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizPurchaseRequestRespDto.java @@ -0,0 +1,181 @@ +package com.metalloop.modules.bussiness.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-求购信息响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-求购信息响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizPurchaseRequestRespDto implements Serializable { + + /** + * 求购信息ID(主键) + */ + @Schema(description = "求购信息ID(主键)") + private Long id; + + /** + * 发布人用户ID(关联 sys_user 表) + */ + @Schema(description = "发布人用户ID(关联 sys_user 表)") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + private String productCategory; + + /** + * 商品材质(如:紫铜、黄铜、A00) + */ + @Schema(description = "商品材质(如:紫铜、黄铜、A00)") + private String material; + + /** + * 求购标题 + */ + @Schema(description = "求购标题") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + private String description; + + /** + * 求购数量( + */ + @Schema(description = "求购数量(") + private java.math.BigDecimal quantity; + + /** + * 期望单价 + */ + @Schema(description = "期望单价") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contactPerson; + + /** + * 联系电话 + */ + @Schema(description = "联系电话") + private String contactPhone; + + /** + * 交货期 + */ + @Schema(description = "交货期") + private java.util.Date deliveryDate; + + /** + * 交货地点 + */ + @Schema(description = "交货地点") + private String deliveryLocation; + + /** + * 图片URL + */ + @Schema(description = "图片URL") + private String imageUrl; + + /** + * 审核状态(0-待审核,1-已通过,2-已驳回) + */ + @Schema(description = "审核状态(0-待审核,1-已通过,2-已驳回)") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + private java.util.Date publishTime; + + /** + * 过期时间(信息有效期截止) + */ + @Schema(description = "过期时间(信息有效期截止)") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + private String finalPaymentDeadline; + + /** + * 上下架状态(0-已下架,1-展示中) + */ + @Schema(description = "上下架状态(0-已下架,1-展示中)") + private Boolean status; + + /** + * 审核驳回原因(audit_status=2时填写) + */ + @Schema(description = "审核驳回原因(audit_status=2时填写)") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/resp/BizSupplyInfoRespDto.java b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizSupplyInfoRespDto.java new file mode 100644 index 0000000..17c4031 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizSupplyInfoRespDto.java @@ -0,0 +1,175 @@ +package com.metalloop.modules.bussiness.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-发布信息响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-发布信息响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizSupplyInfoRespDto implements Serializable { + + /** + * 发布信息ID + */ + @Schema(description = "发布信息ID") + private Long id; + + /** + * 发布人用户ID + */ + @Schema(description = "发布人用户ID") + private Long createUserId; + + /** + * 所属企业ID + */ + @Schema(description = "所属企业ID") + private Long enterpriseId; + + /** + * 元素种类 + */ + @Schema(description = "元素种类") + private String elementType; + + /** + * 商品类别 + */ + @Schema(description = "商品类别") + private String productCategory; + + /** + * 商品材质 + */ + @Schema(description = "商品材质") + private String material; + + /** + * 发布标题 + */ + @Schema(description = "发布标题") + private String title; + + /** + * 详细描述 + */ + @Schema(description = "详细描述") + private String description; + + /** + * 数量 + */ + @Schema(description = "数量") + private java.math.BigDecimal quantity; + + /** + * 单价 + */ + @Schema(description = "单价") + private java.math.BigDecimal unitPrice; + + /** + * 联系人 + */ + @Schema(description = "联系人") + private String contactPerson; + + /** + * 电话 + */ + @Schema(description = "电话") + private String contactPhone; + + /** + * 发货地点 + */ + @Schema(description = "发货地点") + private String deliveryLocation; + + /** + * 图片 + */ + @Schema(description = "图片") + private String imageUrl; + + /** + * 审核状态 + */ + @Schema(description = "审核状态") + private Boolean auditStatus; + + /** + * 发布时间 + */ + @Schema(description = "发布时间") + private java.util.Date publishTime; + + /** + * 过期时间 + */ + @Schema(description = "过期时间") + private java.util.Date expireTime; + + /** + * 账期选择模式 + */ + @Schema(description = "账期选择模式") + private String accountPeriodMode; + + /** + * 定金比例 + */ + @Schema(description = "定金比例") + private java.math.BigDecimal depositRatio; + + /** + * 尾款支付期限 + */ + @Schema(description = "尾款支付期限") + private String finalPaymentDeadline; + + /** + * 上下架状态 + */ + @Schema(description = "上下架状态") + private Boolean status; + + /** + * 审核驳回原因 + */ + @Schema(description = "审核驳回原因") + private String rejectReason; + + /** + * 最后修改人用户ID + */ + @Schema(description = "最后修改人用户ID") + private Long updateUserId; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 修改时间 + */ + @Schema(description = "修改时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/model/resp/BizVarietyRespDto.java b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizVarietyRespDto.java new file mode 100644 index 0000000..8303a06 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/model/resp/BizVarietyRespDto.java @@ -0,0 +1,85 @@ +package com.metalloop.modules.bussiness.model.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 业务-产品品种响应 DTO + * + * @author yy + * @since 2026-09-10 + */ +@Schema(description = "业务-产品品种响应 DTO") +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BizVarietyRespDto implements Serializable { + + /** + * 品种ID(主键) + */ + @Schema(description = "品种ID(主键)") + private Long id; + + /** + * 品种名称 + */ + @Schema(description = "品种名称") + private String varietyName; + + /** + * 品种等级 + */ + @Schema(description = "品种等级") + private String varietyGrade; + + /** + * 父级品种ID + */ + @Schema(description = "父级品种ID") + private Long parentId; + + /** + * 品种主体材质 + */ + @Schema(description = "品种主体材质") + private String varietyMaterial; + + /** + * 品种补充说明 + */ + @Schema(description = "品种补充说明") + private String description; + + /** + * 排序权重 + */ + @Schema(description = "排序权重") + private Integer sort; + + /** + * 状态(0-禁用,1-启用) + */ + @Schema(description = "状态(0-禁用,1-启用)") + private Boolean status; + + /** + * 创建时间 + */ + @Schema(description = "创建时间") + private java.util.Date createTime; + + /** + * 更新时间 + */ + @Schema(description = "更新时间") + private java.util.Date updateTime; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/BizEnterpriseProductService.java b/src/main/java/com/metalloop/modules/bussiness/service/BizEnterpriseProductService.java new file mode 100644 index 0000000..ea941ed --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/BizEnterpriseProductService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.bussiness.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.bussiness.model.po.BizEnterpriseProduct; +import com.metalloop.modules.bussiness.model.query.BizEnterpriseProductQuery; + +import java.util.List; +import java.util.Map; + +/** + * 企业经营产品 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface BizEnterpriseProductService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建企业经营产品 + * + * @param bizEnterpriseProduct 企业经营产品 + * @return 创建后的企业经营产品 + */ + BizEnterpriseProduct create(BizEnterpriseProduct bizEnterpriseProduct); + + /** + * 批量创建企业经营产品 + * + * @param bizEnterpriseProducts 企业经营产品列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List bizEnterpriseProducts); + + /** + * 获取全部企业经营产品列表 + * + * @return 全部企业经营产品列表 + */ + List listAll(); + + /** + * 批量更新企业经营产品 + * + * @param bizEnterpriseProducts 企业经营产品列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List bizEnterpriseProducts); + + /** + * 通过ID删除企业经营产品 + * + * @param id 企业经营产品ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除企业经营产品 + * + * @param ids 企业经营产品ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建企业经营产品 + * + * @param entity 企业经营产品 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(BizEnterpriseProduct entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新企业经营产品 + * + * @param entity 企业经营产品 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(BizEnterpriseProduct entity, LockCondition... conditions); + + /** + * 创建或更新企业经营产品(幂等性) + * + * @param entity 企业经营产品 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(BizEnterpriseProduct entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取企业经营产品 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 企业经营产品分页 + */ + Page pageByQuery(long current, long size, BizEnterpriseProductQuery query); + + /** + * 分页获取全部企业经营产品 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部企业经营产品分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和企业经营产品的映射 + * + * @return ID和企业经营产品的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和企业经营产品的映射 + * + * @param ids 企业经营产品ID列表 + * @return ID和企业经营产品的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和企业经营产品 列表的分组 + * + * @return ID和企业经营产品 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和企业经营产品 列表的分组 + * + * @param ids 企业经营产品ID列表 + * @return ID和企业经营产品 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部企业经营产品数量 + * + * @return 全部企业经营产品数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizEnterpriseProductQuery + + /** + * 通过查询条件修改企业经营产品 + * + * @param entity 企业经营产品 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(BizEnterpriseProduct entity, BizEnterpriseProductQuery query); + + /** + * 通过查询条件删除企业经营产品 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(BizEnterpriseProductQuery query); + + /** + * 通过查询条件获取企业经营产品 + * + * @param query 查询条件 + * @return 企业经营产品 + */ + BizEnterpriseProduct getByQuery(BizEnterpriseProductQuery query); + + /** + * 通过查询条件获取企业经营产品列表 + * + * @param query 查询条件 + * @return 企业经营产品列表 + */ + List listByQuery(BizEnterpriseProductQuery query); + + /** + * 通过查询条件获取ID和企业经营产品的映射 + * + * @param query 查询条件 + * @return ID和企业经营产品的映射 + */ + Map getIdMapByQuery(BizEnterpriseProductQuery query); + + /** + * 通过查询条件获取分组的企业经营产品 + * + * @param query 查询条件 + * @return 企业经营产品分组 + */ + Map> getIdGroupByQuery(BizEnterpriseProductQuery query); + + /** + * 通过查询条件获取企业经营产品数量 + * + * @param query 查询条件 + * @return 企业经营产品数量 + */ + Long countByQuery(BizEnterpriseProductQuery query); + + /** + * 检查是否存在符合查询条件的企业经营产品 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(BizEnterpriseProductQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/BizMaterialService.java b/src/main/java/com/metalloop/modules/bussiness/service/BizMaterialService.java new file mode 100644 index 0000000..17fe544 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/BizMaterialService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.bussiness.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.bussiness.model.po.BizMaterial; +import com.metalloop.modules.bussiness.model.query.BizMaterialQuery; + +import java.util.List; +import java.util.Map; + +/** + * 业务-材质基础 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface BizMaterialService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建业务-材质基础 + * + * @param bizMaterial 业务-材质基础 + * @return 创建后的业务-材质基础 + */ + BizMaterial create(BizMaterial bizMaterial); + + /** + * 批量创建业务-材质基础 + * + * @param bizMaterials 业务-材质基础列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List bizMaterials); + + /** + * 获取全部业务-材质基础列表 + * + * @return 全部业务-材质基础列表 + */ + List listAll(); + + /** + * 批量更新业务-材质基础 + * + * @param bizMaterials 业务-材质基础列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List bizMaterials); + + /** + * 通过ID删除业务-材质基础 + * + * @param id 业务-材质基础ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除业务-材质基础 + * + * @param ids 业务-材质基础ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建业务-材质基础 + * + * @param entity 业务-材质基础 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(BizMaterial entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新业务-材质基础 + * + * @param entity 业务-材质基础 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(BizMaterial entity, LockCondition... conditions); + + /** + * 创建或更新业务-材质基础(幂等性) + * + * @param entity 业务-材质基础 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(BizMaterial entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取业务-材质基础 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 业务-材质基础分页 + */ + Page pageByQuery(long current, long size, BizMaterialQuery query); + + /** + * 分页获取全部业务-材质基础 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部业务-材质基础分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和业务-材质基础的映射 + * + * @return ID和业务-材质基础的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和业务-材质基础的映射 + * + * @param ids 业务-材质基础ID列表 + * @return ID和业务-材质基础的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和业务-材质基础 列表的分组 + * + * @return ID和业务-材质基础 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和业务-材质基础 列表的分组 + * + * @param ids 业务-材质基础ID列表 + * @return ID和业务-材质基础 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部业务-材质基础数量 + * + * @return 全部业务-材质基础数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizMaterialQuery + + /** + * 通过查询条件修改业务-材质基础 + * + * @param entity 业务-材质基础 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(BizMaterial entity, BizMaterialQuery query); + + /** + * 通过查询条件删除业务-材质基础 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(BizMaterialQuery query); + + /** + * 通过查询条件获取业务-材质基础 + * + * @param query 查询条件 + * @return 业务-材质基础 + */ + BizMaterial getByQuery(BizMaterialQuery query); + + /** + * 通过查询条件获取业务-材质基础列表 + * + * @param query 查询条件 + * @return 业务-材质基础列表 + */ + List listByQuery(BizMaterialQuery query); + + /** + * 通过查询条件获取ID和业务-材质基础的映射 + * + * @param query 查询条件 + * @return ID和业务-材质基础的映射 + */ + Map getIdMapByQuery(BizMaterialQuery query); + + /** + * 通过查询条件获取分组的业务-材质基础 + * + * @param query 查询条件 + * @return 业务-材质基础分组 + */ + Map> getIdGroupByQuery(BizMaterialQuery query); + + /** + * 通过查询条件获取业务-材质基础数量 + * + * @param query 查询条件 + * @return 业务-材质基础数量 + */ + Long countByQuery(BizMaterialQuery query); + + /** + * 检查是否存在符合查询条件的业务-材质基础 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(BizMaterialQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/BizPurchaseRequestService.java b/src/main/java/com/metalloop/modules/bussiness/service/BizPurchaseRequestService.java new file mode 100644 index 0000000..898f818 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/BizPurchaseRequestService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.bussiness.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.bussiness.model.po.BizPurchaseRequest; +import com.metalloop.modules.bussiness.model.query.BizPurchaseRequestQuery; + +import java.util.List; +import java.util.Map; + +/** + * 业务-求购信息 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface BizPurchaseRequestService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建业务-求购信息 + * + * @param bizPurchaseRequest 业务-求购信息 + * @return 创建后的业务-求购信息 + */ + BizPurchaseRequest create(BizPurchaseRequest bizPurchaseRequest); + + /** + * 批量创建业务-求购信息 + * + * @param bizPurchaseRequests 业务-求购信息列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List bizPurchaseRequests); + + /** + * 获取全部业务-求购信息列表 + * + * @return 全部业务-求购信息列表 + */ + List listAll(); + + /** + * 批量更新业务-求购信息 + * + * @param bizPurchaseRequests 业务-求购信息列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List bizPurchaseRequests); + + /** + * 通过ID删除业务-求购信息 + * + * @param id 业务-求购信息ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除业务-求购信息 + * + * @param ids 业务-求购信息ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建业务-求购信息 + * + * @param entity 业务-求购信息 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(BizPurchaseRequest entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新业务-求购信息 + * + * @param entity 业务-求购信息 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(BizPurchaseRequest entity, LockCondition... conditions); + + /** + * 创建或更新业务-求购信息(幂等性) + * + * @param entity 业务-求购信息 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(BizPurchaseRequest entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取业务-求购信息 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 业务-求购信息分页 + */ + Page pageByQuery(long current, long size, BizPurchaseRequestQuery query); + + /** + * 分页获取全部业务-求购信息 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部业务-求购信息分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和业务-求购信息的映射 + * + * @return ID和业务-求购信息的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和业务-求购信息的映射 + * + * @param ids 业务-求购信息ID列表 + * @return ID和业务-求购信息的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和业务-求购信息 列表的分组 + * + * @return ID和业务-求购信息 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和业务-求购信息 列表的分组 + * + * @param ids 业务-求购信息ID列表 + * @return ID和业务-求购信息 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部业务-求购信息数量 + * + * @return 全部业务-求购信息数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizPurchaseRequestQuery + + /** + * 通过查询条件修改业务-求购信息 + * + * @param entity 业务-求购信息 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(BizPurchaseRequest entity, BizPurchaseRequestQuery query); + + /** + * 通过查询条件删除业务-求购信息 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(BizPurchaseRequestQuery query); + + /** + * 通过查询条件获取业务-求购信息 + * + * @param query 查询条件 + * @return 业务-求购信息 + */ + BizPurchaseRequest getByQuery(BizPurchaseRequestQuery query); + + /** + * 通过查询条件获取业务-求购信息列表 + * + * @param query 查询条件 + * @return 业务-求购信息列表 + */ + List listByQuery(BizPurchaseRequestQuery query); + + /** + * 通过查询条件获取ID和业务-求购信息的映射 + * + * @param query 查询条件 + * @return ID和业务-求购信息的映射 + */ + Map getIdMapByQuery(BizPurchaseRequestQuery query); + + /** + * 通过查询条件获取分组的业务-求购信息 + * + * @param query 查询条件 + * @return 业务-求购信息分组 + */ + Map> getIdGroupByQuery(BizPurchaseRequestQuery query); + + /** + * 通过查询条件获取业务-求购信息数量 + * + * @param query 查询条件 + * @return 业务-求购信息数量 + */ + Long countByQuery(BizPurchaseRequestQuery query); + + /** + * 检查是否存在符合查询条件的业务-求购信息 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(BizPurchaseRequestQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/BizSupplyInfoService.java b/src/main/java/com/metalloop/modules/bussiness/service/BizSupplyInfoService.java new file mode 100644 index 0000000..cf9a2a4 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/BizSupplyInfoService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.bussiness.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.bussiness.model.po.BizSupplyInfo; +import com.metalloop.modules.bussiness.model.query.BizSupplyInfoQuery; + +import java.util.List; +import java.util.Map; + +/** + * 业务-发布信息 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface BizSupplyInfoService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建业务-发布信息 + * + * @param bizSupplyInfo 业务-发布信息 + * @return 创建后的业务-发布信息 + */ + BizSupplyInfo create(BizSupplyInfo bizSupplyInfo); + + /** + * 批量创建业务-发布信息 + * + * @param bizSupplyInfos 业务-发布信息列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List bizSupplyInfos); + + /** + * 获取全部业务-发布信息列表 + * + * @return 全部业务-发布信息列表 + */ + List listAll(); + + /** + * 批量更新业务-发布信息 + * + * @param bizSupplyInfos 业务-发布信息列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List bizSupplyInfos); + + /** + * 通过ID删除业务-发布信息 + * + * @param id 业务-发布信息ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除业务-发布信息 + * + * @param ids 业务-发布信息ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建业务-发布信息 + * + * @param entity 业务-发布信息 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(BizSupplyInfo entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新业务-发布信息 + * + * @param entity 业务-发布信息 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(BizSupplyInfo entity, LockCondition... conditions); + + /** + * 创建或更新业务-发布信息(幂等性) + * + * @param entity 业务-发布信息 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(BizSupplyInfo entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取业务-发布信息 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 业务-发布信息分页 + */ + Page pageByQuery(long current, long size, BizSupplyInfoQuery query); + + /** + * 分页获取全部业务-发布信息 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部业务-发布信息分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和业务-发布信息的映射 + * + * @return ID和业务-发布信息的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和业务-发布信息的映射 + * + * @param ids 业务-发布信息ID列表 + * @return ID和业务-发布信息的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和业务-发布信息 列表的分组 + * + * @return ID和业务-发布信息 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和业务-发布信息 列表的分组 + * + * @param ids 业务-发布信息ID列表 + * @return ID和业务-发布信息 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部业务-发布信息数量 + * + * @return 全部业务-发布信息数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizSupplyInfoQuery + + /** + * 通过查询条件修改业务-发布信息 + * + * @param entity 业务-发布信息 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(BizSupplyInfo entity, BizSupplyInfoQuery query); + + /** + * 通过查询条件删除业务-发布信息 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(BizSupplyInfoQuery query); + + /** + * 通过查询条件获取业务-发布信息 + * + * @param query 查询条件 + * @return 业务-发布信息 + */ + BizSupplyInfo getByQuery(BizSupplyInfoQuery query); + + /** + * 通过查询条件获取业务-发布信息列表 + * + * @param query 查询条件 + * @return 业务-发布信息列表 + */ + List listByQuery(BizSupplyInfoQuery query); + + /** + * 通过查询条件获取ID和业务-发布信息的映射 + * + * @param query 查询条件 + * @return ID和业务-发布信息的映射 + */ + Map getIdMapByQuery(BizSupplyInfoQuery query); + + /** + * 通过查询条件获取分组的业务-发布信息 + * + * @param query 查询条件 + * @return 业务-发布信息分组 + */ + Map> getIdGroupByQuery(BizSupplyInfoQuery query); + + /** + * 通过查询条件获取业务-发布信息数量 + * + * @param query 查询条件 + * @return 业务-发布信息数量 + */ + Long countByQuery(BizSupplyInfoQuery query); + + /** + * 检查是否存在符合查询条件的业务-发布信息 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(BizSupplyInfoQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/BizVarietyService.java b/src/main/java/com/metalloop/modules/bussiness/service/BizVarietyService.java new file mode 100644 index 0000000..3f18114 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/BizVarietyService.java @@ -0,0 +1,222 @@ +package com.metalloop.modules.bussiness.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.ISuperService; +import com.metalloop.modules.bussiness.model.po.BizVariety; +import com.metalloop.modules.bussiness.model.query.BizVarietyQuery; + +import java.util.List; +import java.util.Map; + +/** + * 业务-产品品种 Service + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("unchecked") +public interface BizVarietyService extends ISuperService { + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + /** + * 创建业务-产品品种 + * + * @param bizVariety 业务-产品品种 + * @return 创建后的业务-产品品种 + */ + BizVariety create(BizVariety bizVariety); + + /** + * 批量创建业务-产品品种 + * + * @param bizVarietys 业务-产品品种列表 + * @return 是否创建成功 + */ + Boolean batchCreate(List bizVarietys); + + /** + * 获取全部业务-产品品种列表 + * + * @return 全部业务-产品品种列表 + */ + List listAll(); + + /** + * 批量更新业务-产品品种 + * + * @param bizVarietys 业务-产品品种列表 + * @return 是否更新成功 + */ + Boolean batchUpdateById(List bizVarietys); + + /** + * 通过ID删除业务-产品品种 + * + * @param id 业务-产品品种ID + * @return 是否删除成功 + */ + Boolean deleteById(Long id); + + /** + * 批量删除业务-产品品种 + * + * @param ids 业务-产品品种ID列表 + * @return 是否删除成功 + */ + Boolean batchDelete(List ids); + + /** + * 幂等性创建业务-产品品种 + * + * @param entity 业务-产品品种 + * @param conditions 幂等性条件 + * @return 是否创建成功 + */ + Boolean createIdempotency(BizVariety entity, LockCondition... conditions); + + /** + * 通过ID幂等性更新业务-产品品种 + * + * @param entity 业务-产品品种 + * @param conditions 幂等性条件 + * @return 是否更新成功 + */ + Boolean updateByIdIdempotency(BizVariety entity, LockCondition... conditions); + + /** + * 创建或更新业务-产品品种(幂等性) + * + * @param entity 业务-产品品种 + * @param conditions 幂等性条件 + * @return 是否创建或更新成功 + */ + Boolean saveOrUpdateIdempotency(BizVariety entity, LockCondition... conditions); + + /** + * 通过查询条件进行分页获取业务-产品品种 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @param query 查询条件 + * @return 业务-产品品种分页 + */ + Page pageByQuery(long current, long size, BizVarietyQuery query); + + /** + * 分页获取全部业务-产品品种 + * + * @param current 当前页数 + * @param size 每页记录数量 + * @return 全部业务-产品品种分页 + */ + Page pageAll(long current, long size); + + /** + * 获取ID和业务-产品品种的映射 + * + * @return ID和业务-产品品种的映射 + */ + Map getIdMap(); + + /** + * 获取指定ID集合的ID和业务-产品品种的映射 + * + * @param ids 业务-产品品种ID列表 + * @return ID和业务-产品品种的映射 + */ + Map getIdMapByIds(List ids); + + /** + * 获取ID和业务-产品品种 列表的分组 + * + * @return ID和业务-产品品种 列表的分组 + */ + Map> getIdGroup(); + + /** + * 获取指定ID集合的ID和业务-产品品种 列表的分组 + * + * @param ids 业务-产品品种ID列表 + * @return ID和业务-产品品种 列表的分组 + */ + Map> getIdGroupByIds(List ids); + + /** + * 获取全部业务-产品品种数量 + * + * @return 全部业务-产品品种数量 + */ + Long countAll(); + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizVarietyQuery + + /** + * 通过查询条件修改业务-产品品种 + * + * @param entity 业务-产品品种 + * @param query 查询条件 + * @return 是否修改成功 + */ + Boolean updateByQuery(BizVariety entity, BizVarietyQuery query); + + /** + * 通过查询条件删除业务-产品品种 + * + * @param query 查询条件 + * @return 是否删除成功 + */ + Boolean removeByQuery(BizVarietyQuery query); + + /** + * 通过查询条件获取业务-产品品种 + * + * @param query 查询条件 + * @return 业务-产品品种 + */ + BizVariety getByQuery(BizVarietyQuery query); + + /** + * 通过查询条件获取业务-产品品种列表 + * + * @param query 查询条件 + * @return 业务-产品品种列表 + */ + List listByQuery(BizVarietyQuery query); + + /** + * 通过查询条件获取ID和业务-产品品种的映射 + * + * @param query 查询条件 + * @return ID和业务-产品品种的映射 + */ + Map getIdMapByQuery(BizVarietyQuery query); + + /** + * 通过查询条件获取分组的业务-产品品种 + * + * @param query 查询条件 + * @return 业务-产品品种分组 + */ + Map> getIdGroupByQuery(BizVarietyQuery query); + + /** + * 通过查询条件获取业务-产品品种数量 + * + * @param query 查询条件 + * @return 业务-产品品种数量 + */ + Long countByQuery(BizVarietyQuery query); + + /** + * 检查是否存在符合查询条件的业务-产品品种 + * + * @param query 查询条件 + * @return 是否存在 + */ + Boolean existsByQuery(BizVarietyQuery query); + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/impl/BizEnterpriseProductServiceImpl.java b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizEnterpriseProductServiceImpl.java new file mode 100644 index 0000000..b847c89 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizEnterpriseProductServiceImpl.java @@ -0,0 +1,169 @@ +package com.metalloop.modules.bussiness.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.bussiness.mapper.BizEnterpriseProductMapper; +import com.metalloop.modules.bussiness.model.po.BizEnterpriseProduct; +import com.metalloop.modules.bussiness.model.query.BizEnterpriseProductQuery; +import com.metalloop.modules.bussiness.service.BizEnterpriseProductService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 企业经营产品 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class BizEnterpriseProductServiceImpl extends SuperServiceImpl implements BizEnterpriseProductService { + + @Resource + private DistributedLock distributedLock; + + @Resource + BizEnterpriseProductMapper bizEnterpriseProductMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public BizEnterpriseProduct create(BizEnterpriseProduct bizEnterpriseProduct) { + save(bizEnterpriseProduct); + return bizEnterpriseProduct; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List bizEnterpriseProducts) { + return saveBatch(bizEnterpriseProducts); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List bizEnterpriseProducts) { + return updateBatchById(bizEnterpriseProducts); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(BizEnterpriseProduct entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(BizEnterpriseProduct entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(BizEnterpriseProduct entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, BizEnterpriseProductQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizEnterpriseProductQuery + + @Override + public Boolean updateByQuery(BizEnterpriseProduct entity, BizEnterpriseProductQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(BizEnterpriseProductQuery query) { + return remove(query); + } + + @Override + public BizEnterpriseProduct getByQuery(BizEnterpriseProductQuery query) { + return get(query); + } + + @Override + public List listByQuery(BizEnterpriseProductQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(BizEnterpriseProductQuery query) { + return toMap(BizEnterpriseProduct::getId, query); + } + + @Override + public Map> getIdGroupByQuery(BizEnterpriseProductQuery query) { + return toGroup(BizEnterpriseProduct::getId, query); + } + + @Override + public Long countByQuery(BizEnterpriseProductQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(BizEnterpriseProductQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/impl/BizMaterialServiceImpl.java b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizMaterialServiceImpl.java new file mode 100644 index 0000000..6ad3b20 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizMaterialServiceImpl.java @@ -0,0 +1,169 @@ +package com.metalloop.modules.bussiness.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.bussiness.mapper.BizMaterialMapper; +import com.metalloop.modules.bussiness.model.po.BizMaterial; +import com.metalloop.modules.bussiness.model.query.BizMaterialQuery; +import com.metalloop.modules.bussiness.service.BizMaterialService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 业务-材质基础 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class BizMaterialServiceImpl extends SuperServiceImpl implements BizMaterialService { + + @Resource + private DistributedLock distributedLock; + + @Resource + BizMaterialMapper bizMaterialMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public BizMaterial create(BizMaterial bizMaterial) { + save(bizMaterial); + return bizMaterial; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List bizMaterials) { + return saveBatch(bizMaterials); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List bizMaterials) { + return updateBatchById(bizMaterials); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(BizMaterial entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(BizMaterial entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(BizMaterial entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, BizMaterialQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizMaterialQuery + + @Override + public Boolean updateByQuery(BizMaterial entity, BizMaterialQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(BizMaterialQuery query) { + return remove(query); + } + + @Override + public BizMaterial getByQuery(BizMaterialQuery query) { + return get(query); + } + + @Override + public List listByQuery(BizMaterialQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(BizMaterialQuery query) { + return toMap(BizMaterial::getId, query); + } + + @Override + public Map> getIdGroupByQuery(BizMaterialQuery query) { + return toGroup(BizMaterial::getId, query); + } + + @Override + public Long countByQuery(BizMaterialQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(BizMaterialQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/impl/BizPurchaseRequestServiceImpl.java b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizPurchaseRequestServiceImpl.java new file mode 100644 index 0000000..1498d3e --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizPurchaseRequestServiceImpl.java @@ -0,0 +1,169 @@ +package com.metalloop.modules.bussiness.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.bussiness.mapper.BizPurchaseRequestMapper; +import com.metalloop.modules.bussiness.model.po.BizPurchaseRequest; +import com.metalloop.modules.bussiness.model.query.BizPurchaseRequestQuery; +import com.metalloop.modules.bussiness.service.BizPurchaseRequestService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 业务-求购信息 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class BizPurchaseRequestServiceImpl extends SuperServiceImpl implements BizPurchaseRequestService { + + @Resource + private DistributedLock distributedLock; + + @Resource + BizPurchaseRequestMapper bizPurchaseRequestMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public BizPurchaseRequest create(BizPurchaseRequest bizPurchaseRequest) { + save(bizPurchaseRequest); + return bizPurchaseRequest; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List bizPurchaseRequests) { + return saveBatch(bizPurchaseRequests); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List bizPurchaseRequests) { + return updateBatchById(bizPurchaseRequests); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(BizPurchaseRequest entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(BizPurchaseRequest entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(BizPurchaseRequest entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, BizPurchaseRequestQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizPurchaseRequestQuery + + @Override + public Boolean updateByQuery(BizPurchaseRequest entity, BizPurchaseRequestQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(BizPurchaseRequestQuery query) { + return remove(query); + } + + @Override + public BizPurchaseRequest getByQuery(BizPurchaseRequestQuery query) { + return get(query); + } + + @Override + public List listByQuery(BizPurchaseRequestQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(BizPurchaseRequestQuery query) { + return toMap(BizPurchaseRequest::getId, query); + } + + @Override + public Map> getIdGroupByQuery(BizPurchaseRequestQuery query) { + return toGroup(BizPurchaseRequest::getId, query); + } + + @Override + public Long countByQuery(BizPurchaseRequestQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(BizPurchaseRequestQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/impl/BizSupplyInfoServiceImpl.java b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizSupplyInfoServiceImpl.java new file mode 100644 index 0000000..d8d60f7 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizSupplyInfoServiceImpl.java @@ -0,0 +1,169 @@ +package com.metalloop.modules.bussiness.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.bussiness.mapper.BizSupplyInfoMapper; +import com.metalloop.modules.bussiness.model.po.BizSupplyInfo; +import com.metalloop.modules.bussiness.model.query.BizSupplyInfoQuery; +import com.metalloop.modules.bussiness.service.BizSupplyInfoService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 业务-发布信息 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class BizSupplyInfoServiceImpl extends SuperServiceImpl implements BizSupplyInfoService { + + @Resource + private DistributedLock distributedLock; + + @Resource + BizSupplyInfoMapper bizSupplyInfoMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public BizSupplyInfo create(BizSupplyInfo bizSupplyInfo) { + save(bizSupplyInfo); + return bizSupplyInfo; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List bizSupplyInfos) { + return saveBatch(bizSupplyInfos); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List bizSupplyInfos) { + return updateBatchById(bizSupplyInfos); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(BizSupplyInfo entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(BizSupplyInfo entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(BizSupplyInfo entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, BizSupplyInfoQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizSupplyInfoQuery + + @Override + public Boolean updateByQuery(BizSupplyInfo entity, BizSupplyInfoQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(BizSupplyInfoQuery query) { + return remove(query); + } + + @Override + public BizSupplyInfo getByQuery(BizSupplyInfoQuery query) { + return get(query); + } + + @Override + public List listByQuery(BizSupplyInfoQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(BizSupplyInfoQuery query) { + return toMap(BizSupplyInfo::getId, query); + } + + @Override + public Map> getIdGroupByQuery(BizSupplyInfoQuery query) { + return toGroup(BizSupplyInfo::getId, query); + } + + @Override + public Long countByQuery(BizSupplyInfoQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(BizSupplyInfoQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/java/com/metalloop/modules/bussiness/service/impl/BizVarietyServiceImpl.java b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizVarietyServiceImpl.java new file mode 100644 index 0000000..d2fb288 --- /dev/null +++ b/src/main/java/com/metalloop/modules/bussiness/service/impl/BizVarietyServiceImpl.java @@ -0,0 +1,169 @@ +package com.metalloop.modules.bussiness.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.metalloop.common.core.lock.DistributedLock; +import com.metalloop.common.core.lock.LockCondition; +import com.metalloop.common.service.impl.SuperServiceImpl; +import com.metalloop.modules.bussiness.mapper.BizVarietyMapper; +import com.metalloop.modules.bussiness.model.po.BizVariety; +import com.metalloop.modules.bussiness.model.query.BizVarietyQuery; +import com.metalloop.modules.bussiness.service.BizVarietyService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 业务-产品品种 Service 实现类 + * + * @author yy + * @since 2026-09-10 + */ +@SuppressWarnings("java:S6809") +@Service +public class BizVarietyServiceImpl extends SuperServiceImpl implements BizVarietyService { + + @Resource + private DistributedLock distributedLock; + + @Resource + BizVarietyMapper bizVarietyMapper; + + // region 自动生成代码区,后续手动添加的代码要放在这个区域之外 + + @Override + public BizVariety create(BizVariety bizVariety) { + save(bizVariety); + return bizVariety; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchCreate(List bizVarietys) { + return saveBatch(bizVarietys); + } + + @Override + public List listAll() { + return list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchUpdateById(List bizVarietys) { + return updateBatchById(bizVarietys); + } + + @Override + public Boolean deleteById(Long id) { + return removeById(id); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean batchDelete(List ids) { + return removeByIds(ids); + } + + @SafeVarargs + @Override + public final Boolean createIdempotency(BizVariety entity, LockCondition... conditions) { + return saveIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean updateByIdIdempotency(BizVariety entity, LockCondition... conditions) { + return updateByIdIdempotency(entity, distributedLock, conditions); + } + + @SafeVarargs + @Override + public final Boolean saveOrUpdateIdempotency(BizVariety entity, LockCondition... conditions) { + return saveOrUpdateIdempotency(entity, distributedLock, conditions); + } + + @Override + public Page pageByQuery(long current, long size, BizVarietyQuery query) { + return page(Page.of(current, size), query); + } + + @Override + public Page pageAll(long current, long size) { + return page(Page.of(current, size)); + } + + @Override + public Map getIdMap() { + return toMap( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map getIdMapByIds(List ids) { + return toMap( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Map> getIdGroup() { + return toGroup( e -> String.valueOf(e.getId()) ,list()); + } + + @Override + public Map> getIdGroupByIds(List ids) { + return toGroup( e -> String.valueOf(e.getId()) ,listByIds(ids)); + } + + @Override + public Long countAll() { + return count(); + } + + // region 此区域的方法主要用作示例,禁止滥用,因为Query对象大而全,调用者会很迷惑,必须封装为更具体的参数及签名的方法,如getByCodeAndType(String code, Integer type)。 + // 除非:确实需要3个及以上参数,方可合并为Query,如BizVarietyQuery + + @Override + public Boolean updateByQuery(BizVariety entity, BizVarietyQuery query) { + return update(entity, query); + } + + @Override + public Boolean removeByQuery(BizVarietyQuery query) { + return remove(query); + } + + @Override + public BizVariety getByQuery(BizVarietyQuery query) { + return get(query); + } + + @Override + public List listByQuery(BizVarietyQuery query) { + return list(query); + } + + @Override + public Map getIdMapByQuery(BizVarietyQuery query) { + return toMap(BizVariety::getId, query); + } + + @Override + public Map> getIdGroupByQuery(BizVarietyQuery query) { + return toGroup(BizVariety::getId, query); + } + + @Override + public Long countByQuery(BizVarietyQuery query) { + return count(query); + } + + @Override + public Boolean existsByQuery(BizVarietyQuery query) { + long count = count(query); + return count > 0; + } + // endregion + + // endregion 自动生成代码区,后续手动添加的代码要放在这个区域之外 +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..d90bcb5 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,52 @@ +spring: + application: + name: metaloop + datasource: + url: jdbc:mysql://localhost:3306/metalloop?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true + username: root + password: 123456 + driver-class-name: com.mysql.cj.jdbc.Driver + hikari: + maximum-pool-size: 20 + minimum-idle: 5 + connection-timeout: 30000 + + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: Asia/Shanghai + serialization: + write-dates-as-timestamps: false + data: + redis: + host: localhost + port: 6379 + database: 0 + password: + timeout: 5000ms + +server: + port: 8080 + +# API文档 +springdoc: + api-docs: + enabled: true + path: /v3/api-docs + swagger-ui: + path: /swagger-ui.html + tags-sorter: alpha + operations-sorter: method + show-actuator: true + packages-to-scan: com.metalloop.modules + paths-to-match: /api/** + +# Sa-Token 配置 +sa-token: + token-name: metalloop-token + timeout: 86400 + active-timeout: -1 + is-concurrent: true + is-share: false + token-style: uuid + is-log: false + jwt-secret-key: metalloop-secret-key \ No newline at end of file diff --git a/src/main/resources/mapper/BizEnterpriseProductMapper.xml b/src/main/resources/mapper/BizEnterpriseProductMapper.xml new file mode 100644 index 0000000..4c210bf --- /dev/null +++ b/src/main/resources/mapper/BizEnterpriseProductMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + id, + enterprise_id, + variety_id, + material_id, + unit_price, + weight, + status, + remark, + create_time, + update_time + + diff --git a/src/main/resources/mapper/BizMaterialMapper.xml b/src/main/resources/mapper/BizMaterialMapper.xml new file mode 100644 index 0000000..f77c2b4 --- /dev/null +++ b/src/main/resources/mapper/BizMaterialMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + id, + material_name, + material_code, + description, + create_time, + update_time + + diff --git a/src/main/resources/mapper/BizPurchaseRequestMapper.xml b/src/main/resources/mapper/BizPurchaseRequestMapper.xml new file mode 100644 index 0000000..fc0ba3d --- /dev/null +++ b/src/main/resources/mapper/BizPurchaseRequestMapper.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + create_user_id, + enterprise_id, + element_type, + product_category, + material, + title, + description, + quantity, + unit_price, + contact_person, + contact_phone, + delivery_date, + delivery_location, + image_url, + audit_status, + publish_time, + expire_time, + account_period_mode, + deposit_ratio, + final_payment_deadline, + status, + reject_reason, + update_user_id, + create_time, + update_time + + diff --git a/src/main/resources/mapper/BizSupplyInfoMapper.xml b/src/main/resources/mapper/BizSupplyInfoMapper.xml new file mode 100644 index 0000000..42b379a --- /dev/null +++ b/src/main/resources/mapper/BizSupplyInfoMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + create_user_id, + enterprise_id, + element_type, + product_category, + material, + title, + description, + quantity, + unit_price, + contact_person, + contact_phone, + delivery_location, + image_url, + audit_status, + publish_time, + expire_time, + account_period_mode, + deposit_ratio, + final_payment_deadline, + status, + reject_reason, + update_user_id, + create_time, + update_time + + diff --git a/src/main/resources/mapper/BizVarietyMapper.xml b/src/main/resources/mapper/BizVarietyMapper.xml new file mode 100644 index 0000000..5653e17 --- /dev/null +++ b/src/main/resources/mapper/BizVarietyMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + id, + variety_name, + variety_grade, + parent_id, + variety_material, + description, + sort, + status, + create_time, + update_time + + diff --git a/src/main/resources/mapper/SysEnterpriseImageMapper.xml b/src/main/resources/mapper/SysEnterpriseImageMapper.xml new file mode 100644 index 0000000..f1b91c3 --- /dev/null +++ b/src/main/resources/mapper/SysEnterpriseImageMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + id, + enterprise_id, + image_type, + image_url, + created_at + + diff --git a/src/main/resources/mapper/SysEnterpriseMapper.xml b/src/main/resources/mapper/SysEnterpriseMapper.xml new file mode 100644 index 0000000..4c1b950 --- /dev/null +++ b/src/main/resources/mapper/SysEnterpriseMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + enterprise_name, + enterprise_address, + warehouse_address, + contact_person, + legal_person, + phone1, + phone2, + phone3, + business_model, + profile_intro, + title_img_url, + intro_img_url, + business_license_url, + legal_id_front_url, + legal_id_back_url, + ocr_credit_code_id, + id_card_number, + credit_limit, + audit_status, + submit_time, + audit_time, + reject_reason, + created_at, + updated_at + + diff --git a/src/main/resources/mapper/SysPermissionMapper.xml b/src/main/resources/mapper/SysPermissionMapper.xml new file mode 100644 index 0000000..a6b6ef4 --- /dev/null +++ b/src/main/resources/mapper/SysPermissionMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + name, + code, + type, + sort, + parent_id, + icon, + api_path, + route_path, + component, + component_name, + description, + enabled, + create_user, + update_user, + create_time, + update_time, + data_status + + diff --git a/src/main/resources/mapper/SysRoleMapper.xml b/src/main/resources/mapper/SysRoleMapper.xml new file mode 100644 index 0000000..74f5de4 --- /dev/null +++ b/src/main/resources/mapper/SysRoleMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + id, + name, + code, + enabled, + description, + create_user, + create_org, + create_time, + update_time, + update_user, + data_status + + diff --git a/src/main/resources/mapper/SysRolePermissionMapper.xml b/src/main/resources/mapper/SysRolePermissionMapper.xml new file mode 100644 index 0000000..920fde9 --- /dev/null +++ b/src/main/resources/mapper/SysRolePermissionMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + id, + role_id, + permission_id + + diff --git a/src/main/resources/mapper/SysUserMapper.xml b/src/main/resources/mapper/SysUserMapper.xml new file mode 100644 index 0000000..be3871a --- /dev/null +++ b/src/main/resources/mapper/SysUserMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + id, + username, + password, + auth_status, + enterprise_id, + phone, + email, + user_status, + reg_time + + diff --git a/src/main/resources/mapper/SysUserRoleMapper.xml b/src/main/resources/mapper/SysUserRoleMapper.xml new file mode 100644 index 0000000..d95b7fa --- /dev/null +++ b/src/main/resources/mapper/SysUserRoleMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + user_id, + role_id, + created_at, + id + + diff --git a/target/classes/Main.class b/target/classes/Main.class new file mode 100644 index 0000000..0fd2817 Binary files /dev/null and b/target/classes/Main.class differ diff --git a/target/classes/application.yml b/target/classes/application.yml new file mode 100644 index 0000000..d90bcb5 --- /dev/null +++ b/target/classes/application.yml @@ -0,0 +1,52 @@ +spring: + application: + name: metaloop + datasource: + url: jdbc:mysql://localhost:3306/metalloop?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true + username: root + password: 123456 + driver-class-name: com.mysql.cj.jdbc.Driver + hikari: + maximum-pool-size: 20 + minimum-idle: 5 + connection-timeout: 30000 + + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: Asia/Shanghai + serialization: + write-dates-as-timestamps: false + data: + redis: + host: localhost + port: 6379 + database: 0 + password: + timeout: 5000ms + +server: + port: 8080 + +# API文档 +springdoc: + api-docs: + enabled: true + path: /v3/api-docs + swagger-ui: + path: /swagger-ui.html + tags-sorter: alpha + operations-sorter: method + show-actuator: true + packages-to-scan: com.metalloop.modules + paths-to-match: /api/** + +# Sa-Token 配置 +sa-token: + token-name: metalloop-token + timeout: 86400 + active-timeout: -1 + is-concurrent: true + is-share: false + token-style: uuid + is-log: false + jwt-secret-key: metalloop-secret-key \ No newline at end of file diff --git a/target/classes/com/metalloop/Application.class b/target/classes/com/metalloop/Application.class new file mode 100644 index 0000000..63da495 Binary files /dev/null and b/target/classes/com/metalloop/Application.class differ diff --git a/target/classes/com/metalloop/common/auth/Authentication$Builder.class b/target/classes/com/metalloop/common/auth/Authentication$Builder.class new file mode 100644 index 0000000..ccdbe83 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/Authentication$Builder.class differ diff --git a/target/classes/com/metalloop/common/auth/Authentication.class b/target/classes/com/metalloop/common/auth/Authentication.class new file mode 100644 index 0000000..69f2fe0 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/Authentication.class differ diff --git a/target/classes/com/metalloop/common/auth/config/AuthServerConfiguration.class b/target/classes/com/metalloop/common/auth/config/AuthServerConfiguration.class new file mode 100644 index 0000000..c5ed00e Binary files /dev/null and b/target/classes/com/metalloop/common/auth/config/AuthServerConfiguration.class differ diff --git a/target/classes/com/metalloop/common/auth/config/AuthServerConfigurer.class b/target/classes/com/metalloop/common/auth/config/AuthServerConfigurer.class new file mode 100644 index 0000000..acfe9ef Binary files /dev/null and b/target/classes/com/metalloop/common/auth/config/AuthServerConfigurer.class differ diff --git a/target/classes/com/metalloop/common/auth/config/AuthServerConfigurerAdapter.class b/target/classes/com/metalloop/common/auth/config/AuthServerConfigurerAdapter.class new file mode 100644 index 0000000..a6ac28e Binary files /dev/null and b/target/classes/com/metalloop/common/auth/config/AuthServerConfigurerAdapter.class differ diff --git a/target/classes/com/metalloop/common/auth/config/AuthServerEndpointsConfigurer.class b/target/classes/com/metalloop/common/auth/config/AuthServerEndpointsConfigurer.class new file mode 100644 index 0000000..8c80e5e Binary files /dev/null and b/target/classes/com/metalloop/common/auth/config/AuthServerEndpointsConfigurer.class differ diff --git a/target/classes/com/metalloop/common/auth/config/EnableAuthServer.class b/target/classes/com/metalloop/common/auth/config/EnableAuthServer.class new file mode 100644 index 0000000..336e7e4 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/config/EnableAuthServer.class differ diff --git a/target/classes/com/metalloop/common/auth/encrypt/KeyProperties$KeyStore.class b/target/classes/com/metalloop/common/auth/encrypt/KeyProperties$KeyStore.class new file mode 100644 index 0000000..37ccd6b Binary files /dev/null and b/target/classes/com/metalloop/common/auth/encrypt/KeyProperties$KeyStore.class differ diff --git a/target/classes/com/metalloop/common/auth/encrypt/KeyProperties.class b/target/classes/com/metalloop/common/auth/encrypt/KeyProperties.class new file mode 100644 index 0000000..086dff3 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/encrypt/KeyProperties.class differ diff --git a/target/classes/com/metalloop/common/auth/encrypt/KeyStoreKeyFactory.class b/target/classes/com/metalloop/common/auth/encrypt/KeyStoreKeyFactory.class new file mode 100644 index 0000000..219bce2 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/encrypt/KeyStoreKeyFactory.class differ diff --git a/target/classes/com/metalloop/common/auth/handler/DefaultLoginSuccessHandler.class b/target/classes/com/metalloop/common/auth/handler/DefaultLoginSuccessHandler.class new file mode 100644 index 0000000..6e86e92 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/handler/DefaultLoginSuccessHandler.class differ diff --git a/target/classes/com/metalloop/common/auth/handler/DefaultLogoutSuccessHandler.class b/target/classes/com/metalloop/common/auth/handler/DefaultLogoutSuccessHandler.class new file mode 100644 index 0000000..39c724c Binary files /dev/null and b/target/classes/com/metalloop/common/auth/handler/DefaultLogoutSuccessHandler.class differ diff --git a/target/classes/com/metalloop/common/auth/handler/DefaultPasswordCheckFailureHandler.class b/target/classes/com/metalloop/common/auth/handler/DefaultPasswordCheckFailureHandler.class new file mode 100644 index 0000000..e40200e Binary files /dev/null and b/target/classes/com/metalloop/common/auth/handler/DefaultPasswordCheckFailureHandler.class differ diff --git a/target/classes/com/metalloop/common/auth/handler/DefaultVerifyCodeHandler.class b/target/classes/com/metalloop/common/auth/handler/DefaultVerifyCodeHandler.class new file mode 100644 index 0000000..4f31b33 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/handler/DefaultVerifyCodeHandler.class differ diff --git a/target/classes/com/metalloop/common/auth/handler/LoginSuccessHandler.class b/target/classes/com/metalloop/common/auth/handler/LoginSuccessHandler.class new file mode 100644 index 0000000..c64ef57 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/handler/LoginSuccessHandler.class differ diff --git a/target/classes/com/metalloop/common/auth/handler/LogoutSuccessHandler.class b/target/classes/com/metalloop/common/auth/handler/LogoutSuccessHandler.class new file mode 100644 index 0000000..cbe71fa Binary files /dev/null and b/target/classes/com/metalloop/common/auth/handler/LogoutSuccessHandler.class differ diff --git a/target/classes/com/metalloop/common/auth/handler/PasswordCheckFailureHandler.class b/target/classes/com/metalloop/common/auth/handler/PasswordCheckFailureHandler.class new file mode 100644 index 0000000..f7848a0 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/handler/PasswordCheckFailureHandler.class differ diff --git a/target/classes/com/metalloop/common/auth/handler/VerifyCodeHandler.class b/target/classes/com/metalloop/common/auth/handler/VerifyCodeHandler.class new file mode 100644 index 0000000..10bfa3e Binary files /dev/null and b/target/classes/com/metalloop/common/auth/handler/VerifyCodeHandler.class differ diff --git a/target/classes/com/metalloop/common/auth/model/AuthenticationMiniAppRequest.class b/target/classes/com/metalloop/common/auth/model/AuthenticationMiniAppRequest.class new file mode 100644 index 0000000..3247ef9 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/model/AuthenticationMiniAppRequest.class differ diff --git a/target/classes/com/metalloop/common/auth/model/AuthenticationRequest.class b/target/classes/com/metalloop/common/auth/model/AuthenticationRequest.class new file mode 100644 index 0000000..5a5891b Binary files /dev/null and b/target/classes/com/metalloop/common/auth/model/AuthenticationRequest.class differ diff --git a/target/classes/com/metalloop/common/auth/model/AuthenticationResponse.class b/target/classes/com/metalloop/common/auth/model/AuthenticationResponse.class new file mode 100644 index 0000000..460bf74 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/model/AuthenticationResponse.class differ diff --git a/target/classes/com/metalloop/common/auth/password/PasswordDecryptor.class b/target/classes/com/metalloop/common/auth/password/PasswordDecryptor.class new file mode 100644 index 0000000..cac34ad Binary files /dev/null and b/target/classes/com/metalloop/common/auth/password/PasswordDecryptor.class differ diff --git a/target/classes/com/metalloop/common/auth/password/RsaPasswordDecryptor.class b/target/classes/com/metalloop/common/auth/password/RsaPasswordDecryptor.class new file mode 100644 index 0000000..1e623d5 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/password/RsaPasswordDecryptor.class differ diff --git a/target/classes/com/metalloop/common/auth/permission/Permission.class b/target/classes/com/metalloop/common/auth/permission/Permission.class new file mode 100644 index 0000000..4fc04c2 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/permission/Permission.class differ diff --git a/target/classes/com/metalloop/common/auth/permission/PermissionService.class b/target/classes/com/metalloop/common/auth/permission/PermissionService.class new file mode 100644 index 0000000..82381da Binary files /dev/null and b/target/classes/com/metalloop/common/auth/permission/PermissionService.class differ diff --git a/target/classes/com/metalloop/common/auth/permission/SimplePermission.class b/target/classes/com/metalloop/common/auth/permission/SimplePermission.class new file mode 100644 index 0000000..1e32ab7 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/permission/SimplePermission.class differ diff --git a/target/classes/com/metalloop/common/auth/sso/SsoCodeService.class b/target/classes/com/metalloop/common/auth/sso/SsoCodeService.class new file mode 100644 index 0000000..edc785e Binary files /dev/null and b/target/classes/com/metalloop/common/auth/sso/SsoCodeService.class differ diff --git a/target/classes/com/metalloop/common/auth/sso/model/SimpleSsoUserInfo$Builder.class b/target/classes/com/metalloop/common/auth/sso/model/SimpleSsoUserInfo$Builder.class new file mode 100644 index 0000000..cd688c6 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/sso/model/SimpleSsoUserInfo$Builder.class differ diff --git a/target/classes/com/metalloop/common/auth/sso/model/SimpleSsoUserInfo.class b/target/classes/com/metalloop/common/auth/sso/model/SimpleSsoUserInfo.class new file mode 100644 index 0000000..0b335fb Binary files /dev/null and b/target/classes/com/metalloop/common/auth/sso/model/SimpleSsoUserInfo.class differ diff --git a/target/classes/com/metalloop/common/auth/sso/model/SsoUserInfo.class b/target/classes/com/metalloop/common/auth/sso/model/SsoUserInfo.class new file mode 100644 index 0000000..a55fc18 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/sso/model/SsoUserInfo.class differ diff --git a/target/classes/com/metalloop/common/auth/userdetails/SimpleUserDetails.class b/target/classes/com/metalloop/common/auth/userdetails/SimpleUserDetails.class new file mode 100644 index 0000000..b4eb11d Binary files /dev/null and b/target/classes/com/metalloop/common/auth/userdetails/SimpleUserDetails.class differ diff --git a/target/classes/com/metalloop/common/auth/userdetails/UserDetails.class b/target/classes/com/metalloop/common/auth/userdetails/UserDetails.class new file mode 100644 index 0000000..1e1a9a4 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/userdetails/UserDetails.class differ diff --git a/target/classes/com/metalloop/common/auth/userdetails/UserDetailsService.class b/target/classes/com/metalloop/common/auth/userdetails/UserDetailsService.class new file mode 100644 index 0000000..ff003c1 Binary files /dev/null and b/target/classes/com/metalloop/common/auth/userdetails/UserDetailsService.class differ diff --git a/target/classes/com/metalloop/common/constant/CommonConstant.class b/target/classes/com/metalloop/common/constant/CommonConstant.class new file mode 100644 index 0000000..bfd09a3 Binary files /dev/null and b/target/classes/com/metalloop/common/constant/CommonConstant.class differ diff --git a/target/classes/com/metalloop/common/constant/SecurityConstants.class b/target/classes/com/metalloop/common/constant/SecurityConstants.class new file mode 100644 index 0000000..90a7821 Binary files /dev/null and b/target/classes/com/metalloop/common/constant/SecurityConstants.class differ diff --git a/target/classes/com/metalloop/common/core/lock/DistributedLock.class b/target/classes/com/metalloop/common/core/lock/DistributedLock.class new file mode 100644 index 0000000..74d16d8 Binary files /dev/null and b/target/classes/com/metalloop/common/core/lock/DistributedLock.class differ diff --git a/target/classes/com/metalloop/common/core/lock/Lock.class b/target/classes/com/metalloop/common/core/lock/Lock.class new file mode 100644 index 0000000..00f6ce9 Binary files /dev/null and b/target/classes/com/metalloop/common/core/lock/Lock.class differ diff --git a/target/classes/com/metalloop/common/core/lock/LockAspect.class b/target/classes/com/metalloop/common/core/lock/LockAspect.class new file mode 100644 index 0000000..add76b7 Binary files /dev/null and b/target/classes/com/metalloop/common/core/lock/LockAspect.class differ diff --git a/target/classes/com/metalloop/common/core/lock/LockCondition.class b/target/classes/com/metalloop/common/core/lock/LockCondition.class new file mode 100644 index 0000000..c8a8aa0 Binary files /dev/null and b/target/classes/com/metalloop/common/core/lock/LockCondition.class differ diff --git a/target/classes/com/metalloop/common/core/lock/LockConditionReqDto$LockConditionReqDtoBuilder.class b/target/classes/com/metalloop/common/core/lock/LockConditionReqDto$LockConditionReqDtoBuilder.class new file mode 100644 index 0000000..b00f6a0 Binary files /dev/null and b/target/classes/com/metalloop/common/core/lock/LockConditionReqDto$LockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/common/core/lock/LockConditionReqDto.class b/target/classes/com/metalloop/common/core/lock/LockConditionReqDto.class new file mode 100644 index 0000000..a4c80ac Binary files /dev/null and b/target/classes/com/metalloop/common/core/lock/LockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/common/core/lock/ZLock.class b/target/classes/com/metalloop/common/core/lock/ZLock.class new file mode 100644 index 0000000..6f13472 Binary files /dev/null and b/target/classes/com/metalloop/common/core/lock/ZLock.class differ diff --git a/target/classes/com/metalloop/common/enums/Direction.class b/target/classes/com/metalloop/common/enums/Direction.class new file mode 100644 index 0000000..ef57dec Binary files /dev/null and b/target/classes/com/metalloop/common/enums/Direction.class differ diff --git a/target/classes/com/metalloop/common/enums/LoginType.class b/target/classes/com/metalloop/common/enums/LoginType.class new file mode 100644 index 0000000..90f24dd Binary files /dev/null and b/target/classes/com/metalloop/common/enums/LoginType.class differ diff --git a/target/classes/com/metalloop/common/exception/AccountExpiredException.class b/target/classes/com/metalloop/common/exception/AccountExpiredException.class new file mode 100644 index 0000000..32aeef9 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/AccountExpiredException.class differ diff --git a/target/classes/com/metalloop/common/exception/AccountStatusException.class b/target/classes/com/metalloop/common/exception/AccountStatusException.class new file mode 100644 index 0000000..5d633b2 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/AccountStatusException.class differ diff --git a/target/classes/com/metalloop/common/exception/AuthenticationException.class b/target/classes/com/metalloop/common/exception/AuthenticationException.class new file mode 100644 index 0000000..bba03c4 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/AuthenticationException.class differ diff --git a/target/classes/com/metalloop/common/exception/BadCredentialsException.class b/target/classes/com/metalloop/common/exception/BadCredentialsException.class new file mode 100644 index 0000000..773bb07 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/BadCredentialsException.class differ diff --git a/target/classes/com/metalloop/common/exception/BusinessException.class b/target/classes/com/metalloop/common/exception/BusinessException.class new file mode 100644 index 0000000..da315f5 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/BusinessException.class differ diff --git a/target/classes/com/metalloop/common/exception/CredentialsExpiredException.class b/target/classes/com/metalloop/common/exception/CredentialsExpiredException.class new file mode 100644 index 0000000..fd8c0bc Binary files /dev/null and b/target/classes/com/metalloop/common/exception/CredentialsExpiredException.class differ diff --git a/target/classes/com/metalloop/common/exception/DefaultExceptionAdvice.class b/target/classes/com/metalloop/common/exception/DefaultExceptionAdvice.class new file mode 100644 index 0000000..3c2c75f Binary files /dev/null and b/target/classes/com/metalloop/common/exception/DefaultExceptionAdvice.class differ diff --git a/target/classes/com/metalloop/common/exception/DisabledException.class b/target/classes/com/metalloop/common/exception/DisabledException.class new file mode 100644 index 0000000..86043d6 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/DisabledException.class differ diff --git a/target/classes/com/metalloop/common/exception/IdempotencyException.class b/target/classes/com/metalloop/common/exception/IdempotencyException.class new file mode 100644 index 0000000..ad9b651 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/IdempotencyException.class differ diff --git a/target/classes/com/metalloop/common/exception/LockException.class b/target/classes/com/metalloop/common/exception/LockException.class new file mode 100644 index 0000000..177e508 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/LockException.class differ diff --git a/target/classes/com/metalloop/common/exception/LockedException.class b/target/classes/com/metalloop/common/exception/LockedException.class new file mode 100644 index 0000000..538c98d Binary files /dev/null and b/target/classes/com/metalloop/common/exception/LockedException.class differ diff --git a/target/classes/com/metalloop/common/exception/UsernameNotFoundException.class b/target/classes/com/metalloop/common/exception/UsernameNotFoundException.class new file mode 100644 index 0000000..3679956 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/UsernameNotFoundException.class differ diff --git a/target/classes/com/metalloop/common/exception/ValidationFailedException.class b/target/classes/com/metalloop/common/exception/ValidationFailedException.class new file mode 100644 index 0000000..2d8bf0c Binary files /dev/null and b/target/classes/com/metalloop/common/exception/ValidationFailedException.class differ diff --git a/target/classes/com/metalloop/common/exception/code/CodeMsg.class b/target/classes/com/metalloop/common/exception/code/CodeMsg.class new file mode 100644 index 0000000..3a35114 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/code/CodeMsg.class differ diff --git a/target/classes/com/metalloop/common/exception/code/ResponseCode.class b/target/classes/com/metalloop/common/exception/code/ResponseCode.class new file mode 100644 index 0000000..d314ce4 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/code/ResponseCode.class differ diff --git a/target/classes/com/metalloop/common/exception/model/ApiErrorLog.class b/target/classes/com/metalloop/common/exception/model/ApiErrorLog.class new file mode 100644 index 0000000..b459685 Binary files /dev/null and b/target/classes/com/metalloop/common/exception/model/ApiErrorLog.class differ diff --git a/target/classes/com/metalloop/common/model/Result.class b/target/classes/com/metalloop/common/model/Result.class new file mode 100644 index 0000000..c4a87bd Binary files /dev/null and b/target/classes/com/metalloop/common/model/Result.class differ diff --git a/target/classes/com/metalloop/common/redis/RedisAutoConfigure.class b/target/classes/com/metalloop/common/redis/RedisAutoConfigure.class new file mode 100644 index 0000000..915ee35 Binary files /dev/null and b/target/classes/com/metalloop/common/redis/RedisAutoConfigure.class differ diff --git a/target/classes/com/metalloop/common/redis/lock/RedissonDistributedLock.class b/target/classes/com/metalloop/common/redis/lock/RedissonDistributedLock.class new file mode 100644 index 0000000..8aca097 Binary files /dev/null and b/target/classes/com/metalloop/common/redis/lock/RedissonDistributedLock.class differ diff --git a/target/classes/com/metalloop/common/redis/properties/CacheManagerProperties$CacheConfig.class b/target/classes/com/metalloop/common/redis/properties/CacheManagerProperties$CacheConfig.class new file mode 100644 index 0000000..4aa30f4 Binary files /dev/null and b/target/classes/com/metalloop/common/redis/properties/CacheManagerProperties$CacheConfig.class differ diff --git a/target/classes/com/metalloop/common/redis/properties/CacheManagerProperties.class b/target/classes/com/metalloop/common/redis/properties/CacheManagerProperties.class new file mode 100644 index 0000000..bbf5cec Binary files /dev/null and b/target/classes/com/metalloop/common/redis/properties/CacheManagerProperties.class differ diff --git a/target/classes/com/metalloop/common/redis/properties/RedissonLockAutoConfiguration.class b/target/classes/com/metalloop/common/redis/properties/RedissonLockAutoConfiguration.class new file mode 100644 index 0000000..23c1a51 Binary files /dev/null and b/target/classes/com/metalloop/common/redis/properties/RedissonLockAutoConfiguration.class differ diff --git a/target/classes/com/metalloop/common/redis/template/RedisRepository$1.class b/target/classes/com/metalloop/common/redis/template/RedisRepository$1.class new file mode 100644 index 0000000..2b454ae Binary files /dev/null and b/target/classes/com/metalloop/common/redis/template/RedisRepository$1.class differ diff --git a/target/classes/com/metalloop/common/redis/template/RedisRepository.class b/target/classes/com/metalloop/common/redis/template/RedisRepository.class new file mode 100644 index 0000000..291cf1a Binary files /dev/null and b/target/classes/com/metalloop/common/redis/template/RedisRepository.class differ diff --git a/target/classes/com/metalloop/common/service/ISuperService.class b/target/classes/com/metalloop/common/service/ISuperService.class new file mode 100644 index 0000000..f447b74 Binary files /dev/null and b/target/classes/com/metalloop/common/service/ISuperService.class differ diff --git a/target/classes/com/metalloop/common/service/impl/SuperServiceImpl.class b/target/classes/com/metalloop/common/service/impl/SuperServiceImpl.class new file mode 100644 index 0000000..a01fc29 Binary files /dev/null and b/target/classes/com/metalloop/common/service/impl/SuperServiceImpl.class differ diff --git a/target/classes/com/metalloop/common/utils/IPHelper.class b/target/classes/com/metalloop/common/utils/IPHelper.class new file mode 100644 index 0000000..9c30481 Binary files /dev/null and b/target/classes/com/metalloop/common/utils/IPHelper.class differ diff --git a/target/classes/com/metalloop/common/utils/QueryWrapperBuilder$CachedColumnResults.class b/target/classes/com/metalloop/common/utils/QueryWrapperBuilder$CachedColumnResults.class new file mode 100644 index 0000000..3c76c20 Binary files /dev/null and b/target/classes/com/metalloop/common/utils/QueryWrapperBuilder$CachedColumnResults.class differ diff --git a/target/classes/com/metalloop/common/utils/QueryWrapperBuilder$QueryStrategy.class b/target/classes/com/metalloop/common/utils/QueryWrapperBuilder$QueryStrategy.class new file mode 100644 index 0000000..c5a7a68 Binary files /dev/null and b/target/classes/com/metalloop/common/utils/QueryWrapperBuilder$QueryStrategy.class differ diff --git a/target/classes/com/metalloop/common/utils/QueryWrapperBuilder.class b/target/classes/com/metalloop/common/utils/QueryWrapperBuilder.class new file mode 100644 index 0000000..3a90383 Binary files /dev/null and b/target/classes/com/metalloop/common/utils/QueryWrapperBuilder.class differ diff --git a/target/classes/com/metalloop/common/utils/RsaUtils.class b/target/classes/com/metalloop/common/utils/RsaUtils.class new file mode 100644 index 0000000..a660dbe Binary files /dev/null and b/target/classes/com/metalloop/common/utils/RsaUtils.class differ diff --git a/target/classes/com/metalloop/common/utils/SpringUtil.class b/target/classes/com/metalloop/common/utils/SpringUtil.class new file mode 100644 index 0000000..32c9eb7 Binary files /dev/null and b/target/classes/com/metalloop/common/utils/SpringUtil.class differ diff --git a/target/classes/com/metalloop/common/utils/json/JsonUtils.class b/target/classes/com/metalloop/common/utils/json/JsonUtils.class new file mode 100644 index 0000000..1284eb3 Binary files /dev/null and b/target/classes/com/metalloop/common/utils/json/JsonUtils.class differ diff --git a/target/classes/com/metalloop/framework/satoken/SaTokenInterceptorConfig.class b/target/classes/com/metalloop/framework/satoken/SaTokenInterceptorConfig.class new file mode 100644 index 0000000..8c3a948 Binary files /dev/null and b/target/classes/com/metalloop/framework/satoken/SaTokenInterceptorConfig.class differ diff --git a/target/classes/com/metalloop/framework/satoken/StpInterfaceImpl.class b/target/classes/com/metalloop/framework/satoken/StpInterfaceImpl.class new file mode 100644 index 0000000..c1b0663 Binary files /dev/null and b/target/classes/com/metalloop/framework/satoken/StpInterfaceImpl.class differ diff --git a/target/classes/com/metalloop/framework/satoken/admin/StpAdminUtil.class b/target/classes/com/metalloop/framework/satoken/admin/StpAdminUtil.class new file mode 100644 index 0000000..c8c350a Binary files /dev/null and b/target/classes/com/metalloop/framework/satoken/admin/StpAdminUtil.class differ diff --git a/target/classes/com/metalloop/framework/satoken/admin/config/SaTokenAdminConfiguration.class b/target/classes/com/metalloop/framework/satoken/admin/config/SaTokenAdminConfiguration.class new file mode 100644 index 0000000..fe0bc0a Binary files /dev/null and b/target/classes/com/metalloop/framework/satoken/admin/config/SaTokenAdminConfiguration.class differ diff --git a/target/classes/com/metalloop/framework/satoken/admin/config/SaTokenAdminProperties.class b/target/classes/com/metalloop/framework/satoken/admin/config/SaTokenAdminProperties.class new file mode 100644 index 0000000..3fec59f Binary files /dev/null and b/target/classes/com/metalloop/framework/satoken/admin/config/SaTokenAdminProperties.class differ diff --git a/target/classes/com/metalloop/framework/satoken/self/StpSelfUtil.class b/target/classes/com/metalloop/framework/satoken/self/StpSelfUtil.class new file mode 100644 index 0000000..d8c4bb4 Binary files /dev/null and b/target/classes/com/metalloop/framework/satoken/self/StpSelfUtil.class differ diff --git a/target/classes/com/metalloop/framework/satoken/self/config/SaTokenSelfConfiguration.class b/target/classes/com/metalloop/framework/satoken/self/config/SaTokenSelfConfiguration.class new file mode 100644 index 0000000..f3c854d Binary files /dev/null and b/target/classes/com/metalloop/framework/satoken/self/config/SaTokenSelfConfiguration.class differ diff --git a/target/classes/com/metalloop/framework/satoken/self/config/SaTokenSelfProperties.class b/target/classes/com/metalloop/framework/satoken/self/config/SaTokenSelfProperties.class new file mode 100644 index 0000000..bcc779f Binary files /dev/null and b/target/classes/com/metalloop/framework/satoken/self/config/SaTokenSelfProperties.class differ diff --git a/target/classes/com/metalloop/framework/swagger/OpenApiConfig.class b/target/classes/com/metalloop/framework/swagger/OpenApiConfig.class new file mode 100644 index 0000000..0ed3bbc Binary files /dev/null and b/target/classes/com/metalloop/framework/swagger/OpenApiConfig.class differ diff --git a/target/classes/com/metalloop/modules/auth/controller/AuthController.class b/target/classes/com/metalloop/modules/auth/controller/AuthController.class new file mode 100644 index 0000000..3bfa593 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/controller/AuthController.class differ diff --git a/target/classes/com/metalloop/modules/auth/controller/RsaPublicKeyController.class b/target/classes/com/metalloop/modules/auth/controller/RsaPublicKeyController.class new file mode 100644 index 0000000..32ef98f Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/controller/RsaPublicKeyController.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseConverter.class b/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseConverter.class new file mode 100644 index 0000000..695ea92 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseConverter.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseConverterImpl.class b/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseConverterImpl.class new file mode 100644 index 0000000..44896e8 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseImageConverter.class b/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseImageConverter.class new file mode 100644 index 0000000..4e421f4 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseImageConverter.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseImageConverterImpl.class b/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseImageConverterImpl.class new file mode 100644 index 0000000..dc35c73 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysEnterpriseImageConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysPermissionConverter.class b/target/classes/com/metalloop/modules/auth/converter/SysPermissionConverter.class new file mode 100644 index 0000000..5d4a186 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysPermissionConverter.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysPermissionConverterImpl.class b/target/classes/com/metalloop/modules/auth/converter/SysPermissionConverterImpl.class new file mode 100644 index 0000000..d6a3f28 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysPermissionConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysRoleConverter.class b/target/classes/com/metalloop/modules/auth/converter/SysRoleConverter.class new file mode 100644 index 0000000..fa21696 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysRoleConverter.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysRoleConverterImpl.class b/target/classes/com/metalloop/modules/auth/converter/SysRoleConverterImpl.class new file mode 100644 index 0000000..76d7618 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysRoleConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysRolePermissionConverter.class b/target/classes/com/metalloop/modules/auth/converter/SysRolePermissionConverter.class new file mode 100644 index 0000000..bed87a7 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysRolePermissionConverter.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysRolePermissionConverterImpl.class b/target/classes/com/metalloop/modules/auth/converter/SysRolePermissionConverterImpl.class new file mode 100644 index 0000000..8f0f65a Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysRolePermissionConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysUserConverter.class b/target/classes/com/metalloop/modules/auth/converter/SysUserConverter.class new file mode 100644 index 0000000..964eb58 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysUserConverter.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysUserConverterImpl.class b/target/classes/com/metalloop/modules/auth/converter/SysUserConverterImpl.class new file mode 100644 index 0000000..a444afc Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysUserConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysUserRoleConverter.class b/target/classes/com/metalloop/modules/auth/converter/SysUserRoleConverter.class new file mode 100644 index 0000000..3d4e181 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysUserRoleConverter.class differ diff --git a/target/classes/com/metalloop/modules/auth/converter/SysUserRoleConverterImpl.class b/target/classes/com/metalloop/modules/auth/converter/SysUserRoleConverterImpl.class new file mode 100644 index 0000000..20c8066 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/converter/SysUserRoleConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/mapper/SysEnterpriseImageMapper.class b/target/classes/com/metalloop/modules/auth/mapper/SysEnterpriseImageMapper.class new file mode 100644 index 0000000..6b826de Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/mapper/SysEnterpriseImageMapper.class differ diff --git a/target/classes/com/metalloop/modules/auth/mapper/SysEnterpriseMapper.class b/target/classes/com/metalloop/modules/auth/mapper/SysEnterpriseMapper.class new file mode 100644 index 0000000..a953b4b Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/mapper/SysEnterpriseMapper.class differ diff --git a/target/classes/com/metalloop/modules/auth/mapper/SysPermissionMapper.class b/target/classes/com/metalloop/modules/auth/mapper/SysPermissionMapper.class new file mode 100644 index 0000000..b0cd73e Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/mapper/SysPermissionMapper.class differ diff --git a/target/classes/com/metalloop/modules/auth/mapper/SysRoleMapper.class b/target/classes/com/metalloop/modules/auth/mapper/SysRoleMapper.class new file mode 100644 index 0000000..c1b8551 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/mapper/SysRoleMapper.class differ diff --git a/target/classes/com/metalloop/modules/auth/mapper/SysRolePermissionMapper.class b/target/classes/com/metalloop/modules/auth/mapper/SysRolePermissionMapper.class new file mode 100644 index 0000000..c151ffe Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/mapper/SysRolePermissionMapper.class differ diff --git a/target/classes/com/metalloop/modules/auth/mapper/SysUserMapper.class b/target/classes/com/metalloop/modules/auth/mapper/SysUserMapper.class new file mode 100644 index 0000000..7a652f6 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/mapper/SysUserMapper.class differ diff --git a/target/classes/com/metalloop/modules/auth/mapper/SysUserRoleMapper.class b/target/classes/com/metalloop/modules/auth/mapper/SysUserRoleMapper.class new file mode 100644 index 0000000..da41c51 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/mapper/SysUserRoleMapper.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysEnterprise$SysEnterpriseBuilder.class b/target/classes/com/metalloop/modules/auth/model/po/SysEnterprise$SysEnterpriseBuilder.class new file mode 100644 index 0000000..e90c907 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysEnterprise$SysEnterpriseBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysEnterprise.class b/target/classes/com/metalloop/modules/auth/model/po/SysEnterprise.class new file mode 100644 index 0000000..4874a41 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysEnterprise.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysEnterpriseImage$SysEnterpriseImageBuilder.class b/target/classes/com/metalloop/modules/auth/model/po/SysEnterpriseImage$SysEnterpriseImageBuilder.class new file mode 100644 index 0000000..4654826 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysEnterpriseImage$SysEnterpriseImageBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysEnterpriseImage.class b/target/classes/com/metalloop/modules/auth/model/po/SysEnterpriseImage.class new file mode 100644 index 0000000..9b8805b Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysEnterpriseImage.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysPermission$SysPermissionBuilder.class b/target/classes/com/metalloop/modules/auth/model/po/SysPermission$SysPermissionBuilder.class new file mode 100644 index 0000000..52a47cc Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysPermission$SysPermissionBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysPermission.class b/target/classes/com/metalloop/modules/auth/model/po/SysPermission.class new file mode 100644 index 0000000..709daf2 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysPermission.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysRole$SysRoleBuilder.class b/target/classes/com/metalloop/modules/auth/model/po/SysRole$SysRoleBuilder.class new file mode 100644 index 0000000..aca9a48 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysRole$SysRoleBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysRole.class b/target/classes/com/metalloop/modules/auth/model/po/SysRole.class new file mode 100644 index 0000000..bcfce16 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysRole.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysRolePermission$SysRolePermissionBuilder.class b/target/classes/com/metalloop/modules/auth/model/po/SysRolePermission$SysRolePermissionBuilder.class new file mode 100644 index 0000000..856844c Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysRolePermission$SysRolePermissionBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysRolePermission.class b/target/classes/com/metalloop/modules/auth/model/po/SysRolePermission.class new file mode 100644 index 0000000..ad68351 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysRolePermission.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysUser$SysUserBuilder.class b/target/classes/com/metalloop/modules/auth/model/po/SysUser$SysUserBuilder.class new file mode 100644 index 0000000..393b090 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysUser$SysUserBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysUser.class b/target/classes/com/metalloop/modules/auth/model/po/SysUser.class new file mode 100644 index 0000000..f7c7514 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysUser.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysUserRole$SysUserRoleBuilder.class b/target/classes/com/metalloop/modules/auth/model/po/SysUserRole$SysUserRoleBuilder.class new file mode 100644 index 0000000..25faa17 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysUserRole$SysUserRoleBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/po/SysUserRole.class b/target/classes/com/metalloop/modules/auth/model/po/SysUserRole.class new file mode 100644 index 0000000..9408572 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/po/SysUserRole.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseImageQuery$SysEnterpriseImageQueryBuilder.class b/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseImageQuery$SysEnterpriseImageQueryBuilder.class new file mode 100644 index 0000000..1b72c1c Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseImageQuery$SysEnterpriseImageQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseImageQuery.class b/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseImageQuery.class new file mode 100644 index 0000000..282fbf5 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseImageQuery.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseQuery$SysEnterpriseQueryBuilder.class b/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseQuery$SysEnterpriseQueryBuilder.class new file mode 100644 index 0000000..1997afe Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseQuery$SysEnterpriseQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseQuery.class b/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseQuery.class new file mode 100644 index 0000000..433e187 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysEnterpriseQuery.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysPermissionQuery$SysPermissionQueryBuilder.class b/target/classes/com/metalloop/modules/auth/model/query/SysPermissionQuery$SysPermissionQueryBuilder.class new file mode 100644 index 0000000..95a02ed Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysPermissionQuery$SysPermissionQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysPermissionQuery.class b/target/classes/com/metalloop/modules/auth/model/query/SysPermissionQuery.class new file mode 100644 index 0000000..07f650b Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysPermissionQuery.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysRolePermissionQuery$SysRolePermissionQueryBuilder.class b/target/classes/com/metalloop/modules/auth/model/query/SysRolePermissionQuery$SysRolePermissionQueryBuilder.class new file mode 100644 index 0000000..f10d6f2 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysRolePermissionQuery$SysRolePermissionQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysRolePermissionQuery.class b/target/classes/com/metalloop/modules/auth/model/query/SysRolePermissionQuery.class new file mode 100644 index 0000000..af8387b Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysRolePermissionQuery.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysRoleQuery$SysRoleQueryBuilder.class b/target/classes/com/metalloop/modules/auth/model/query/SysRoleQuery$SysRoleQueryBuilder.class new file mode 100644 index 0000000..7bd9724 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysRoleQuery$SysRoleQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysRoleQuery.class b/target/classes/com/metalloop/modules/auth/model/query/SysRoleQuery.class new file mode 100644 index 0000000..551ade6 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysRoleQuery.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysUserQuery$SysUserQueryBuilder.class b/target/classes/com/metalloop/modules/auth/model/query/SysUserQuery$SysUserQueryBuilder.class new file mode 100644 index 0000000..f1e91de Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysUserQuery$SysUserQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysUserQuery.class b/target/classes/com/metalloop/modules/auth/model/query/SysUserQuery.class new file mode 100644 index 0000000..1df9569 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysUserQuery.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysUserRoleQuery$SysUserRoleQueryBuilder.class b/target/classes/com/metalloop/modules/auth/model/query/SysUserRoleQuery$SysUserRoleQueryBuilder.class new file mode 100644 index 0000000..554e46b Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysUserRoleQuery$SysUserRoleQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/query/SysUserRoleQuery.class b/target/classes/com/metalloop/modules/auth/model/query/SysUserRoleQuery.class new file mode 100644 index 0000000..7b205b3 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/query/SysUserRoleQuery.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/AuthenticationRequest.class b/target/classes/com/metalloop/modules/auth/model/req/AuthenticationRequest.class new file mode 100644 index 0000000..ae711d8 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/AuthenticationRequest.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageLockConditionReqDto$SysEnterpriseImageLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageLockConditionReqDto$SysEnterpriseImageLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..ef2eb0d Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageLockConditionReqDto$SysEnterpriseImageLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageLockConditionReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageLockConditionReqDto.class new file mode 100644 index 0000000..f2137ba Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImagePageQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImagePageQueryReqDto.class new file mode 100644 index 0000000..0ae0d03 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImagePageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageQueryReqDto$SysEnterpriseImageQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageQueryReqDto$SysEnterpriseImageQueryReqDtoBuilder.class new file mode 100644 index 0000000..7ce6e50 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageQueryReqDto$SysEnterpriseImageQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageQueryReqDto.class new file mode 100644 index 0000000..be728e7 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageReqDto$SysEnterpriseImageReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageReqDto$SysEnterpriseImageReqDtoBuilder.class new file mode 100644 index 0000000..5eca726 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageReqDto$SysEnterpriseImageReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageReqDto.class new file mode 100644 index 0000000..8e4672e Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageUpdateByQueryReqDto$SysEnterpriseImageUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageUpdateByQueryReqDto$SysEnterpriseImageUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..b6b729b Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageUpdateByQueryReqDto$SysEnterpriseImageUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageUpdateByQueryReqDto.class new file mode 100644 index 0000000..663178d Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseImageUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseLockConditionReqDto$SysEnterpriseLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseLockConditionReqDto$SysEnterpriseLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..9f3c66e Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseLockConditionReqDto$SysEnterpriseLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseLockConditionReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseLockConditionReqDto.class new file mode 100644 index 0000000..77165af Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterprisePageQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterprisePageQueryReqDto.class new file mode 100644 index 0000000..89ae7d6 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterprisePageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseQueryReqDto$SysEnterpriseQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseQueryReqDto$SysEnterpriseQueryReqDtoBuilder.class new file mode 100644 index 0000000..a2010e1 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseQueryReqDto$SysEnterpriseQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseQueryReqDto.class new file mode 100644 index 0000000..62f27a3 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseReqDto$SysEnterpriseReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseReqDto$SysEnterpriseReqDtoBuilder.class new file mode 100644 index 0000000..2a3de81 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseReqDto$SysEnterpriseReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseReqDto.class new file mode 100644 index 0000000..e2791b5 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseUpdateByQueryReqDto$SysEnterpriseUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseUpdateByQueryReqDto$SysEnterpriseUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..6627f26 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseUpdateByQueryReqDto$SysEnterpriseUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseUpdateByQueryReqDto.class new file mode 100644 index 0000000..975183a Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysEnterpriseUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysPermissionLockConditionReqDto$SysPermissionLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionLockConditionReqDto$SysPermissionLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..5e249d9 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionLockConditionReqDto$SysPermissionLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysPermissionLockConditionReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionLockConditionReqDto.class new file mode 100644 index 0000000..bec3c91 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysPermissionPageQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionPageQueryReqDto.class new file mode 100644 index 0000000..6a2a193 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionPageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysPermissionQueryReqDto$SysPermissionQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionQueryReqDto$SysPermissionQueryReqDtoBuilder.class new file mode 100644 index 0000000..ebd515c Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionQueryReqDto$SysPermissionQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysPermissionQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionQueryReqDto.class new file mode 100644 index 0000000..ecf49a7 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysPermissionReqDto$SysPermissionReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionReqDto$SysPermissionReqDtoBuilder.class new file mode 100644 index 0000000..0c15f35 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionReqDto$SysPermissionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysPermissionReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionReqDto.class new file mode 100644 index 0000000..e2281df Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysPermissionUpdateByQueryReqDto$SysPermissionUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionUpdateByQueryReqDto$SysPermissionUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..e5f0ef7 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionUpdateByQueryReqDto$SysPermissionUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysPermissionUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionUpdateByQueryReqDto.class new file mode 100644 index 0000000..ea4bc11 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysPermissionUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRoleLockConditionReqDto$SysRoleLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysRoleLockConditionReqDto$SysRoleLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..16a9dd6 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRoleLockConditionReqDto$SysRoleLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRoleLockConditionReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRoleLockConditionReqDto.class new file mode 100644 index 0000000..e4b85e4 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRoleLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePageQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePageQueryReqDto.class new file mode 100644 index 0000000..05db7a0 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionLockConditionReqDto$SysRolePermissionLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionLockConditionReqDto$SysRolePermissionLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..dfe8f32 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionLockConditionReqDto$SysRolePermissionLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionLockConditionReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionLockConditionReqDto.class new file mode 100644 index 0000000..e54905d Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionPageQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionPageQueryReqDto.class new file mode 100644 index 0000000..2ffb6bd Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionPageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionQueryReqDto$SysRolePermissionQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionQueryReqDto$SysRolePermissionQueryReqDtoBuilder.class new file mode 100644 index 0000000..7027a9d Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionQueryReqDto$SysRolePermissionQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionQueryReqDto.class new file mode 100644 index 0000000..dc8b265 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionReqDto$SysRolePermissionReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionReqDto$SysRolePermissionReqDtoBuilder.class new file mode 100644 index 0000000..7cc514e Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionReqDto$SysRolePermissionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionReqDto.class new file mode 100644 index 0000000..eb0d574 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionUpdateByQueryReqDto$SysRolePermissionUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionUpdateByQueryReqDto$SysRolePermissionUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..051bdd4 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionUpdateByQueryReqDto$SysRolePermissionUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionUpdateByQueryReqDto.class new file mode 100644 index 0000000..bc8fbfb Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRolePermissionUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRoleQueryReqDto$SysRoleQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysRoleQueryReqDto$SysRoleQueryReqDtoBuilder.class new file mode 100644 index 0000000..80799fd Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRoleQueryReqDto$SysRoleQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRoleQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRoleQueryReqDto.class new file mode 100644 index 0000000..60803da Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRoleQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRoleReqDto$SysRoleReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysRoleReqDto$SysRoleReqDtoBuilder.class new file mode 100644 index 0000000..dd89c0d Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRoleReqDto$SysRoleReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRoleReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRoleReqDto.class new file mode 100644 index 0000000..5a0eddb Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRoleReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRoleUpdateByQueryReqDto$SysRoleUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysRoleUpdateByQueryReqDto$SysRoleUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..ad7a7ef Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRoleUpdateByQueryReqDto$SysRoleUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysRoleUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysRoleUpdateByQueryReqDto.class new file mode 100644 index 0000000..8dc9173 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysRoleUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserLockConditionReqDto$SysUserLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserLockConditionReqDto$SysUserLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..50c8fd4 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserLockConditionReqDto$SysUserLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserLockConditionReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserLockConditionReqDto.class new file mode 100644 index 0000000..4016799 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserPageQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserPageQueryReqDto.class new file mode 100644 index 0000000..2062e0d Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserPageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserQueryReqDto$SysUserQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserQueryReqDto$SysUserQueryReqDtoBuilder.class new file mode 100644 index 0000000..f347828 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserQueryReqDto$SysUserQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserQueryReqDto.class new file mode 100644 index 0000000..b9bd4bc Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserReqDto$SysUserReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserReqDto$SysUserReqDtoBuilder.class new file mode 100644 index 0000000..a9c4cea Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserReqDto$SysUserReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserReqDto.class new file mode 100644 index 0000000..6e2a594 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleLockConditionReqDto$SysUserRoleLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleLockConditionReqDto$SysUserRoleLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..652b243 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleLockConditionReqDto$SysUserRoleLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleLockConditionReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleLockConditionReqDto.class new file mode 100644 index 0000000..91e7084 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserRolePageQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserRolePageQueryReqDto.class new file mode 100644 index 0000000..107b537 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserRolePageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleQueryReqDto$SysUserRoleQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleQueryReqDto$SysUserRoleQueryReqDtoBuilder.class new file mode 100644 index 0000000..01cb2df Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleQueryReqDto$SysUserRoleQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleQueryReqDto.class new file mode 100644 index 0000000..945a9eb Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleReqDto$SysUserRoleReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleReqDto$SysUserRoleReqDtoBuilder.class new file mode 100644 index 0000000..3199485 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleReqDto$SysUserRoleReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleReqDto.class new file mode 100644 index 0000000..257be31 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleUpdateByQueryReqDto$SysUserRoleUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleUpdateByQueryReqDto$SysUserRoleUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..4bd0eb5 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleUpdateByQueryReqDto$SysUserRoleUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleUpdateByQueryReqDto.class new file mode 100644 index 0000000..3fcdb09 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserRoleUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserUpdateByQueryReqDto$SysUserUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserUpdateByQueryReqDto$SysUserUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..635a9dd Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserUpdateByQueryReqDto$SysUserUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/req/SysUserUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/auth/model/req/SysUserUpdateByQueryReqDto.class new file mode 100644 index 0000000..6531511 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/req/SysUserUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/AuthenticationResponse.class b/target/classes/com/metalloop/modules/auth/model/resp/AuthenticationResponse.class new file mode 100644 index 0000000..2e70ca0 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/AuthenticationResponse.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseImageRespDto$SysEnterpriseImageRespDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseImageRespDto$SysEnterpriseImageRespDtoBuilder.class new file mode 100644 index 0000000..f4b32a0 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseImageRespDto$SysEnterpriseImageRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseImageRespDto.class b/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseImageRespDto.class new file mode 100644 index 0000000..265be44 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseImageRespDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseRespDto$SysEnterpriseRespDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseRespDto$SysEnterpriseRespDtoBuilder.class new file mode 100644 index 0000000..d0ec8cb Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseRespDto$SysEnterpriseRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseRespDto.class b/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseRespDto.class new file mode 100644 index 0000000..9850726 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysEnterpriseRespDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysPermissionRespDto$SysPermissionRespDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/resp/SysPermissionRespDto$SysPermissionRespDtoBuilder.class new file mode 100644 index 0000000..d32601b Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysPermissionRespDto$SysPermissionRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysPermissionRespDto.class b/target/classes/com/metalloop/modules/auth/model/resp/SysPermissionRespDto.class new file mode 100644 index 0000000..2f66dc5 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysPermissionRespDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysRolePermissionRespDto$SysRolePermissionRespDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/resp/SysRolePermissionRespDto$SysRolePermissionRespDtoBuilder.class new file mode 100644 index 0000000..39b1244 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysRolePermissionRespDto$SysRolePermissionRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysRolePermissionRespDto.class b/target/classes/com/metalloop/modules/auth/model/resp/SysRolePermissionRespDto.class new file mode 100644 index 0000000..188486a Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysRolePermissionRespDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysRoleRespDto$SysRoleRespDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/resp/SysRoleRespDto$SysRoleRespDtoBuilder.class new file mode 100644 index 0000000..66a1d7d Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysRoleRespDto$SysRoleRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysRoleRespDto.class b/target/classes/com/metalloop/modules/auth/model/resp/SysRoleRespDto.class new file mode 100644 index 0000000..920fd7e Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysRoleRespDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysUserRespDto$SysUserRespDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/resp/SysUserRespDto$SysUserRespDtoBuilder.class new file mode 100644 index 0000000..6d809f6 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysUserRespDto$SysUserRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysUserRespDto.class b/target/classes/com/metalloop/modules/auth/model/resp/SysUserRespDto.class new file mode 100644 index 0000000..87e589f Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysUserRespDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysUserRoleRespDto$SysUserRoleRespDtoBuilder.class b/target/classes/com/metalloop/modules/auth/model/resp/SysUserRoleRespDto$SysUserRoleRespDtoBuilder.class new file mode 100644 index 0000000..70f4493 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysUserRoleRespDto$SysUserRoleRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/auth/model/resp/SysUserRoleRespDto.class b/target/classes/com/metalloop/modules/auth/model/resp/SysUserRoleRespDto.class new file mode 100644 index 0000000..089fe05 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/model/resp/SysUserRoleRespDto.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/SysEnterpriseImageService.class b/target/classes/com/metalloop/modules/auth/service/SysEnterpriseImageService.class new file mode 100644 index 0000000..69dee90 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/SysEnterpriseImageService.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/SysEnterpriseService.class b/target/classes/com/metalloop/modules/auth/service/SysEnterpriseService.class new file mode 100644 index 0000000..58522d8 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/SysEnterpriseService.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/SysPermissionService.class b/target/classes/com/metalloop/modules/auth/service/SysPermissionService.class new file mode 100644 index 0000000..cb10d3d Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/SysPermissionService.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/SysRolePermissionService.class b/target/classes/com/metalloop/modules/auth/service/SysRolePermissionService.class new file mode 100644 index 0000000..c6207d3 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/SysRolePermissionService.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/SysRoleService.class b/target/classes/com/metalloop/modules/auth/service/SysRoleService.class new file mode 100644 index 0000000..6fd9519 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/SysRoleService.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/SysUserRoleService.class b/target/classes/com/metalloop/modules/auth/service/SysUserRoleService.class new file mode 100644 index 0000000..dfcce31 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/SysUserRoleService.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/SysUserService.class b/target/classes/com/metalloop/modules/auth/service/SysUserService.class new file mode 100644 index 0000000..31556ec Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/SysUserService.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/impl/SysEnterpriseImageServiceImpl.class b/target/classes/com/metalloop/modules/auth/service/impl/SysEnterpriseImageServiceImpl.class new file mode 100644 index 0000000..4b256c7 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/impl/SysEnterpriseImageServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/impl/SysEnterpriseServiceImpl.class b/target/classes/com/metalloop/modules/auth/service/impl/SysEnterpriseServiceImpl.class new file mode 100644 index 0000000..d819c19 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/impl/SysEnterpriseServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/impl/SysPermissionServiceImpl.class b/target/classes/com/metalloop/modules/auth/service/impl/SysPermissionServiceImpl.class new file mode 100644 index 0000000..e73b3c3 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/impl/SysPermissionServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/impl/SysRolePermissionServiceImpl.class b/target/classes/com/metalloop/modules/auth/service/impl/SysRolePermissionServiceImpl.class new file mode 100644 index 0000000..99f3116 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/impl/SysRolePermissionServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/impl/SysRoleServiceImpl.class b/target/classes/com/metalloop/modules/auth/service/impl/SysRoleServiceImpl.class new file mode 100644 index 0000000..8573c4f Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/impl/SysRoleServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/impl/SysUserRoleServiceImpl.class b/target/classes/com/metalloop/modules/auth/service/impl/SysUserRoleServiceImpl.class new file mode 100644 index 0000000..9bb0303 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/impl/SysUserRoleServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/auth/service/impl/SysUserServiceImpl.class b/target/classes/com/metalloop/modules/auth/service/impl/SysUserServiceImpl.class new file mode 100644 index 0000000..6c97c50 Binary files /dev/null and b/target/classes/com/metalloop/modules/auth/service/impl/SysUserServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverter.class b/target/classes/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverter.class new file mode 100644 index 0000000..854e479 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverter.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverterImpl.class b/target/classes/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverterImpl.class new file mode 100644 index 0000000..b47a2be Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizMaterialConverter.class b/target/classes/com/metalloop/modules/bussiness/converter/BizMaterialConverter.class new file mode 100644 index 0000000..85d5804 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizMaterialConverter.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizMaterialConverterImpl.class b/target/classes/com/metalloop/modules/bussiness/converter/BizMaterialConverterImpl.class new file mode 100644 index 0000000..e52fd9b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizMaterialConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverter.class b/target/classes/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverter.class new file mode 100644 index 0000000..fec6eaa Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverter.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverterImpl.class b/target/classes/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverterImpl.class new file mode 100644 index 0000000..4e6d0cc Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverter.class b/target/classes/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverter.class new file mode 100644 index 0000000..87b5863 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverter.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverterImpl.class b/target/classes/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverterImpl.class new file mode 100644 index 0000000..27d8858 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizVarietyConverter.class b/target/classes/com/metalloop/modules/bussiness/converter/BizVarietyConverter.class new file mode 100644 index 0000000..a0f1854 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizVarietyConverter.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/converter/BizVarietyConverterImpl.class b/target/classes/com/metalloop/modules/bussiness/converter/BizVarietyConverterImpl.class new file mode 100644 index 0000000..4cd5940 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/converter/BizVarietyConverterImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/mapper/BizEnterpriseProductMapper.class b/target/classes/com/metalloop/modules/bussiness/mapper/BizEnterpriseProductMapper.class new file mode 100644 index 0000000..f4a84fb Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/mapper/BizEnterpriseProductMapper.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/mapper/BizMaterialMapper.class b/target/classes/com/metalloop/modules/bussiness/mapper/BizMaterialMapper.class new file mode 100644 index 0000000..6f78099 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/mapper/BizMaterialMapper.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/mapper/BizPurchaseRequestMapper.class b/target/classes/com/metalloop/modules/bussiness/mapper/BizPurchaseRequestMapper.class new file mode 100644 index 0000000..f7aa669 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/mapper/BizPurchaseRequestMapper.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/mapper/BizSupplyInfoMapper.class b/target/classes/com/metalloop/modules/bussiness/mapper/BizSupplyInfoMapper.class new file mode 100644 index 0000000..3688aad Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/mapper/BizSupplyInfoMapper.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/mapper/BizVarietyMapper.class b/target/classes/com/metalloop/modules/bussiness/mapper/BizVarietyMapper.class new file mode 100644 index 0000000..3f89d5a Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/mapper/BizVarietyMapper.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizEnterpriseProduct$BizEnterpriseProductBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizEnterpriseProduct$BizEnterpriseProductBuilder.class new file mode 100644 index 0000000..8c55de2 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizEnterpriseProduct$BizEnterpriseProductBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizEnterpriseProduct.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizEnterpriseProduct.class new file mode 100644 index 0000000..09b0b0b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizEnterpriseProduct.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizMaterial$BizMaterialBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizMaterial$BizMaterialBuilder.class new file mode 100644 index 0000000..add0412 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizMaterial$BizMaterialBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizMaterial.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizMaterial.class new file mode 100644 index 0000000..80b454b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizMaterial.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizPurchaseRequest$BizPurchaseRequestBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizPurchaseRequest$BizPurchaseRequestBuilder.class new file mode 100644 index 0000000..8fe1e7b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizPurchaseRequest$BizPurchaseRequestBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizPurchaseRequest.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizPurchaseRequest.class new file mode 100644 index 0000000..baac228 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizPurchaseRequest.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizSupplyInfo$BizSupplyInfoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizSupplyInfo$BizSupplyInfoBuilder.class new file mode 100644 index 0000000..f7c224f Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizSupplyInfo$BizSupplyInfoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizSupplyInfo.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizSupplyInfo.class new file mode 100644 index 0000000..25b229e Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizSupplyInfo.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizVariety$BizVarietyBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizVariety$BizVarietyBuilder.class new file mode 100644 index 0000000..a28a248 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizVariety$BizVarietyBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/po/BizVariety.class b/target/classes/com/metalloop/modules/bussiness/model/po/BizVariety.class new file mode 100644 index 0000000..cd7d6b4 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/po/BizVariety.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizEnterpriseProductQuery$BizEnterpriseProductQueryBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizEnterpriseProductQuery$BizEnterpriseProductQueryBuilder.class new file mode 100644 index 0000000..40611f1 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizEnterpriseProductQuery$BizEnterpriseProductQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizEnterpriseProductQuery.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizEnterpriseProductQuery.class new file mode 100644 index 0000000..d624c16 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizEnterpriseProductQuery.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizMaterialQuery$BizMaterialQueryBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizMaterialQuery$BizMaterialQueryBuilder.class new file mode 100644 index 0000000..bf08cda Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizMaterialQuery$BizMaterialQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizMaterialQuery.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizMaterialQuery.class new file mode 100644 index 0000000..373337b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizMaterialQuery.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizPurchaseRequestQuery$BizPurchaseRequestQueryBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizPurchaseRequestQuery$BizPurchaseRequestQueryBuilder.class new file mode 100644 index 0000000..14e68f5 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizPurchaseRequestQuery$BizPurchaseRequestQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizPurchaseRequestQuery.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizPurchaseRequestQuery.class new file mode 100644 index 0000000..7fd1934 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizPurchaseRequestQuery.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizSupplyInfoQuery$BizSupplyInfoQueryBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizSupplyInfoQuery$BizSupplyInfoQueryBuilder.class new file mode 100644 index 0000000..c733321 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizSupplyInfoQuery$BizSupplyInfoQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizSupplyInfoQuery.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizSupplyInfoQuery.class new file mode 100644 index 0000000..41a6107 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizSupplyInfoQuery.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizVarietyQuery$BizVarietyQueryBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizVarietyQuery$BizVarietyQueryBuilder.class new file mode 100644 index 0000000..aa0aa3c Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizVarietyQuery$BizVarietyQueryBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/query/BizVarietyQuery.class b/target/classes/com/metalloop/modules/bussiness/model/query/BizVarietyQuery.class new file mode 100644 index 0000000..a1df2ff Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/query/BizVarietyQuery.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductLockConditionReqDto$BizEnterpriseProductLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductLockConditionReqDto$BizEnterpriseProductLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..331eb8f Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductLockConditionReqDto$BizEnterpriseProductLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductLockConditionReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductLockConditionReqDto.class new file mode 100644 index 0000000..188d5b1 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductPageQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductPageQueryReqDto.class new file mode 100644 index 0000000..62f4ce8 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductPageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductQueryReqDto$BizEnterpriseProductQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductQueryReqDto$BizEnterpriseProductQueryReqDtoBuilder.class new file mode 100644 index 0000000..8eff2c6 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductQueryReqDto$BizEnterpriseProductQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductQueryReqDto.class new file mode 100644 index 0000000..3c4039d Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductReqDto$BizEnterpriseProductReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductReqDto$BizEnterpriseProductReqDtoBuilder.class new file mode 100644 index 0000000..d263be5 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductReqDto$BizEnterpriseProductReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductReqDto.class new file mode 100644 index 0000000..767b521 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductUpdateByQueryReqDto$BizEnterpriseProductUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductUpdateByQueryReqDto$BizEnterpriseProductUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..c26c5c4 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductUpdateByQueryReqDto$BizEnterpriseProductUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductUpdateByQueryReqDto.class new file mode 100644 index 0000000..e97eb6d Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizEnterpriseProductUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialLockConditionReqDto$BizMaterialLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialLockConditionReqDto$BizMaterialLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..339ac9e Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialLockConditionReqDto$BizMaterialLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialLockConditionReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialLockConditionReqDto.class new file mode 100644 index 0000000..1f0a3a8 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialPageQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialPageQueryReqDto.class new file mode 100644 index 0000000..b0c2c55 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialPageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialQueryReqDto$BizMaterialQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialQueryReqDto$BizMaterialQueryReqDtoBuilder.class new file mode 100644 index 0000000..5ab9a21 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialQueryReqDto$BizMaterialQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialQueryReqDto.class new file mode 100644 index 0000000..8fc9e8f Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialReqDto$BizMaterialReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialReqDto$BizMaterialReqDtoBuilder.class new file mode 100644 index 0000000..3e8dbbc Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialReqDto$BizMaterialReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialReqDto.class new file mode 100644 index 0000000..133beec Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialUpdateByQueryReqDto$BizMaterialUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialUpdateByQueryReqDto$BizMaterialUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..d8831e2 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialUpdateByQueryReqDto$BizMaterialUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialUpdateByQueryReqDto.class new file mode 100644 index 0000000..9c3f293 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizMaterialUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestLockConditionReqDto$BizPurchaseRequestLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestLockConditionReqDto$BizPurchaseRequestLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..808c6a7 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestLockConditionReqDto$BizPurchaseRequestLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestLockConditionReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestLockConditionReqDto.class new file mode 100644 index 0000000..bafc049 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestPageQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestPageQueryReqDto.class new file mode 100644 index 0000000..9c460a0 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestPageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestQueryReqDto$BizPurchaseRequestQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestQueryReqDto$BizPurchaseRequestQueryReqDtoBuilder.class new file mode 100644 index 0000000..9a571dc Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestQueryReqDto$BizPurchaseRequestQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestQueryReqDto.class new file mode 100644 index 0000000..843db2c Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestReqDto$BizPurchaseRequestReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestReqDto$BizPurchaseRequestReqDtoBuilder.class new file mode 100644 index 0000000..ea1ffdd Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestReqDto$BizPurchaseRequestReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestReqDto.class new file mode 100644 index 0000000..24082d7 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestUpdateByQueryReqDto$BizPurchaseRequestUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestUpdateByQueryReqDto$BizPurchaseRequestUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..fd98be2 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestUpdateByQueryReqDto$BizPurchaseRequestUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestUpdateByQueryReqDto.class new file mode 100644 index 0000000..8b6c4c5 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizPurchaseRequestUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoLockConditionReqDto$BizSupplyInfoLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoLockConditionReqDto$BizSupplyInfoLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..bc2a505 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoLockConditionReqDto$BizSupplyInfoLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoLockConditionReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoLockConditionReqDto.class new file mode 100644 index 0000000..770ebd8 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoPageQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoPageQueryReqDto.class new file mode 100644 index 0000000..81e447a Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoPageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoQueryReqDto$BizSupplyInfoQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoQueryReqDto$BizSupplyInfoQueryReqDtoBuilder.class new file mode 100644 index 0000000..fdf3306 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoQueryReqDto$BizSupplyInfoQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoQueryReqDto.class new file mode 100644 index 0000000..d6b714b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoReqDto$BizSupplyInfoReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoReqDto$BizSupplyInfoReqDtoBuilder.class new file mode 100644 index 0000000..84b6bed Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoReqDto$BizSupplyInfoReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoReqDto.class new file mode 100644 index 0000000..d9749c4 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoUpdateByQueryReqDto$BizSupplyInfoUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoUpdateByQueryReqDto$BizSupplyInfoUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..8b9f5ed Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoUpdateByQueryReqDto$BizSupplyInfoUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoUpdateByQueryReqDto.class new file mode 100644 index 0000000..28c6e09 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizSupplyInfoUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyLockConditionReqDto$BizVarietyLockConditionReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyLockConditionReqDto$BizVarietyLockConditionReqDtoBuilder.class new file mode 100644 index 0000000..8e508d3 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyLockConditionReqDto$BizVarietyLockConditionReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyLockConditionReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyLockConditionReqDto.class new file mode 100644 index 0000000..0889511 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyLockConditionReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyPageQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyPageQueryReqDto.class new file mode 100644 index 0000000..82f20d3 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyPageQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyQueryReqDto$BizVarietyQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyQueryReqDto$BizVarietyQueryReqDtoBuilder.class new file mode 100644 index 0000000..1253f3c Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyQueryReqDto$BizVarietyQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyQueryReqDto.class new file mode 100644 index 0000000..19d71ce Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyReqDto$BizVarietyReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyReqDto$BizVarietyReqDtoBuilder.class new file mode 100644 index 0000000..9ed70e2 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyReqDto$BizVarietyReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyReqDto.class new file mode 100644 index 0000000..3e539f9 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyUpdateByQueryReqDto$BizVarietyUpdateByQueryReqDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyUpdateByQueryReqDto$BizVarietyUpdateByQueryReqDtoBuilder.class new file mode 100644 index 0000000..ab9580a Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyUpdateByQueryReqDto$BizVarietyUpdateByQueryReqDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyUpdateByQueryReqDto.class b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyUpdateByQueryReqDto.class new file mode 100644 index 0000000..f7a64e2 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/req/BizVarietyUpdateByQueryReqDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizEnterpriseProductRespDto$BizEnterpriseProductRespDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizEnterpriseProductRespDto$BizEnterpriseProductRespDtoBuilder.class new file mode 100644 index 0000000..3a62474 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizEnterpriseProductRespDto$BizEnterpriseProductRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizEnterpriseProductRespDto.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizEnterpriseProductRespDto.class new file mode 100644 index 0000000..6ff2584 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizEnterpriseProductRespDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizMaterialRespDto$BizMaterialRespDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizMaterialRespDto$BizMaterialRespDtoBuilder.class new file mode 100644 index 0000000..03fc1c2 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizMaterialRespDto$BizMaterialRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizMaterialRespDto.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizMaterialRespDto.class new file mode 100644 index 0000000..62d368e Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizMaterialRespDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizPurchaseRequestRespDto$BizPurchaseRequestRespDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizPurchaseRequestRespDto$BizPurchaseRequestRespDtoBuilder.class new file mode 100644 index 0000000..a037360 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizPurchaseRequestRespDto$BizPurchaseRequestRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizPurchaseRequestRespDto.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizPurchaseRequestRespDto.class new file mode 100644 index 0000000..8291cb2 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizPurchaseRequestRespDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizSupplyInfoRespDto$BizSupplyInfoRespDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizSupplyInfoRespDto$BizSupplyInfoRespDtoBuilder.class new file mode 100644 index 0000000..6b75c14 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizSupplyInfoRespDto$BizSupplyInfoRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizSupplyInfoRespDto.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizSupplyInfoRespDto.class new file mode 100644 index 0000000..bedde0b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizSupplyInfoRespDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizVarietyRespDto$BizVarietyRespDtoBuilder.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizVarietyRespDto$BizVarietyRespDtoBuilder.class new file mode 100644 index 0000000..49d865b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizVarietyRespDto$BizVarietyRespDtoBuilder.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/model/resp/BizVarietyRespDto.class b/target/classes/com/metalloop/modules/bussiness/model/resp/BizVarietyRespDto.class new file mode 100644 index 0000000..5bc837f Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/model/resp/BizVarietyRespDto.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/BizEnterpriseProductService.class b/target/classes/com/metalloop/modules/bussiness/service/BizEnterpriseProductService.class new file mode 100644 index 0000000..1abe0d5 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/BizEnterpriseProductService.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/BizMaterialService.class b/target/classes/com/metalloop/modules/bussiness/service/BizMaterialService.class new file mode 100644 index 0000000..c73339b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/BizMaterialService.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/BizPurchaseRequestService.class b/target/classes/com/metalloop/modules/bussiness/service/BizPurchaseRequestService.class new file mode 100644 index 0000000..a081146 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/BizPurchaseRequestService.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/BizSupplyInfoService.class b/target/classes/com/metalloop/modules/bussiness/service/BizSupplyInfoService.class new file mode 100644 index 0000000..a10727a Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/BizSupplyInfoService.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/BizVarietyService.class b/target/classes/com/metalloop/modules/bussiness/service/BizVarietyService.class new file mode 100644 index 0000000..c7725ce Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/BizVarietyService.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/impl/BizEnterpriseProductServiceImpl.class b/target/classes/com/metalloop/modules/bussiness/service/impl/BizEnterpriseProductServiceImpl.class new file mode 100644 index 0000000..9011c6b Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/impl/BizEnterpriseProductServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/impl/BizMaterialServiceImpl.class b/target/classes/com/metalloop/modules/bussiness/service/impl/BizMaterialServiceImpl.class new file mode 100644 index 0000000..275c633 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/impl/BizMaterialServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/impl/BizPurchaseRequestServiceImpl.class b/target/classes/com/metalloop/modules/bussiness/service/impl/BizPurchaseRequestServiceImpl.class new file mode 100644 index 0000000..b6d188d Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/impl/BizPurchaseRequestServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/impl/BizSupplyInfoServiceImpl.class b/target/classes/com/metalloop/modules/bussiness/service/impl/BizSupplyInfoServiceImpl.class new file mode 100644 index 0000000..3279336 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/impl/BizSupplyInfoServiceImpl.class differ diff --git a/target/classes/com/metalloop/modules/bussiness/service/impl/BizVarietyServiceImpl.class b/target/classes/com/metalloop/modules/bussiness/service/impl/BizVarietyServiceImpl.class new file mode 100644 index 0000000..8cd4658 Binary files /dev/null and b/target/classes/com/metalloop/modules/bussiness/service/impl/BizVarietyServiceImpl.class differ diff --git a/target/classes/main/resources/application.yml b/target/classes/main/resources/application.yml new file mode 100644 index 0000000..d90bcb5 --- /dev/null +++ b/target/classes/main/resources/application.yml @@ -0,0 +1,52 @@ +spring: + application: + name: metaloop + datasource: + url: jdbc:mysql://localhost:3306/metalloop?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true + username: root + password: 123456 + driver-class-name: com.mysql.cj.jdbc.Driver + hikari: + maximum-pool-size: 20 + minimum-idle: 5 + connection-timeout: 30000 + + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: Asia/Shanghai + serialization: + write-dates-as-timestamps: false + data: + redis: + host: localhost + port: 6379 + database: 0 + password: + timeout: 5000ms + +server: + port: 8080 + +# API文档 +springdoc: + api-docs: + enabled: true + path: /v3/api-docs + swagger-ui: + path: /swagger-ui.html + tags-sorter: alpha + operations-sorter: method + show-actuator: true + packages-to-scan: com.metalloop.modules + paths-to-match: /api/** + +# Sa-Token 配置 +sa-token: + token-name: metalloop-token + timeout: 86400 + active-timeout: -1 + is-concurrent: true + is-share: false + token-style: uuid + is-log: false + jwt-secret-key: metalloop-secret-key \ No newline at end of file diff --git a/target/classes/main/resources/mapper/BizEnterpriseProductMapper.xml b/target/classes/main/resources/mapper/BizEnterpriseProductMapper.xml new file mode 100644 index 0000000..4c210bf --- /dev/null +++ b/target/classes/main/resources/mapper/BizEnterpriseProductMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + id, + enterprise_id, + variety_id, + material_id, + unit_price, + weight, + status, + remark, + create_time, + update_time + + diff --git a/target/classes/main/resources/mapper/BizMaterialMapper.xml b/target/classes/main/resources/mapper/BizMaterialMapper.xml new file mode 100644 index 0000000..f77c2b4 --- /dev/null +++ b/target/classes/main/resources/mapper/BizMaterialMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + id, + material_name, + material_code, + description, + create_time, + update_time + + diff --git a/target/classes/main/resources/mapper/BizPurchaseRequestMapper.xml b/target/classes/main/resources/mapper/BizPurchaseRequestMapper.xml new file mode 100644 index 0000000..fc0ba3d --- /dev/null +++ b/target/classes/main/resources/mapper/BizPurchaseRequestMapper.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + create_user_id, + enterprise_id, + element_type, + product_category, + material, + title, + description, + quantity, + unit_price, + contact_person, + contact_phone, + delivery_date, + delivery_location, + image_url, + audit_status, + publish_time, + expire_time, + account_period_mode, + deposit_ratio, + final_payment_deadline, + status, + reject_reason, + update_user_id, + create_time, + update_time + + diff --git a/target/classes/main/resources/mapper/BizSupplyInfoMapper.xml b/target/classes/main/resources/mapper/BizSupplyInfoMapper.xml new file mode 100644 index 0000000..42b379a --- /dev/null +++ b/target/classes/main/resources/mapper/BizSupplyInfoMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + create_user_id, + enterprise_id, + element_type, + product_category, + material, + title, + description, + quantity, + unit_price, + contact_person, + contact_phone, + delivery_location, + image_url, + audit_status, + publish_time, + expire_time, + account_period_mode, + deposit_ratio, + final_payment_deadline, + status, + reject_reason, + update_user_id, + create_time, + update_time + + diff --git a/target/classes/main/resources/mapper/BizVarietyMapper.xml b/target/classes/main/resources/mapper/BizVarietyMapper.xml new file mode 100644 index 0000000..5653e17 --- /dev/null +++ b/target/classes/main/resources/mapper/BizVarietyMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + id, + variety_name, + variety_grade, + parent_id, + variety_material, + description, + sort, + status, + create_time, + update_time + + diff --git a/target/classes/main/resources/mapper/SysEnterpriseImageMapper.xml b/target/classes/main/resources/mapper/SysEnterpriseImageMapper.xml new file mode 100644 index 0000000..f1b91c3 --- /dev/null +++ b/target/classes/main/resources/mapper/SysEnterpriseImageMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + id, + enterprise_id, + image_type, + image_url, + created_at + + diff --git a/target/classes/main/resources/mapper/SysEnterpriseMapper.xml b/target/classes/main/resources/mapper/SysEnterpriseMapper.xml new file mode 100644 index 0000000..4c1b950 --- /dev/null +++ b/target/classes/main/resources/mapper/SysEnterpriseMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + enterprise_name, + enterprise_address, + warehouse_address, + contact_person, + legal_person, + phone1, + phone2, + phone3, + business_model, + profile_intro, + title_img_url, + intro_img_url, + business_license_url, + legal_id_front_url, + legal_id_back_url, + ocr_credit_code_id, + id_card_number, + credit_limit, + audit_status, + submit_time, + audit_time, + reject_reason, + created_at, + updated_at + + diff --git a/target/classes/main/resources/mapper/SysPermissionMapper.xml b/target/classes/main/resources/mapper/SysPermissionMapper.xml new file mode 100644 index 0000000..a6b6ef4 --- /dev/null +++ b/target/classes/main/resources/mapper/SysPermissionMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + name, + code, + type, + sort, + parent_id, + icon, + api_path, + route_path, + component, + component_name, + description, + enabled, + create_user, + update_user, + create_time, + update_time, + data_status + + diff --git a/target/classes/main/resources/mapper/SysRoleMapper.xml b/target/classes/main/resources/mapper/SysRoleMapper.xml new file mode 100644 index 0000000..74f5de4 --- /dev/null +++ b/target/classes/main/resources/mapper/SysRoleMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + id, + name, + code, + enabled, + description, + create_user, + create_org, + create_time, + update_time, + update_user, + data_status + + diff --git a/target/classes/main/resources/mapper/SysRolePermissionMapper.xml b/target/classes/main/resources/mapper/SysRolePermissionMapper.xml new file mode 100644 index 0000000..920fde9 --- /dev/null +++ b/target/classes/main/resources/mapper/SysRolePermissionMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + id, + role_id, + permission_id + + diff --git a/target/classes/main/resources/mapper/SysUserMapper.xml b/target/classes/main/resources/mapper/SysUserMapper.xml new file mode 100644 index 0000000..be3871a --- /dev/null +++ b/target/classes/main/resources/mapper/SysUserMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + id, + username, + password, + auth_status, + enterprise_id, + phone, + email, + user_status, + reg_time + + diff --git a/target/classes/main/resources/mapper/SysUserRoleMapper.xml b/target/classes/main/resources/mapper/SysUserRoleMapper.xml new file mode 100644 index 0000000..d95b7fa --- /dev/null +++ b/target/classes/main/resources/mapper/SysUserRoleMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + user_id, + role_id, + created_at, + id + + diff --git a/target/classes/mapper/BizEnterpriseProductMapper.xml b/target/classes/mapper/BizEnterpriseProductMapper.xml new file mode 100644 index 0000000..4c210bf --- /dev/null +++ b/target/classes/mapper/BizEnterpriseProductMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + id, + enterprise_id, + variety_id, + material_id, + unit_price, + weight, + status, + remark, + create_time, + update_time + + diff --git a/target/classes/mapper/BizMaterialMapper.xml b/target/classes/mapper/BizMaterialMapper.xml new file mode 100644 index 0000000..f77c2b4 --- /dev/null +++ b/target/classes/mapper/BizMaterialMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + id, + material_name, + material_code, + description, + create_time, + update_time + + diff --git a/target/classes/mapper/BizPurchaseRequestMapper.xml b/target/classes/mapper/BizPurchaseRequestMapper.xml new file mode 100644 index 0000000..fc0ba3d --- /dev/null +++ b/target/classes/mapper/BizPurchaseRequestMapper.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + create_user_id, + enterprise_id, + element_type, + product_category, + material, + title, + description, + quantity, + unit_price, + contact_person, + contact_phone, + delivery_date, + delivery_location, + image_url, + audit_status, + publish_time, + expire_time, + account_period_mode, + deposit_ratio, + final_payment_deadline, + status, + reject_reason, + update_user_id, + create_time, + update_time + + diff --git a/target/classes/mapper/BizSupplyInfoMapper.xml b/target/classes/mapper/BizSupplyInfoMapper.xml new file mode 100644 index 0000000..42b379a --- /dev/null +++ b/target/classes/mapper/BizSupplyInfoMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + create_user_id, + enterprise_id, + element_type, + product_category, + material, + title, + description, + quantity, + unit_price, + contact_person, + contact_phone, + delivery_location, + image_url, + audit_status, + publish_time, + expire_time, + account_period_mode, + deposit_ratio, + final_payment_deadline, + status, + reject_reason, + update_user_id, + create_time, + update_time + + diff --git a/target/classes/mapper/BizVarietyMapper.xml b/target/classes/mapper/BizVarietyMapper.xml new file mode 100644 index 0000000..5653e17 --- /dev/null +++ b/target/classes/mapper/BizVarietyMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + id, + variety_name, + variety_grade, + parent_id, + variety_material, + description, + sort, + status, + create_time, + update_time + + diff --git a/target/classes/mapper/SysEnterpriseImageMapper.xml b/target/classes/mapper/SysEnterpriseImageMapper.xml new file mode 100644 index 0000000..f1b91c3 --- /dev/null +++ b/target/classes/mapper/SysEnterpriseImageMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + id, + enterprise_id, + image_type, + image_url, + created_at + + diff --git a/target/classes/mapper/SysEnterpriseMapper.xml b/target/classes/mapper/SysEnterpriseMapper.xml new file mode 100644 index 0000000..4c1b950 --- /dev/null +++ b/target/classes/mapper/SysEnterpriseMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + enterprise_name, + enterprise_address, + warehouse_address, + contact_person, + legal_person, + phone1, + phone2, + phone3, + business_model, + profile_intro, + title_img_url, + intro_img_url, + business_license_url, + legal_id_front_url, + legal_id_back_url, + ocr_credit_code_id, + id_card_number, + credit_limit, + audit_status, + submit_time, + audit_time, + reject_reason, + created_at, + updated_at + + diff --git a/target/classes/mapper/SysPermissionMapper.xml b/target/classes/mapper/SysPermissionMapper.xml new file mode 100644 index 0000000..a6b6ef4 --- /dev/null +++ b/target/classes/mapper/SysPermissionMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, + name, + code, + type, + sort, + parent_id, + icon, + api_path, + route_path, + component, + component_name, + description, + enabled, + create_user, + update_user, + create_time, + update_time, + data_status + + diff --git a/target/classes/mapper/SysRoleMapper.xml b/target/classes/mapper/SysRoleMapper.xml new file mode 100644 index 0000000..74f5de4 --- /dev/null +++ b/target/classes/mapper/SysRoleMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + id, + name, + code, + enabled, + description, + create_user, + create_org, + create_time, + update_time, + update_user, + data_status + + diff --git a/target/classes/mapper/SysRolePermissionMapper.xml b/target/classes/mapper/SysRolePermissionMapper.xml new file mode 100644 index 0000000..920fde9 --- /dev/null +++ b/target/classes/mapper/SysRolePermissionMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + id, + role_id, + permission_id + + diff --git a/target/classes/mapper/SysUserMapper.xml b/target/classes/mapper/SysUserMapper.xml new file mode 100644 index 0000000..be3871a --- /dev/null +++ b/target/classes/mapper/SysUserMapper.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + id, + username, + password, + auth_status, + enterprise_id, + phone, + email, + user_status, + reg_time + + diff --git a/target/classes/mapper/SysUserRoleMapper.xml b/target/classes/mapper/SysUserRoleMapper.xml new file mode 100644 index 0000000..d95b7fa --- /dev/null +++ b/target/classes/mapper/SysUserRoleMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + user_id, + role_id, + created_at, + id + + diff --git a/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysEnterpriseConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysEnterpriseConverterImpl.java new file mode 100644 index 0000000..4fd98c6 --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysEnterpriseConverterImpl.java @@ -0,0 +1,157 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.po.SysEnterprise; +import com.metalloop.modules.auth.model.query.SysEnterpriseQuery; +import com.metalloop.modules.auth.model.req.SysEnterpriseQueryReqDto; +import com.metalloop.modules.auth.model.req.SysEnterpriseReqDto; +import com.metalloop.modules.auth.model.resp.SysEnterpriseRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class SysEnterpriseConverterImpl implements SysEnterpriseConverter { + + @Override + public SysEnterpriseRespDto toRespDto(SysEnterprise sysEnterprise) { + if ( sysEnterprise == null ) { + return null; + } + + SysEnterpriseRespDto sysEnterpriseRespDto = new SysEnterpriseRespDto(); + + sysEnterpriseRespDto.setId( sysEnterprise.getId() ); + sysEnterpriseRespDto.setEnterpriseName( sysEnterprise.getEnterpriseName() ); + sysEnterpriseRespDto.setEnterpriseAddress( sysEnterprise.getEnterpriseAddress() ); + sysEnterpriseRespDto.setWarehouseAddress( sysEnterprise.getWarehouseAddress() ); + sysEnterpriseRespDto.setContactPerson( sysEnterprise.getContactPerson() ); + sysEnterpriseRespDto.setLegalPerson( sysEnterprise.getLegalPerson() ); + sysEnterpriseRespDto.setPhone1( sysEnterprise.getPhone1() ); + sysEnterpriseRespDto.setPhone2( sysEnterprise.getPhone2() ); + sysEnterpriseRespDto.setPhone3( sysEnterprise.getPhone3() ); + sysEnterpriseRespDto.setBusinessModel( sysEnterprise.getBusinessModel() ); + sysEnterpriseRespDto.setProfileIntro( sysEnterprise.getProfileIntro() ); + sysEnterpriseRespDto.setTitleImgUrl( sysEnterprise.getTitleImgUrl() ); + sysEnterpriseRespDto.setIntroImgUrl( sysEnterprise.getIntroImgUrl() ); + sysEnterpriseRespDto.setBusinessLicenseUrl( sysEnterprise.getBusinessLicenseUrl() ); + sysEnterpriseRespDto.setLegalIdFrontUrl( sysEnterprise.getLegalIdFrontUrl() ); + sysEnterpriseRespDto.setLegalIdBackUrl( sysEnterprise.getLegalIdBackUrl() ); + sysEnterpriseRespDto.setOcrCreditCodeId( sysEnterprise.getOcrCreditCodeId() ); + sysEnterpriseRespDto.setIdCardNumber( sysEnterprise.getIdCardNumber() ); + sysEnterpriseRespDto.setCreditLimit( sysEnterprise.getCreditLimit() ); + sysEnterpriseRespDto.setAuditStatus( sysEnterprise.getAuditStatus() ); + sysEnterpriseRespDto.setSubmitTime( sysEnterprise.getSubmitTime() ); + sysEnterpriseRespDto.setAuditTime( sysEnterprise.getAuditTime() ); + sysEnterpriseRespDto.setRejectReason( sysEnterprise.getRejectReason() ); + sysEnterpriseRespDto.setCreatedAt( sysEnterprise.getCreatedAt() ); + sysEnterpriseRespDto.setUpdatedAt( sysEnterprise.getUpdatedAt() ); + + return sysEnterpriseRespDto; + } + + @Override + public List toRespDto(List sysEnterprises) { + if ( sysEnterprises == null ) { + return null; + } + + List list = new ArrayList( sysEnterprises.size() ); + for ( SysEnterprise sysEnterprise : sysEnterprises ) { + list.add( toRespDto( sysEnterprise ) ); + } + + return list; + } + + @Override + public SysEnterprise fromReqDto(SysEnterpriseReqDto sysEnterpriseReqDto) { + if ( sysEnterpriseReqDto == null ) { + return null; + } + + SysEnterprise sysEnterprise = new SysEnterprise(); + + sysEnterprise.setId( sysEnterpriseReqDto.getId() ); + sysEnterprise.setEnterpriseName( sysEnterpriseReqDto.getEnterpriseName() ); + sysEnterprise.setEnterpriseAddress( sysEnterpriseReqDto.getEnterpriseAddress() ); + sysEnterprise.setWarehouseAddress( sysEnterpriseReqDto.getWarehouseAddress() ); + sysEnterprise.setContactPerson( sysEnterpriseReqDto.getContactPerson() ); + sysEnterprise.setLegalPerson( sysEnterpriseReqDto.getLegalPerson() ); + sysEnterprise.setPhone1( sysEnterpriseReqDto.getPhone1() ); + sysEnterprise.setPhone2( sysEnterpriseReqDto.getPhone2() ); + sysEnterprise.setPhone3( sysEnterpriseReqDto.getPhone3() ); + sysEnterprise.setBusinessModel( sysEnterpriseReqDto.getBusinessModel() ); + sysEnterprise.setProfileIntro( sysEnterpriseReqDto.getProfileIntro() ); + sysEnterprise.setTitleImgUrl( sysEnterpriseReqDto.getTitleImgUrl() ); + sysEnterprise.setIntroImgUrl( sysEnterpriseReqDto.getIntroImgUrl() ); + sysEnterprise.setBusinessLicenseUrl( sysEnterpriseReqDto.getBusinessLicenseUrl() ); + sysEnterprise.setLegalIdFrontUrl( sysEnterpriseReqDto.getLegalIdFrontUrl() ); + sysEnterprise.setLegalIdBackUrl( sysEnterpriseReqDto.getLegalIdBackUrl() ); + sysEnterprise.setOcrCreditCodeId( sysEnterpriseReqDto.getOcrCreditCodeId() ); + sysEnterprise.setIdCardNumber( sysEnterpriseReqDto.getIdCardNumber() ); + sysEnterprise.setCreditLimit( sysEnterpriseReqDto.getCreditLimit() ); + sysEnterprise.setAuditStatus( sysEnterpriseReqDto.getAuditStatus() ); + sysEnterprise.setSubmitTime( sysEnterpriseReqDto.getSubmitTime() ); + sysEnterprise.setAuditTime( sysEnterpriseReqDto.getAuditTime() ); + sysEnterprise.setRejectReason( sysEnterpriseReqDto.getRejectReason() ); + sysEnterprise.setCreatedAt( sysEnterpriseReqDto.getCreatedAt() ); + sysEnterprise.setUpdatedAt( sysEnterpriseReqDto.getUpdatedAt() ); + + return sysEnterprise; + } + + @Override + public List fromReqDto(List sysEnterpriseReqDtos) { + if ( sysEnterpriseReqDtos == null ) { + return null; + } + + List list = new ArrayList( sysEnterpriseReqDtos.size() ); + for ( SysEnterpriseReqDto sysEnterpriseReqDto : sysEnterpriseReqDtos ) { + list.add( fromReqDto( sysEnterpriseReqDto ) ); + } + + return list; + } + + @Override + public SysEnterpriseQuery fromQueryReqDtoToQuery(SysEnterpriseQueryReqDto sysEnterpriseQueryReqDto) { + if ( sysEnterpriseQueryReqDto == null ) { + return null; + } + + SysEnterpriseQuery sysEnterpriseQuery = new SysEnterpriseQuery(); + + sysEnterpriseQuery.setId( sysEnterpriseQueryReqDto.getId() ); + sysEnterpriseQuery.setEnterpriseName( sysEnterpriseQueryReqDto.getEnterpriseName() ); + sysEnterpriseQuery.setEnterpriseAddress( sysEnterpriseQueryReqDto.getEnterpriseAddress() ); + sysEnterpriseQuery.setWarehouseAddress( sysEnterpriseQueryReqDto.getWarehouseAddress() ); + sysEnterpriseQuery.setContactPerson( sysEnterpriseQueryReqDto.getContactPerson() ); + sysEnterpriseQuery.setLegalPerson( sysEnterpriseQueryReqDto.getLegalPerson() ); + sysEnterpriseQuery.setPhone1( sysEnterpriseQueryReqDto.getPhone1() ); + sysEnterpriseQuery.setPhone2( sysEnterpriseQueryReqDto.getPhone2() ); + sysEnterpriseQuery.setPhone3( sysEnterpriseQueryReqDto.getPhone3() ); + sysEnterpriseQuery.setBusinessModel( sysEnterpriseQueryReqDto.getBusinessModel() ); + sysEnterpriseQuery.setProfileIntro( sysEnterpriseQueryReqDto.getProfileIntro() ); + sysEnterpriseQuery.setTitleImgUrl( sysEnterpriseQueryReqDto.getTitleImgUrl() ); + sysEnterpriseQuery.setIntroImgUrl( sysEnterpriseQueryReqDto.getIntroImgUrl() ); + sysEnterpriseQuery.setBusinessLicenseUrl( sysEnterpriseQueryReqDto.getBusinessLicenseUrl() ); + sysEnterpriseQuery.setLegalIdFrontUrl( sysEnterpriseQueryReqDto.getLegalIdFrontUrl() ); + sysEnterpriseQuery.setLegalIdBackUrl( sysEnterpriseQueryReqDto.getLegalIdBackUrl() ); + sysEnterpriseQuery.setOcrCreditCodeId( sysEnterpriseQueryReqDto.getOcrCreditCodeId() ); + sysEnterpriseQuery.setIdCardNumber( sysEnterpriseQueryReqDto.getIdCardNumber() ); + sysEnterpriseQuery.setCreditLimit( sysEnterpriseQueryReqDto.getCreditLimit() ); + sysEnterpriseQuery.setAuditStatus( sysEnterpriseQueryReqDto.getAuditStatus() ); + sysEnterpriseQuery.setSubmitTime( sysEnterpriseQueryReqDto.getSubmitTime() ); + sysEnterpriseQuery.setAuditTime( sysEnterpriseQueryReqDto.getAuditTime() ); + sysEnterpriseQuery.setRejectReason( sysEnterpriseQueryReqDto.getRejectReason() ); + sysEnterpriseQuery.setCreatedAt( sysEnterpriseQueryReqDto.getCreatedAt() ); + sysEnterpriseQuery.setUpdatedAt( sysEnterpriseQueryReqDto.getUpdatedAt() ); + + return sysEnterpriseQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysEnterpriseImageConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysEnterpriseImageConverterImpl.java new file mode 100644 index 0000000..03681be --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysEnterpriseImageConverterImpl.java @@ -0,0 +1,97 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.po.SysEnterpriseImage; +import com.metalloop.modules.auth.model.query.SysEnterpriseImageQuery; +import com.metalloop.modules.auth.model.req.SysEnterpriseImageQueryReqDto; +import com.metalloop.modules.auth.model.req.SysEnterpriseImageReqDto; +import com.metalloop.modules.auth.model.resp.SysEnterpriseImageRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class SysEnterpriseImageConverterImpl implements SysEnterpriseImageConverter { + + @Override + public SysEnterpriseImageRespDto toRespDto(SysEnterpriseImage sysEnterpriseImage) { + if ( sysEnterpriseImage == null ) { + return null; + } + + SysEnterpriseImageRespDto sysEnterpriseImageRespDto = new SysEnterpriseImageRespDto(); + + sysEnterpriseImageRespDto.setId( sysEnterpriseImage.getId() ); + sysEnterpriseImageRespDto.setEnterpriseId( sysEnterpriseImage.getEnterpriseId() ); + sysEnterpriseImageRespDto.setImageType( sysEnterpriseImage.getImageType() ); + sysEnterpriseImageRespDto.setImageUrl( sysEnterpriseImage.getImageUrl() ); + sysEnterpriseImageRespDto.setCreatedAt( sysEnterpriseImage.getCreatedAt() ); + + return sysEnterpriseImageRespDto; + } + + @Override + public List toRespDto(List sysEnterpriseImages) { + if ( sysEnterpriseImages == null ) { + return null; + } + + List list = new ArrayList( sysEnterpriseImages.size() ); + for ( SysEnterpriseImage sysEnterpriseImage : sysEnterpriseImages ) { + list.add( toRespDto( sysEnterpriseImage ) ); + } + + return list; + } + + @Override + public SysEnterpriseImage fromReqDto(SysEnterpriseImageReqDto sysEnterpriseImageReqDto) { + if ( sysEnterpriseImageReqDto == null ) { + return null; + } + + SysEnterpriseImage sysEnterpriseImage = new SysEnterpriseImage(); + + sysEnterpriseImage.setId( sysEnterpriseImageReqDto.getId() ); + sysEnterpriseImage.setEnterpriseId( sysEnterpriseImageReqDto.getEnterpriseId() ); + sysEnterpriseImage.setImageType( sysEnterpriseImageReqDto.getImageType() ); + sysEnterpriseImage.setImageUrl( sysEnterpriseImageReqDto.getImageUrl() ); + sysEnterpriseImage.setCreatedAt( sysEnterpriseImageReqDto.getCreatedAt() ); + + return sysEnterpriseImage; + } + + @Override + public List fromReqDto(List sysEnterpriseImageReqDtos) { + if ( sysEnterpriseImageReqDtos == null ) { + return null; + } + + List list = new ArrayList( sysEnterpriseImageReqDtos.size() ); + for ( SysEnterpriseImageReqDto sysEnterpriseImageReqDto : sysEnterpriseImageReqDtos ) { + list.add( fromReqDto( sysEnterpriseImageReqDto ) ); + } + + return list; + } + + @Override + public SysEnterpriseImageQuery fromQueryReqDtoToQuery(SysEnterpriseImageQueryReqDto sysEnterpriseImageQueryReqDto) { + if ( sysEnterpriseImageQueryReqDto == null ) { + return null; + } + + SysEnterpriseImageQuery sysEnterpriseImageQuery = new SysEnterpriseImageQuery(); + + sysEnterpriseImageQuery.setId( sysEnterpriseImageQueryReqDto.getId() ); + sysEnterpriseImageQuery.setEnterpriseId( sysEnterpriseImageQueryReqDto.getEnterpriseId() ); + sysEnterpriseImageQuery.setImageType( sysEnterpriseImageQueryReqDto.getImageType() ); + sysEnterpriseImageQuery.setImageUrl( sysEnterpriseImageQueryReqDto.getImageUrl() ); + sysEnterpriseImageQuery.setCreatedAt( sysEnterpriseImageQueryReqDto.getCreatedAt() ); + + return sysEnterpriseImageQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysPermissionConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysPermissionConverterImpl.java new file mode 100644 index 0000000..1e3c1f3 --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysPermissionConverterImpl.java @@ -0,0 +1,136 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.po.SysPermission; +import com.metalloop.modules.auth.model.query.SysPermissionQuery; +import com.metalloop.modules.auth.model.req.SysPermissionQueryReqDto; +import com.metalloop.modules.auth.model.req.SysPermissionReqDto; +import com.metalloop.modules.auth.model.resp.SysPermissionRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class SysPermissionConverterImpl implements SysPermissionConverter { + + @Override + public SysPermissionRespDto toRespDto(SysPermission sysPermission) { + if ( sysPermission == null ) { + return null; + } + + SysPermissionRespDto sysPermissionRespDto = new SysPermissionRespDto(); + + sysPermissionRespDto.setId( sysPermission.getId() ); + sysPermissionRespDto.setName( sysPermission.getName() ); + sysPermissionRespDto.setCode( sysPermission.getCode() ); + sysPermissionRespDto.setType( sysPermission.getType() ); + sysPermissionRespDto.setSort( sysPermission.getSort() ); + sysPermissionRespDto.setParentId( sysPermission.getParentId() ); + sysPermissionRespDto.setIcon( sysPermission.getIcon() ); + sysPermissionRespDto.setApiPath( sysPermission.getApiPath() ); + sysPermissionRespDto.setRoutePath( sysPermission.getRoutePath() ); + sysPermissionRespDto.setComponent( sysPermission.getComponent() ); + sysPermissionRespDto.setComponentName( sysPermission.getComponentName() ); + sysPermissionRespDto.setDescription( sysPermission.getDescription() ); + sysPermissionRespDto.setEnabled( sysPermission.getEnabled() ); + sysPermissionRespDto.setCreateUser( sysPermission.getCreateUser() ); + sysPermissionRespDto.setUpdateUser( sysPermission.getUpdateUser() ); + sysPermissionRespDto.setCreateTime( sysPermission.getCreateTime() ); + sysPermissionRespDto.setUpdateTime( sysPermission.getUpdateTime() ); + sysPermissionRespDto.setDataStatus( sysPermission.getDataStatus() ); + + return sysPermissionRespDto; + } + + @Override + public List toRespDto(List sysPermissions) { + if ( sysPermissions == null ) { + return null; + } + + List list = new ArrayList( sysPermissions.size() ); + for ( SysPermission sysPermission : sysPermissions ) { + list.add( toRespDto( sysPermission ) ); + } + + return list; + } + + @Override + public SysPermission fromReqDto(SysPermissionReqDto sysPermissionReqDto) { + if ( sysPermissionReqDto == null ) { + return null; + } + + SysPermission sysPermission = new SysPermission(); + + sysPermission.setId( sysPermissionReqDto.getId() ); + sysPermission.setName( sysPermissionReqDto.getName() ); + sysPermission.setCode( sysPermissionReqDto.getCode() ); + sysPermission.setType( sysPermissionReqDto.getType() ); + sysPermission.setSort( sysPermissionReqDto.getSort() ); + sysPermission.setParentId( sysPermissionReqDto.getParentId() ); + sysPermission.setIcon( sysPermissionReqDto.getIcon() ); + sysPermission.setApiPath( sysPermissionReqDto.getApiPath() ); + sysPermission.setRoutePath( sysPermissionReqDto.getRoutePath() ); + sysPermission.setComponent( sysPermissionReqDto.getComponent() ); + sysPermission.setComponentName( sysPermissionReqDto.getComponentName() ); + sysPermission.setDescription( sysPermissionReqDto.getDescription() ); + sysPermission.setEnabled( sysPermissionReqDto.getEnabled() ); + sysPermission.setCreateUser( sysPermissionReqDto.getCreateUser() ); + sysPermission.setUpdateUser( sysPermissionReqDto.getUpdateUser() ); + sysPermission.setCreateTime( sysPermissionReqDto.getCreateTime() ); + sysPermission.setUpdateTime( sysPermissionReqDto.getUpdateTime() ); + sysPermission.setDataStatus( sysPermissionReqDto.getDataStatus() ); + + return sysPermission; + } + + @Override + public List fromReqDto(List sysPermissionReqDtos) { + if ( sysPermissionReqDtos == null ) { + return null; + } + + List list = new ArrayList( sysPermissionReqDtos.size() ); + for ( SysPermissionReqDto sysPermissionReqDto : sysPermissionReqDtos ) { + list.add( fromReqDto( sysPermissionReqDto ) ); + } + + return list; + } + + @Override + public SysPermissionQuery fromQueryReqDtoToQuery(SysPermissionQueryReqDto sysPermissionQueryReqDto) { + if ( sysPermissionQueryReqDto == null ) { + return null; + } + + SysPermissionQuery sysPermissionQuery = new SysPermissionQuery(); + + sysPermissionQuery.setId( sysPermissionQueryReqDto.getId() ); + sysPermissionQuery.setName( sysPermissionQueryReqDto.getName() ); + sysPermissionQuery.setCode( sysPermissionQueryReqDto.getCode() ); + sysPermissionQuery.setType( sysPermissionQueryReqDto.getType() ); + sysPermissionQuery.setSort( sysPermissionQueryReqDto.getSort() ); + sysPermissionQuery.setParentId( sysPermissionQueryReqDto.getParentId() ); + sysPermissionQuery.setIcon( sysPermissionQueryReqDto.getIcon() ); + sysPermissionQuery.setApiPath( sysPermissionQueryReqDto.getApiPath() ); + sysPermissionQuery.setRoutePath( sysPermissionQueryReqDto.getRoutePath() ); + sysPermissionQuery.setComponent( sysPermissionQueryReqDto.getComponent() ); + sysPermissionQuery.setComponentName( sysPermissionQueryReqDto.getComponentName() ); + sysPermissionQuery.setDescription( sysPermissionQueryReqDto.getDescription() ); + sysPermissionQuery.setEnabled( sysPermissionQueryReqDto.getEnabled() ); + sysPermissionQuery.setCreateUser( sysPermissionQueryReqDto.getCreateUser() ); + sysPermissionQuery.setUpdateUser( sysPermissionQueryReqDto.getUpdateUser() ); + sysPermissionQuery.setCreateTime( sysPermissionQueryReqDto.getCreateTime() ); + sysPermissionQuery.setUpdateTime( sysPermissionQueryReqDto.getUpdateTime() ); + sysPermissionQuery.setDataStatus( sysPermissionQueryReqDto.getDataStatus() ); + + return sysPermissionQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysRoleConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysRoleConverterImpl.java new file mode 100644 index 0000000..9270a31 --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysRoleConverterImpl.java @@ -0,0 +1,115 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.po.SysRole; +import com.metalloop.modules.auth.model.query.SysRoleQuery; +import com.metalloop.modules.auth.model.req.SysRoleQueryReqDto; +import com.metalloop.modules.auth.model.req.SysRoleReqDto; +import com.metalloop.modules.auth.model.resp.SysRoleRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class SysRoleConverterImpl implements SysRoleConverter { + + @Override + public SysRoleRespDto toRespDto(SysRole sysRole) { + if ( sysRole == null ) { + return null; + } + + SysRoleRespDto sysRoleRespDto = new SysRoleRespDto(); + + sysRoleRespDto.setId( sysRole.getId() ); + sysRoleRespDto.setName( sysRole.getName() ); + sysRoleRespDto.setCode( sysRole.getCode() ); + sysRoleRespDto.setEnabled( sysRole.getEnabled() ); + sysRoleRespDto.setDescription( sysRole.getDescription() ); + sysRoleRespDto.setCreateUser( sysRole.getCreateUser() ); + sysRoleRespDto.setCreateOrg( sysRole.getCreateOrg() ); + sysRoleRespDto.setCreateTime( sysRole.getCreateTime() ); + sysRoleRespDto.setUpdateTime( sysRole.getUpdateTime() ); + sysRoleRespDto.setUpdateUser( sysRole.getUpdateUser() ); + sysRoleRespDto.setDataStatus( sysRole.getDataStatus() ); + + return sysRoleRespDto; + } + + @Override + public List toRespDto(List sysRoles) { + if ( sysRoles == null ) { + return null; + } + + List list = new ArrayList( sysRoles.size() ); + for ( SysRole sysRole : sysRoles ) { + list.add( toRespDto( sysRole ) ); + } + + return list; + } + + @Override + public SysRole fromReqDto(SysRoleReqDto sysRoleReqDto) { + if ( sysRoleReqDto == null ) { + return null; + } + + SysRole sysRole = new SysRole(); + + sysRole.setId( sysRoleReqDto.getId() ); + sysRole.setName( sysRoleReqDto.getName() ); + sysRole.setCode( sysRoleReqDto.getCode() ); + sysRole.setEnabled( sysRoleReqDto.getEnabled() ); + sysRole.setDescription( sysRoleReqDto.getDescription() ); + sysRole.setCreateUser( sysRoleReqDto.getCreateUser() ); + sysRole.setCreateOrg( sysRoleReqDto.getCreateOrg() ); + sysRole.setCreateTime( sysRoleReqDto.getCreateTime() ); + sysRole.setUpdateTime( sysRoleReqDto.getUpdateTime() ); + sysRole.setUpdateUser( sysRoleReqDto.getUpdateUser() ); + sysRole.setDataStatus( sysRoleReqDto.getDataStatus() ); + + return sysRole; + } + + @Override + public List fromReqDto(List sysRoleReqDtos) { + if ( sysRoleReqDtos == null ) { + return null; + } + + List list = new ArrayList( sysRoleReqDtos.size() ); + for ( SysRoleReqDto sysRoleReqDto : sysRoleReqDtos ) { + list.add( fromReqDto( sysRoleReqDto ) ); + } + + return list; + } + + @Override + public SysRoleQuery fromQueryReqDtoToQuery(SysRoleQueryReqDto sysRoleQueryReqDto) { + if ( sysRoleQueryReqDto == null ) { + return null; + } + + SysRoleQuery sysRoleQuery = new SysRoleQuery(); + + sysRoleQuery.setId( sysRoleQueryReqDto.getId() ); + sysRoleQuery.setName( sysRoleQueryReqDto.getName() ); + sysRoleQuery.setCode( sysRoleQueryReqDto.getCode() ); + sysRoleQuery.setEnabled( sysRoleQueryReqDto.getEnabled() ); + sysRoleQuery.setDescription( sysRoleQueryReqDto.getDescription() ); + sysRoleQuery.setCreateUser( sysRoleQueryReqDto.getCreateUser() ); + sysRoleQuery.setCreateOrg( sysRoleQueryReqDto.getCreateOrg() ); + sysRoleQuery.setCreateTime( sysRoleQueryReqDto.getCreateTime() ); + sysRoleQuery.setUpdateTime( sysRoleQueryReqDto.getUpdateTime() ); + sysRoleQuery.setUpdateUser( sysRoleQueryReqDto.getUpdateUser() ); + sysRoleQuery.setDataStatus( sysRoleQueryReqDto.getDataStatus() ); + + return sysRoleQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysRolePermissionConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysRolePermissionConverterImpl.java new file mode 100644 index 0000000..aeb285b --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysRolePermissionConverterImpl.java @@ -0,0 +1,91 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.po.SysRolePermission; +import com.metalloop.modules.auth.model.query.SysRolePermissionQuery; +import com.metalloop.modules.auth.model.req.SysRolePermissionQueryReqDto; +import com.metalloop.modules.auth.model.req.SysRolePermissionReqDto; +import com.metalloop.modules.auth.model.resp.SysRolePermissionRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class SysRolePermissionConverterImpl implements SysRolePermissionConverter { + + @Override + public SysRolePermissionRespDto toRespDto(SysRolePermission sysRolePermission) { + if ( sysRolePermission == null ) { + return null; + } + + SysRolePermissionRespDto sysRolePermissionRespDto = new SysRolePermissionRespDto(); + + sysRolePermissionRespDto.setId( sysRolePermission.getId() ); + sysRolePermissionRespDto.setRoleId( sysRolePermission.getRoleId() ); + sysRolePermissionRespDto.setPermissionId( sysRolePermission.getPermissionId() ); + + return sysRolePermissionRespDto; + } + + @Override + public List toRespDto(List sysRolePermissions) { + if ( sysRolePermissions == null ) { + return null; + } + + List list = new ArrayList( sysRolePermissions.size() ); + for ( SysRolePermission sysRolePermission : sysRolePermissions ) { + list.add( toRespDto( sysRolePermission ) ); + } + + return list; + } + + @Override + public SysRolePermission fromReqDto(SysRolePermissionReqDto sysRolePermissionReqDto) { + if ( sysRolePermissionReqDto == null ) { + return null; + } + + SysRolePermission sysRolePermission = new SysRolePermission(); + + sysRolePermission.setId( sysRolePermissionReqDto.getId() ); + sysRolePermission.setRoleId( sysRolePermissionReqDto.getRoleId() ); + sysRolePermission.setPermissionId( sysRolePermissionReqDto.getPermissionId() ); + + return sysRolePermission; + } + + @Override + public List fromReqDto(List sysRolePermissionReqDtos) { + if ( sysRolePermissionReqDtos == null ) { + return null; + } + + List list = new ArrayList( sysRolePermissionReqDtos.size() ); + for ( SysRolePermissionReqDto sysRolePermissionReqDto : sysRolePermissionReqDtos ) { + list.add( fromReqDto( sysRolePermissionReqDto ) ); + } + + return list; + } + + @Override + public SysRolePermissionQuery fromQueryReqDtoToQuery(SysRolePermissionQueryReqDto sysRolePermissionQueryReqDto) { + if ( sysRolePermissionQueryReqDto == null ) { + return null; + } + + SysRolePermissionQuery sysRolePermissionQuery = new SysRolePermissionQuery(); + + sysRolePermissionQuery.setId( sysRolePermissionQueryReqDto.getId() ); + sysRolePermissionQuery.setRoleId( sysRolePermissionQueryReqDto.getRoleId() ); + sysRolePermissionQuery.setPermissionId( sysRolePermissionQueryReqDto.getPermissionId() ); + + return sysRolePermissionQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysUserConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysUserConverterImpl.java new file mode 100644 index 0000000..3f92f81 --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysUserConverterImpl.java @@ -0,0 +1,109 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.po.SysUser; +import com.metalloop.modules.auth.model.query.SysUserQuery; +import com.metalloop.modules.auth.model.req.SysUserQueryReqDto; +import com.metalloop.modules.auth.model.req.SysUserReqDto; +import com.metalloop.modules.auth.model.resp.SysUserRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class SysUserConverterImpl implements SysUserConverter { + + @Override + public SysUserRespDto toRespDto(SysUser sysUser) { + if ( sysUser == null ) { + return null; + } + + SysUserRespDto sysUserRespDto = new SysUserRespDto(); + + sysUserRespDto.setId( sysUser.getId() ); + sysUserRespDto.setUsername( sysUser.getUsername() ); + sysUserRespDto.setPassword( sysUser.getPassword() ); + sysUserRespDto.setAuthStatus( sysUser.getAuthStatus() ); + sysUserRespDto.setEnterpriseId( sysUser.getEnterpriseId() ); + sysUserRespDto.setPhone( sysUser.getPhone() ); + sysUserRespDto.setEmail( sysUser.getEmail() ); + sysUserRespDto.setUserStatus( sysUser.getUserStatus() ); + sysUserRespDto.setRegTime( sysUser.getRegTime() ); + + return sysUserRespDto; + } + + @Override + public List toRespDto(List sysUsers) { + if ( sysUsers == null ) { + return null; + } + + List list = new ArrayList( sysUsers.size() ); + for ( SysUser sysUser : sysUsers ) { + list.add( toRespDto( sysUser ) ); + } + + return list; + } + + @Override + public SysUser fromReqDto(SysUserReqDto sysUserReqDto) { + if ( sysUserReqDto == null ) { + return null; + } + + SysUser sysUser = new SysUser(); + + sysUser.setId( sysUserReqDto.getId() ); + sysUser.setUsername( sysUserReqDto.getUsername() ); + sysUser.setPassword( sysUserReqDto.getPassword() ); + sysUser.setAuthStatus( sysUserReqDto.getAuthStatus() ); + sysUser.setEnterpriseId( sysUserReqDto.getEnterpriseId() ); + sysUser.setPhone( sysUserReqDto.getPhone() ); + sysUser.setEmail( sysUserReqDto.getEmail() ); + sysUser.setUserStatus( sysUserReqDto.getUserStatus() ); + sysUser.setRegTime( sysUserReqDto.getRegTime() ); + + return sysUser; + } + + @Override + public List fromReqDto(List sysUserReqDtos) { + if ( sysUserReqDtos == null ) { + return null; + } + + List list = new ArrayList( sysUserReqDtos.size() ); + for ( SysUserReqDto sysUserReqDto : sysUserReqDtos ) { + list.add( fromReqDto( sysUserReqDto ) ); + } + + return list; + } + + @Override + public SysUserQuery fromQueryReqDtoToQuery(SysUserQueryReqDto sysUserQueryReqDto) { + if ( sysUserQueryReqDto == null ) { + return null; + } + + SysUserQuery sysUserQuery = new SysUserQuery(); + + sysUserQuery.setId( sysUserQueryReqDto.getId() ); + sysUserQuery.setUsername( sysUserQueryReqDto.getUsername() ); + sysUserQuery.setPassword( sysUserQueryReqDto.getPassword() ); + sysUserQuery.setAuthStatus( sysUserQueryReqDto.getAuthStatus() ); + sysUserQuery.setEnterpriseId( sysUserQueryReqDto.getEnterpriseId() ); + sysUserQuery.setPhone( sysUserQueryReqDto.getPhone() ); + sysUserQuery.setEmail( sysUserQueryReqDto.getEmail() ); + sysUserQuery.setUserStatus( sysUserQueryReqDto.getUserStatus() ); + sysUserQuery.setRegTime( sysUserQueryReqDto.getRegTime() ); + + return sysUserQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysUserRoleConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysUserRoleConverterImpl.java new file mode 100644 index 0000000..424666b --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/auth/converter/SysUserRoleConverterImpl.java @@ -0,0 +1,94 @@ +package com.metalloop.modules.auth.converter; + +import com.metalloop.modules.auth.model.po.SysUserRole; +import com.metalloop.modules.auth.model.query.SysUserRoleQuery; +import com.metalloop.modules.auth.model.req.SysUserRoleQueryReqDto; +import com.metalloop.modules.auth.model.req.SysUserRoleReqDto; +import com.metalloop.modules.auth.model.resp.SysUserRoleRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class SysUserRoleConverterImpl implements SysUserRoleConverter { + + @Override + public SysUserRoleRespDto toRespDto(SysUserRole sysUserRole) { + if ( sysUserRole == null ) { + return null; + } + + SysUserRoleRespDto sysUserRoleRespDto = new SysUserRoleRespDto(); + + sysUserRoleRespDto.setUserId( sysUserRole.getUserId() ); + sysUserRoleRespDto.setRoleId( sysUserRole.getRoleId() ); + sysUserRoleRespDto.setCreatedAt( sysUserRole.getCreatedAt() ); + sysUserRoleRespDto.setId( sysUserRole.getId() ); + + return sysUserRoleRespDto; + } + + @Override + public List toRespDto(List sysUserRoles) { + if ( sysUserRoles == null ) { + return null; + } + + List list = new ArrayList( sysUserRoles.size() ); + for ( SysUserRole sysUserRole : sysUserRoles ) { + list.add( toRespDto( sysUserRole ) ); + } + + return list; + } + + @Override + public SysUserRole fromReqDto(SysUserRoleReqDto sysUserRoleReqDto) { + if ( sysUserRoleReqDto == null ) { + return null; + } + + SysUserRole sysUserRole = new SysUserRole(); + + sysUserRole.setUserId( sysUserRoleReqDto.getUserId() ); + sysUserRole.setRoleId( sysUserRoleReqDto.getRoleId() ); + sysUserRole.setCreatedAt( sysUserRoleReqDto.getCreatedAt() ); + sysUserRole.setId( sysUserRoleReqDto.getId() ); + + return sysUserRole; + } + + @Override + public List fromReqDto(List sysUserRoleReqDtos) { + if ( sysUserRoleReqDtos == null ) { + return null; + } + + List list = new ArrayList( sysUserRoleReqDtos.size() ); + for ( SysUserRoleReqDto sysUserRoleReqDto : sysUserRoleReqDtos ) { + list.add( fromReqDto( sysUserRoleReqDto ) ); + } + + return list; + } + + @Override + public SysUserRoleQuery fromQueryReqDtoToQuery(SysUserRoleQueryReqDto sysUserRoleQueryReqDto) { + if ( sysUserRoleQueryReqDto == null ) { + return null; + } + + SysUserRoleQuery sysUserRoleQuery = new SysUserRoleQuery(); + + sysUserRoleQuery.setUserId( sysUserRoleQueryReqDto.getUserId() ); + sysUserRoleQuery.setRoleId( sysUserRoleQueryReqDto.getRoleId() ); + sysUserRoleQuery.setCreatedAt( sysUserRoleQueryReqDto.getCreatedAt() ); + sysUserRoleQuery.setId( sysUserRoleQueryReqDto.getId() ); + + return sysUserRoleQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverterImpl.java new file mode 100644 index 0000000..9a4d887 --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizEnterpriseProductConverterImpl.java @@ -0,0 +1,112 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.po.BizEnterpriseProduct; +import com.metalloop.modules.bussiness.model.query.BizEnterpriseProductQuery; +import com.metalloop.modules.bussiness.model.req.BizEnterpriseProductQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizEnterpriseProductReqDto; +import com.metalloop.modules.bussiness.model.resp.BizEnterpriseProductRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class BizEnterpriseProductConverterImpl implements BizEnterpriseProductConverter { + + @Override + public BizEnterpriseProductRespDto toRespDto(BizEnterpriseProduct bizEnterpriseProduct) { + if ( bizEnterpriseProduct == null ) { + return null; + } + + BizEnterpriseProductRespDto bizEnterpriseProductRespDto = new BizEnterpriseProductRespDto(); + + bizEnterpriseProductRespDto.setId( bizEnterpriseProduct.getId() ); + bizEnterpriseProductRespDto.setEnterpriseId( bizEnterpriseProduct.getEnterpriseId() ); + bizEnterpriseProductRespDto.setVarietyId( bizEnterpriseProduct.getVarietyId() ); + bizEnterpriseProductRespDto.setMaterialId( bizEnterpriseProduct.getMaterialId() ); + bizEnterpriseProductRespDto.setUnitPrice( bizEnterpriseProduct.getUnitPrice() ); + bizEnterpriseProductRespDto.setWeight( bizEnterpriseProduct.getWeight() ); + bizEnterpriseProductRespDto.setStatus( bizEnterpriseProduct.getStatus() ); + bizEnterpriseProductRespDto.setRemark( bizEnterpriseProduct.getRemark() ); + bizEnterpriseProductRespDto.setCreateTime( bizEnterpriseProduct.getCreateTime() ); + bizEnterpriseProductRespDto.setUpdateTime( bizEnterpriseProduct.getUpdateTime() ); + + return bizEnterpriseProductRespDto; + } + + @Override + public List toRespDto(List bizEnterpriseProducts) { + if ( bizEnterpriseProducts == null ) { + return null; + } + + List list = new ArrayList( bizEnterpriseProducts.size() ); + for ( BizEnterpriseProduct bizEnterpriseProduct : bizEnterpriseProducts ) { + list.add( toRespDto( bizEnterpriseProduct ) ); + } + + return list; + } + + @Override + public BizEnterpriseProduct fromReqDto(BizEnterpriseProductReqDto bizEnterpriseProductReqDto) { + if ( bizEnterpriseProductReqDto == null ) { + return null; + } + + BizEnterpriseProduct bizEnterpriseProduct = new BizEnterpriseProduct(); + + bizEnterpriseProduct.setId( bizEnterpriseProductReqDto.getId() ); + bizEnterpriseProduct.setEnterpriseId( bizEnterpriseProductReqDto.getEnterpriseId() ); + bizEnterpriseProduct.setVarietyId( bizEnterpriseProductReqDto.getVarietyId() ); + bizEnterpriseProduct.setMaterialId( bizEnterpriseProductReqDto.getMaterialId() ); + bizEnterpriseProduct.setUnitPrice( bizEnterpriseProductReqDto.getUnitPrice() ); + bizEnterpriseProduct.setWeight( bizEnterpriseProductReqDto.getWeight() ); + bizEnterpriseProduct.setStatus( bizEnterpriseProductReqDto.getStatus() ); + bizEnterpriseProduct.setRemark( bizEnterpriseProductReqDto.getRemark() ); + bizEnterpriseProduct.setCreateTime( bizEnterpriseProductReqDto.getCreateTime() ); + bizEnterpriseProduct.setUpdateTime( bizEnterpriseProductReqDto.getUpdateTime() ); + + return bizEnterpriseProduct; + } + + @Override + public List fromReqDto(List bizEnterpriseProductReqDtos) { + if ( bizEnterpriseProductReqDtos == null ) { + return null; + } + + List list = new ArrayList( bizEnterpriseProductReqDtos.size() ); + for ( BizEnterpriseProductReqDto bizEnterpriseProductReqDto : bizEnterpriseProductReqDtos ) { + list.add( fromReqDto( bizEnterpriseProductReqDto ) ); + } + + return list; + } + + @Override + public BizEnterpriseProductQuery fromQueryReqDtoToQuery(BizEnterpriseProductQueryReqDto bizEnterpriseProductQueryReqDto) { + if ( bizEnterpriseProductQueryReqDto == null ) { + return null; + } + + BizEnterpriseProductQuery bizEnterpriseProductQuery = new BizEnterpriseProductQuery(); + + bizEnterpriseProductQuery.setId( bizEnterpriseProductQueryReqDto.getId() ); + bizEnterpriseProductQuery.setEnterpriseId( bizEnterpriseProductQueryReqDto.getEnterpriseId() ); + bizEnterpriseProductQuery.setVarietyId( bizEnterpriseProductQueryReqDto.getVarietyId() ); + bizEnterpriseProductQuery.setMaterialId( bizEnterpriseProductQueryReqDto.getMaterialId() ); + bizEnterpriseProductQuery.setUnitPrice( bizEnterpriseProductQueryReqDto.getUnitPrice() ); + bizEnterpriseProductQuery.setWeight( bizEnterpriseProductQueryReqDto.getWeight() ); + bizEnterpriseProductQuery.setStatus( bizEnterpriseProductQueryReqDto.getStatus() ); + bizEnterpriseProductQuery.setRemark( bizEnterpriseProductQueryReqDto.getRemark() ); + bizEnterpriseProductQuery.setCreateTime( bizEnterpriseProductQueryReqDto.getCreateTime() ); + bizEnterpriseProductQuery.setUpdateTime( bizEnterpriseProductQueryReqDto.getUpdateTime() ); + + return bizEnterpriseProductQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizMaterialConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizMaterialConverterImpl.java new file mode 100644 index 0000000..7fb60d3 --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizMaterialConverterImpl.java @@ -0,0 +1,100 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.po.BizMaterial; +import com.metalloop.modules.bussiness.model.query.BizMaterialQuery; +import com.metalloop.modules.bussiness.model.req.BizMaterialQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizMaterialReqDto; +import com.metalloop.modules.bussiness.model.resp.BizMaterialRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class BizMaterialConverterImpl implements BizMaterialConverter { + + @Override + public BizMaterialRespDto toRespDto(BizMaterial bizMaterial) { + if ( bizMaterial == null ) { + return null; + } + + BizMaterialRespDto bizMaterialRespDto = new BizMaterialRespDto(); + + bizMaterialRespDto.setId( bizMaterial.getId() ); + bizMaterialRespDto.setMaterialName( bizMaterial.getMaterialName() ); + bizMaterialRespDto.setMaterialCode( bizMaterial.getMaterialCode() ); + bizMaterialRespDto.setDescription( bizMaterial.getDescription() ); + bizMaterialRespDto.setCreateTime( bizMaterial.getCreateTime() ); + bizMaterialRespDto.setUpdateTime( bizMaterial.getUpdateTime() ); + + return bizMaterialRespDto; + } + + @Override + public List toRespDto(List bizMaterials) { + if ( bizMaterials == null ) { + return null; + } + + List list = new ArrayList( bizMaterials.size() ); + for ( BizMaterial bizMaterial : bizMaterials ) { + list.add( toRespDto( bizMaterial ) ); + } + + return list; + } + + @Override + public BizMaterial fromReqDto(BizMaterialReqDto bizMaterialReqDto) { + if ( bizMaterialReqDto == null ) { + return null; + } + + BizMaterial bizMaterial = new BizMaterial(); + + bizMaterial.setId( bizMaterialReqDto.getId() ); + bizMaterial.setMaterialName( bizMaterialReqDto.getMaterialName() ); + bizMaterial.setMaterialCode( bizMaterialReqDto.getMaterialCode() ); + bizMaterial.setDescription( bizMaterialReqDto.getDescription() ); + bizMaterial.setCreateTime( bizMaterialReqDto.getCreateTime() ); + bizMaterial.setUpdateTime( bizMaterialReqDto.getUpdateTime() ); + + return bizMaterial; + } + + @Override + public List fromReqDto(List bizMaterialReqDtos) { + if ( bizMaterialReqDtos == null ) { + return null; + } + + List list = new ArrayList( bizMaterialReqDtos.size() ); + for ( BizMaterialReqDto bizMaterialReqDto : bizMaterialReqDtos ) { + list.add( fromReqDto( bizMaterialReqDto ) ); + } + + return list; + } + + @Override + public BizMaterialQuery fromQueryReqDtoToQuery(BizMaterialQueryReqDto bizMaterialQueryReqDto) { + if ( bizMaterialQueryReqDto == null ) { + return null; + } + + BizMaterialQuery bizMaterialQuery = new BizMaterialQuery(); + + bizMaterialQuery.setId( bizMaterialQueryReqDto.getId() ); + bizMaterialQuery.setMaterialName( bizMaterialQueryReqDto.getMaterialName() ); + bizMaterialQuery.setMaterialCode( bizMaterialQueryReqDto.getMaterialCode() ); + bizMaterialQuery.setDescription( bizMaterialQueryReqDto.getDescription() ); + bizMaterialQuery.setCreateTime( bizMaterialQueryReqDto.getCreateTime() ); + bizMaterialQuery.setUpdateTime( bizMaterialQueryReqDto.getUpdateTime() ); + + return bizMaterialQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverterImpl.java new file mode 100644 index 0000000..2fac640 --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizPurchaseRequestConverterImpl.java @@ -0,0 +1,160 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.po.BizPurchaseRequest; +import com.metalloop.modules.bussiness.model.query.BizPurchaseRequestQuery; +import com.metalloop.modules.bussiness.model.req.BizPurchaseRequestQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizPurchaseRequestReqDto; +import com.metalloop.modules.bussiness.model.resp.BizPurchaseRequestRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class BizPurchaseRequestConverterImpl implements BizPurchaseRequestConverter { + + @Override + public BizPurchaseRequestRespDto toRespDto(BizPurchaseRequest bizPurchaseRequest) { + if ( bizPurchaseRequest == null ) { + return null; + } + + BizPurchaseRequestRespDto bizPurchaseRequestRespDto = new BizPurchaseRequestRespDto(); + + bizPurchaseRequestRespDto.setId( bizPurchaseRequest.getId() ); + bizPurchaseRequestRespDto.setCreateUserId( bizPurchaseRequest.getCreateUserId() ); + bizPurchaseRequestRespDto.setEnterpriseId( bizPurchaseRequest.getEnterpriseId() ); + bizPurchaseRequestRespDto.setElementType( bizPurchaseRequest.getElementType() ); + bizPurchaseRequestRespDto.setProductCategory( bizPurchaseRequest.getProductCategory() ); + bizPurchaseRequestRespDto.setMaterial( bizPurchaseRequest.getMaterial() ); + bizPurchaseRequestRespDto.setTitle( bizPurchaseRequest.getTitle() ); + bizPurchaseRequestRespDto.setDescription( bizPurchaseRequest.getDescription() ); + bizPurchaseRequestRespDto.setQuantity( bizPurchaseRequest.getQuantity() ); + bizPurchaseRequestRespDto.setUnitPrice( bizPurchaseRequest.getUnitPrice() ); + bizPurchaseRequestRespDto.setContactPerson( bizPurchaseRequest.getContactPerson() ); + bizPurchaseRequestRespDto.setContactPhone( bizPurchaseRequest.getContactPhone() ); + bizPurchaseRequestRespDto.setDeliveryDate( bizPurchaseRequest.getDeliveryDate() ); + bizPurchaseRequestRespDto.setDeliveryLocation( bizPurchaseRequest.getDeliveryLocation() ); + bizPurchaseRequestRespDto.setImageUrl( bizPurchaseRequest.getImageUrl() ); + bizPurchaseRequestRespDto.setAuditStatus( bizPurchaseRequest.getAuditStatus() ); + bizPurchaseRequestRespDto.setPublishTime( bizPurchaseRequest.getPublishTime() ); + bizPurchaseRequestRespDto.setExpireTime( bizPurchaseRequest.getExpireTime() ); + bizPurchaseRequestRespDto.setAccountPeriodMode( bizPurchaseRequest.getAccountPeriodMode() ); + bizPurchaseRequestRespDto.setDepositRatio( bizPurchaseRequest.getDepositRatio() ); + bizPurchaseRequestRespDto.setFinalPaymentDeadline( bizPurchaseRequest.getFinalPaymentDeadline() ); + bizPurchaseRequestRespDto.setStatus( bizPurchaseRequest.getStatus() ); + bizPurchaseRequestRespDto.setRejectReason( bizPurchaseRequest.getRejectReason() ); + bizPurchaseRequestRespDto.setUpdateUserId( bizPurchaseRequest.getUpdateUserId() ); + bizPurchaseRequestRespDto.setCreateTime( bizPurchaseRequest.getCreateTime() ); + bizPurchaseRequestRespDto.setUpdateTime( bizPurchaseRequest.getUpdateTime() ); + + return bizPurchaseRequestRespDto; + } + + @Override + public List toRespDto(List bizPurchaseRequests) { + if ( bizPurchaseRequests == null ) { + return null; + } + + List list = new ArrayList( bizPurchaseRequests.size() ); + for ( BizPurchaseRequest bizPurchaseRequest : bizPurchaseRequests ) { + list.add( toRespDto( bizPurchaseRequest ) ); + } + + return list; + } + + @Override + public BizPurchaseRequest fromReqDto(BizPurchaseRequestReqDto bizPurchaseRequestReqDto) { + if ( bizPurchaseRequestReqDto == null ) { + return null; + } + + BizPurchaseRequest bizPurchaseRequest = new BizPurchaseRequest(); + + bizPurchaseRequest.setId( bizPurchaseRequestReqDto.getId() ); + bizPurchaseRequest.setCreateUserId( bizPurchaseRequestReqDto.getCreateUserId() ); + bizPurchaseRequest.setEnterpriseId( bizPurchaseRequestReqDto.getEnterpriseId() ); + bizPurchaseRequest.setElementType( bizPurchaseRequestReqDto.getElementType() ); + bizPurchaseRequest.setProductCategory( bizPurchaseRequestReqDto.getProductCategory() ); + bizPurchaseRequest.setMaterial( bizPurchaseRequestReqDto.getMaterial() ); + bizPurchaseRequest.setTitle( bizPurchaseRequestReqDto.getTitle() ); + bizPurchaseRequest.setDescription( bizPurchaseRequestReqDto.getDescription() ); + bizPurchaseRequest.setQuantity( bizPurchaseRequestReqDto.getQuantity() ); + bizPurchaseRequest.setUnitPrice( bizPurchaseRequestReqDto.getUnitPrice() ); + bizPurchaseRequest.setContactPerson( bizPurchaseRequestReqDto.getContactPerson() ); + bizPurchaseRequest.setContactPhone( bizPurchaseRequestReqDto.getContactPhone() ); + bizPurchaseRequest.setDeliveryDate( bizPurchaseRequestReqDto.getDeliveryDate() ); + bizPurchaseRequest.setDeliveryLocation( bizPurchaseRequestReqDto.getDeliveryLocation() ); + bizPurchaseRequest.setImageUrl( bizPurchaseRequestReqDto.getImageUrl() ); + bizPurchaseRequest.setAuditStatus( bizPurchaseRequestReqDto.getAuditStatus() ); + bizPurchaseRequest.setPublishTime( bizPurchaseRequestReqDto.getPublishTime() ); + bizPurchaseRequest.setExpireTime( bizPurchaseRequestReqDto.getExpireTime() ); + bizPurchaseRequest.setAccountPeriodMode( bizPurchaseRequestReqDto.getAccountPeriodMode() ); + bizPurchaseRequest.setDepositRatio( bizPurchaseRequestReqDto.getDepositRatio() ); + bizPurchaseRequest.setFinalPaymentDeadline( bizPurchaseRequestReqDto.getFinalPaymentDeadline() ); + bizPurchaseRequest.setStatus( bizPurchaseRequestReqDto.getStatus() ); + bizPurchaseRequest.setRejectReason( bizPurchaseRequestReqDto.getRejectReason() ); + bizPurchaseRequest.setUpdateUserId( bizPurchaseRequestReqDto.getUpdateUserId() ); + bizPurchaseRequest.setCreateTime( bizPurchaseRequestReqDto.getCreateTime() ); + bizPurchaseRequest.setUpdateTime( bizPurchaseRequestReqDto.getUpdateTime() ); + + return bizPurchaseRequest; + } + + @Override + public List fromReqDto(List bizPurchaseRequestReqDtos) { + if ( bizPurchaseRequestReqDtos == null ) { + return null; + } + + List list = new ArrayList( bizPurchaseRequestReqDtos.size() ); + for ( BizPurchaseRequestReqDto bizPurchaseRequestReqDto : bizPurchaseRequestReqDtos ) { + list.add( fromReqDto( bizPurchaseRequestReqDto ) ); + } + + return list; + } + + @Override + public BizPurchaseRequestQuery fromQueryReqDtoToQuery(BizPurchaseRequestQueryReqDto bizPurchaseRequestQueryReqDto) { + if ( bizPurchaseRequestQueryReqDto == null ) { + return null; + } + + BizPurchaseRequestQuery bizPurchaseRequestQuery = new BizPurchaseRequestQuery(); + + bizPurchaseRequestQuery.setId( bizPurchaseRequestQueryReqDto.getId() ); + bizPurchaseRequestQuery.setCreateUserId( bizPurchaseRequestQueryReqDto.getCreateUserId() ); + bizPurchaseRequestQuery.setEnterpriseId( bizPurchaseRequestQueryReqDto.getEnterpriseId() ); + bizPurchaseRequestQuery.setElementType( bizPurchaseRequestQueryReqDto.getElementType() ); + bizPurchaseRequestQuery.setProductCategory( bizPurchaseRequestQueryReqDto.getProductCategory() ); + bizPurchaseRequestQuery.setMaterial( bizPurchaseRequestQueryReqDto.getMaterial() ); + bizPurchaseRequestQuery.setTitle( bizPurchaseRequestQueryReqDto.getTitle() ); + bizPurchaseRequestQuery.setDescription( bizPurchaseRequestQueryReqDto.getDescription() ); + bizPurchaseRequestQuery.setQuantity( bizPurchaseRequestQueryReqDto.getQuantity() ); + bizPurchaseRequestQuery.setUnitPrice( bizPurchaseRequestQueryReqDto.getUnitPrice() ); + bizPurchaseRequestQuery.setContactPerson( bizPurchaseRequestQueryReqDto.getContactPerson() ); + bizPurchaseRequestQuery.setContactPhone( bizPurchaseRequestQueryReqDto.getContactPhone() ); + bizPurchaseRequestQuery.setDeliveryDate( bizPurchaseRequestQueryReqDto.getDeliveryDate() ); + bizPurchaseRequestQuery.setDeliveryLocation( bizPurchaseRequestQueryReqDto.getDeliveryLocation() ); + bizPurchaseRequestQuery.setImageUrl( bizPurchaseRequestQueryReqDto.getImageUrl() ); + bizPurchaseRequestQuery.setAuditStatus( bizPurchaseRequestQueryReqDto.getAuditStatus() ); + bizPurchaseRequestQuery.setPublishTime( bizPurchaseRequestQueryReqDto.getPublishTime() ); + bizPurchaseRequestQuery.setExpireTime( bizPurchaseRequestQueryReqDto.getExpireTime() ); + bizPurchaseRequestQuery.setAccountPeriodMode( bizPurchaseRequestQueryReqDto.getAccountPeriodMode() ); + bizPurchaseRequestQuery.setDepositRatio( bizPurchaseRequestQueryReqDto.getDepositRatio() ); + bizPurchaseRequestQuery.setFinalPaymentDeadline( bizPurchaseRequestQueryReqDto.getFinalPaymentDeadline() ); + bizPurchaseRequestQuery.setStatus( bizPurchaseRequestQueryReqDto.getStatus() ); + bizPurchaseRequestQuery.setRejectReason( bizPurchaseRequestQueryReqDto.getRejectReason() ); + bizPurchaseRequestQuery.setUpdateUserId( bizPurchaseRequestQueryReqDto.getUpdateUserId() ); + bizPurchaseRequestQuery.setCreateTime( bizPurchaseRequestQueryReqDto.getCreateTime() ); + bizPurchaseRequestQuery.setUpdateTime( bizPurchaseRequestQueryReqDto.getUpdateTime() ); + + return bizPurchaseRequestQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverterImpl.java new file mode 100644 index 0000000..df29496 --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizSupplyInfoConverterImpl.java @@ -0,0 +1,157 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.po.BizSupplyInfo; +import com.metalloop.modules.bussiness.model.query.BizSupplyInfoQuery; +import com.metalloop.modules.bussiness.model.req.BizSupplyInfoQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizSupplyInfoReqDto; +import com.metalloop.modules.bussiness.model.resp.BizSupplyInfoRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class BizSupplyInfoConverterImpl implements BizSupplyInfoConverter { + + @Override + public BizSupplyInfoRespDto toRespDto(BizSupplyInfo bizSupplyInfo) { + if ( bizSupplyInfo == null ) { + return null; + } + + BizSupplyInfoRespDto bizSupplyInfoRespDto = new BizSupplyInfoRespDto(); + + bizSupplyInfoRespDto.setId( bizSupplyInfo.getId() ); + bizSupplyInfoRespDto.setCreateUserId( bizSupplyInfo.getCreateUserId() ); + bizSupplyInfoRespDto.setEnterpriseId( bizSupplyInfo.getEnterpriseId() ); + bizSupplyInfoRespDto.setElementType( bizSupplyInfo.getElementType() ); + bizSupplyInfoRespDto.setProductCategory( bizSupplyInfo.getProductCategory() ); + bizSupplyInfoRespDto.setMaterial( bizSupplyInfo.getMaterial() ); + bizSupplyInfoRespDto.setTitle( bizSupplyInfo.getTitle() ); + bizSupplyInfoRespDto.setDescription( bizSupplyInfo.getDescription() ); + bizSupplyInfoRespDto.setQuantity( bizSupplyInfo.getQuantity() ); + bizSupplyInfoRespDto.setUnitPrice( bizSupplyInfo.getUnitPrice() ); + bizSupplyInfoRespDto.setContactPerson( bizSupplyInfo.getContactPerson() ); + bizSupplyInfoRespDto.setContactPhone( bizSupplyInfo.getContactPhone() ); + bizSupplyInfoRespDto.setDeliveryLocation( bizSupplyInfo.getDeliveryLocation() ); + bizSupplyInfoRespDto.setImageUrl( bizSupplyInfo.getImageUrl() ); + bizSupplyInfoRespDto.setAuditStatus( bizSupplyInfo.getAuditStatus() ); + bizSupplyInfoRespDto.setPublishTime( bizSupplyInfo.getPublishTime() ); + bizSupplyInfoRespDto.setExpireTime( bizSupplyInfo.getExpireTime() ); + bizSupplyInfoRespDto.setAccountPeriodMode( bizSupplyInfo.getAccountPeriodMode() ); + bizSupplyInfoRespDto.setDepositRatio( bizSupplyInfo.getDepositRatio() ); + bizSupplyInfoRespDto.setFinalPaymentDeadline( bizSupplyInfo.getFinalPaymentDeadline() ); + bizSupplyInfoRespDto.setStatus( bizSupplyInfo.getStatus() ); + bizSupplyInfoRespDto.setRejectReason( bizSupplyInfo.getRejectReason() ); + bizSupplyInfoRespDto.setUpdateUserId( bizSupplyInfo.getUpdateUserId() ); + bizSupplyInfoRespDto.setCreateTime( bizSupplyInfo.getCreateTime() ); + bizSupplyInfoRespDto.setUpdateTime( bizSupplyInfo.getUpdateTime() ); + + return bizSupplyInfoRespDto; + } + + @Override + public List toRespDto(List bizSupplyInfos) { + if ( bizSupplyInfos == null ) { + return null; + } + + List list = new ArrayList( bizSupplyInfos.size() ); + for ( BizSupplyInfo bizSupplyInfo : bizSupplyInfos ) { + list.add( toRespDto( bizSupplyInfo ) ); + } + + return list; + } + + @Override + public BizSupplyInfo fromReqDto(BizSupplyInfoReqDto bizSupplyInfoReqDto) { + if ( bizSupplyInfoReqDto == null ) { + return null; + } + + BizSupplyInfo bizSupplyInfo = new BizSupplyInfo(); + + bizSupplyInfo.setId( bizSupplyInfoReqDto.getId() ); + bizSupplyInfo.setCreateUserId( bizSupplyInfoReqDto.getCreateUserId() ); + bizSupplyInfo.setEnterpriseId( bizSupplyInfoReqDto.getEnterpriseId() ); + bizSupplyInfo.setElementType( bizSupplyInfoReqDto.getElementType() ); + bizSupplyInfo.setProductCategory( bizSupplyInfoReqDto.getProductCategory() ); + bizSupplyInfo.setMaterial( bizSupplyInfoReqDto.getMaterial() ); + bizSupplyInfo.setTitle( bizSupplyInfoReqDto.getTitle() ); + bizSupplyInfo.setDescription( bizSupplyInfoReqDto.getDescription() ); + bizSupplyInfo.setQuantity( bizSupplyInfoReqDto.getQuantity() ); + bizSupplyInfo.setUnitPrice( bizSupplyInfoReqDto.getUnitPrice() ); + bizSupplyInfo.setContactPerson( bizSupplyInfoReqDto.getContactPerson() ); + bizSupplyInfo.setContactPhone( bizSupplyInfoReqDto.getContactPhone() ); + bizSupplyInfo.setDeliveryLocation( bizSupplyInfoReqDto.getDeliveryLocation() ); + bizSupplyInfo.setImageUrl( bizSupplyInfoReqDto.getImageUrl() ); + bizSupplyInfo.setAuditStatus( bizSupplyInfoReqDto.getAuditStatus() ); + bizSupplyInfo.setPublishTime( bizSupplyInfoReqDto.getPublishTime() ); + bizSupplyInfo.setExpireTime( bizSupplyInfoReqDto.getExpireTime() ); + bizSupplyInfo.setAccountPeriodMode( bizSupplyInfoReqDto.getAccountPeriodMode() ); + bizSupplyInfo.setDepositRatio( bizSupplyInfoReqDto.getDepositRatio() ); + bizSupplyInfo.setFinalPaymentDeadline( bizSupplyInfoReqDto.getFinalPaymentDeadline() ); + bizSupplyInfo.setStatus( bizSupplyInfoReqDto.getStatus() ); + bizSupplyInfo.setRejectReason( bizSupplyInfoReqDto.getRejectReason() ); + bizSupplyInfo.setUpdateUserId( bizSupplyInfoReqDto.getUpdateUserId() ); + bizSupplyInfo.setCreateTime( bizSupplyInfoReqDto.getCreateTime() ); + bizSupplyInfo.setUpdateTime( bizSupplyInfoReqDto.getUpdateTime() ); + + return bizSupplyInfo; + } + + @Override + public List fromReqDto(List bizSupplyInfoReqDtos) { + if ( bizSupplyInfoReqDtos == null ) { + return null; + } + + List list = new ArrayList( bizSupplyInfoReqDtos.size() ); + for ( BizSupplyInfoReqDto bizSupplyInfoReqDto : bizSupplyInfoReqDtos ) { + list.add( fromReqDto( bizSupplyInfoReqDto ) ); + } + + return list; + } + + @Override + public BizSupplyInfoQuery fromQueryReqDtoToQuery(BizSupplyInfoQueryReqDto bizSupplyInfoQueryReqDto) { + if ( bizSupplyInfoQueryReqDto == null ) { + return null; + } + + BizSupplyInfoQuery bizSupplyInfoQuery = new BizSupplyInfoQuery(); + + bizSupplyInfoQuery.setId( bizSupplyInfoQueryReqDto.getId() ); + bizSupplyInfoQuery.setCreateUserId( bizSupplyInfoQueryReqDto.getCreateUserId() ); + bizSupplyInfoQuery.setEnterpriseId( bizSupplyInfoQueryReqDto.getEnterpriseId() ); + bizSupplyInfoQuery.setElementType( bizSupplyInfoQueryReqDto.getElementType() ); + bizSupplyInfoQuery.setProductCategory( bizSupplyInfoQueryReqDto.getProductCategory() ); + bizSupplyInfoQuery.setMaterial( bizSupplyInfoQueryReqDto.getMaterial() ); + bizSupplyInfoQuery.setTitle( bizSupplyInfoQueryReqDto.getTitle() ); + bizSupplyInfoQuery.setDescription( bizSupplyInfoQueryReqDto.getDescription() ); + bizSupplyInfoQuery.setQuantity( bizSupplyInfoQueryReqDto.getQuantity() ); + bizSupplyInfoQuery.setUnitPrice( bizSupplyInfoQueryReqDto.getUnitPrice() ); + bizSupplyInfoQuery.setContactPerson( bizSupplyInfoQueryReqDto.getContactPerson() ); + bizSupplyInfoQuery.setContactPhone( bizSupplyInfoQueryReqDto.getContactPhone() ); + bizSupplyInfoQuery.setDeliveryLocation( bizSupplyInfoQueryReqDto.getDeliveryLocation() ); + bizSupplyInfoQuery.setImageUrl( bizSupplyInfoQueryReqDto.getImageUrl() ); + bizSupplyInfoQuery.setAuditStatus( bizSupplyInfoQueryReqDto.getAuditStatus() ); + bizSupplyInfoQuery.setPublishTime( bizSupplyInfoQueryReqDto.getPublishTime() ); + bizSupplyInfoQuery.setExpireTime( bizSupplyInfoQueryReqDto.getExpireTime() ); + bizSupplyInfoQuery.setAccountPeriodMode( bizSupplyInfoQueryReqDto.getAccountPeriodMode() ); + bizSupplyInfoQuery.setDepositRatio( bizSupplyInfoQueryReqDto.getDepositRatio() ); + bizSupplyInfoQuery.setFinalPaymentDeadline( bizSupplyInfoQueryReqDto.getFinalPaymentDeadline() ); + bizSupplyInfoQuery.setStatus( bizSupplyInfoQueryReqDto.getStatus() ); + bizSupplyInfoQuery.setRejectReason( bizSupplyInfoQueryReqDto.getRejectReason() ); + bizSupplyInfoQuery.setUpdateUserId( bizSupplyInfoQueryReqDto.getUpdateUserId() ); + bizSupplyInfoQuery.setCreateTime( bizSupplyInfoQueryReqDto.getCreateTime() ); + bizSupplyInfoQuery.setUpdateTime( bizSupplyInfoQueryReqDto.getUpdateTime() ); + + return bizSupplyInfoQuery; + } +} diff --git a/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizVarietyConverterImpl.java b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizVarietyConverterImpl.java new file mode 100644 index 0000000..d91417f --- /dev/null +++ b/target/generated-sources/annotations/com/metalloop/modules/bussiness/converter/BizVarietyConverterImpl.java @@ -0,0 +1,112 @@ +package com.metalloop.modules.bussiness.converter; + +import com.metalloop.modules.bussiness.model.po.BizVariety; +import com.metalloop.modules.bussiness.model.query.BizVarietyQuery; +import com.metalloop.modules.bussiness.model.req.BizVarietyQueryReqDto; +import com.metalloop.modules.bussiness.model.req.BizVarietyReqDto; +import com.metalloop.modules.bussiness.model.resp.BizVarietyRespDto; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.processing.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2026-09-11T14:27:41+0800", + comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.20.1 (Microsoft)" +) +public class BizVarietyConverterImpl implements BizVarietyConverter { + + @Override + public BizVarietyRespDto toRespDto(BizVariety bizVariety) { + if ( bizVariety == null ) { + return null; + } + + BizVarietyRespDto bizVarietyRespDto = new BizVarietyRespDto(); + + bizVarietyRespDto.setId( bizVariety.getId() ); + bizVarietyRespDto.setVarietyName( bizVariety.getVarietyName() ); + bizVarietyRespDto.setVarietyGrade( bizVariety.getVarietyGrade() ); + bizVarietyRespDto.setParentId( bizVariety.getParentId() ); + bizVarietyRespDto.setVarietyMaterial( bizVariety.getVarietyMaterial() ); + bizVarietyRespDto.setDescription( bizVariety.getDescription() ); + bizVarietyRespDto.setSort( bizVariety.getSort() ); + bizVarietyRespDto.setStatus( bizVariety.getStatus() ); + bizVarietyRespDto.setCreateTime( bizVariety.getCreateTime() ); + bizVarietyRespDto.setUpdateTime( bizVariety.getUpdateTime() ); + + return bizVarietyRespDto; + } + + @Override + public List toRespDto(List bizVarietys) { + if ( bizVarietys == null ) { + return null; + } + + List list = new ArrayList( bizVarietys.size() ); + for ( BizVariety bizVariety : bizVarietys ) { + list.add( toRespDto( bizVariety ) ); + } + + return list; + } + + @Override + public BizVariety fromReqDto(BizVarietyReqDto bizVarietyReqDto) { + if ( bizVarietyReqDto == null ) { + return null; + } + + BizVariety bizVariety = new BizVariety(); + + bizVariety.setId( bizVarietyReqDto.getId() ); + bizVariety.setVarietyName( bizVarietyReqDto.getVarietyName() ); + bizVariety.setVarietyGrade( bizVarietyReqDto.getVarietyGrade() ); + bizVariety.setParentId( bizVarietyReqDto.getParentId() ); + bizVariety.setVarietyMaterial( bizVarietyReqDto.getVarietyMaterial() ); + bizVariety.setDescription( bizVarietyReqDto.getDescription() ); + bizVariety.setSort( bizVarietyReqDto.getSort() ); + bizVariety.setStatus( bizVarietyReqDto.getStatus() ); + bizVariety.setCreateTime( bizVarietyReqDto.getCreateTime() ); + bizVariety.setUpdateTime( bizVarietyReqDto.getUpdateTime() ); + + return bizVariety; + } + + @Override + public List fromReqDto(List bizVarietyReqDtos) { + if ( bizVarietyReqDtos == null ) { + return null; + } + + List list = new ArrayList( bizVarietyReqDtos.size() ); + for ( BizVarietyReqDto bizVarietyReqDto : bizVarietyReqDtos ) { + list.add( fromReqDto( bizVarietyReqDto ) ); + } + + return list; + } + + @Override + public BizVarietyQuery fromQueryReqDtoToQuery(BizVarietyQueryReqDto bizVarietyQueryReqDto) { + if ( bizVarietyQueryReqDto == null ) { + return null; + } + + BizVarietyQuery bizVarietyQuery = new BizVarietyQuery(); + + bizVarietyQuery.setId( bizVarietyQueryReqDto.getId() ); + bizVarietyQuery.setVarietyName( bizVarietyQueryReqDto.getVarietyName() ); + bizVarietyQuery.setVarietyGrade( bizVarietyQueryReqDto.getVarietyGrade() ); + bizVarietyQuery.setParentId( bizVarietyQueryReqDto.getParentId() ); + bizVarietyQuery.setVarietyMaterial( bizVarietyQueryReqDto.getVarietyMaterial() ); + bizVarietyQuery.setDescription( bizVarietyQueryReqDto.getDescription() ); + bizVarietyQuery.setSort( bizVarietyQueryReqDto.getSort() ); + bizVarietyQuery.setStatus( bizVarietyQueryReqDto.getStatus() ); + bizVarietyQuery.setCreateTime( bizVarietyQueryReqDto.getCreateTime() ); + bizVarietyQuery.setUpdateTime( bizVarietyQueryReqDto.getUpdateTime() ); + + return bizVarietyQuery; + } +}