commit 65d34df79299ab179a3834203422ce47b0f85ac3 Author: wangyuxuan Date: Tue Dec 9 23:47:14 2025 +0800 Initial commit diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..3cd7ab6 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..6fdd523 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d31b37a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7b016a8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.compile.nullAnalysis.mode": "automatic" +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a821123 --- /dev/null +++ b/README.md @@ -0,0 +1,134 @@ +## 科技大脑展示平台(technological-brain) + +面向高校/企业的人才与科研信息管理与展示后端服务,基于 Spring Boot 构建,集成权限认证、参数配置、科研与成果管理等功能模块,并提供在线 API 文档。 + +### 技术栈 +- **后端框架**: Spring Boot 2.5.14, Spring MVC, Spring Security (JWT) +- **持久层**: MyBatis-Plus, MyBatis XML 映射 +- **数据库/连接池**: MySQL 8.x, Druid +- **缓存**: Redis (Lettuce) +- **对象映射**: MapStruct +- **工具库**: Hutool, Guava, Apache Commons +- **文档**: Springfox Swagger2 2.9.2, Knife4j +- **云存储**: 阿里云 OSS SDK + +### 目录结构(关键路径) +```text +src/ + main/ + java/com/CUST/brain/ + BrainApplication.java # 应用入口 + common/ # 通用配置、拦截器、异常、工具 + config/ # Security / Swagger / Redis 等配置 + security/ # JWT 过滤器、异常处理器 + dto/ enums/ utils/ ... + dao/ + domain/ # 实体对象 + mapper/ # MyBatis-Plus Mapper 接口 + service/ # 业务接口与实现 + web/controller/ # REST 控制器 + resources/ + application.yml # 应用配置 + mapper/*.xml # MyBatis 映射 XML + db/schema.sql # 库表结构初始化 + db/data.sql # 基础数据(菜单/用户/角色/参数等) +``` + +### 功能模块 +- **系统管理**: 用户、角色、权限、参数(类型/值) +- **人才管理**: 人才基本信息、工作单位(高校/企业)、履历、工作领域 +- **科研管理**: 科研项目、立项项目、科技报告 +- **成果管理**: 论文专著、专利、学术奖励、荣誉称号 + +以上模块的导航/菜单初始化见 `src/main/resources/db/data.sql`。 + +### 环境要求 +- JDK 1.8 +- Maven 3.6+ +- MySQL 8.x +- Redis 5+ + +### 快速开始 +1) 克隆并进入项目目录 +```bash +git clone +cd technological_brain +``` + +2) 配置数据库与中间件 +- 新建数据库 `technological_brain`(或使用自定义库名) +- 启动 Redis 服务 +- 根据实际环境修改 `src/main/resources/application.yml` 中的以下配置项(建议改为环境变量或外部化配置): + - spring.datasource.url / username / password + - spring.redis.host / port / password + - jwt.secret / expiration + - oss.endpoint / access-key-id / access-key-secret / bucket-name / domain + +3) 初始化数据库 +```sql +-- 执行库表结构 +src/main/resources/db/schema.sql + +-- 初始化菜单/用户/角色/参数等数据 +src/main/resources/db/data.sql +``` + +4) 启动服务 +```bash +mvn clean package -DskipTests +java -jar target/brain-1.0.0.jar +``` + +默认服务端口与上下文路径见 `application.yml`: +- 端口: 8090 +- 上下文: /brain + +因此应用根地址为: `http://localhost:8090/brain` + +### API 文档与调试 +- 文档入口: `http://localhost:8090/brain/doc.html` +- Swagger/Knife4j 可通过 `swagger.enable` 与 `knife4j.enable` 开关控制 +- 文档扫描基础包: `com.CUST.brain.web.controller` + +### 认证与授权 +- 统一认证接口(放行): `POST /api/system/auth/login` +- 其他接口默认需要认证,携带 JWT: + - Header: `Authorization: Bearer ` +- 安全配置参考 `common/config/SecurityConfig.java` + +### 配置说明(节选) +`src/main/resources/application.yml` 包含以下关键配置: +- **server**: `port`, `servlet.context-path` +- **spring.datasource**: Druid 数据源与连接池参数 +- **spring.redis**: Redis 连接与池参数 +- **mybatis-plus**: `mapper-locations`, `type-aliases-package`, 驼峰映射、逻辑删除 +- **logging**: 各包日志级别 +- **swagger/knife4j**: 文档开关与显示项 +- **jwt**: `secret`, `expiration`, `tokenHeader`, `tokenHead` +- **oss**: 阿里云 OSS 访问配置(请勿在仓库中明文提交敏感信息) + +> 安全提示:强烈建议将数据库、Redis、JWT、OSS 等敏感配置改为环境变量或外部化配置文件,避免明文泄露。 + +### 构建与部署 +- 构建命令:`mvn clean package -DskipTests` +- 运行命令:`java -jar target/brain-1.0.0.jar` +- 常用 JVM/运行参数: +```bash +java -Xms512m -Xmx1024m \ + -Dspring.profiles.active=prod \ + -Dserver.port=8090 \ + -jar target/brain-1.0.0.jar +``` + +### 常见问题 +- 文档页无法访问:确认 `swagger.enable=true`、`knife4j.enable=true`,并使用带有上下文路径的地址 `/brain/doc.html`。 +- 登录失败:检查初始化数据是否执行、用户密码是否匹配、JWT `secret` 是否与生成 token 的配置一致。 +- 数据源/Redis 连接失败:核对主机、端口、用户名密码与防火墙/容器网络。 + +### 版权与声明 +本项目仅用于教学/演示目的,涉及的账号、密钥配置请在实际部署前更换为安全的私有配置。 + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..8c0e0d3 --- /dev/null +++ b/pom.xml @@ -0,0 +1,337 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.5.14 + + + + com.CUST + brain + 1.0.0 + jar + brain + 科技大脑展示平台 + + + UTF-8 + UTF-8 + 1.8 + 1.8 + 1.8 + + + 2021.0.8 + 3.5.3.2 + 1.2.20 + 2.0.9 + 5.8.25 + 3.14.0 + 4.4 + 2.15.1 + 32.1.3-jre + 0.12.5 + 1.5.5.Final + 6.2.5.Final + 2.0.45 + 1.18.30 + 2.9.2 + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-actuator + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + mysql + mysql-connector-java + 8.0.33 + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + org.apache.commons + commons-pool2 + + + + cn.hutool + hutool-all + 5.8.20 + + + + + io.springfox + springfox-swagger2 + ${springfox.version} + + + io.springfox + springfox-swagger-ui + ${springfox.version} + + + com.github.xiaoymin + knife4j-spring-ui + 2.0.9 + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + commons-io + commons-io + ${commons-io.version} + + + com.google.guava + guava + ${guava.version} + + + com.alibaba.fastjson2 + fastjson2 + ${fastjson2.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + + io.jsonwebtoken + jjwt-api + 0.11.5 + + + io.jsonwebtoken + jjwt-impl + 0.11.5 + runtime + + + io.jsonwebtoken + jjwt-jackson + 0.11.5 + runtime + + + + + org.mapstruct + mapstruct + ${mapstruct.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + provided + + + + + org.hibernate.validator + hibernate-validator + + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + + com.aliyun.oss + aliyun-sdk-oss + 3.16.2 + + + + + + + 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} + + + + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + + aliyun + aliyun + https://maven.aliyun.com/repository/public + + true + + + false + + + + gitee-snapshots + Gitee Snapshots + https://gitee.com/xiaoym/knife4j/raw/master/repository + + false + + + true + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + + aliyun-plugin + aliyun-plugin + https://maven.aliyun.com/repository/public + + true + + + false + + + + \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/BrainApplication.java b/src/main/java/com/CUST/brain/BrainApplication.java new file mode 100644 index 0000000..4015fa3 --- /dev/null +++ b/src/main/java/com/CUST/brain/BrainApplication.java @@ -0,0 +1,18 @@ +package com.CUST.brain; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * 应用程序入口 + */ +@SpringBootApplication +@EnableTransactionManagement +@MapperScan("com.CUST.brain.dao.mapper") +public class BrainApplication { + public static void main(String[] args) { + SpringApplication.run(BrainApplication.class, args); + } +} diff --git a/src/main/java/com/CUST/brain/common/annotation/RedisCache.java b/src/main/java/com/CUST/brain/common/annotation/RedisCache.java new file mode 100644 index 0000000..5730a81 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/annotation/RedisCache.java @@ -0,0 +1,62 @@ +package com.CUST.brain.common.annotation; + +import com.CUST.brain.common.enums.CacheUpdateStrategy; +import java.lang.annotation.*; + +/** + * Redis缓存注解 + */ +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface RedisCache { + /** + * 缓存key前缀 + */ + String prefix() default ""; + + /** + * 缓存key + */ + String key() default ""; + + /** + * 缓存字段(用于Hash结构) + */ + String field() default ""; + + /** + * 过期时间(秒) + */ + int expire() default 3600; + + /** + * 是否使用Hash结构存储 + */ + boolean isHash() default false; + + /** + * 是否缓存null值 + */ + boolean cacheNull() default false; + + /** + * 缓存条件(SpEL表达式) + */ + String condition() default ""; + + /** + * 不缓存条件(SpEL表达式) + */ + String unless() default ""; + + /** + * 缓存更新策略 + */ + CacheUpdateStrategy updateStrategy() default CacheUpdateStrategy.UPDATE; + + /** + * 是否自动续期 + */ + boolean autoRenew() default false; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/api/CommonResult.java b/src/main/java/com/CUST/brain/common/api/CommonResult.java new file mode 100644 index 0000000..ad2d2a7 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/api/CommonResult.java @@ -0,0 +1,78 @@ +package com.CUST.brain.common.api; + +import lombok.Data; + +/** + * 通用返回结果 + */ +@Data +public class CommonResult { + private long code; + private String message; + private T data; + + protected CommonResult() { + } + + protected CommonResult(long code, String message, T data) { + this.code = code; + this.message = message; + this.data = data; + } + + /** + * 成功返回结果 + */ + public static CommonResult success(T data) { + return new CommonResult(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data); + } + + /** + * 成功返回结果 + */ + public static CommonResult success(T data, String message) { + return new CommonResult(ResultCode.SUCCESS.getCode(), message, data); + } + + /** + * 失败返回结果 + */ + public static CommonResult failed(String message) { + return new CommonResult(ResultCode.FAILED.getCode(), message, null); + } + + /** + * 失败返回结果 + */ + public static CommonResult failed() { + return failed(ResultCode.FAILED.getMessage()); + } + + /** + * 参数验证失败返回结果 + */ + public static CommonResult validateFailed(String message) { + return new CommonResult(ResultCode.VALIDATE_FAILED.getCode(), message, null); + } + + /** + * 未登录返回结果 + */ + public static CommonResult unauthorized(T data) { + return new CommonResult(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data); + } + + /** + * 未授权返回结果 + */ + public static CommonResult forbidden(T data) { + return new CommonResult(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data); + } + + /** + * 自定义返回结果 + */ + public static CommonResult custom(long code, String message, T data) { + return new CommonResult(code, message, data); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/api/IErrorCode.java b/src/main/java/com/CUST/brain/common/api/IErrorCode.java new file mode 100644 index 0000000..c6d2d12 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/api/IErrorCode.java @@ -0,0 +1,6 @@ +package com.CUST.brain.common.api; + +public interface IErrorCode { + Integer getCode(); + String getMessage(); +} diff --git a/src/main/java/com/CUST/brain/common/api/ResultCode.java b/src/main/java/com/CUST/brain/common/api/ResultCode.java new file mode 100644 index 0000000..4f2e9e2 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/api/ResultCode.java @@ -0,0 +1,28 @@ +package com.CUST.brain.common.api; + +/** + * 返回码枚举类 + */ +public enum ResultCode { + SUCCESS(200, "操作成功"), + FAILED(500, "操作失败"), + VALIDATE_FAILED(404, "参数检验失败"), + UNAUTHORIZED(401, "暂未登录或token已经过期"), + FORBIDDEN(403, "没有相关权限"); + + private long code; + private String message; + + private ResultCode(long code, String message) { + this.code = code; + this.message = message; + } + + public long getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/src/main/java/com/CUST/brain/common/aspect/RedisCacheAspect.java b/src/main/java/com/CUST/brain/common/aspect/RedisCacheAspect.java new file mode 100644 index 0000000..13b03ef --- /dev/null +++ b/src/main/java/com/CUST/brain/common/aspect/RedisCacheAspect.java @@ -0,0 +1,359 @@ +package com.CUST.brain.common.aspect; + +import com.CUST.brain.common.annotation.RedisCache; +import com.CUST.brain.common.enums.CacheUpdateStrategy; +import com.CUST.brain.common.constant.RedisKeyConstants; +import com.CUST.brain.common.exception.BusinessException; +import com.CUST.brain.common.utils.RedisUtils; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +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.expression.EvaluationContext; +import org.springframework.expression.ExpressionParser; +import org.springframework.expression.common.TemplateParserContext; +import org.springframework.expression.spel.standard.SpelExpressionParser; +import org.springframework.expression.spel.support.StandardEvaluationContext; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.lang.reflect.Method; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.lang.reflect.Type; +import com.fasterxml.jackson.core.type.TypeReference; + +/** + * Redis缓存切面 + */ +@Slf4j +@Aspect +@Component +public class RedisCacheAspect { + + @Resource + private RedisUtils redisUtils; + + @Resource + private ObjectMapper objectMapper; + + private static final ExpressionParser PARSER = new SpelExpressionParser(); + private static final String NULL_VALUE = "NULL_VALUE"; + private static final long DEFAULT_EXPIRE = 3600L; + private static final long LOCK_TIMEOUT = 10000L; + private static final String LOCK_PREFIX = "lock:"; + + @Around("@annotation(redisCache)") + public Object around(ProceedingJoinPoint pjp, RedisCache redisCache) throws Throwable { + // 1. 解析缓存key + String key = parseKey(pjp, redisCache.key()); + log.info("【RedisCache】开始处理缓存,原始key表达式={}, 解析后key={}", redisCache.key(), key); + + if (!StringUtils.hasText(key) || "cache:error".equals(key) || "cache:empty".equals(key)) { + log.warn("【RedisCache】无效的缓存key,直接执行目标方法,key={}", key); + return pjp.proceed(); + } + + // 2. 从 Redis 中获取缓存数据 + Object cachedValue = redisUtils.get(key); + log.info("【RedisCache】尝试获取缓存,key={}, 缓存值={}", key, cachedValue); + + if (cachedValue != null) { + log.info("【RedisCache】缓存命中,key={}, value={}", key, cachedValue); + // 自动反序列化为目标方法返回类型 + MethodSignature signature = (MethodSignature) pjp.getSignature(); + Class returnType = signature.getReturnType(); + Type genericReturnType = signature.getMethod().getGenericReturnType(); + try { + if (returnType == String.class) { + return cachedValue.toString(); + } else if (returnType == java.util.List.class || (cachedValue.toString().startsWith("[") && cachedValue.toString().endsWith("]"))) { + // 针对List类型自动反序列化 + return objectMapper.readValue(cachedValue.toString(), objectMapper.getTypeFactory().constructType(genericReturnType)); + } else if (cachedValue instanceof String) { + return objectMapper.readValue((String) cachedValue, returnType); + } else { + return cachedValue; + } + } catch (Exception e) { + log.error("【RedisCache】自动反序列化缓存失败,key={}, type={}, error={}", key, returnType, e.getMessage()); + throw new RuntimeException("缓存反序列化失败", e); + } + } + + // 3. 缓存未命中,使用分布式锁 + String lockKey = LOCK_PREFIX + key.replace("cache:", ""); + String lockValue = UUID.randomUUID().toString(); + + log.info("【RedisCache】缓存未命中,尝试获取分布式锁,lockKey={}, lockValue={}, timeout={}ms", + lockKey, lockValue, LOCK_TIMEOUT); + boolean lockAcquired = redisUtils.tryLock(lockKey, lockValue, LOCK_TIMEOUT, TimeUnit.MILLISECONDS); + + if (lockAcquired) { + try { + // 3.1 二次检查,避免缓存穿透 + cachedValue = redisUtils.get(key); + log.info("【RedisCache】获取锁后二次检查缓存,key={}, 缓存值={}", key, cachedValue); + + if (cachedValue != null) { + log.info("【RedisCache】二次检查缓存命中,key={}, value={}", key, cachedValue); + return cachedValue; + } + + // 3.2 执行目标方法,获取新数据 + log.info("【RedisCache】开始执行目标方法,key={}", key); + Object newValue = pjp.proceed(); + log.info("【RedisCache】目标方法执行完成,key={}, 新值={}", key, newValue); + + // 3.3 将新数据存入 Redis + if (newValue != null || redisCache.cacheNull()) { + redisUtils.set(key, newValue, redisCache.expire()); + log.info("【RedisCache】更新缓存成功,key={}, value={}, expire={}", key, newValue, redisCache.expire()); + } else { + log.info("【RedisCache】值为null且不缓存null,key={}", key); + } + + return newValue; + } finally { + // 3.4 释放分布式锁 + boolean unlocked = redisUtils.unlock(lockKey, lockValue); + log.info("【RedisCache】释放分布式锁,lockKey={}, lockValue={}, result={}", lockKey, lockValue, unlocked); + } + } else { + // 3.5 未获取到锁,采用自旋策略 + log.info("【RedisCache】未获取到锁,开始自旋重试,key={}", key); + int retryCount = 0; + int maxRetry = 3; + long retryInterval = 100; // 重试间隔,单位毫秒 + + while (retryCount < maxRetry) { + cachedValue = redisUtils.get(key); + log.info("【RedisCache】自旋重试获取缓存,key={}, 重试次数={}, 缓存值={}", key, retryCount, cachedValue); + + if (cachedValue != null) { + log.info("【RedisCache】自旋重试后缓存命中,key={}, value={}, retryCount={}", key, cachedValue, retryCount); + return cachedValue; + } + + try { + Thread.sleep(retryInterval); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + log.warn("【RedisCache】自旋等待被中断,key={}, retryCount={}", key, retryCount); + throw new BusinessException(500, "缓存操作被中断,请稍后重试"); + } + + retryCount++; + } + + // 3.6 自旋重试后仍未命中,执行目标方法 + log.info("【RedisCache】自旋重试后仍未命中,开始执行目标方法,key={}", key); + Object newValue = pjp.proceed(); + log.info("【RedisCache】目标方法执行完成,key={}, 新值={}", key, newValue); + + if (newValue != null || redisCache.cacheNull()) { + redisUtils.set(key, newValue, redisCache.expire()); + log.info("【RedisCache】更新缓存成功,key={}, value={}, expire={}", key, newValue, redisCache.expire()); + } else { + log.info("【RedisCache】值为null且不缓存null,key={}", key); + } + + return newValue; + } + } + + /** + * 解析缓存key + */ + private String parseKey(ProceedingJoinPoint pjp, String keyExpression) { + if (!StringUtils.hasText(keyExpression)) { + log.warn("【RedisCache】key表达式为空"); + return "cache:empty"; + } + + // 如果keyExpression不包含SpEL表达式,直接返回 + if (!keyExpression.contains("#")) { + return "cache:" + keyExpression; + } + + // 使用SpEL解析 + ExpressionParser parser = new SpelExpressionParser(); + StandardEvaluationContext context = new StandardEvaluationContext(); + Object[] args = pjp.getArgs(); + MethodSignature signature = (MethodSignature) pjp.getSignature(); + String[] paramNames = signature.getParameterNames(); + + // 支持参数名和#p0两种方式 + for (int i = 0; i < args.length; i++) { + Object arg = args[i]; + if (arg != null) { + // 如果是复杂对象,转换为JSON字符串 + if (!(arg instanceof String) && !(arg instanceof Number) && !(arg instanceof Boolean)) { + try { + arg = objectMapper.writeValueAsString(arg); + } catch (JsonProcessingException e) { + log.warn("【RedisCache】参数序列化失败,使用toString(),arg={}", arg); + arg = String.valueOf(arg); + } + } + // 同时支持参数名和#p0两种方式 + if (paramNames != null && i < paramNames.length) { + context.setVariable(paramNames[i], arg); + } + context.setVariable("p" + i, arg); + } + } + + try { + log.debug("【RedisCache】开始解析SpEL表达式,原始表达式={}", keyExpression); + // 直接使用SpEL解析,不使用TemplateParserContext + String parsedKey = parser.parseExpression(keyExpression).getValue(context, String.class); + if (parsedKey == null) { + log.warn("【RedisCache】SpEL表达式解析结果为空,keyExpression={}", keyExpression); + return "cache:null"; + } + + // 清理和规范化key + parsedKey = parsedKey.trim(); + // 移除多余的下划线 + parsedKey = parsedKey.replaceAll("_+", "_"); + // 移除开头和结尾的下划线 + parsedKey = parsedKey.replaceAll("^_+|_+$", ""); + // 确保key不包含特殊字符 + parsedKey = parsedKey.replaceAll("[^a-zA-Z0-9_:.-]", "_"); + + // 如果key为空,返回默认值 + if (!StringUtils.hasText(parsedKey)) { + log.warn("【RedisCache】SpEL表达式解析结果为空字符串,keyExpression={}", keyExpression); + return "cache:empty"; + } + + log.debug("【RedisCache】SpEL表达式解析成功,keyExpression={},解析结果={}", keyExpression, parsedKey); + return "cache:" + parsedKey; + } catch (Exception e) { + log.error("【RedisCache】SpEL表达式解析失败,keyExpression={},错误信息={}", keyExpression, e.getMessage()); + return "cache:error"; + } + } + + /** + * 检查条件 + */ + private boolean checkCondition(ProceedingJoinPoint point, String condition) { + if (!StringUtils.hasText(condition)) { + return true; + } + try { + EvaluationContext context = new StandardEvaluationContext(point.getArgs()); + return Boolean.TRUE.equals(PARSER.parseExpression(condition).getValue(context, Boolean.class)); + } catch (Exception e) { + log.error("解析条件表达式失败: {}", condition, e); + return false; + } + } + + /** + * 获取缓存值 + */ + private Object getCacheValue(String key, RedisCache redisCache) { + try { + if (redisCache.isHash() && StringUtils.hasText(redisCache.field())) { + Object value = redisUtils.hGet(key, redisCache.field(), String.class); + return parseValue(value); + } else { + Object value = redisUtils.get(key); + return parseValue(value); + } + } catch (Exception e) { + log.error("获取缓存值失败: {}", key, e); + return null; + } + } + + /** + * 解析缓存值 + */ + private Object parseValue(Object value) { + if (value == null) { + return null; + } + if (value instanceof String && NULL_VALUE.equals(value)) { + return null; + } + return value; + } + + /** + * 更新缓存 + */ + private void updateCache(String key, Object value, RedisCache redisCache) { + try { + if (value == null && !redisCache.cacheNull()) { + return; + } + + long expire = redisCache.expire() > 0 ? redisCache.expire() : DEFAULT_EXPIRE; + + // 确保key是字符串类型 + String safeKey = String.valueOf(key); + // 确保field是字符串类型 + String safeField = StringUtils.hasText(redisCache.field()) ? String.valueOf(redisCache.field()) : null; + // 确保value是字符串类型 + String safeValue; + if (value == null) { + safeValue = NULL_VALUE; + } else if (value instanceof String) { + safeValue = (String) value; + } else { + try { + safeValue = objectMapper.writeValueAsString(value); + } catch (JsonProcessingException e) { + log.warn("【RedisCache】值序列化失败,使用toString(),value={}", value); + safeValue = String.valueOf(value); + } + } + + log.debug("【RedisCache】更新缓存,key={}, field={}, value={}, expire={}", safeKey, safeField, safeValue, expire); + + switch (redisCache.updateStrategy()) { + case UPDATE: + if (redisCache.isHash() && safeField != null) { + redisUtils.hSet(safeKey, safeField, safeValue, expire, TimeUnit.SECONDS); + } else { + redisUtils.set(safeKey, safeValue, expire); + } + break; + case DELETE: + if (redisCache.isHash() && safeField != null) { + redisUtils.hDelete(safeKey, safeField); + } else { + redisUtils.delete(safeKey); + } + break; + case IGNORE: + log.debug("【RedisCache】忽略缓存更新,key={}", safeKey); + break; + } + + // 自动续期 + if (redisCache.autoRenew() && value != null) { + scheduleRenew(safeKey, redisCache); + } + } catch (Exception e) { + log.error("【RedisCache】更新缓存失败,key={}, error={}", key, e.getMessage()); + } + } + + /** + * 定时续期 + */ + private void scheduleRenew(String key, RedisCache redisCache) { + // 这里可以使用定时任务框架(如Quartz)来实现续期 + // 为了简单起见,这里只是记录日志 + log.info("缓存自动续期: {}, expire: {}", key, redisCache.expire()); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/cache/ParamCacheManager.java b/src/main/java/com/CUST/brain/common/cache/ParamCacheManager.java new file mode 100644 index 0000000..4a7b4a3 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/cache/ParamCacheManager.java @@ -0,0 +1,148 @@ +package com.CUST.brain.common.cache; + +import com.CUST.brain.common.enums.ParamTypeEnum; +import com.CUST.brain.dao.domain.system.SysParam; +import com.CUST.brain.service.SysParamService; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; +import org.springframework.context.annotation.Lazy; +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 参数缓存管理器 + */ +@Component +public class ParamCacheManager { + + @Resource(name = "paramRedisTemplate") + private RedisTemplate redisTemplate; + + @Resource + @Lazy + private SysParamService sysParamService; + + private static final String PARAM_CACHE_KEY = "sys:param:type:"; + private static final String PARAM_LIST_CACHE_KEY = "sys:param:list:"; + + /** + * 服务启动时初始化参数缓存 + */ + @PostConstruct + public void init() { + // 获取所有参数类型 + List typeCodes = Arrays.stream(ParamTypeEnum.values()) + .map(ParamTypeEnum::getCode) + .collect(Collectors.toList()); + + // 批量获取所有参数 + Map> paramMap = sysParamService.getParamsByTypes(typeCodes); + + // 更新缓存 + paramMap.forEach(this::cacheParamList); + } + + /** + * 缓存参数列表 + */ + public void cacheParamList(String typeCode, List params) { + if (params != null) { + redisTemplate.opsForValue().set(PARAM_LIST_CACHE_KEY + typeCode, params); + + // 缓存参数Map + Map paramValueMap = params.stream() + .collect(Collectors.toMap( + SysParam::getParamName, + SysParam::getParamValue, + (v1, v2) -> v1 + )); + redisTemplate.opsForValue().set(PARAM_CACHE_KEY + typeCode, paramValueMap); + } + } + + /** + * 获取参数列表 + */ + @SuppressWarnings("unchecked") + public List getParamList(String typeCode) { + Object cached; + try { + cached = redisTemplate.opsForValue().get(PARAM_LIST_CACHE_KEY + typeCode); + } catch (RuntimeException e) { + // 兼容历史序列化格式不一致导致的反序列化失败 + removeParamCache(typeCode); + return null; + } + if (cached == null) { + return null; + } + if (cached instanceof List) { + List rawList = (List) cached; + if (rawList.isEmpty() || rawList.get(0) instanceof SysParam) { + return (List) cached; + } + if (rawList.get(0) instanceof Map) { + // 兼容历史缓存中以 LinkedHashMap 形式存储的对象 + List converted = new ArrayList<>(rawList.size()); + for (Object item : rawList) { + if (!(item instanceof Map)) { + continue; + } + Map map = (Map) item; + SysParam p = new SysParam(); + Object v; + if ((v = map.get("paramType")) != null) p.setParamType(String.valueOf(v)); + if ((v = map.get("paramName")) != null) p.setParamName(String.valueOf(v)); + if ((v = map.get("paramValue")) != null) p.setParamValue(String.valueOf(v)); + if ((v = map.get("dataType")) != null) p.setDataType(String.valueOf(v)); + if ((v = map.get("sortOrder")) != null) p.setSortOrder(v instanceof Number ? ((Number) v).intValue() : null); + if ((v = map.get("status")) != null) p.setStatus(v instanceof Number ? ((Number) v).intValue() : null); + if ((v = map.get("remark")) != null) p.setRemark(String.valueOf(v)); + converted.add(p); + } + // 回写成强类型,避免后续再转换 + cacheParamList(typeCode, converted); + return converted; + } + } + // 类型不匹配时直接清理,避免 ClassCastException 重现 + removeParamCache(typeCode); + return null; + } + + /** + * 获取参数Map + */ + @SuppressWarnings("unchecked") + public Map getParamMap(String typeCode) { + return (Map) redisTemplate.opsForValue().get(PARAM_CACHE_KEY + typeCode); + } + + /** + * 删除参数缓存 + */ + public void removeParamCache(String typeCode) { + redisTemplate.delete(PARAM_LIST_CACHE_KEY + typeCode); + redisTemplate.delete(PARAM_CACHE_KEY + typeCode); + } + + /** + * 删除所有参数缓存 + */ + public void removeAllParamCache() { + Arrays.stream(ParamTypeEnum.values()) + .map(ParamTypeEnum::getCode) + .forEach(this::removeParamCache); + // 兜底:直接删除所有匹配 key,防止新增类型遗漏 + Set keys1 = redisTemplate.keys(PARAM_LIST_CACHE_KEY + "*"); + if (keys1 != null && !keys1.isEmpty()) { + redisTemplate.delete(keys1); + } + Set keys2 = redisTemplate.keys(PARAM_CACHE_KEY + "*"); + if (keys2 != null && !keys2.isEmpty()) { + redisTemplate.delete(keys2); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/config/MyMetaObjectHandler.java b/src/main/java/com/CUST/brain/common/config/MyMetaObjectHandler.java new file mode 100644 index 0000000..d9b07d2 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/config/MyMetaObjectHandler.java @@ -0,0 +1,28 @@ +package com.CUST.brain.common.config; + +import com.CUST.brain.common.utils.SecurityUtils; +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import org.apache.ibatis.reflection.MetaObject; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; + +@Component +public class MyMetaObjectHandler implements MetaObjectHandler { + + @Override + public void insertFill(MetaObject metaObject) { + this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now()); + this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); + String userName = SecurityUtils.getCurrentUsername(); + this.strictInsertFill(metaObject, "createBy", String.class, userName); + this.strictInsertFill(metaObject, "updateBy", String.class, userName); + } + + @Override + public void updateFill(MetaObject metaObject) { + this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); + String userName = SecurityUtils.getCurrentUsername(); + this.strictUpdateFill(metaObject, "updateBy", String.class, userName); + } +} diff --git a/src/main/java/com/CUST/brain/common/config/OssProperties.java b/src/main/java/com/CUST/brain/common/config/OssProperties.java new file mode 100644 index 0000000..9ceab68 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/config/OssProperties.java @@ -0,0 +1,15 @@ +package com.CUST.brain.common.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Data +@Component +@ConfigurationProperties(prefix = "oss") +public class OssProperties { + private String endpoint; + private String accessKeyId; + private String accessKeySecret; + private String bucketName; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/config/RedisConfig.java b/src/main/java/com/CUST/brain/common/config/RedisConfig.java new file mode 100644 index 0000000..eed9219 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/config/RedisConfig.java @@ -0,0 +1,110 @@ +package com.CUST.brain.common.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; +import com.fasterxml.jackson.databind.SerializationFeature; +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +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.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import java.time.Duration; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +@Configuration +@EnableCaching +public class RedisConfig { + + public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; + public static final LocalDateTimeSerializer LOCAL_DATE_TIME_SERIALIZER = + new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)); + + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory factory) { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(factory); + + // 使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值 + Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer<>(Object.class); + ObjectMapper mapper = new ObjectMapper(); + mapper.registerModule(new JavaTimeModule()); // 支持Java8时间类型 + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL); + serializer.setObjectMapper(mapper); + + // 使用StringRedisSerializer来序列化和反序列化redis的key值 + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(serializer); + + // Hash的key也采用StringRedisSerializer的序列化方式 + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(serializer); + + template.afterPropertiesSet(); + return template; + } + + @Bean + public CacheManager cacheManager(RedisConnectionFactory factory) { + Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer<>(Object.class); + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL); + // 统一时间格式 + JavaTimeModule javaTimeModule = new JavaTimeModule(); + javaTimeModule.addSerializer(LocalDateTime.class, LOCAL_DATE_TIME_SERIALIZER); + mapper.registerModule(javaTimeModule); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + serializer.setObjectMapper(mapper); + + RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() + .entryTtl(Duration.ofDays(1)) + .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer())) + .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(serializer)) + .disableCachingNullValues(); + + return RedisCacheManager.builder(factory) + .cacheDefaults(config) + .transactionAware() + .build(); + } + + @Bean("paramRedisTemplate") + public RedisTemplate paramRedisTemplate(RedisConnectionFactory factory) { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(factory); + + // 使用带 JavaTimeModule 的 GenericJackson2JsonRedisSerializer 兼容 LocalDateTime + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + JavaTimeModule javaTimeModule = new JavaTimeModule(); + javaTimeModule.addSerializer(LocalDateTime.class, LOCAL_DATE_TIME_SERIALIZER); + javaTimeModule.addDeserializer(LocalDateTime.class, + new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT))); + mapper.registerModule(javaTimeModule); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + GenericJackson2JsonRedisSerializer genericSerializer = new GenericJackson2JsonRedisSerializer(mapper); + + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(genericSerializer); + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(genericSerializer); + + template.afterPropertiesSet(); + return template; + } +} diff --git a/src/main/java/com/CUST/brain/common/config/RedisConfig.java~ b/src/main/java/com/CUST/brain/common/config/RedisConfig.java~ new file mode 100644 index 0000000..b80c3b3 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/config/RedisConfig.java~ @@ -0,0 +1,95 @@ +package com.CUST.brain.common.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import java.time.Duration; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +@Configuration +@EnableCaching +public class RedisConfig { + + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory factory) { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(factory); + + // 使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值 + Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer<>(Object.class); + ObjectMapper mapper = new ObjectMapper(); + mapper.registerModule(new JavaTimeModule()); // 支持Java8时间类型 + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); +// mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL); + serializer.setObjectMapper(mapper); + + // 使用StringRedisSerializer来序列化和反序列化redis的key值 + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(serializer); + + // Hash的key也采用StringRedisSerializer的序列化方式 + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(serializer); + + template.afterPropertiesSet(); + return template; + } + + @Bean + public RedisCacheManager redisCacheManager(RedisConnectionFactory factory) { + // 使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值 + Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer<>(Object.class); + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); +// mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL); + serializer.setObjectMapper(mapper); + + // 配置序列化 + RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() + // 缓存有效期1天 + .entryTtl(Duration.ofDays(1)) + // 使用StringRedisSerializer来序列化和反序列化redis的key值 + .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer())) + // 使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值 + .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(serializer)) + // 禁用空值 + .disableCachingNullValues(); + + return RedisCacheManager.builder(factory) + .cacheDefaults(config) + .transactionAware() + .build(); + } + + @Bean("paramRedisTemplate") + public RedisTemplate paramRedisTemplate(RedisConnectionFactory factory) { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(factory); + + Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer<>(Object.class); + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + // 不加activateDefaultTyping + serializer.setObjectMapper(mapper); + + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(serializer); + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(serializer); + + template.afterPropertiesSet(); + return template; + } +} diff --git a/src/main/java/com/CUST/brain/common/config/SecurityConfig.java b/src/main/java/com/CUST/brain/common/config/SecurityConfig.java new file mode 100644 index 0000000..5d637c3 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/config/SecurityConfig.java @@ -0,0 +1,59 @@ +package com.CUST.brain.common.config; + +import com.CUST.brain.common.security.filter.JwtAuthenticationTokenFilter; +import com.CUST.brain.common.security.handler.RestAuthenticationEntryPoint; +import com.CUST.brain.common.security.handler.RestfulAccessDeniedHandler; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +import javax.annotation.Resource; + +/** + * Spring Security配置 + */ +@Configuration +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled = true) +public class SecurityConfig { + + @Resource + private RestfulAccessDeniedHandler restfulAccessDeniedHandler; + + @Resource + private RestAuthenticationEntryPoint restAuthenticationEntryPoint; + + @Resource + private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter; + + @Bean + public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { + return authenticationConfiguration.getAuthenticationManager(); + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http.csrf().disable() + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .authorizeRequests() + .antMatchers("/api/system/auth/login").permitAll() + .antMatchers("/doc.html", "/webjars/**", "/swagger-resources/**", "/v2/api-docs").permitAll() + .anyRequest().authenticated(); + + http.exceptionHandling() + .accessDeniedHandler(restfulAccessDeniedHandler) + .authenticationEntryPoint(restAuthenticationEntryPoint); + + http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); + + return http.build(); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/config/SwaggerConfig.java b/src/main/java/com/CUST/brain/common/config/SwaggerConfig.java new file mode 100644 index 0000000..5787cc0 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/config/SwaggerConfig.java @@ -0,0 +1,52 @@ +package com.CUST.brain.common.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +@EnableSwagger2 +public class SwaggerConfig { + @Value("${swagger.enable}") + private boolean enableSwagger; + + @Value("${swagger.title}") + private String title; + + @Value("${swagger.description}") + private String description; + + @Value("${swagger.version}") + private String version; + + @Value("${swagger.base-package}") + private String basePackage; + + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .enable(enableSwagger) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage(basePackage)) + .paths(PathSelectors.any()) + .build(); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title(title) + .description(description) + .version(version) + .contact(new Contact("CUST", "http://www.cust.edu.cn", "support@cust.edu.cn")) + .build(); + } +} diff --git a/src/main/java/com/CUST/brain/common/constant/RedisKeyConstants.java b/src/main/java/com/CUST/brain/common/constant/RedisKeyConstants.java new file mode 100644 index 0000000..3da9485 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/constant/RedisKeyConstants.java @@ -0,0 +1,132 @@ +package com.CUST.brain.common.constant; + +/** + * Redis缓存key常量 + */ +public class RedisKeyConstants { + + /** + * 用户相关缓存key前缀 + */ + public static final String USER_PREFIX = "user:"; + + /** + * 用户token缓存key + */ + public static final String USER_TOKEN = USER_PREFIX + "token:%s"; + + /** + * 用户信息缓存key + */ + public static final String USER_INFO = USER_PREFIX + "info:"; + + /** + * 用户角色缓存key + */ + public static final String USER_ROLES = USER_PREFIX + "roles:"; + + /** + * 用户权限缓存key + */ + public static final String USER_PERMISSIONS = USER_PREFIX + "permissions:"; + + /** + * 系统相关缓存key前缀 + */ + public static final String SYS_PREFIX = "sys:"; + + /** + * 系统用户缓存key + */ + public static final String SYS_USER = SYS_PREFIX + "user:"; + + /** + * 系统角色缓存key + */ + public static final String SYS_ROLE = SYS_PREFIX + "role:"; + + /** + * 系统权限缓存key + */ + public static final String SYS_PERMISSION = SYS_PREFIX + "permission:"; + + /** + * 分布式锁key前缀 + */ + public static final String LOCK_PREFIX = "lock:"; + + /** + * 验证码缓存key前缀 + */ + public static final String CAPTCHA_PREFIX = "captcha:"; + + /** + * 限流缓存key前缀 + */ + public static final String RATE_LIMIT_PREFIX = "rate:limit:"; + + /** + * 业务相关缓存key前缀 + */ + public static final String BUSINESS_PREFIX = "business:"; + + /** + * 人才信息缓存key + */ + public static final String TALENT_INFO = BUSINESS_PREFIX + "talent:info:"; + + /** + * 企业信息缓存key + */ + public static final String ENTERPRISE_INFO = BUSINESS_PREFIX + "enterprise:info:"; + + /** + * 项目信息缓存key + */ + public static final String PROJECT_INFO = BUSINESS_PREFIX + "project:info:"; + + /** + * 系统参数相关 + */ + public static final String PARAM_TYPE = SYS_PREFIX + "param:type:"; + public static final String PARAM_VALUES = SYS_PREFIX + "param:values:"; + public static final String PARAM_LIST = SYS_PREFIX + "param:list:"; + + /** + * 角色权限相关 + */ + public static final String ROLE_PERMISSIONS = SYS_ROLE + "permissions:%s"; + public static final String ROLE_INFO = SYS_ROLE + "info:%s"; + public static final String PERMISSION_INFO = SYS_PERMISSION + "info:%s"; + + /** + * 人才信息相关 + */ + public static final String TALENT_BASIC = BUSINESS_PREFIX + "basic:%s"; + public static final String TALENT_LIST = BUSINESS_PREFIX + "list:%s"; + public static final String TALENT_UNIT = BUSINESS_PREFIX + "unit:%s"; + + /** + * 项目相关 + */ + public static final String PROJECT_LIST = BUSINESS_PREFIX + "list:%s"; + + /** + * 系统配置 + */ + public static final String SYS_CONFIG = SYS_PREFIX + "config:%s"; + + /** + * 用户菜单缓存前缀 + */ + public static final String USER_MENUS = USER_PREFIX + "menus:"; + + /** + * Token黑名单前缀 + */ + public static final String TOKEN_BLACKLIST = USER_PREFIX + "token:blacklist:"; + + private RedisKeyConstants() { + throw new IllegalStateException("Constant class"); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/dto/system/AssignRoleRequestDTO.java b/src/main/java/com/CUST/brain/common/dto/system/AssignRoleRequestDTO.java new file mode 100644 index 0000000..1d7289d --- /dev/null +++ b/src/main/java/com/CUST/brain/common/dto/system/AssignRoleRequestDTO.java @@ -0,0 +1,15 @@ +package com.CUST.brain.common.dto.system; + +import java.util.List; + +public class AssignRoleRequestDTO { + + private String userId; + private List roleIds; + + // getter/setter + public String getUserId() { return userId; } + public void setUserId(String userId) { this.userId = userId; } + public List getRoleIds() { return roleIds; } + public void setRoleIds(List roleIds) { this.roleIds = roleIds; } +} diff --git a/src/main/java/com/CUST/brain/common/dto/system/LoginRequestDTO.java b/src/main/java/com/CUST/brain/common/dto/system/LoginRequestDTO.java new file mode 100644 index 0000000..0409527 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/dto/system/LoginRequestDTO.java @@ -0,0 +1,27 @@ +package com.CUST.brain.common.dto.system; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 登录请求DTO + */ +@Data +public class LoginRequestDTO { + /** + * 用户名 + */ + @NotBlank(message = "用户名不能为空") + private String username; + + /** + * 密码 + */ + @NotBlank(message = "密码不能为空") + private String password; + + @ApiModelProperty(value = "登录类型:1-展示端,2-后台", required = true, example = "2") + private Integer loginType; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/dto/system/LoginResponseDTO.java b/src/main/java/com/CUST/brain/common/dto/system/LoginResponseDTO.java new file mode 100644 index 0000000..39268a6 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/dto/system/LoginResponseDTO.java @@ -0,0 +1,41 @@ +package com.CUST.brain.common.dto.system; + +import lombok.Data; + +import java.util.List; + +/** + * 登录响应DTO + */ +@Data +public class LoginResponseDTO { + /** + * 用户ID + */ + private String userId; + + /** + * 用户名 + */ + private String username; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 访问令牌 + */ + private String token; + + /** + * 角色列表 + */ + private List roles; + + /** + * 权限列表 + */ + private List permissions; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/dto/system/MenuResponseDTO.java b/src/main/java/com/CUST/brain/common/dto/system/MenuResponseDTO.java new file mode 100644 index 0000000..eb01b33 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/dto/system/MenuResponseDTO.java @@ -0,0 +1,56 @@ +package com.CUST.brain.common.dto.system; + +import lombok.Data; + +import java.util.List; + +/** + * 菜单响应DTO + */ +@Data +public class MenuResponseDTO { + /** + * 菜单ID + */ + private String id; + + /** + * 父菜单ID + */ + private String parentId; + + /** + * 菜单名称 + */ + private String name; + + /** + * 菜单编码 + */ + private String code; + + /** + * 菜单路径 + */ + private String path; + + /** + * 菜单图标 + */ + private String icon; + + /** + * 菜单类型(1-目录,2-菜单,3-按钮) + */ + private Integer type; + + /** + * 排序 + */ + private Integer sort; + + /** + * 子菜单 + */ + private List children; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/dto/system/PermissionTreeVO.java b/src/main/java/com/CUST/brain/common/dto/system/PermissionTreeVO.java new file mode 100644 index 0000000..37ce16b --- /dev/null +++ b/src/main/java/com/CUST/brain/common/dto/system/PermissionTreeVO.java @@ -0,0 +1,24 @@ +package com.CUST.brain.common.dto.system; + +import lombok.Data; + +import java.util.List; + +/** + * 角色对应权限列表DTO + */ +@Data +public class PermissionTreeVO { + + private String id; + private String permissionName; + private String permissionCode; + private Integer permissionType; + private String parentId; + private String path; + private String component; + private String icon; + private Integer sort; + private Integer status; // 角色下该权限的启用状态(1-启用,0-禁用,null-未分配) + private List children; +} diff --git a/src/main/java/com/CUST/brain/common/dto/system/SysRoleRequestDTO.java b/src/main/java/com/CUST/brain/common/dto/system/SysRoleRequestDTO.java new file mode 100644 index 0000000..087b3a0 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/dto/system/SysRoleRequestDTO.java @@ -0,0 +1,65 @@ +package com.CUST.brain.common.dto.system; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * 系统角色请求DTO + */ +@Data +@ApiModel(description = "系统角色请求参数") +public class SysRoleRequestDTO { + /** + * 角色ID + */ + @ApiModelProperty(value = "角色ID", example = "1") + private String id; + + /** + * 角色名称 + */ + @NotBlank(message = "角色名称不能为空") + @Size(max = 50, message = "角色名称长度不能超过50个字符") + @ApiModelProperty(value = "角色名称", required = true, example = "管理员") + private String roleName; + + /** + * 角色编码 + */ + @NotBlank(message = "角色编码不能为空") + @Size(max = 50, message = "角色编码长度不能超过50个字符") + @ApiModelProperty(value = "角色编码", required = true, example = "ADMIN") + private String roleCode; + + /** + * 角色描述 + */ + @Size(max = 200, message = "角色描述长度不能超过200个字符") + @ApiModelProperty(value = "角色描述", example = "系统管理员角色") + private String roleDesc; + + /** + * 登录类型:1-仅展示端,2-展示端和后台 + */ + @NotNull(message = "登录类型不能为空") + @ApiModelProperty(value = "登录类型:1-仅展示端,2-展示端和后台", required = true, example = "2") + private Integer loginType; + + /** + * 排序 + */ + @ApiModelProperty(value = "排序", example = "1") + private Integer sort; + + /** + * 状态:0-禁用,1-启用 + */ + @NotNull(message = "状态不能为空") + @ApiModelProperty(value = "状态:0-禁用,1-启用", required = true, example = "1") + private Integer status; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/dto/system/SysRoleResponseDTO.java b/src/main/java/com/CUST/brain/common/dto/system/SysRoleResponseDTO.java new file mode 100644 index 0000000..43a413c --- /dev/null +++ b/src/main/java/com/CUST/brain/common/dto/system/SysRoleResponseDTO.java @@ -0,0 +1,56 @@ +package com.CUST.brain.common.dto.system; + +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * 系统角色响应DTO + */ +@Data +public class SysRoleResponseDTO { + /** + * 角色ID + */ + private Long id; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 角色编码 + */ + private String roleCode; + + /** + * 角色描述 + */ + private String roleDesc; + + /** + * 登录类型:1-仅展示端,2-展示端和后台 + */ + private Integer loginType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 状态:0-禁用,1-启用 + */ + private Integer status; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime updateTime; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/dto/system/UpdateRolePermissionsRequestDTO.java b/src/main/java/com/CUST/brain/common/dto/system/UpdateRolePermissionsRequestDTO.java new file mode 100644 index 0000000..3b19a19 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/dto/system/UpdateRolePermissionsRequestDTO.java @@ -0,0 +1,18 @@ +package com.CUST.brain.common.dto.system; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +/** + * 更新角色权限请求DTO + */ +@Data +public class UpdateRolePermissionsRequestDTO { + + @NotBlank(message = "角色ID不能为空") + private String roleId; + + private List permissionIds; +} diff --git a/src/main/java/com/CUST/brain/common/dto/system/UserInfoResponseDTO.java b/src/main/java/com/CUST/brain/common/dto/system/UserInfoResponseDTO.java new file mode 100644 index 0000000..04389dd --- /dev/null +++ b/src/main/java/com/CUST/brain/common/dto/system/UserInfoResponseDTO.java @@ -0,0 +1,66 @@ +package com.CUST.brain.common.dto.system; + +import lombok.Data; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 用户信息响应DTO + */ +@Data +public class UserInfoResponseDTO { + /** + * 用户ID + */ + private String userId; + + /** + * 用户名 + */ + private String username; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 手机号 + */ + private String phone; + + /** + * 邮箱 + */ + private String email; + + /** + * 状态(0-禁用,1-启用) + */ + private Integer status; + + /** + * 最后登录时间 + */ + private LocalDateTime lastLoginTime; + + /** + * 最后登录IP + */ + private String lastLoginIp; + + /** + * 用户角色列表 + */ + private List roles; + + /** + * 用户权限列表 + */ + private List permissions; + + /** + * 用户菜单列表 + */ + private List menus; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/enums/CacheUpdateStrategy.java b/src/main/java/com/CUST/brain/common/enums/CacheUpdateStrategy.java new file mode 100644 index 0000000..f95c64d --- /dev/null +++ b/src/main/java/com/CUST/brain/common/enums/CacheUpdateStrategy.java @@ -0,0 +1,21 @@ +package com.CUST.brain.common.enums; + +/** + * 缓存更新策略枚举 + */ +public enum CacheUpdateStrategy { + /** + * 更新缓存 + */ + UPDATE, + + /** + * 删除缓存 + */ + DELETE, + + /** + * 忽略缓存 + */ + IGNORE +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/enums/EducationEnum.java b/src/main/java/com/CUST/brain/common/enums/EducationEnum.java new file mode 100644 index 0000000..5efa894 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/enums/EducationEnum.java @@ -0,0 +1,65 @@ +package com.CUST.brain.common.enums; + +import lombok.Getter; + +/** + * 学历枚举 + */ +@Getter +public enum EducationEnum { + + /** + * 博士 + */ + DOCTOR("DOCTOR", "博士", "1", 1), + + /** + * 硕士 + */ + MASTER("MASTER", "硕士", "2", 2), + + /** + * 本科 + */ + BACHELOR("BACHELOR", "本科", "3", 3), + + /** + * 专科 + */ + COLLEGE("COLLEGE", "专科", "4", 4), + + /** + * 其他 + */ + OTHER("OTHER", "其他", "5", 5); + + private final String code; + private final String name; + private final String value; + private final Integer sort; + + EducationEnum(String code, String name, String value, Integer sort) { + this.code = code; + this.name = name; + this.value = value; + this.sort = sort; + } + + public static EducationEnum getByCode(String code) { + for (EducationEnum education : values()) { + if (education.getCode().equals(code)) { + return education; + } + } + return null; + } + + public static EducationEnum getByValue(String value) { + for (EducationEnum education : values()) { + if (education.getValue().equals(value)) { + return education; + } + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/enums/ParamTypeEnum.java b/src/main/java/com/CUST/brain/common/enums/ParamTypeEnum.java new file mode 100644 index 0000000..8886290 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/enums/ParamTypeEnum.java @@ -0,0 +1,157 @@ +package com.CUST.brain.common.enums; + +import lombok.Getter; + +/** + * 参数类型枚举 + */ +@Getter +public enum ParamTypeEnum { + + /** + * 性别 + */ + SEX("SEX", "性别"), + + /** + * 学历 + */ + EDUCATION("EDUCATION", "学历"), + + /** + * 职称 + */ + TITLE("TITLE", "职称"), + + /** + * 政治面貌 + */ + POLITICAL_STATUS("POLITICAL_STATUS", "政治面貌"), + + /** + * 民族 + */ + ETHNICITY("ETHNICITY", "民族"), + + /** + * 婚姻状况 + */ + MARITAL_STATUS("MARITAL_STATUS", "婚姻状况"), + + /** + * 健康状况 + */ + HEALTH_STATUS("HEALTH_STATUS", "健康状况"), + + /** + * 工作状态 + */ + WORK_STATUS("WORK_STATUS", "工作状态"), + + /** + * 项目类型 + */ + PROJECT_TYPE("PROJECT_TYPE", "项目类型"), + + /** + * 项目级别 + */ + PROJECT_LEVEL("PROJECT_LEVEL", "项目级别"), + + /** + * 项目状态 + */ + PROJECT_STATUS("PROJECT_STATUS", "项目状态"), + + /** + * 获奖级别 + */ + AWARD_LEVEL("AWARD_LEVEL", "获奖级别"), + + /** + * 获奖类型 + */ + AWARD_TYPE("AWARD_TYPE", "获奖类型"), + + /** + * 专利类型 + */ + PATENT_TYPE("PATENT_TYPE", "专利类型"), + + /** + * 专利状态 + */ + PATENT_STATUS("PATENT_STATUS", "专利状态"), + + /** + * 论文类型 + */ + PAPER_TYPE("PAPER_TYPE", "论文类型"), + + /** + * 论文级别 + */ + PAPER_LEVEL("PAPER_LEVEL", "论文级别"), + + /** + * 著作类型 + */ + MONOGRAPH_TYPE("MONOGRAPH_TYPE", "著作类型"), + + /** + * 单位类型 + */ + UNIT_TYPE("UNIT_TYPE", "单位类型"), + + /** + * 单位性质 + */ + UNIT_NATURE("UNIT_NATURE", "单位性质"), + + /** + * 单位规模 + */ + UNIT_SCALE("UNIT_SCALE", "单位规模"), + + /** + * 单位行业 + */ + UNIT_INDUSTRY("UNIT_INDUSTRY", "单位行业"), + + /** + * 单位地区 + */ + UNIT_REGION("UNIT_REGION", "单位地区"), + + /** + * 单位状态 + */ + UNIT_STATUS("UNIT_STATUS", "单位状态"); + + /** + * 参数类型编码 + */ + private final String code; + + /** + * 参数类型名称 + */ + private final String name; + + ParamTypeEnum(String code, String name) { + this.code = code; + this.name = name; + } + + /** + * 根据编码获取枚举 + */ + public static ParamTypeEnum getByCode(String code) { + for (ParamTypeEnum type : values()) { + if (type.getCode().equals(code)) { + return type; + } + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/enums/SexEnum.java b/src/main/java/com/CUST/brain/common/enums/SexEnum.java new file mode 100644 index 0000000..aad908c --- /dev/null +++ b/src/main/java/com/CUST/brain/common/enums/SexEnum.java @@ -0,0 +1,71 @@ +package com.CUST.brain.common.enums; + +import lombok.Getter; + +/** + * 性别枚举 + */ +@Getter +public enum SexEnum { + + /** + * 男 + */ + MALE("MALE", "男", "0", 1), + + /** + * 女 + */ + FEMALE("FEMALE", "女", "1", 2); + + /** + * 参数编码 + */ + private final String code; + + /** + * 参数名称 + */ + private final String name; + + /** + * 参数值 + */ + private final String value; + + /** + * 排序号 + */ + private final Integer sort; + + SexEnum(String code, String name, String value, Integer sort) { + this.code = code; + this.name = name; + this.value = value; + this.sort = sort; + } + + /** + * 根据编码获取枚举 + */ + public static SexEnum getByCode(String code) { + for (SexEnum sex : values()) { + if (sex.getCode().equals(code)) { + return sex; + } + } + return null; + } + + /** + * 根据值获取枚举 + */ + public static SexEnum getByValue(String value) { + for (SexEnum sex : values()) { + if (sex.getValue().equals(value)) { + return sex; + } + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/enums/TitleEnum.java b/src/main/java/com/CUST/brain/common/enums/TitleEnum.java new file mode 100644 index 0000000..c17a713 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/enums/TitleEnum.java @@ -0,0 +1,80 @@ +package com.CUST.brain.common.enums; + +import lombok.Getter; + +/** + * 职称枚举 + */ +@Getter +public enum TitleEnum { + + /** + * 教授 + */ + PROFESSOR("PROFESSOR", "教授", "1", 1), + + /** + * 副教授 + */ + ASSOCIATE_PROFESSOR("ASSOCIATE_PROFESSOR", "副教授", "2", 2), + + /** + * 讲师 + */ + LECTURER("LECTURER", "讲师", "3", 3), + + /** + * 助教 + */ + ASSISTANT("ASSISTANT", "助教", "4", 4), + + /** + * 研究员 + */ + RESEARCHER("RESEARCHER", "研究员", "5", 5), + + /** + * 副研究员 + */ + ASSOCIATE_RESEARCHER("ASSOCIATE_RESEARCHER", "副研究员", "6", 6), + + /** + * 助理研究员 + */ + ASSISTANT_RESEARCHER("ASSISTANT_RESEARCHER", "助理研究员", "7", 7), + + /** + * 其他 + */ + OTHER("OTHER", "其他", "8", 8); + + private final String code; + private final String name; + private final String value; + private final Integer sort; + + TitleEnum(String code, String name, String value, Integer sort) { + this.code = code; + this.name = name; + this.value = value; + this.sort = sort; + } + + public static TitleEnum getByCode(String code) { + for (TitleEnum title : values()) { + if (title.getCode().equals(code)) { + return title; + } + } + return null; + } + + public static TitleEnum getByValue(String value) { + for (TitleEnum title : values()) { + if (title.getValue().equals(value)) { + return title; + } + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/exception/BusinessException.java b/src/main/java/com/CUST/brain/common/exception/BusinessException.java new file mode 100644 index 0000000..2e28542 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/exception/BusinessException.java @@ -0,0 +1,32 @@ +package com.CUST.brain.common.exception; + +import com.CUST.brain.common.api.ResultCode; +import lombok.Getter; + +/** + * 业务异常 + */ +@Getter +public class BusinessException extends RuntimeException { + private final long code; + + public BusinessException(String message) { + super(message); + this.code = ResultCode.FAILED.getCode(); + } + + public BusinessException(ResultCode resultCode) { + super(resultCode.getMessage()); + this.code = resultCode.getCode(); + } + + public BusinessException(ResultCode resultCode, String message) { + super(message); + this.code = resultCode.getCode(); + } + + public BusinessException(long code, String message) { + super(message); + this.code = code; + } +} diff --git a/src/main/java/com/CUST/brain/common/exception/GlobalExceptionHandler.java b/src/main/java/com/CUST/brain/common/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..0263798 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/exception/GlobalExceptionHandler.java @@ -0,0 +1,63 @@ +package com.CUST.brain.common.exception; + +import com.CUST.brain.common.api.CommonResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.validation.BindException; +import org.springframework.validation.BindingResult; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +/** + * 全局异常处理 + */ +@Slf4j +@RestControllerAdvice +public class GlobalExceptionHandler { + + @ExceptionHandler(BusinessException.class) + public CommonResult handleBusinessException(BusinessException e) { + log.warn("业务异常:{}", e.getMessage()); + return CommonResult.custom(e.getCode(), e.getMessage(), null); + } + + @ExceptionHandler(AccessDeniedException.class) + public CommonResult handleAccessDeniedException(AccessDeniedException e) { + log.error("权限不足:{}", e.getMessage(), e); + return CommonResult.forbidden(e.getMessage()); + } + + @ExceptionHandler(MethodArgumentNotValidException.class) + public CommonResult handleValidException(MethodArgumentNotValidException e) { + BindingResult bindingResult = e.getBindingResult(); + String message = null; + if (bindingResult.hasErrors()) { + FieldError fieldError = bindingResult.getFieldError(); + if (fieldError != null) { + message = fieldError.getDefaultMessage(); + } + } + return CommonResult.validateFailed(message); + } + + @ExceptionHandler(BindException.class) + public CommonResult handleValidException(BindException e) { + BindingResult bindingResult = e.getBindingResult(); + String message = null; + if (bindingResult.hasErrors()) { + FieldError fieldError = bindingResult.getFieldError(); + if (fieldError != null) { + message = fieldError.getDefaultMessage(); + } + } + return CommonResult.validateFailed(message); + } + + @ExceptionHandler(Exception.class) + public CommonResult handleException(Exception e) { + log.error("系统异常:{}", e.getMessage(), e); + return CommonResult.failed("系统异常,请联系管理员"); + } +} diff --git a/src/main/java/com/CUST/brain/common/security/LoginUser.java b/src/main/java/com/CUST/brain/common/security/LoginUser.java new file mode 100644 index 0000000..a3f8c67 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/security/LoginUser.java @@ -0,0 +1,63 @@ +package com.CUST.brain.common.security; + +import lombok.Data; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import java.time.LocalDateTime; +import java.util.Collection; +import java.util.List; + +/** + * 自定义登录用户信息,扩展UserDetails + */ +@Data +public class LoginUser implements UserDetails { + private String userId; + private String username; + private String password; + private String realName; + private String phone; + private String email; + private Integer status; + private LocalDateTime lastLoginTime; + private String lastLoginIp; + private List roles; + private List permissions; + private Collection authorities; + + @Override + public Collection getAuthorities() { + return authorities; + } + + @Override + public String getPassword() { + return password; + } + + @Override + public String getUsername() { + return username; + } + + @Override + public boolean isAccountNonExpired() { + return true; + } + + @Override + public boolean isAccountNonLocked() { + return true; + } + + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + @Override + public boolean isEnabled() { + return status != null && status == 1; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/security/filter/JwtAuthenticationTokenFilter.java b/src/main/java/com/CUST/brain/common/security/filter/JwtAuthenticationTokenFilter.java new file mode 100644 index 0000000..3bfca8e --- /dev/null +++ b/src/main/java/com/CUST/brain/common/security/filter/JwtAuthenticationTokenFilter.java @@ -0,0 +1,49 @@ +package com.CUST.brain.common.security.filter; + +import com.CUST.brain.common.utils.JwtTokenUtil; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.annotation.Resource; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * JWT登录授权过滤器 + */ +@Component +public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { + @Resource + private UserDetailsService userDetailsService; + @Resource + private JwtTokenUtil jwtTokenUtil; + + @Override + protected void doFilterInternal(HttpServletRequest request, + HttpServletResponse response, + FilterChain chain) throws ServletException, IOException { + String authHeader = request.getHeader(jwtTokenUtil.getTokenHeader()); + if (authHeader != null && authHeader.startsWith(jwtTokenUtil.getTokenHead())) { + // The part after "Bearer " + String authToken = authHeader.substring(jwtTokenUtil.getTokenHead().length()).trim(); + String username = jwtTokenUtil.getUsernameFromToken(authToken); + if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) { + UserDetails userDetails = this.userDetailsService.loadUserByUsername(username); + if (jwtTokenUtil.validateToken(authToken)) { + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); + authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); + SecurityContextHolder.getContext().setAuthentication(authentication); + } + } + } + chain.doFilter(request, response); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/security/handler/RestAuthenticationEntryPoint.java b/src/main/java/com/CUST/brain/common/security/handler/RestAuthenticationEntryPoint.java new file mode 100644 index 0000000..6123410 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/security/handler/RestAuthenticationEntryPoint.java @@ -0,0 +1,31 @@ +package com.CUST.brain.common.security.handler; + +import com.CUST.brain.common.api.CommonResult; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 自定义未登录或token失效时的返回结果 + */ +@Slf4j +@Component +public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint { + @Override + public void commence(HttpServletRequest request, + HttpServletResponse response, + AuthenticationException authException) throws IOException, ServletException { + log.warn("未登录或token已过期: {}", authException.getMessage()); + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/json"); + response.getWriter().println(new ObjectMapper().writeValueAsString(CommonResult.unauthorized(authException.getMessage()))); + response.getWriter().flush(); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/security/handler/RestfulAccessDeniedHandler.java b/src/main/java/com/CUST/brain/common/security/handler/RestfulAccessDeniedHandler.java new file mode 100644 index 0000000..db0a16e --- /dev/null +++ b/src/main/java/com/CUST/brain/common/security/handler/RestfulAccessDeniedHandler.java @@ -0,0 +1,28 @@ +package com.CUST.brain.common.security.handler; + +import com.CUST.brain.common.api.CommonResult; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.web.access.AccessDeniedHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 自定义无权限访问的返回结果 + */ +@Component +public class RestfulAccessDeniedHandler implements AccessDeniedHandler { + @Override + public void handle(HttpServletRequest request, + HttpServletResponse response, + AccessDeniedException e) throws IOException, ServletException { + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/json"); + response.getWriter().println(new ObjectMapper().writeValueAsString(CommonResult.forbidden(e.getMessage()))); + response.getWriter().flush(); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/security/service/UserDetailsServiceImpl.java b/src/main/java/com/CUST/brain/common/security/service/UserDetailsServiceImpl.java new file mode 100644 index 0000000..79c3465 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/security/service/UserDetailsServiceImpl.java @@ -0,0 +1,80 @@ +package com.CUST.brain.common.security.service; + +import com.CUST.brain.dao.domain.system.SysPermission; +import com.CUST.brain.dao.domain.system.SysRole; +import com.CUST.brain.dao.domain.system.SysUser; +import com.CUST.brain.service.SysPermissionService; +import com.CUST.brain.service.SysRoleService; +import com.CUST.brain.service.SysUserService; +import com.CUST.brain.common.security.LoginUser; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 用户详情服务实现类 + */ +@Service +public class UserDetailsServiceImpl implements UserDetailsService { + + @Resource + private SysUserService userService; + + @Resource + private SysRoleService roleService; + + @Resource + private SysPermissionService permissionService; + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { + // 1. 查询用户 + SysUser user = userService.getByUsername(username); + if (user == null) { + throw new UsernameNotFoundException("用户名或密码错误"); + } + + // 2. 查询用户角色 + List roles = roleService.getRolesByUserId(user.getUserId()); + List roleCodes = roles.stream() + .map(SysRole::getRoleCode) + .collect(Collectors.toList()); + + // 3. 查询用户权限 + List permissions = permissionService.getPermissionsByUserId(user.getUserId()); + List permissionCodes = permissions.stream() + .map(SysPermission::getPermissionCode) + .collect(Collectors.toList()); + + // 4. 合并角色和权限 + List authorities = roleCodes.stream() + .map(role -> new SimpleGrantedAuthority("ROLE_" + role)) + .collect(Collectors.toList()); + authorities.addAll(permissionCodes.stream() + .map(SimpleGrantedAuthority::new) + .collect(Collectors.toList())); + + // 5. 返回LoginUser对象 + LoginUser loginUser = new LoginUser(); + loginUser.setUserId(user.getUserId()); + loginUser.setUsername(user.getUsername()); + loginUser.setPassword(user.getPassword()); + loginUser.setRealName(user.getRealName()); + loginUser.setPhone(user.getPhone()); + loginUser.setEmail(user.getEmail()); + loginUser.setStatus(user.getStatus()); + loginUser.setLastLoginTime(user.getLastLoginTime()); + loginUser.setLastLoginIp(user.getLastLoginIp()); + loginUser.setRoles(roleCodes); + loginUser.setPermissions(permissionCodes); + loginUser.setAuthorities(authorities); + return loginUser; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/utils/CacheCleanUtils.java b/src/main/java/com/CUST/brain/common/utils/CacheCleanUtils.java new file mode 100644 index 0000000..c8a95e9 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/utils/CacheCleanUtils.java @@ -0,0 +1,98 @@ +package com.CUST.brain.common.utils; + +import com.CUST.brain.dao.mapper.SysUserRoleMapper; +import org.springframework.cache.CacheManager; +import org.springframework.stereotype.Component; +import javax.annotation.Resource; +import java.util.List; + +@Component +public class CacheCleanUtils { + + @Resource + private RedisUtils redisUtils; + + @Resource + private SysUserRoleMapper sysUserRoleMapper; + + @Resource + private CacheManager cacheManager; + + /** + * 清理角色相关缓存 + * key: cache:sys:role:detail:{roleId} + * cache:sys:role:select* + */ + public void clearRoleCache(String roleId) { + if (roleId != null) { + redisUtils.delete("cache:sys:role:detail:" + roleId); + } + redisUtils.deleteByPattern("cache:sys:role:select*"); + } + + /** + * 清理用户相关缓存 + * key: cache:sys:user:info:{userId} + * cache:user:roles:{userId} + * cache:user:permissions:{userId} + */ + public void clearUserCache(String userId) { + if (userId != null) { + redisUtils.delete("cache:sys:user:info:" + userId); + redisUtils.delete("cache:user:roles:" + userId); + redisUtils.delete("cache:user:permissions:" + userId); + } + } + + /** + * 清理用户信息缓存(通过用户名) + * key: cache:sys:user:{username} + */ + public void clearUserCacheByUserName(String username) { + if (username != null) { + redisUtils.delete("cache:sys:user:" + username); + } + } + + /** + * 清理拥有某角色的所有用户的相关缓存 + */ + public void clearUsersByRole(String roleId) { + if (roleId != null) { + List userIds = sysUserRoleMapper.selectUserIdsByRoleId(roleId); + for (String userId : userIds) { + clearUserCache(userId); + } + } + } + + /** + * 清理角色权限分配列表缓存 + * key: cache:permission:listForRole:{roleCode} + */ + public void clearPermissionListCacheByRoleCode(String roleCode) { + if (roleCode != null) { + redisUtils.delete("cache:permission:listForRole:" + roleCode); + } + } + + /** + * 清理所有角色权限分配列表缓存(如有需要) + */ + public void clearAllPermissionListCache() { + redisUtils.deleteByPattern("cache:permission:listForRole*"); + } + + /** + * 清理参数缓存 + * + * @param paramType 参数类型 + * @param paramName 参数名称,如果为null则清理该类型的所有参数缓存 + */ + public void clearParamCache(String paramType, String paramName) { + if (paramType != null) { + redisUtils.delete("sys:param:type:" + paramType); + redisUtils.delete("sys:param:list:" + paramType); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/utils/JwtTokenUtil.java b/src/main/java/com/CUST/brain/common/utils/JwtTokenUtil.java new file mode 100644 index 0000000..9c70fd5 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/utils/JwtTokenUtil.java @@ -0,0 +1,226 @@ +package com.CUST.brain.common.utils; + +import com.CUST.brain.common.constant.RedisKeyConstants; +import com.CUST.brain.common.exception.BusinessException; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.Base64; + +/** + * JWT Token工具类 + */ +@Slf4j +@Component +public class JwtTokenUtil { + + @Value("${jwt.secret}") + private String secret; + + @Value("${jwt.expiration}") + private Long expiration; + + @Value("${jwt.tokenHeader}") + private String tokenHeader; + + @Value("${jwt.tokenHead}") + private String tokenHead; + + @Resource + private RedisUtils redisUtils; + + @Autowired + private ObjectMapper objectMapper; + + /** + * 生成token + * + * @param userId 用户ID + * @param username 用户名 + * @return token + */ + public String generateToken(String userId, String username) { + log.info("生成token用的密钥片段: {}...{}", secret.substring(0, 8), secret.substring(secret.length() - 8)); + Map claims = new HashMap<>(); + claims.put("userId", userId); + claims.put("username", username); + return generateToken(claims); + } + + /** + * 从token中获取用户ID + * + * @param token token + * @return 用户ID + */ + public String getUserIdFromToken(String token) { + String userId; + try { + Claims claims = getClaimsFromToken(token); + userId = claims.get("userId", String.class); + } catch (Exception e) { + log.error("从token中获取用户ID失败: {}", e.getMessage()); + throw new BusinessException(401, "无效的token"); + } + return userId; + } + + /** + * 从token中获取用户名 + * + * @param token token + * @return 用户名 + */ + public String getUsernameFromToken(String token) { + String username; + try { + Claims claims = getClaimsFromToken(token); + username = claims.get("username", String.class); + } catch (Exception e) { + log.error("从token中获取用户名失败: {}", e.getMessage()); + throw new BusinessException(401, "无效的token"); + } + return username; + } + + /** + * 验证token是否有效 + * + * @param token token + * @return 是否有效 + */ + public boolean validateToken(String token) { + try { + // 1. 检查token是否在黑名单中 + String blacklistKey = RedisKeyConstants.TOKEN_BLACKLIST + token; + if (redisUtils.hasKey(blacklistKey)) { + log.warn("token在黑名单中: {}", token); + return false; + } + + // 2. 检查token是否过期 + Claims claims = getClaimsFromToken(token); + Date expiration = claims.getExpiration(); + if (expiration.before(new Date())) { + log.warn("token已过期: {}", token); + return false; + } + + // 3. 检查token是否在Redis中存在 + String userId = claims.get("userId", String.class); + String tokenKey = String.format(RedisKeyConstants.USER_TOKEN, userId); + Object cachedTokenObj = redisUtils.get(tokenKey); + if (cachedTokenObj == null) { + log.warn("token不存在: {}", token); + return false; + } + String cachedToken = cachedTokenObj.toString(); + log.info("校验token: 传入token={}, Redis中token={}", token, cachedToken); + if (!cachedToken.equals(token)) { + log.warn("token已更新: {}", token); + return false; + } + + return true; + } catch (Exception e) { + log.error("验证token失败: {}", e.getMessage()); + return false; + } + } + + /** + * 刷新token + * + * @param token 原token + * @return 新token + */ + public String refreshToken(String token) { + try { + Claims claims = getClaimsFromToken(token); + claims.put("created", new Date()); + String newToken = generateToken(claims); + + // 更新Redis中的token + String userId = claims.get("userId", String.class); + String tokenKey = String.format(RedisKeyConstants.USER_TOKEN, userId); + // 将毫秒转换为秒 + long expireSeconds = TimeUnit.MILLISECONDS.toSeconds(expiration); + redisUtils.set(tokenKey, newToken, expireSeconds); + + return newToken; + } catch (Exception e) { + log.error("刷新token失败: {}", e.getMessage()); + throw new BusinessException(401, "刷新token失败"); + } + } + + /** + * 获取Base64解码后的密钥字节数组 + */ + private byte[] getSecretKeyBytes() { + log.info("JWT密钥片段: {}...{}", secret.substring(0, 8), secret.substring(secret.length() - 8)); + return Base64.getDecoder().decode(secret); + } + + /** + * 从token中获取JWT中的负载 + */ + private Claims getClaimsFromToken(String token) { + Claims claims = null; + try { + log.info("校验token: {}", token); + log.info("校验token用的密钥片段: {}...{}", secret.substring(0, 8), secret.substring(secret.length() - 8)); + claims = Jwts.parser() + .setSigningKey(getSecretKeyBytes()) + .parseClaimsJws(token) + .getBody(); + } catch (Exception e) { + log.error("JWT格式验证失败: {}", e.getMessage()); + throw new BusinessException(401, "无效的token"); + } + return claims; + } + + /** + * 根据负载生成JWT token + */ + private String generateToken(Map claims) { + return Jwts.builder() + .setClaims(claims) + .setExpiration(generateExpirationDate()) + .signWith(SignatureAlgorithm.HS512, getSecretKeyBytes()) + .compact(); + } + + /** + * 生成token的过期时间 + */ + private Date generateExpirationDate() { + return new Date(System.currentTimeMillis() + expiration * 1000); + } + + /** + * 获取token的完整格式(带前缀) + */ + public String getTokenHeader() { + return tokenHeader; + } + + /** + * 获取token的前缀 + */ + public String getTokenHead() { + return tokenHead; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/utils/OssUtil.java b/src/main/java/com/CUST/brain/common/utils/OssUtil.java new file mode 100644 index 0000000..1d0a613 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/utils/OssUtil.java @@ -0,0 +1,33 @@ +package com.CUST.brain.common.utils; + +import com.CUST.brain.common.config.OssProperties; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +@Component +public class OssUtil { + + @Autowired + private OssProperties ossProperties; + + public String upload(MultipartFile file, String objectName) { + OSS ossClient = new OSSClientBuilder().build( + ossProperties.getEndpoint(), + ossProperties.getAccessKeyId(), + ossProperties.getAccessKeySecret() + ); + try { + ossClient.putObject(ossProperties.getBucketName(), objectName, file.getInputStream()); + // 拼接文件公网访问地址 + return "https://" + ossProperties.getBucketName() + "." + ossProperties.getEndpoint().replace("https://", "") + "/" + objectName; + } catch (Exception e) { + e.printStackTrace(); + return null; + } finally { + ossClient.shutdown(); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/utils/ParamUtils.java b/src/main/java/com/CUST/brain/common/utils/ParamUtils.java new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/src/main/java/com/CUST/brain/common/utils/ParamUtils.java @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/utils/PasswordEncoder.java b/src/main/java/com/CUST/brain/common/utils/PasswordEncoder.java new file mode 100644 index 0000000..63c0eea --- /dev/null +++ b/src/main/java/com/CUST/brain/common/utils/PasswordEncoder.java @@ -0,0 +1,59 @@ +package com.CUST.brain.common.utils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; + +/** + * 密码编码器 + */ +@Component +public class PasswordEncoder extends BCryptPasswordEncoder { + private static final Logger log = LoggerFactory.getLogger(PasswordEncoder.class); + + public PasswordEncoder() { + super(10); // 使用强度为10的BCrypt加密 + } + + @PostConstruct + public void testPasswordEncoder() { + // 测试1:使用当前实例 + String rawPassword = "admin123"; + String encodedPassword = encode(rawPassword); + log.info("测试1 - 当前实例 - 原始密码: {}, 加密后: {}", rawPassword, encodedPassword); + boolean matches = matches(rawPassword, encodedPassword); + log.info("测试1 - 当前实例 - 匹配结果: {}", matches); + + // 测试2:使用数据库中的密码 + String dbPassword = "$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iKTVKIUi"; + boolean dbMatches = matches(rawPassword, dbPassword); + log.info("测试2 - 当前实例 - 数据库密码匹配结果: {}", dbMatches); + + // 测试3:使用新的 BCryptPasswordEncoder 实例 + BCryptPasswordEncoder newEncoder = new BCryptPasswordEncoder(10); + String newEncoded = newEncoder.encode(rawPassword); + log.info("测试3 - 新实例 - 原始密码: {}, 加密后: {}", rawPassword, newEncoded); + boolean newMatches = newEncoder.matches(rawPassword, newEncoded); + log.info("测试3 - 新实例 - 匹配结果: {}", newMatches); + + // 测试4:使用新实例匹配数据库密码 + boolean newDbMatches = newEncoder.matches(rawPassword, dbPassword); + log.info("测试4 - 新实例 - 数据库密码匹配结果: {}", newDbMatches); + } + + @Override + public String encode(CharSequence rawPassword) { + String encoded = super.encode(rawPassword); + log.debug("密码加密 - 原始密码: {}, 加密后: {}", rawPassword, encoded); + return encoded; + } + + @Override + public boolean matches(CharSequence rawPassword, String encodedPassword) { + boolean matches = super.matches(rawPassword, encodedPassword); + log.debug("密码匹配 - 原始密码: {}, 加密密码: {}, 匹配结果: {}", rawPassword, encodedPassword, matches); + return matches; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/utils/RedisUtils.java b/src/main/java/com/CUST/brain/common/utils/RedisUtils.java new file mode 100644 index 0000000..b0ab9f3 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/utils/RedisUtils.java @@ -0,0 +1,625 @@ +package com.CUST.brain.common.utils; + +import com.CUST.brain.common.constant.RedisKeyConstants; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.connection.RedisStringCommands; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.DefaultRedisScript; +import org.springframework.data.redis.core.types.Expiration; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * Redis工具类 + */ +@Slf4j +@Component +public class RedisUtils { + + @Resource + private RedisTemplate redisTemplate; + + private static ObjectMapper objectMapper; + + @Autowired + public void setObjectMapper(ObjectMapper objectMapper) { + RedisUtils.objectMapper = objectMapper; + } + + private static final String LOCK_SCRIPT = + "local expire = tonumber(ARGV[2]) " + + "if not expire then redis.log(redis.LOG_WARNING, 'expire is nil or not a number: ' .. tostring(ARGV[2])) return 0 end " + + "if expire <= 0 then redis.log(redis.LOG_WARNING, 'expire <= 0: ' .. tostring(expire)) return 0 end " + + "local set_result = redis.call('set', KEYS[1], ARGV[1], 'NX', 'PX', expire) " + + "redis.log(redis.LOG_DEBUG, 'set result: ' .. tostring(set_result)) " + + "return set_result == 'OK' and 1 or 0"; + + private static final String UNLOCK_SCRIPT = + "if redis.call('get', KEYS[1]) == ARGV[1] then " + + " return redis.call('del', KEYS[1]) " + + "else " + + " return 0 " + + "end"; + + private static final String RENEW_SCRIPT = + "local expire = tonumber(ARGV[2]) " + + "if not expire then redis.log(redis.LOG_WARNING, 'expire is nil or not a number: ' .. tostring(ARGV[2])) return 0 end " + + "if expire <= 0 then redis.log(redis.LOG_WARNING, 'expire <= 0: ' .. tostring(expire)) return 0 end " + + "if redis.call('get', KEYS[1]) == ARGV[1] then " + + " local pexpire_result = redis.call('pexpire', KEYS[1], expire) " + + " redis.log(redis.LOG_DEBUG, 'pexpire result: ' .. tostring(pexpire_result)) " + + " return pexpire_result == 1 and 1 or 0 " + + "else " + + " return 0 " + + "end"; + + /** + * 设置缓存(对象自动转为JSON字符串) + * @param key 键 + * @param value 值 + * @param timeout 过期时间(秒) + */ + public void set(String key, Object value, long timeout) { + try { + if (value instanceof String) { + redisTemplate.opsForValue().set(key, value, timeout, TimeUnit.SECONDS); + } else { + String json = objectMapper.writeValueAsString(value); + redisTemplate.opsForValue().set(key, json, timeout, TimeUnit.SECONDS); + } + } catch (JsonProcessingException e) { + log.error("[RedisUtils] set序列化异常", e); + throw new RuntimeException("Redis序列化异常", e); + } + } + + /** + * 获取缓存并反序列化为指定类型(JSON字符串) + */ + public T get(String key, Class clazz) { + Object obj = redisTemplate.opsForValue().get(key); + if (obj == null) return null; + if (clazz == String.class) { + return clazz.cast(obj); + } + try { + return objectMapper.readValue(obj.toString(), clazz); + } catch (Exception e) { + log.error("[RedisUtils] get反序列化异常", e); + throw new RuntimeException("Redis反序列化异常", e); + } + } + + /** + * 获取缓存(原始String) + */ + public String get(String key) { + Object obj = redisTemplate.opsForValue().get(key); + return obj == null ? null : obj.toString(); + } + + /** + * 删除缓存 + * + * @param key 键 + */ + public void delete(String key) { + redisTemplate.delete(key); + } + + /** + * 判断key是否存在 + * + * @param key 键 + * @return 是否存在 + */ + public Boolean hasKey(String key) { + return redisTemplate.hasKey(key); + } + + /** + * 设置过期时间 + * + * @param key 键 + * @param timeout 过期时间(秒) + * @return 是否成功 + */ + public Boolean expire(String key, long timeout) { + return redisTemplate.expire(key, timeout, TimeUnit.SECONDS); + } + + /** + * 获取过期时间 + * + * @param key 键 + * @return 过期时间(秒) + */ + public Long getExpire(String key) { + return redisTemplate.getExpire(key, TimeUnit.SECONDS); + } + + /** + * 批量删除缓存 + */ + public Long delete(Collection keys) { + return redisTemplate.delete(keys); + } + + /** + * 递增 + */ + public Long increment(String key, long delta) { + return redisTemplate.opsForValue().increment(key, delta); + } + + /** + * 递减 + */ + public Long decrement(String key, long delta) { + return redisTemplate.opsForValue().decrement(key, delta); + } + + /** + * 获取Hash中的属性并反序列化为指定类型 + */ + public T hGet(String key, String hashKey, Class clazz) { + Object obj = redisTemplate.opsForHash().get(key, hashKey); + return objectMapper.convertValue(obj, clazz); + } + + /** + * 向Hash中放入一个属性 + */ + public void hSet(String key, String hashKey, Object value) { + redisTemplate.opsForHash().put(key, hashKey, value); + } + + /** + * 向Hash中放入一个属性并设置过期时间 + */ + public void hSet(String key, String hashKey, Object value, long timeout, TimeUnit unit) { + redisTemplate.opsForHash().put(key, hashKey, value); + redisTemplate.expire(key, timeout, unit); + } + + /** + * 直接设置整个Hash + */ + public void hSetAll(String key, Map map) { + redisTemplate.opsForHash().putAll(key, map); + } + + /** + * 直接设置整个Hash并设置过期时间 + */ + public void hSetAll(String key, Map map, long timeout, TimeUnit unit) { + redisTemplate.opsForHash().putAll(key, map); + redisTemplate.expire(key, timeout, unit); + } + + /** + * 获取整个Hash并反序列化为指定类型Map + */ + public Map hGetAll(String key, Class clazz) { + Map map = redisTemplate.opsForHash().entries(key); + Map result = new HashMap<>(); + for (Map.Entry entry : map.entrySet()) { + result.put(String.valueOf(entry.getKey()), objectMapper.convertValue(entry.getValue(), clazz)); + } + return result; + } + + /** + * 删除Hash中的属性 + */ + public Long hDelete(String key, Object... hashKeys) { + return redisTemplate.opsForHash().delete(key, hashKeys); + } + + /** + * 判断Hash中是否存在该属性 + */ + public Boolean hHasKey(String key, String hashKey) { + return redisTemplate.opsForHash().hasKey(key, hashKey); + } + + /** + * Hash递增 + */ + public Long hIncrement(String key, String hashKey, long delta) { + return redisTemplate.opsForHash().increment(key, hashKey, delta); + } + + /** + * Hash递减 + */ + public Long hDecrement(String key, String hashKey, long delta) { + return redisTemplate.opsForHash().increment(key, hashKey, -delta); + } + + /** + * 获取Set中的所有值 + */ + public Set sMembers(String key) { + return redisTemplate.opsForSet().members(key); + } + + /** + * 判断Set中是否存在value + */ + public Boolean sIsMember(String key, Object value) { + return redisTemplate.opsForSet().isMember(key, value); + } + + /** + * 向Set中放入数据 + */ + public Long sAdd(String key, Object... values) { + return redisTemplate.opsForSet().add(key, values); + } + + /** + * 向Set中放入数据并设置过期时间 + */ + public Long sAdd(String key, long timeout, TimeUnit unit, Object... values) { + Long count = redisTemplate.opsForSet().add(key, values); + redisTemplate.expire(key, timeout, unit); + return count; + } + + /** + * 获取Set的长度 + */ + public Long sSize(String key) { + return redisTemplate.opsForSet().size(key); + } + + /** + * 移除Set中的值 + */ + public Long sRemove(String key, Object... values) { + return redisTemplate.opsForSet().remove(key, values); + } + + /** + * 获取List缓存并反序列化为指定类型List + */ + public List getList(String key, Class clazz) { + Object obj = redisTemplate.opsForValue().get(key); + if (obj instanceof List) { + List list = (List) obj; + List result = new ArrayList<>(); + for (Object item : list) { + result.add(objectMapper.convertValue(item, clazz)); + } + return result; + } + return Collections.emptyList(); + } + + /** + * 获取List中的值并反序列化为指定类型 + */ + public List lRange(String key, long start, long end, Class clazz) { + List list = redisTemplate.opsForList().range(key, start, end); + List result = new ArrayList<>(); + for (Object item : list) { + result.add(objectMapper.convertValue(item, clazz)); + } + return result; + } + + /** + * 获取List的长度 + */ + public Long lSize(String key) { + return redisTemplate.opsForList().size(key); + } + + /** + * 获取List中指定索引的值 + */ + public Object lIndex(String key, long index) { + return redisTemplate.opsForList().index(key, index); + } + + /** + * 向List中放入数据 + */ + public Long lRightPush(String key, Object value) { + return redisTemplate.opsForList().rightPush(key, value); + } + + /** + * 向List中放入数据并设置过期时间 + */ + public Long lRightPush(String key, Object value, long timeout, TimeUnit unit) { + Long size = redisTemplate.opsForList().rightPush(key, value); + redisTemplate.expire(key, timeout, unit); + return size; + } + + /** + * 向List中批量放入数据 + */ + public Long lRightPushAll(String key, Object... values) { + return redisTemplate.opsForList().rightPushAll(key, values); + } + + /** + * 向List中批量放入数据并设置过期时间 + */ + public Long lRightPushAll(String key, long timeout, TimeUnit unit, Object... values) { + Long size = redisTemplate.opsForList().rightPushAll(key, values); + redisTemplate.expire(key, timeout, unit); + return size; + } + + /** + * 从List中移除数据 + */ + public Long lRemove(String key, long count, Object value) { + return redisTemplate.opsForList().remove(key, count, value); + } + + /** + * 获取分布式锁 + */ + public boolean tryLock(String key, String value, long timeout, TimeUnit unit) { + // 参数校验 + if (!StringUtils.hasText(key)) { + log.warn("【分布式锁】tryLock失败,key为空"); + return false; + } + + // 确保key是有效的字符串 + String safeKey = key.trim().replaceAll("[^a-zA-Z0-9_:.-]", "_"); + if (!StringUtils.hasText(safeKey)) { + log.warn("【分布式锁】tryLock失败,key无效,原始key={}", key); + return false; + } + + // 确保value是有效的字符串 + String safeValue = value == null ? UUID.randomUUID().toString() : value.trim(); + if (!StringUtils.hasText(safeValue)) { + log.warn("【分布式锁】tryLock失败,value无效,key={}", safeKey); + return false; + } + + // 参数修正 + if (timeout <= 0) { + timeout = 10; // 默认10秒 + } + if (unit == null) { + unit = TimeUnit.SECONDS; + } + long millis = unit.toMillis(timeout); + if (millis <= 0) { + millis = 10000; // 默认10秒 + } + + log.info("【分布式锁】tryLock开始,key={}, value={}, timeout={}, unit={}, millis={}, thread={}", + safeKey, safeValue, timeout, unit, millis, Thread.currentThread().getName()); + + try { + DefaultRedisScript script = new DefaultRedisScript<>(LOCK_SCRIPT, Long.class); + List keys = Collections.singletonList(safeKey); + // 确保 millis 是有效的正整数 + if (millis <= 0) { + log.warn("【分布式锁】tryLock失败,timeout必须大于0,millis={}", millis); + return false; + } + String millisStr = String.valueOf(millis); + log.debug("【分布式锁】tryLock参数,key={}, value={}, millisStr={}", safeKey, safeValue, millisStr); + String[] args = new String[]{safeValue, millisStr}; + + // 先检查 key 是否存在 + Boolean exists = redisTemplate.hasKey(safeKey); + log.debug("【分布式锁】tryLock前检查key是否存在,key={}, exists={}", safeKey, exists); + + // 尝试直接使用 set 命令 + Boolean setResult = redisTemplate.opsForValue().setIfAbsent(safeKey, safeValue, millis, TimeUnit.MILLISECONDS); + log.debug("【分布式锁】直接set命令结果,key={}, result={}", safeKey, setResult); + + if (Boolean.TRUE.equals(setResult)) { + log.info("【分布式锁】tryLock成功(直接set),key={}, value={}", safeKey, safeValue); + return true; + } + + // 如果直接set失败,尝试使用脚本 + Long result = redisTemplate.execute(script, keys, args); + boolean lockResult = (result != null && result == 1L); + + // 检查执行后的状态 + if (!lockResult) { + String currentValue = (String) redisTemplate.opsForValue().get(safeKey); + Long ttl = redisTemplate.getExpire(safeKey, TimeUnit.MILLISECONDS); + log.debug("【分布式锁】tryLock失败后的状态,key={}, currentValue={}, ttl={}", safeKey, currentValue, ttl); + } + + log.info("【分布式锁】tryLock结束,key={}, value={}, result={}, thread={}", + safeKey, safeValue, lockResult, Thread.currentThread().getName()); + return lockResult; + } catch (Exception e) { + log.error("【分布式锁】tryLock异常,key={}, value={}, error={}", safeKey, safeValue, e.getMessage(), e); + return false; + } + } + + /** + * 释放分布式锁 + */ + public boolean unlock(String key, String value) { + // 参数校验 + if (!StringUtils.hasText(key)) { + log.warn("【分布式锁】unlock失败,key为空"); + return false; + } + + // 确保key是有效的字符串 + String safeKey = key.trim().replaceAll("[^a-zA-Z0-9_:.-]", "_"); + if (!StringUtils.hasText(safeKey)) { + log.warn("【分布式锁】unlock失败,key无效,原始key={}", key); + return false; + } + + // 确保value是有效的字符串 + String safeValue = value == null ? "" : value.trim(); + if (!StringUtils.hasText(safeValue)) { + log.warn("【分布式锁】unlock失败,value无效,key={}", safeKey); + return false; + } + + log.info("【分布式锁】unlock开始,key={}, value={}, thread={}", + safeKey, safeValue, Thread.currentThread().getName()); + + try { + DefaultRedisScript script = new DefaultRedisScript<>(UNLOCK_SCRIPT, Long.class); + List keys = Collections.singletonList(safeKey); + String[] args = new String[]{safeValue}; + + Long result = redisTemplate.execute(script, keys, args); + boolean unlockResult = (result != null && result == 1L); + + log.info("【分布式锁】unlock结束,key={}, value={}, result={}, thread={}", + safeKey, safeValue, unlockResult, Thread.currentThread().getName()); + return unlockResult; + } catch (Exception e) { + log.error("【分布式锁】unlock异常,key={}, value={}, error={}", safeKey, safeValue, e.getMessage()); + return false; + } + } + + /** + * 续期分布式锁 + */ + public boolean renewLock(String key, String value, long timeout, TimeUnit unit) { + // 参数校验 + if (!StringUtils.hasText(key)) { + log.warn("【分布式锁】renewLock失败,key为空"); + return false; + } + + // 确保key是有效的字符串 + String safeKey = key.trim().replaceAll("[^a-zA-Z0-9_:.-]", "_"); + if (!StringUtils.hasText(safeKey)) { + log.warn("【分布式锁】renewLock失败,key无效,原始key={}", key); + return false; + } + + // 确保value是有效的字符串 + String safeValue = value == null ? "" : value.trim(); + if (!StringUtils.hasText(safeValue)) { + log.warn("【分布式锁】renewLock失败,value无效,key={}", safeKey); + return false; + } + + // 参数修正 + if (timeout <= 0) { + timeout = 10; // 默认10秒 + } + if (unit == null) { + unit = TimeUnit.SECONDS; + } + long millis = unit.toMillis(timeout); + if (millis <= 0) { + millis = 10000; // 默认10秒 + } + + log.info("【分布式锁】renewLock开始,key={}, value={}, timeout={}, unit={}, millis={}, thread={}", + safeKey, safeValue, timeout, unit, millis, Thread.currentThread().getName()); + + try { + DefaultRedisScript script = new DefaultRedisScript<>(RENEW_SCRIPT, Long.class); + List keys = Collections.singletonList(safeKey); + // 确保 millis 是有效的正整数 + if (millis <= 0) { + log.warn("【分布式锁】renewLock失败,timeout必须大于0,millis={}", millis); + return false; + } + String millisStr = String.valueOf(millis); + log.debug("【分布式锁】renewLock参数,key={}, value={}, millisStr={}", safeKey, safeValue, millisStr); + String[] args = new String[]{safeValue, millisStr}; + + Long result = redisTemplate.execute(script, keys, args); + boolean renewResult = (result != null && result == 1L); + + log.info("【分布式锁】renewLock结束,key={}, value={}, result={}, thread={}", + safeKey, safeValue, renewResult, Thread.currentThread().getName()); + return renewResult; + } catch (Exception e) { + log.error("【分布式锁】renewLock异常,key={}, value={}, error={}", safeKey, safeValue, e.getMessage()); + return false; + } + } + + /** + * 批量删除指定前缀的key + */ + public void deleteByPattern(String pattern) { + Set keys = redisTemplate.keys(pattern); + if (keys != null && !keys.isEmpty()) { + redisTemplate.delete(keys); + } + } + + /** + * 获取缓存统计信息 + */ + public Map getStats() { + Map stats = new HashMap<>(); + try { + Properties info = redisTemplate.getConnectionFactory().getConnection().info(); + stats.put("usedMemory", info.getProperty("used_memory")); + stats.put("connectedClients", info.getProperty("connected_clients")); + stats.put("totalConnectionsReceived", info.getProperty("total_connections_received")); + stats.put("totalCommandsProcessed", info.getProperty("total_commands_processed")); + stats.put("instantaneousOpsPerSec", info.getProperty("instantaneous_ops_per_sec")); + stats.put("keyspaceHits", info.getProperty("keyspace_hits")); + stats.put("keyspaceMisses", info.getProperty("keyspace_misses")); + } catch (Exception e) { + log.error("获取Redis统计信息失败", e); + } + return stats; + } + + /** + * 获取缓存命中率 + */ + public double getHitRate() { + try { + Properties info = redisTemplate.getConnectionFactory().getConnection().info(); + long hits = Long.parseLong(info.getProperty("keyspace_hits", "0")); + long misses = Long.parseLong(info.getProperty("keyspace_misses", "0")); + long total = hits + misses; + return total > 0 ? (double) hits / total : 0; + } catch (Exception e) { + log.error("获取Redis命中率失败", e); + return 0; + } + } + + /** + * 定期清理TTL为-1的死锁key(建议用定时任务调用) + */ + public void cleanDeadLocks(String lockPrefix) { + Set keys = redisTemplate.keys(lockPrefix + "*"); + if (keys != null && !keys.isEmpty()) { + for (String key : keys) { + Long ttl = redisTemplate.getExpire(key, TimeUnit.MILLISECONDS); + if (ttl == null || ttl == -1) { + redisTemplate.delete(key); + log.warn("【分布式锁】发现并清理死锁key:{}", key); + } + } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/common/utils/SecurityUtils.java b/src/main/java/com/CUST/brain/common/utils/SecurityUtils.java new file mode 100644 index 0000000..baf8a56 --- /dev/null +++ b/src/main/java/com/CUST/brain/common/utils/SecurityUtils.java @@ -0,0 +1,60 @@ +package com.CUST.brain.common.utils; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import com.CUST.brain.common.security.LoginUser; +import com.CUST.brain.common.exception.BusinessException; + +/** + * 安全工具类 + */ +public class SecurityUtils { + + private SecurityUtils() { + throw new IllegalStateException("Utility class"); + } + + /** + * 获取当前登录用户ID + */ + public static String getCurrentUserId() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null || !authentication.isAuthenticated()) { + throw new BusinessException(401, "用户未登录"); + } + Object principal = authentication.getPrincipal(); + if (principal instanceof LoginUser) { + return ((LoginUser) principal).getUserId(); + } else if (principal instanceof UserDetails) { + // 兼容旧逻辑 + return ((UserDetails) principal).getUsername(); + } + return principal.toString(); + } + + /** + * 获取当前登录用户名 + */ + public static String getCurrentUsername() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null || !authentication.isAuthenticated()) { + throw new BusinessException(401, "用户未登录"); + } + Object principal = authentication.getPrincipal(); + if (principal instanceof LoginUser) { + return ((LoginUser) principal).getUsername(); + } else if (principal instanceof UserDetails) { + return ((UserDetails) principal).getUsername(); + } + return principal.toString(); + } + + /** + * 判断当前用户是否已登录 + */ + public static boolean isAuthenticated() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + return authentication != null && authentication.isAuthenticated(); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/base/BaseEntity.java b/src/main/java/com/CUST/brain/dao/domain/base/BaseEntity.java new file mode 100644 index 0000000..7304407 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/base/BaseEntity.java @@ -0,0 +1,55 @@ +package com.CUST.brain.dao.domain.base; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 基础实体类 + */ +@Data +public class BaseEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** + * 更新人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 删除标志(0-未删除,1-已删除) + */ + @TableLogic + private Integer flag; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/base/BaseRelationEntity.java b/src/main/java/com/CUST/brain/dao/domain/base/BaseRelationEntity.java new file mode 100644 index 0000000..ab11bfa --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/base/BaseRelationEntity.java @@ -0,0 +1,35 @@ +package com.CUST.brain.dao.domain.base; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 关系实体基类 + */ +@Data +public class BaseRelationEntity{ + + /** + * 主键ID + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/AcademicAward.java b/src/main/java/com/CUST/brain/dao/domain/business/AcademicAward.java new file mode 100644 index 0000000..4d2af53 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/AcademicAward.java @@ -0,0 +1,53 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +/** + * 学术奖励信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("academic_award") +public class AcademicAward extends BaseEntity { + + /** + * 奖项id + */ + @TableId(value = "id") + private String id; + + /** + * 人才id + */ + private String talentId; + + /** + * 奖励名称 + */ + private String awardName; + + /** + * 奖励级别 + */ + private String awardLevel; + + /** + * 授予时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate awardTime; + + /** + * 授予机构 + */ + private String awardingAgency; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/EmploymentUnit.java b/src/main/java/com/CUST/brain/dao/domain/business/EmploymentUnit.java new file mode 100644 index 0000000..50f3baa --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/EmploymentUnit.java @@ -0,0 +1,32 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 工作单位信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("employment_unit") +public class EmploymentUnit extends BaseEntity { + + /** + * 工作单位id + */ + @TableId + private String id; + + /** + * 工作单位名称 + */ + private String unitName; + + /** + * 工作单位地址 + */ + private String unitAddress; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/EnterpriseInfo.java b/src/main/java/com/CUST/brain/dao/domain/business/EnterpriseInfo.java new file mode 100644 index 0000000..cb03924 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/EnterpriseInfo.java @@ -0,0 +1,124 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.time.LocalDate; + +/** + * 企业信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("enterprise_info") +public class EnterpriseInfo extends BaseEntity { + + /** + * 企业id + */ + @TableId + private String id; + + /** + * 纳税人识别号 + */ + private String taxpayerId; + + /** + * 企业名称 + */ + private String companyName; + + /** + * 企业类型 + */ + private String companyType; + + /** + * 是否高新技术企业认证(0:否,1:是) + */ + private Integer isHighTechCertified; + + /** + * 资质证书 + */ + private String qualificationCertificate; + + /** + * 企业状态 + */ + private String companyStatus; + + /** + * 法定代表人id + */ + private String talentId; + + /** + * 注册资本 + */ + private String registeredCapital; + + /** + * 企业地址 + */ + private String companyAddress; + + /** + * 所属省份 + */ + private String province; + + /** + * 所属城市 + */ + private String city; + + /** + * 所属区域 + */ + private String district; + + /** + * 所属行业 + */ + private String industry; + + /** + * 成立日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate establishmentDate; + + /** + * 员工人数 + */ + private Integer employeeCount; + + /** + * 网址 + */ + private String website; + + /** + * 经营范围 + */ + private String businessScope; + + /** + * 联系电话 + */ + private String contactPhone; + + /** + * 联系邮箱 + */ + private String contactEmail; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/HonoraryTitle.java b/src/main/java/com/CUST/brain/dao/domain/business/HonoraryTitle.java new file mode 100644 index 0000000..f349efe --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/HonoraryTitle.java @@ -0,0 +1,48 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +/** + * 荣誉称号信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("honorary_title") +public class HonoraryTitle extends BaseEntity { + + /** + * 荣誉ID + */ + @TableId + private String id; + + /** + * 人才ID + */ + private String talentId; + + /** + * 荣誉称号 + */ + private String honorTitle; + + /** + * 授予时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate awardTime; + + /** + * 授予机构 + */ + private String awardingAgency; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/HonoraryTitle.java~ b/src/main/java/com/CUST/brain/dao/domain/business/HonoraryTitle.java~ new file mode 100644 index 0000000..d2b02ee --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/HonoraryTitle.java~ @@ -0,0 +1,48 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.common.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +/** + * 荣誉称号信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("honorary_title") +public class HonoraryTitle extends BaseEntity { + + /** + * 荣誉ID + */ + @TableId + private String id; + + /** + * 人才ID + */ + private String talentId; + + /** + * 荣誉称号 + */ + private String honorTitle; + + /** + * 授予时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate awardTime; + + /** + * 授予机构 + */ + private String awardingAgency; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/PapersAndMonographs.java b/src/main/java/com/CUST/brain/dao/domain/business/PapersAndMonographs.java new file mode 100644 index 0000000..eb0fa66 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/PapersAndMonographs.java @@ -0,0 +1,78 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +/** + * 论文专著信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("papers_and_monographs") +public class PapersAndMonographs extends BaseEntity { + + /** + * 论文专著ID + */ + @TableId + private String id; + + /** + * 人才ID + */ + private String talentId; + + /** + * 标题 + */ + private String title; + + /** + * 发表时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime publicationTime; + + /** + * 刊物名称 + */ + private String journalName; + + /** + * 卷号 + */ + private String volumeNumber; + + /** + * 期号 + */ + private String issueNumber; + + /** + * 页码 + */ + private String pageRange; + + /** + * DOI号 + */ + private String doi; + + /** + * 著作类型(参数表WORK_TYPE) + */ + private String workType; + + /** + * 状态:1-草稿,2-已发布 + */ + private Integer status; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/Patent.java b/src/main/java/com/CUST/brain/dao/domain/business/Patent.java new file mode 100644 index 0000000..1356a4c --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/Patent.java @@ -0,0 +1,60 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +/** + * 专利信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("patent") +public class Patent extends BaseEntity { + + /** + * 专利id + */ + @TableId + private String id; + + /** + * 人才id + */ + private String talentId; + + /** + * 专利名称 + */ + private String patentName; + + /** + * 专利编号 + */ + private String patentNumber; + + /** + * 申请时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate applicationTime; + + /** + * 授权时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate authorizationTime; + + /** + * 状态:1-草稿,2-已发布 + */ + private String status; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/ProjectInitiation.java b/src/main/java/com/CUST/brain/dao/domain/business/ProjectInitiation.java new file mode 100644 index 0000000..5e43f91 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/ProjectInitiation.java @@ -0,0 +1,86 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.time.LocalDate; + +/** + * 立项项目信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("project_initiation") +public class ProjectInitiation extends BaseEntity { + + /** + * 立项项目id + */ + @TableId + private String id; + + /** + * 立项项目编号 + */ + private String projectProposalNumber; + + /** + * 项目名称 + */ + private String projectName; + + /** + * 项目来源 + */ + private String projectFrom; + + /** + * 项目类型 + */ + private String projectType; + + /** + * 资金来源组织 + */ + private String fundingFrom; + + /** + * 承担单位id + */ + private String undertakingUnitId; + + /** + * 项目金额 + */ + private BigDecimal projectAccount; + + /** + * 项目启动时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate startTime; + + /** + * 项目终止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate endTime; + + /** + * 项目当前状态(PROJECT_STATUS) + */ + private String projectStatus; + + /** + * 状态:1-草稿,2-已发布 + */ + private Integer status; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/ResearchProject.java b/src/main/java/com/CUST/brain/dao/domain/business/ResearchProject.java new file mode 100644 index 0000000..0a57459 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/ResearchProject.java @@ -0,0 +1,141 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; +import java.time.LocalDate; + +/** + * 科研项目信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("research_project") +public class ResearchProject extends BaseEntity { + + /** + * 项目ID + */ + @TableId + private String id; + + /** + * 项目名称 + */ + private String name; + + /** + * 项目名称英文版 + */ + private String titleEn; + + /** + * 项目类型 + */ + private String projectType; + + /** + * 检索关键词 + */ + private String keywordOriginal; + + /** + * 检索关键词英文 + */ + private String keywordEn; + + /** + * 摘要 + */ + private String summaryCn; + + /** + * 摘要英文 + */ + private String summaryEn; + + /** + * 预算/财政拨款 + */ + private BigDecimal funding; + + /** + * 货币代码 + */ + private String currencyCode; + + /** + * 项目金额(美元) + */ + private BigDecimal fundingDollar; + + /** + * 申请年份 + */ + private Integer applyYear; + + /** + * 项目启动时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate planStartDate; + + /** + * 项目终止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate planEndDate; + + /** + * 承担单位id + */ + private String undertakeUnitId; + + /** + * 省份 + */ + private String undertakeUnitState; + + /** + * 国家 + */ + private String undertakeUnitCountry; + + /** + * 资金名称 + */ + private String funderName; + + /** + * 资金来源组织 + */ + private String funderGroup; + + /** + * 资金国家 + */ + private String funderCountry; + + /** + * 学科大类(第一学科) + */ + private String primarySubject; + + /** + * 学科小类 + */ + private String subSubject; + + /** + * 状态:1-草稿,2-已发布 + */ + private Integer status; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/Resume.java b/src/main/java/com/CUST/brain/dao/domain/business/Resume.java new file mode 100644 index 0000000..d4bddde --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/Resume.java @@ -0,0 +1,55 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +/** + * 履历信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("resume") +public class Resume extends BaseEntity { + + /** + * 履历ID + */ + @TableId + private String id; + + /** + * 人才ID + */ + private String talentId; + + /** + * 起始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + /** + * 结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; + + /** + * 所在单位id + */ + private String unitId; + + /** + * 工作内容 + */ + private String workContent; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/ReviewExperience.java b/src/main/java/com/CUST/brain/dao/domain/business/ReviewExperience.java new file mode 100644 index 0000000..2395928 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/ReviewExperience.java @@ -0,0 +1,53 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +/** + * 评审经历信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("review_experience") +public class ReviewExperience extends BaseEntity { + + /** + * 评审id + */ + @TableId + private String id; + + /** + * 人才id + */ + private String talentId; + + /** + * 评审项目 + */ + private String reviewProject; + + /** + * 评审时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime reviewTime; + + /** + * 评审机构 + */ + private String reviewingAgency; + + /** + * 评审角色 + */ + private String reviewRole; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/TalentBasic.java b/src/main/java/com/CUST/brain/dao/domain/business/TalentBasic.java new file mode 100644 index 0000000..c211d5d --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/TalentBasic.java @@ -0,0 +1,95 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +/** + * 人才基本信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("talent_basic") +public class TalentBasic extends BaseEntity { + + /** + * 人才id + */ + @TableId + private String id; + + /** + * 姓名 + */ + private String name; + + /** + * 性别(0-男,1-女) + */ + private Integer sex; + + /** + * 出生日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate birthDate; + + /** + * 单位id + */ + private String unitId; + + /** + * 单位类型:school-高校,company-企业 + */ + private String unitType; + + /** + * 最高学历 + */ + private String highestEdu; + + /** + * 最高学历毕业学校 + */ + private String highestSchool; + + /** + * 分类定级人才 + */ + private String classifyGrade; + + /** + * 职称 + */ + private String title; + + /** + * 地区编码 + */ + private String region; + + /** + * 照片 + */ + private String image; + + /** + * 最高技术职务资格 + */ + private String highestPosition; + + /** + * 入职时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate entryDate; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/TalentBasic.java~ b/src/main/java/com/CUST/brain/dao/domain/business/TalentBasic.java~ new file mode 100644 index 0000000..91b992e --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/TalentBasic.java~ @@ -0,0 +1,95 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +/** + * 人才基本信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("talent_basic") +public class TalentBasic extends BaseEntity { + + /** + * 人才id + */ + @TableId + private String id; + + /** + * 姓名 + */ + private String name; + + /** + * 性别(0-男,1-女) + */ + private Integer sex; + + /** + * 出生日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate birthDate; + + /** + * 单位id + */ + private String unitId; + + /** + * 单位id + */ + private String unitType; + + /** + * 最高学历 + */ + private String highestEdu; + + /** + * 最高学历毕业学校 + */ + private String highestSchool; + + /** + * 分类定级人才 + */ + private String classifyGrade; + + /** + * 职称 + */ + private String title; + + /** + * 地区编码 + */ + private String region; + + /** + * 照片 + */ + private String image; + + /** + * 最高技术职务资格 + */ + private String highestPosition; + + /** + * 入职时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate entryDate; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/TechReport.java b/src/main/java/com/CUST/brain/dao/domain/business/TechReport.java new file mode 100644 index 0000000..3f17d83 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/TechReport.java @@ -0,0 +1,118 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +/** + * 科技报告信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("tech_report") +public class TechReport extends BaseEntity { + + /** + * 报告id + */ + @TableId + private String id; + + /** + * 项目id + */ + private String projectId; + + /** + * 报告名称(中文) + */ + private String reportNameCn; + + /** + * 报告名称(英文) + */ + private String reportName; + + /** + * 作者(中文) + */ + private String authorCn; + + /** + * 作者(英文) + */ + private String authorEn; + + /** + * 作者单位(中文) + */ + private String workplaceCn; + + /** + * 作者单位(英文) + */ + private String workplaceEn; + + /** + * 关键词(中文) + */ + private String keywordCn; + + /** + * 关键词(英文) + */ + private String keywordEn; + + /** + * 摘要(中文) + */ + private String summaryCn; + + /** + * 摘要(英文) + */ + private String summaryEn; + + /** + * 编撰时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime writingTime; + + /** + * 支持机构 + */ + private String institution; + + /** + * 报告类型 + */ + private String reportType; + + /** + * 支持渠道 + */ + private String channel; + + /** + * 是否公开 + */ + private String isPublic; + + /** + * 报告状态 + */ + private String status; + + /** + * 报告全文路径 + */ + private String reportPath; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/business/WorkDomain.java b/src/main/java/com/CUST/brain/dao/domain/business/WorkDomain.java new file mode 100644 index 0000000..dd3c236 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/business/WorkDomain.java @@ -0,0 +1,37 @@ +package com.CUST.brain.dao.domain.business; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 工作领域信息实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("work_domain") +public class WorkDomain extends BaseEntity { + + /** + * 领域id + */ + @TableId + private String id; + + /** + * 人才id + */ + private String talentId; + + /** + * 学科项目 + */ + private String disciplineDomain; + + /** + * 行业领域 + */ + private String industryDomain; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/relation/PapersAndMonographsTalent.java b/src/main/java/com/CUST/brain/dao/domain/relation/PapersAndMonographsTalent.java new file mode 100644 index 0000000..c5bb5cd --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/relation/PapersAndMonographsTalent.java @@ -0,0 +1,28 @@ +package com.CUST.brain.dao.domain.relation; + +import com.CUST.brain.dao.domain.base.BaseRelationEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 论文专著关联实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("papers_and_monographs_talent") +public class PapersAndMonographsTalent extends BaseRelationEntity { + + /** + * 人才ID + */ + @TableField("talent_id") + private String talentId; + + /** + * 论文专著ID + */ + @TableField("papers_and_monographs_id") + private String papersAndMonographsId; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/relation/PatentTalent.java b/src/main/java/com/CUST/brain/dao/domain/relation/PatentTalent.java new file mode 100644 index 0000000..82d0a86 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/relation/PatentTalent.java @@ -0,0 +1,28 @@ +package com.CUST.brain.dao.domain.relation; + +import com.CUST.brain.dao.domain.base.BaseRelationEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 专利关联实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("patent_talent") +public class PatentTalent extends BaseRelationEntity { + + /** + * 人才ID + */ + @TableField("talent_id") + private String talentId; + + /** + * 专利ID + */ + @TableField("patent_id") + private String patentId; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/relation/ResearchProjectTalent.java b/src/main/java/com/CUST/brain/dao/domain/relation/ResearchProjectTalent.java new file mode 100644 index 0000000..33c6725 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/relation/ResearchProjectTalent.java @@ -0,0 +1,26 @@ +package com.CUST.brain.dao.domain.relation; + +import com.CUST.brain.dao.domain.base.BaseRelationEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 科研项目人才关联实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("research_project_talent") +public class ResearchProjectTalent extends BaseRelationEntity { + + /** + * 项目编号 + */ + private String projectId; + + /** + * 人才id + */ + private String talentId; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/relation/SysRolePermission.java b/src/main/java/com/CUST/brain/dao/domain/relation/SysRolePermission.java new file mode 100644 index 0000000..ceafd26 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/relation/SysRolePermission.java @@ -0,0 +1,28 @@ +package com.CUST.brain.dao.domain.relation; + +import com.CUST.brain.dao.domain.base.BaseRelationEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 角色权限关联实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_role_permission") +public class SysRolePermission extends BaseRelationEntity { + + /** + * 角色ID + */ + @TableField("role_id") + private String roleId; + + /** + * 权限ID + */ + @TableField("permission_id") + private String permissionId; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/relation/SysUserRole.java b/src/main/java/com/CUST/brain/dao/domain/relation/SysUserRole.java new file mode 100644 index 0000000..ba10bfc --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/relation/SysUserRole.java @@ -0,0 +1,28 @@ +package com.CUST.brain.dao.domain.relation; + +import com.CUST.brain.dao.domain.base.BaseRelationEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户角色关联实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_user_role") +public class SysUserRole extends BaseRelationEntity { + + /** + * 用户ID + */ + @TableField("user_id") + private String userId; + + /** + * 角色ID + */ + @TableField("role_id") + private String roleId; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/relation/TalentProjectInitiation.java b/src/main/java/com/CUST/brain/dao/domain/relation/TalentProjectInitiation.java new file mode 100644 index 0000000..b71276e --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/relation/TalentProjectInitiation.java @@ -0,0 +1,34 @@ +package com.CUST.brain.dao.domain.relation; + +import com.CUST.brain.dao.domain.base.BaseRelationEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 人才立项关联实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("talent_project_initiation") +public class TalentProjectInitiation extends BaseRelationEntity { + + /** + * 人才ID + */ + @TableField("talent_id") + private String talentId; + + /** + * 立项项目ID + */ + @TableField("project_initiation_id") + private String projectInitiationId; + + /** + * 是否负责人(0:否,1:是) + */ + @TableField("is_principal") + private Boolean isPrincipal; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/relation/TalentReport.java b/src/main/java/com/CUST/brain/dao/domain/relation/TalentReport.java new file mode 100644 index 0000000..ea04b8e --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/relation/TalentReport.java @@ -0,0 +1,26 @@ +package com.CUST.brain.dao.domain.relation; + +import com.CUST.brain.dao.domain.base.BaseRelationEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 人才报告关联实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("talent_report") +public class TalentReport extends BaseRelationEntity { + + /** + * 人才id + */ + private String talentId; + + /** + * 报告id + */ + private String reportId; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/system/SysParam.java b/src/main/java/com/CUST/brain/dao/domain/system/SysParam.java new file mode 100644 index 0000000..0ec607a --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/system/SysParam.java @@ -0,0 +1,19 @@ +package com.CUST.brain.dao.domain.system; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_param") +public class SysParam extends BaseEntity { + private String paramType; + private String paramName; + private String paramValue; + private String dataType; + private Integer sortOrder; + private Integer status; + private String remark; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/system/SysParam.java~ b/src/main/java/com/CUST/brain/dao/domain/system/SysParam.java~ new file mode 100644 index 0000000..48f882e --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/system/SysParam.java~ @@ -0,0 +1,22 @@ +package com.CUST.brain.dao.domain.system; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_param") +public class SysParam extends BaseEntity { + private String paramType; + private String paramCode; + private String paramName; + private String paramValue; + private String dataType; + private Integer sortOrder; + private Integer status; + private + +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/system/SysParamType.java b/src/main/java/com/CUST/brain/dao/domain/system/SysParamType.java new file mode 100644 index 0000000..d982519 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/system/SysParamType.java @@ -0,0 +1,40 @@ +package com.CUST.brain.dao.domain.system; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 系统参数类型实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_param_type") +public class SysParamType extends BaseEntity { + + /** + * 类型代码 + */ + private String typeCode; + + /** + * 类型名称 + */ + private String typeName; + + /** + * 类型描述 + */ + private String remark; + + /** + * 排序 + */ + private Integer sortOrder; + + private Integer status; + + // getter和setter略,可自动生成 +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/system/SysParamType.java~ b/src/main/java/com/CUST/brain/dao/domain/system/SysParamType.java~ new file mode 100644 index 0000000..f5fc017 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/system/SysParamType.java~ @@ -0,0 +1,40 @@ +package com.CUST.brain.dao.domain.system; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 系统参数类型实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_param_type") +public class SysParamType extends BaseEntity { + + /** + * 类型代码 + */ + private String typeCode; + + /** + * 类型名称 + */ + private String typeName; + + /** + * 类型描述 + */ + private String typeDesc; + + /** + * 排序 + */ + private Integer sortOrder; + + private Integer status; + + // getter和setter略,可自动生成 +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/system/SysPermission.java b/src/main/java/com/CUST/brain/dao/domain/system/SysPermission.java new file mode 100644 index 0000000..cbc6229 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/system/SysPermission.java @@ -0,0 +1,67 @@ +package com.CUST.brain.dao.domain.system; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 系统权限实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_permission") +public class SysPermission extends BaseEntity { + + /** + * 主键ID + */ + @TableId + private String id; + + /** + * 权限名称 + */ + private String permissionName; + + /** + * 权限编码 + */ + private String permissionCode; + + /** + * 权限类型:1-菜单,2-按钮,3-接口 + */ + private Integer permissionType; + + /** + * 父权限ID + */ + private String parentId; + + /** + * 路径 + */ + private String path; + + /** + * 前端组件 + */ + private String component; + + /** + * 图标 + */ + private String icon; + + /** + * 排序 + */ + private Integer sort; + + /** + * 状态:0-禁用,1-启用 + */ + private Integer status; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/system/SysRole.java b/src/main/java/com/CUST/brain/dao/domain/system/SysRole.java new file mode 100644 index 0000000..78220e0 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/system/SysRole.java @@ -0,0 +1,52 @@ +package com.CUST.brain.dao.domain.system; + +import com.CUST.brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 系统角色实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_role") +public class SysRole extends BaseEntity { + + /** + * 主键ID + */ + @TableId + private String id; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 角色编码 + */ + private String roleCode; + + /** + * 角色描述 + */ + private String roleDesc; + + /** + * 登录类型:1-仅展示端,2-展示端和后台 + */ + private Integer loginType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 状态:0-禁用,1-启用 + */ + private Integer status; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/system/SysRole.java~ b/src/main/java/com/CUST/brain/dao/domain/system/SysRole.java~ new file mode 100644 index 0000000..983dea2 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/system/SysRole.java~ @@ -0,0 +1,47 @@ +package com.axtk.technological_brain.dao.domain.system; + +import com.axtk.technological_brain.dao.domain.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 系统角色实体类 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sys_role") +public class SysRole extends BaseEntity { + + /** + * 主键ID + */ + @TableId + private String id; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 角色编码 + */ + private String roleCode; + + /** + * 角色描述 + */ + private String description; + + /** + * 排序 + */ + private Integer sort; + + /** + * 状态:0-禁用,1-启用 + */ + private Integer status; +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/domain/system/SysUser.java b/src/main/java/com/CUST/brain/dao/domain/system/SysUser.java new file mode 100644 index 0000000..3bb78ac --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/domain/system/SysUser.java @@ -0,0 +1,75 @@ +package com.CUST.brain.dao.domain.system; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * 系统用户实体类 + */ +@Data +@TableName("sys_user") +@ApiModel("系统用户") +public class SysUser { + + @TableId(type = IdType.ASSIGN_UUID) + @ApiModelProperty("用户ID") + private String id; + + @ApiModelProperty("用户名") + private String username; + + @ApiModelProperty("密码") + private String password; + + @ApiModelProperty("真实姓名") + private String realName; + + @ApiModelProperty("手机号") + private String phone; + + @ApiModelProperty("邮箱") + private String email; + + @ApiModelProperty("状态:0-禁用,1-启用") + private Integer status; + + @ApiModelProperty("最后登录时间") + private LocalDateTime lastLoginTime; + + @ApiModelProperty("最后登录IP") + private String lastLoginIp; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + + /** + * 更新人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + @ApiModelProperty("删除标志:0-已删除,1-未删除") + private Integer flag; + + /** + * 获取用户ID + */ + @JsonIgnore + public String getUserId() { + return this.id; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/AcademicAwardMapper.java b/src/main/java/com/CUST/brain/dao/mapper/AcademicAwardMapper.java new file mode 100644 index 0000000..7b0a608 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/AcademicAwardMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.AcademicAward; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 学术奖励Mapper接口 + */ +@Mapper +public interface AcademicAwardMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/EmploymentUnitMapper.java b/src/main/java/com/CUST/brain/dao/mapper/EmploymentUnitMapper.java new file mode 100644 index 0000000..fbb8fc0 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/EmploymentUnitMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.EmploymentUnit; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 就业单位Mapper接口 + */ +@Mapper +public interface EmploymentUnitMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/EnterpriseInfoMapper.java b/src/main/java/com/CUST/brain/dao/mapper/EnterpriseInfoMapper.java new file mode 100644 index 0000000..ba1603e --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/EnterpriseInfoMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.EnterpriseInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 企业信息Mapper接口 + */ +@Mapper +public interface EnterpriseInfoMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/HonoraryTitleMapper.java b/src/main/java/com/CUST/brain/dao/mapper/HonoraryTitleMapper.java new file mode 100644 index 0000000..9b14b2f --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/HonoraryTitleMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.HonoraryTitle; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 荣誉称号Mapper接口 + */ +@Mapper +public interface HonoraryTitleMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/PapersAndMonographsMapper.java b/src/main/java/com/CUST/brain/dao/mapper/PapersAndMonographsMapper.java new file mode 100644 index 0000000..69a3477 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/PapersAndMonographsMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.PapersAndMonographs; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 论文专著Mapper接口 + */ +@Mapper +public interface PapersAndMonographsMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/PapersAndMonographsTalentMapper.java b/src/main/java/com/CUST/brain/dao/mapper/PapersAndMonographsTalentMapper.java new file mode 100644 index 0000000..3ce1d56 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/PapersAndMonographsTalentMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.relation.PapersAndMonographsTalent; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 论文专著人才关联Mapper接口 + */ +@Mapper +public interface PapersAndMonographsTalentMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/PatentMapper.java b/src/main/java/com/CUST/brain/dao/mapper/PatentMapper.java new file mode 100644 index 0000000..fb03778 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/PatentMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.Patent; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 专利Mapper接口 + */ +@Mapper +public interface PatentMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/PatentTalentMapper.java b/src/main/java/com/CUST/brain/dao/mapper/PatentTalentMapper.java new file mode 100644 index 0000000..55ae032 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/PatentTalentMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.relation.PatentTalent; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 专利人才关联Mapper接口 + */ +@Mapper +public interface PatentTalentMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/ProjectInitiationMapper.java b/src/main/java/com/CUST/brain/dao/mapper/ProjectInitiationMapper.java new file mode 100644 index 0000000..5d1c1f9 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/ProjectInitiationMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.ProjectInitiation; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 项目立项Mapper接口 + */ +@Mapper +public interface ProjectInitiationMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/ResearchProjectMapper.java b/src/main/java/com/CUST/brain/dao/mapper/ResearchProjectMapper.java new file mode 100644 index 0000000..330ec1b --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/ResearchProjectMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.ResearchProject; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 科研项目Mapper接口 + */ +@Mapper +public interface ResearchProjectMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/ResearchProjectTalentMapper.java b/src/main/java/com/CUST/brain/dao/mapper/ResearchProjectTalentMapper.java new file mode 100644 index 0000000..ff3b4ce --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/ResearchProjectTalentMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.relation.ResearchProjectTalent; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 科研项目人才关联Mapper接口 + */ +@Mapper +public interface ResearchProjectTalentMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/ResumeMapper.java b/src/main/java/com/CUST/brain/dao/mapper/ResumeMapper.java new file mode 100644 index 0000000..8a0121d --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/ResumeMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.Resume; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 简历Mapper接口 + */ +@Mapper +public interface ResumeMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/ReviewExperienceMapper.java b/src/main/java/com/CUST/brain/dao/mapper/ReviewExperienceMapper.java new file mode 100644 index 0000000..13d5dde --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/ReviewExperienceMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.ReviewExperience; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 评审经历Mapper接口 + */ +@Mapper +public interface ReviewExperienceMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/SysParamMapper.java b/src/main/java/com/CUST/brain/dao/mapper/SysParamMapper.java new file mode 100644 index 0000000..8f2251b --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/SysParamMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.system.SysParam; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 系统参数Mapper接口 + */ +@Mapper +public interface SysParamMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/SysParamTypeMapper.java b/src/main/java/com/CUST/brain/dao/mapper/SysParamTypeMapper.java new file mode 100644 index 0000000..2f47842 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/SysParamTypeMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.system.SysParamType; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 系统参数类型Mapper接口 + */ +@Mapper +public interface SysParamTypeMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/SysPermissionMapper.java b/src/main/java/com/CUST/brain/dao/mapper/SysPermissionMapper.java new file mode 100644 index 0000000..16afa8d --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/SysPermissionMapper.java @@ -0,0 +1,32 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.common.dto.system.PermissionTreeVO; +import com.CUST.brain.dao.domain.system.SysPermission; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 系统权限Mapper接口 + */ +public interface SysPermissionMapper extends BaseMapper { + + /** + * 根据用户ID查询权限列表 + * + * @param userId 用户ID + * @return 权限列表 + */ + + List selectPermissionsByUserId(@Param("userId") String userId); + + List selectPermissionsWithRoleStatus(@Param("roleId") String roleId, @Param("isSuperAdmin") boolean isSuperAdmin); + + List selectPermissionsByRoleId(@Param("roleId") String roleId); + + void deleteRolePermissionsByRoleId(@Param("roleId") String roleId); + + void insertRolePermissionsBatch(@Param("list") List list); + +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/SysRoleMapper.java b/src/main/java/com/CUST/brain/dao/mapper/SysRoleMapper.java new file mode 100644 index 0000000..a946424 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/SysRoleMapper.java @@ -0,0 +1,29 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.system.SysRole; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +import java.util.List; + +/** + * 系统角色Mapper接口 + */ +public interface SysRoleMapper extends BaseMapper { + + /** + * 根据用户ID查询角色列表 + * + * @param userId 用户ID + * @return 角色列表 + */ + List selectRolesByUserId(@Param("userId") String userId); + + @Update("UPDATE sys_role SET status = 0 WHERE id = #{roleId} AND status = 1") + int disableRole(@Param("roleId") String roleId); + + @Update("UPDATE sys_role SET status = 1 WHERE id = #{roleId} AND status = 0") + int restoreRole(@Param("roleId") String roleId); +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/SysRolePermissionMapper.java b/src/main/java/com/CUST/brain/dao/mapper/SysRolePermissionMapper.java new file mode 100644 index 0000000..8ae74a8 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/SysRolePermissionMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.relation.SysRolePermission; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 角色权限关联Mapper接口 + */ +@Mapper +public interface SysRolePermissionMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/SysUserMapper.java b/src/main/java/com/CUST/brain/dao/mapper/SysUserMapper.java new file mode 100644 index 0000000..72f5757 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/SysUserMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.system.SysUser; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 系统用户Mapper接口 + */ +@Mapper +public interface SysUserMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/SysUserRoleMapper.java b/src/main/java/com/CUST/brain/dao/mapper/SysUserRoleMapper.java new file mode 100644 index 0000000..8d611ca --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/SysUserRoleMapper.java @@ -0,0 +1,20 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.relation.SysUserRole; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import java.util.List; + +/** + * 用户角色关联Mapper接口 + */ +@Mapper +public interface SysUserRoleMapper extends BaseMapper { + /** + * 根据角色ID查找所有拥有该角色的用户ID + */ + @Select("SELECT user_id FROM sys_user_role WHERE role_id = #{roleId}") + List selectUserIdsByRoleId(@Param("roleId") String roleId); +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/TalentBasicMapper.java b/src/main/java/com/CUST/brain/dao/mapper/TalentBasicMapper.java new file mode 100644 index 0000000..ffa58e5 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/TalentBasicMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.TalentBasic; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 人才基本信息Mapper接口 + */ +@Mapper +public interface TalentBasicMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/TalentProjectInitiationMapper.java b/src/main/java/com/CUST/brain/dao/mapper/TalentProjectInitiationMapper.java new file mode 100644 index 0000000..b7243d2 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/TalentProjectInitiationMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.relation.TalentProjectInitiation; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 人才项目立项关联Mapper接口 + */ +@Mapper +public interface TalentProjectInitiationMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/TalentReportMapper.java b/src/main/java/com/CUST/brain/dao/mapper/TalentReportMapper.java new file mode 100644 index 0000000..98384de --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/TalentReportMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.relation.TalentReport; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 人才报告关联Mapper接口 + */ +@Mapper +public interface TalentReportMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/TechReportMapper.java b/src/main/java/com/CUST/brain/dao/mapper/TechReportMapper.java new file mode 100644 index 0000000..319c0a0 --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/TechReportMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.TechReport; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 技术报告Mapper接口 + */ +@Mapper +public interface TechReportMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/dao/mapper/WorkDomainMapper.java b/src/main/java/com/CUST/brain/dao/mapper/WorkDomainMapper.java new file mode 100644 index 0000000..5a462fd --- /dev/null +++ b/src/main/java/com/CUST/brain/dao/mapper/WorkDomainMapper.java @@ -0,0 +1,12 @@ +package com.CUST.brain.dao.mapper; + +import com.CUST.brain.dao.domain.business.WorkDomain; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作领域Mapper接口 + */ +@Mapper +public interface WorkDomainMapper extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/SysParamService.java b/src/main/java/com/CUST/brain/service/SysParamService.java new file mode 100644 index 0000000..523f574 --- /dev/null +++ b/src/main/java/com/CUST/brain/service/SysParamService.java @@ -0,0 +1,51 @@ +package com.CUST.brain.service; + +import com.CUST.brain.dao.domain.system.SysParam; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; +import java.util.Map; + +public interface SysParamService extends IService { + + /** + * 根据参数类型获取参数列表 + * + * @param typeId 参数类型ID + * @return 参数Map,key为参数名,value为参数值 + */ + Map getParamsByType(String typeId); + + /** + * 获取参数值 + * + * @param typeId 参数类型ID + * @param paramName 参数名 + * @return 参数值 + */ + String getParamValue(String typeId, String paramName); + + /** + * 更新参数 + * + * @param param 参数对象 + * @return 是否成功 + */ + boolean updateParam(SysParam param); + + /** + * 根据参数类型获取参数列表 + * + * @param typeCode 参数类型编码 + * @return 参数列表 + */ + List listByType(String typeCode); + + /** + * 批量获取多个参数类型的参数列表 + * + * @param typeCodes 参数类型编码列表 + * @return Map> key为参数类型编码,value为该类型的参数列表 + */ + Map> getParamsByTypes(List typeCodes); +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/SysParamTypeService.java b/src/main/java/com/CUST/brain/service/SysParamTypeService.java new file mode 100644 index 0000000..e6e368c --- /dev/null +++ b/src/main/java/com/CUST/brain/service/SysParamTypeService.java @@ -0,0 +1,35 @@ +package com.CUST.brain.service; + +import com.CUST.brain.dao.domain.system.SysParamType; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * 系统参数类型服务接口 + */ +public interface SysParamTypeService extends IService { + + /** + * 获取所有参数类型列表 + * + * @return 参数类型列表 + */ + List listAll(); + + /** + * 根据类型名称查询参数类型 + * + * @param typeName 类型名称 + * @return 参数类型 + */ + SysParamType getByTypeName(String typeName); + + /** + * 更新参数类型 + * + * @param paramType 参数类型 + * @return 是否成功 + */ + boolean updateParamType(SysParamType paramType); +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/SysPermissionService.java b/src/main/java/com/CUST/brain/service/SysPermissionService.java new file mode 100644 index 0000000..d706b9e --- /dev/null +++ b/src/main/java/com/CUST/brain/service/SysPermissionService.java @@ -0,0 +1,42 @@ +package com.CUST.brain.service; + +import com.CUST.brain.common.dto.system.UpdateRolePermissionsRequestDTO; +import com.CUST.brain.dao.domain.system.SysPermission; +import com.baomidou.mybatisplus.extension.service.IService; +import com.CUST.brain.common.dto.system.PermissionTreeVO; + +import java.util.List; + +public interface SysPermissionService extends IService { + + /** + * 根据用户ID获取权限列表 + * + * @param userId 用户ID + * @return 权限列表 + */ + List getPermissionsByUserId(String userId); + + /** + * 根据权限编码获取权限 + * + * @param permissionCode 权限编码 + * @return 权限信息 + */ + SysPermission getByPermissionCode(String permissionCode); + + /** + * 获取分配角色权限的权限列表 + * @param roleId 角色ID + * @return 权限列表 + */ + List listForRoleTree(String roleId); + + /** + * 更新角色权限 + * @param requestDTO 角色权限更新DTO + */ + void updateRolePermissions(UpdateRolePermissionsRequestDTO requestDTO); + + List getPermissionIdsByRoleId(String roleId); +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/SysRoleService.java b/src/main/java/com/CUST/brain/service/SysRoleService.java new file mode 100644 index 0000000..cecd5ff --- /dev/null +++ b/src/main/java/com/CUST/brain/service/SysRoleService.java @@ -0,0 +1,61 @@ +package com.CUST.brain.service; + +import com.CUST.brain.dao.domain.system.SysRole; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import java.util.List; + +public interface SysRoleService extends IService { + + /** + * 根据用户ID获取角色列表 + * + * @param userId 用户ID + * @return 角色列表 + */ + List getRolesByUserId(String userId); + + /** + * 根据角色编码获取角色 + * + * @param roleCode 角色编码 + * @return 角色信息 + */ + SysRole getByRoleCode(String roleCode); + + void addRole(SysRole role); + void updateRole(SysRole role); + void deleteRole(String roleId); + void disableRole(String roleId); + void restoreRole(String roleId); + + /** + * 获取角色详情 + * + * @param roleId 角色ID + * @return 角色详细信息 + */ + SysRole getRoleDetail(String roleId); + + /** + * 分页查询角色列表 + * + * @param pageNum 页码 + * @param pageSize 每页数量 + * @param roleName 角色名称(可选) + * @param roleCode 角色编码(可选) + * @param status 状态(可选) + * @return 分页结果 + */ + Page pageRoles(Integer pageNum, Integer pageSize, String roleName, String roleCode, Integer status); + + /** + * 获取角色列表(用于下拉框) + * + * @param roleName 角色名称(可选,用于搜索) + * @param status 状态(可选,1-启用) + * @return 角色列表 + */ + List listRoles(String roleName, Integer status); +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/SysUserService.java b/src/main/java/com/CUST/brain/service/SysUserService.java new file mode 100644 index 0000000..dc5beaf --- /dev/null +++ b/src/main/java/com/CUST/brain/service/SysUserService.java @@ -0,0 +1,112 @@ +package com.CUST.brain.service; + +import com.CUST.brain.dao.domain.system.SysUser; +import com.CUST.brain.common.dto.system.LoginRequestDTO; +import com.CUST.brain.common.dto.system.LoginResponseDTO; +import com.CUST.brain.common.dto.system.UserInfoResponseDTO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * 系统用户服务接口 + */ +public interface SysUserService extends IService { + + /** + * 用户登录 + * + * @param loginDTO 登录信息 + * @return 登录响应 + */ + LoginResponseDTO login(LoginRequestDTO loginDTO); + + /** + * 用户登出 + * + * @param token 用户token + * @param userId 用户ID + */ + void logout(String token, String userId); + + /** + * 添加用户 + * + * @param user 用户信息 + * @return 是否成功 + */ + boolean addUser(SysUser user); + + /** + * 根据用户名查询用户 + * + * @param username 用户名 + * @return 用户信息 + */ + SysUser getByUsername(String username); + + /** + * 更新用户状态 + * + * @param id 用户ID + * @param status 状态:0-禁用,1-启用 + * @return 是否成功 + */ + boolean updateStatus(String id, Integer status); + + /** + * 更新用户密码 + * + * @param id 用户ID + * @param oldPassword 旧密码 + * @param newPassword 新密码 + * @return 是否成功 + */ + boolean updatePassword(String id, String oldPassword, String newPassword); + + /** + * 重置用户密码 + * + * @param id 用户ID + * @return 新密码 + */ + String resetPassword(String id); + + /** + * 更新用户最后登录信息 + * + * @param id 用户ID + * @param ip 登录IP + * @return 是否成功 + */ + boolean updateLoginInfo(String id, String ip); + + /** + * 获取用户信息 + * + * @param userId 用户ID + * @return 用户信息 + */ + UserInfoResponseDTO getUserInfo(String userId); + + /** + * 更新用户 + * + * @param user 用户信息 + * @return 是否成功 + */ + boolean updateUser(SysUser user); + + /** + * 用户分配角色 + * + * @param userId 用户id,roleIds 角色id列表 + * + */ + void assignRoles(String userId, List roleIds); + + /** + * 删除用户并清理相关缓存 + */ + boolean deleteUser(String userId); +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/TalentBasicService.java b/src/main/java/com/CUST/brain/service/TalentBasicService.java new file mode 100644 index 0000000..2cb2a51 --- /dev/null +++ b/src/main/java/com/CUST/brain/service/TalentBasicService.java @@ -0,0 +1,52 @@ +package com.CUST.brain.service; + +import com.CUST.brain.dao.domain.business.TalentBasic; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * 人才基本信息服务接口 + */ +public interface TalentBasicService extends IService { + + /** + * 根据姓名查询人才 + * + * @param name 姓名 + * @return 人才列表 + */ + List getByName(String name); + + /** + * 根据单位ID查询人才 + * + * @param unitId 单位ID + * @return 人才列表 + */ + List getByUnitId(String unitId); + + /** + * 根据职称查询人才 + * + * @param title 职称 + * @return 人才列表 + */ + List getByTitle(String title); + + /** + * 根据分类定级查询人才 + * + * @param classifyGrade 分类定级 + * @return 人才列表 + */ + List getByClassifyGrade(String classifyGrade); + + /** + * 更新人才信息 + * + * @param talent 人才信息 + * @return 是否成功 + */ + boolean updateTalent(TalentBasic talent); +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/impl/SysParamServiceImpl.java b/src/main/java/com/CUST/brain/service/impl/SysParamServiceImpl.java new file mode 100644 index 0000000..2d75f5f --- /dev/null +++ b/src/main/java/com/CUST/brain/service/impl/SysParamServiceImpl.java @@ -0,0 +1,83 @@ +package com.CUST.brain.service.impl; + +import com.CUST.brain.common.cache.ParamCacheManager; +import com.CUST.brain.dao.domain.system.SysParam; +import com.CUST.brain.dao.mapper.SysParamMapper; +import com.CUST.brain.service.SysParamService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class SysParamServiceImpl extends ServiceImpl implements SysParamService { + + @Resource + private ParamCacheManager paramCacheManager; + + @Override + public Map getParamsByType(String typeId) { + // 先从缓存获取 + Map paramMap = paramCacheManager.getParamMap(typeId); + if (paramMap == null) { + // 缓存未命中,从数据库查询 + List params = listByType(typeId); + paramMap = params.stream() + .collect(Collectors.toMap( + SysParam::getParamName, + SysParam::getParamValue, + (v1, v2) -> v1 + )); + // 更新缓存 + paramCacheManager.cacheParamList(typeId, params); + } + return paramMap; + } + + @Override + public String getParamValue(String typeId, String paramName) { + Map paramMap = getParamsByType(typeId); + return paramMap.get(paramName); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateParam(SysParam param) { + boolean result = updateById(param); + if (result) { + // 删除缓存 + paramCacheManager.removeParamCache(param.getParamType()); + } + return result; + } + + @Override + public List listByType(String typeCode) { + // 先从缓存获取 + List params = paramCacheManager.getParamList(typeCode); + if (params == null) { + // 缓存未命中,从数据库查询 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysParam::getParamType, typeCode); + params = list(wrapper); + // 更新缓存 + paramCacheManager.cacheParamList(typeCode, params); + } + return params; + } + + @Override + public Map> getParamsByTypes(List typeCodes) { + if (typeCodes == null || typeCodes.isEmpty()) { + return Collections.emptyMap(); + } + Map> result = new HashMap<>(); + for (String typeCode : typeCodes) { + result.put(typeCode, listByType(typeCode)); + } + return result; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/impl/SysParamTypeServiceImpl.java b/src/main/java/com/CUST/brain/service/impl/SysParamTypeServiceImpl.java new file mode 100644 index 0000000..1e49b08 --- /dev/null +++ b/src/main/java/com/CUST/brain/service/impl/SysParamTypeServiceImpl.java @@ -0,0 +1,60 @@ +package com.CUST.brain.service.impl; + +import com.CUST.brain.common.annotation.RedisCache; +import com.CUST.brain.common.constant.RedisKeyConstants; +import com.CUST.brain.dao.domain.system.SysParamType; +import com.CUST.brain.dao.mapper.SysParamTypeMapper; +import com.CUST.brain.service.SysParamTypeService; +import com.CUST.brain.common.utils.RedisUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 系统参数类型服务实现类 + */ +@Service +public class SysParamTypeServiceImpl extends ServiceImpl implements SysParamTypeService { + + @Resource + private RedisUtils redisUtils; + + @Autowired + private ObjectMapper objectMapper; + + @Override + @RedisCache(key = RedisKeyConstants.SYS_PREFIX + "param:type:list", expire = 86400) + public List listAll() { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysParamType::getFlag, 0) + .orderByAsc(SysParamType::getSortOrder); + return list(wrapper); + } + + @Override + @RedisCache(key = RedisKeyConstants.SYS_PREFIX + "param:type:name:#{typeName}", expire = 86400) + public SysParamType getByTypeName(String typeName) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysParamType::getTypeName, typeName) + .eq(SysParamType::getFlag, 0); + return getOne(wrapper); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateParamType(SysParamType paramType) { + boolean result = updateById(paramType); + if (result) { + // 删除相关缓存 + redisUtils.delete(RedisKeyConstants.SYS_PREFIX + "param:type:list"); + redisUtils.delete(RedisKeyConstants.SYS_PREFIX + "param:type:name:" + paramType.getTypeName()); + } + return result; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/impl/SysPermissionServiceImpl.java b/src/main/java/com/CUST/brain/service/impl/SysPermissionServiceImpl.java new file mode 100644 index 0000000..9fc3c6e --- /dev/null +++ b/src/main/java/com/CUST/brain/service/impl/SysPermissionServiceImpl.java @@ -0,0 +1,110 @@ +package com.CUST.brain.service.impl; + +import com.CUST.brain.common.annotation.RedisCache; +import com.CUST.brain.common.constant.RedisKeyConstants; +import com.CUST.brain.common.dto.system.PermissionTreeVO; +import com.CUST.brain.common.dto.system.UpdateRolePermissionsRequestDTO; +import com.CUST.brain.dao.domain.system.SysPermission; +import com.CUST.brain.dao.domain.system.SysRole; +import com.CUST.brain.dao.domain.relation.SysRolePermission; +import com.CUST.brain.dao.mapper.SysPermissionMapper; +import com.CUST.brain.dao.mapper.SysRoleMapper; +import com.CUST.brain.service.SysPermissionService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.CUST.brain.common.utils.CacheCleanUtils; +import javax.annotation.Resource; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +@Service +public class SysPermissionServiceImpl extends ServiceImpl implements SysPermissionService { + + private static final Logger log = LoggerFactory.getLogger(SysPermissionServiceImpl.class); + + @Resource + private CacheCleanUtils cacheCleanUtils; + + @Resource + private SysRoleMapper sysRoleMapper; + + @Autowired + private ObjectMapper objectMapper; + + @Override + @RedisCache(key = "'user:permissions:' + #p0", expire = 1800, cacheNull = true) + public List getPermissionsByUserId(String userId) { + log.debug("SysPermissionServiceImpl.getPermissionsByUserId 入参: {}", userId); + List permissions = baseMapper.selectPermissionsByUserId(userId); + log.debug("SysPermissionServiceImpl.getPermissionsByUserId 查询结果: {}", permissions); + return permissions; + } + + @Override + @RedisCache(key = RedisKeyConstants.SYS_PERMISSION + "code:${#permissionCode}", expire = 1800) + public SysPermission getByPermissionCode(String permissionCode) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysPermission::getPermissionCode, permissionCode) + .eq(SysPermission::getFlag, 1); + return getOne(wrapper); + } + + /** + * 获取分配角色权限的权限列表 + * @param roleId 角色ID + * @return 权限列表 + */ + @Override + @RedisCache(key = "'permission:listForRoleTree:' + #roleId", expire = 1800) + public List listForRoleTree(String roleId) { + SysRole role = sysRoleMapper.selectById(roleId); + boolean isSuperAdmin = role != null && "SUPER_ADMIN".equals(role.getRoleCode()); + List flatList = baseMapper.selectPermissionsWithRoleStatus(roleId, isSuperAdmin); + return buildTree(flatList, null); + } + + private List buildTree(List list, String parentId) { + List children = list.stream() + .filter(node -> (parentId == null ? node.getParentId() == null : parentId.equals(node.getParentId()))) + .peek(node -> { + List childList = buildTree(list, node.getId()); + node.setChildren(childList); + }) + .collect(java.util.stream.Collectors.toList()); + return children; + } + + @Override + public List getPermissionIdsByRoleId(String roleId) { + return baseMapper.selectPermissionsByRoleId(roleId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateRolePermissions(UpdateRolePermissionsRequestDTO requestDTO) { + String roleId = requestDTO.getRoleId(); + List permissionIds = requestDTO.getPermissionIds(); + // 删除原有权限 + baseMapper.deleteRolePermissionsByRoleId(roleId); + // 批量插入新权限 + if (permissionIds != null && !permissionIds.isEmpty()) { + List list = new java.util.ArrayList<>(); + for (String pid : permissionIds) { + SysRolePermission rp = new SysRolePermission(); + rp.setRoleId(roleId); + rp.setPermissionId(pid); + list.add(rp); + } + baseMapper.insertRolePermissionsBatch(list); + } + // 清理相关缓存 + cacheCleanUtils.clearRoleCache(roleId); + cacheCleanUtils.clearUsersByRole(roleId); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/impl/SysRoleServiceImpl.java b/src/main/java/com/CUST/brain/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000..b6de5ff --- /dev/null +++ b/src/main/java/com/CUST/brain/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,165 @@ +package com.CUST.brain.service.impl; + +import com.CUST.brain.common.annotation.RedisCache; +import com.CUST.brain.common.exception.BusinessException; +import com.CUST.brain.dao.domain.system.SysRole; +import com.CUST.brain.dao.mapper.SysRoleMapper; +import com.CUST.brain.service.SysRoleService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import com.CUST.brain.dao.mapper.SysUserRoleMapper; +import com.CUST.brain.common.utils.RedisUtils; +import javax.annotation.Resource; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.commons.lang3.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.CUST.brain.common.utils.CacheCleanUtils; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.List; + +@Service +public class SysRoleServiceImpl extends ServiceImpl implements SysRoleService { + private static final Logger log = LoggerFactory.getLogger(SysRoleServiceImpl.class); + + @Resource + private RedisUtils redisUtils; + @Resource + private SysUserRoleMapper sysUserRoleMapper; + @Resource + private CacheCleanUtils cacheCleanUtils; + + @Resource + private SysRoleMapper sysRoleMapper; + + @Autowired + private ObjectMapper objectMapper; + + @Override + @RedisCache(key = "'user:roles:' + #p0", expire = 1800, cacheNull = true) + public List getRolesByUserId(String userId) { + String cacheKey = "cache:user:roles:" + userId; + Object obj = redisUtils.get(cacheKey); + if (obj != null) { + try { + return objectMapper.readValue(obj.toString(), new TypeReference>(){}); + } catch (Exception e) { + log.error("角色缓存反序列化失败", e); + // 反序列化失败时可选择清理缓存或降级为数据库查询 + } + } + return baseMapper.selectRolesByUserId(userId); + } + + @Override + public SysRole getByRoleCode(String roleCode) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysRole::getRoleCode, roleCode) + .eq(SysRole::getFlag, 0); + return getOne(wrapper); + } + + @Override + public void addRole(SysRole role) { + save(role); + } + + @Override + public void updateRole(SysRole role) { + updateById(role); + cacheCleanUtils.clearUsersByRole(role.getId()); + cacheCleanUtils.clearRoleCache(role.getId()); + } + + @Override + public void deleteRole(String roleId) { + SysRole role = getById(roleId); + if (role != null && "USER".equals(role.getRoleCode())) { + throw new BusinessException(400, "基础角色不能被删除"); + } + if (role != null && "SUPER_ADMIN".equals(role.getRoleCode())) { + throw new BusinessException(400, "超级管理员不能被删除"); + } + removeById(roleId); + cacheCleanUtils.clearUsersByRole(roleId); + cacheCleanUtils.clearRoleCache(roleId); + } + + public void disableRole(String roleId) { + SysRole role = getById(roleId); + if (role != null && "USER".equals(role.getRoleCode())) { + throw new BusinessException(400, "基础角色不能被禁用"); + } + if (role != null && "SUPER_ADMIN".equals(role.getRoleCode())) { + throw new BusinessException(400, "超级管理员不能被禁用"); + } + int count = sysRoleMapper.disableRole(roleId); + if (count == 0) { + throw new BusinessException(400, "禁用失败,角色不存在或未被删除"); + } + cacheCleanUtils.clearRoleCache(roleId); + cacheCleanUtils.clearUsersByRole(roleId); + } + + public void restoreRole(String roleId) { + int count = sysRoleMapper.restoreRole(roleId); + if (count == 0) { + throw new BusinessException(400, "恢复失败,角色不存在或未被删除"); + } + cacheCleanUtils.clearRoleCache(roleId); + cacheCleanUtils.clearUsersByRole(roleId); + } + + @Override + @RedisCache(key = "'sys:role:detail:' + #p0", expire = 1800) + public SysRole getRoleDetail(String roleId) { + log.debug("SysRoleServiceImpl.getRoleDetail 入参: {}", roleId); + SysRole role = getById(roleId); + if (role == null) { + log.warn("SysRoleServiceImpl.getRoleDetail 未找到角色信息, roleId: {}", roleId); + return null; + } + log.debug("SysRoleServiceImpl.getRoleDetail 查询结果: {}", role); + return role; + } + + @Override + public Page pageRoles(Integer pageNum, Integer pageSize, String roleName, String roleCode, Integer status) { + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + // 构建查询条件 + wrapper.eq(SysRole::getFlag, 0) // 未删除的记录 + .like(StringUtils.isNotBlank(roleName), SysRole::getRoleName, roleName) + .like(StringUtils.isNotBlank(roleCode), SysRole::getRoleCode, roleCode) + .eq(status != null, SysRole::getStatus, status) + .orderByAsc(SysRole::getSort); // 按排序字段升序 + + // 执行分页查询 + Page result = page(page, wrapper); + log.debug("SysRoleServiceImpl.pageRoles 查询结果: {}", result); + return result; + } + + @Override + @RedisCache(key = "'sys:role:select:' + (#p0 != null ? #p0 : '') + ':' + (#p1 != null ? #p1 : '')", expire = 1800) + public List listRoles(String roleName, Integer status) { + log.debug("SysRoleServiceImpl.listRoles 入参: roleName={}, status={}", roleName, status); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.select("id", "role_name", "role_code") // 只查询需要的字段 + .eq("flag", 0) // 未删除的记录 + .like(StringUtils.isNotBlank(roleName), "role_name", roleName) + .eq(status != null, "status", status) + .orderByAsc("sort"); // 按排序字段升序 + + List roles = list(wrapper); + log.debug("SysRoleServiceImpl.listRoles 查询结果: {}", roles); + return roles; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/impl/SysRoleServiceImpl.java~ b/src/main/java/com/CUST/brain/service/impl/SysRoleServiceImpl.java~ new file mode 100644 index 0000000..f6b8cc2 --- /dev/null +++ b/src/main/java/com/CUST/brain/service/impl/SysRoleServiceImpl.java~ @@ -0,0 +1,167 @@ +package com.CUST.brain.service.impl; + +import com.CUST.brain.common.annotation.RedisCache; +import com.CUST.brain.common.exception.BusinessException; +import com.CUST.brain.dao.domain.system.SysRole; +import com.CUST.brain.dao.mapper.SysRoleMapper; +import com.CUST.brain.service.SysRoleService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import com.CUST.brain.dao.mapper.SysUserRoleMapper; +import com.CUST.brain.common.utils.RedisUtils; +import javax.annotation.Resource; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.commons.lang3.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.CUST.brain.common.utils.CacheCleanUtils; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; +import com.fasterxml.jackson.core.type.TypeReference; + +import java.util.List; + +@Service +public class SysRoleServiceImpl extends ServiceImpl implements SysRoleService { + private static final Logger log = LoggerFactory.getLogger(SysRoleServiceImpl.class); + + @Resource + private RedisUtils redisUtils; + @Resource + private SysUserRoleMapper sysUserRoleMapper; + @Resource + private CacheCleanUtils cacheCleanUtils; + + @Resource + private SysRoleMapper sysRoleMapper; + + @Autowired + private ObjectMapper objectMapper; + + @Override + @RedisCache(key = "'user:roles:' + #p0", expire = 1800, cacheNull = true) + public List getRolesByUserId(String userId) { + String cacheKey = "cache:user:roles:" + userId; + Object obj = redisUtils.get(cacheKey); + if (obj != null) { + try { + return objectMapper.readValue(obj.toString(), new TypeReference>(){}); + } catch (Exception e) { + log.error("角色缓存反序列化失败", e); + // 反序列化失败时可选择清理缓存或降级为数据库查询 + } + } + List roles = baseMapper.selectRolesByUserId(userId); + // 这里不需要手动set,切面会自动缓存 + return roles; + } + + @Override + public SysRole getByRoleCode(String roleCode) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysRole::getRoleCode, roleCode) + .eq(SysRole::getFlag, 0); + return getOne(wrapper); + } + + @Override + public void addRole(SysRole role) { + save(role); + } + + @Override + public void updateRole(SysRole role) { + updateById(role); + cacheCleanUtils.clearUsersByRole(role.getId()); + cacheCleanUtils.clearRoleCache(role.getId()); + } + + @Override + public void deleteRole(String roleId) { + SysRole role = getById(roleId); + if (role != null && "USER".equals(role.getRoleCode())) { + throw new BusinessException(400, "基础角色不能被删除"); + } + if (role != null && "SUPER_ADMIN".equals(role.getRoleCode())) { + throw new BusinessException(400, "超级管理员不能被删除"); + } + removeById(roleId); + cacheCleanUtils.clearUsersByRole(roleId); + cacheCleanUtils.clearRoleCache(roleId); + } + + public void disableRole(String roleId) { + SysRole role = getById(roleId); + if (role != null && "USER".equals(role.getRoleCode())) { + throw new BusinessException(400, "基础角色不能被禁用"); + } + if (role != null && "SUPER_ADMIN".equals(role.getRoleCode())) { + throw new BusinessException(400, "超级管理员不能被禁用"); + } + int count = sysRoleMapper.disableRole(roleId); + if (count == 0) { + throw new BusinessException(400, "禁用失败,角色不存在或未被删除"); + } + cacheCleanUtils.clearRoleCache(roleId); + cacheCleanUtils.clearUsersByRole(roleId); + } + + public void restoreRole(String roleId) { + int count = sysRoleMapper.restoreRole(roleId); + if (count == 0) { + throw new BusinessException(400, "恢复失败,角色不存在或未被删除"); + } + cacheCleanUtils.clearRoleCache(roleId); + cacheCleanUtils.clearUsersByRole(roleId); + } + + @Override + @RedisCache(key = "'sys:role:detail:' + #p0", expire = 1800) + public SysRole getRoleDetail(String roleId) { + log.debug("SysRoleServiceImpl.getRoleDetail 入参: {}", roleId); + SysRole role = getById(roleId); + if (role == null) { + log.warn("SysRoleServiceImpl.getRoleDetail 未找到角色信息, roleId: {}", roleId); + return null; + } + log.debug("SysRoleServiceImpl.getRoleDetail 查询结果: {}", role); + return role; + } + + @Override + public Page pageRoles(Integer pageNum, Integer pageSize, String roleName, String roleCode, Integer status) { + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + // 构建查询条件 + wrapper.eq(SysRole::getFlag, 0) // 未删除的记录 + .like(StringUtils.isNotBlank(roleName), SysRole::getRoleName, roleName) + .like(StringUtils.isNotBlank(roleCode), SysRole::getRoleCode, roleCode) + .eq(status != null, SysRole::getStatus, status) + .orderByAsc(SysRole::getSort); // 按排序字段升序 + + // 执行分页查询 + Page result = page(page, wrapper); + log.debug("SysRoleServiceImpl.pageRoles 查询结果: {}", result); + return result; + } + + @Override + @RedisCache(key = "'sys:role:select:' + (#p0 != null ? #p0 : '') + ':' + (#p1 != null ? #p1 : '')", expire = 1800) + public List listRoles(String roleName, Integer status) { + log.debug("SysRoleServiceImpl.listRoles 入参: roleName={}, status={}", roleName, status); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.select("id", "role_name", "role_code") // 只查询需要的字段 + .eq("flag", 0) // 未删除的记录 + .like(StringUtils.isNotBlank(roleName), "role_name", roleName) + .eq(status != null, "status", status) + .orderByAsc("sort"); // 按排序字段升序 + + List roles = list(wrapper); + log.debug("SysRoleServiceImpl.listRoles 查询结果: {}", roles); + return roles; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/impl/SysUserServiceImpl.java b/src/main/java/com/CUST/brain/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000..ec3e1d0 --- /dev/null +++ b/src/main/java/com/CUST/brain/service/impl/SysUserServiceImpl.java @@ -0,0 +1,389 @@ +package com.CUST.brain.service.impl; + +import com.CUST.brain.common.annotation.RedisCache; +import com.CUST.brain.common.constant.RedisKeyConstants; +import com.CUST.brain.common.exception.BusinessException; +import com.CUST.brain.dao.domain.relation.SysUserRole; +import com.CUST.brain.dao.domain.system.SysPermission; +import com.CUST.brain.dao.domain.system.SysRole; +import com.CUST.brain.dao.domain.system.SysUser; +import com.CUST.brain.dao.mapper.SysUserMapper; +import com.CUST.brain.common.dto.system.LoginRequestDTO; +import com.CUST.brain.common.dto.system.LoginResponseDTO; +import com.CUST.brain.common.dto.system.UserInfoResponseDTO; +import com.CUST.brain.common.dto.system.MenuResponseDTO; +import com.CUST.brain.dao.mapper.SysUserRoleMapper; +import com.CUST.brain.service.SysPermissionService; +import com.CUST.brain.service.SysRoleService; +import com.CUST.brain.service.SysUserService; +import com.CUST.brain.common.utils.JwtTokenUtil; +import com.CUST.brain.common.utils.RedisUtils; +import com.CUST.brain.common.utils.PasswordEncoder; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +import com.CUST.brain.common.utils.CacheCleanUtils; + +/** + * 系统用户服务实现类 + */ +@Service +public class SysUserServiceImpl extends ServiceImpl implements SysUserService { + + private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); + + @Resource + private PasswordEncoder passwordEncoder; + + @Resource + private JwtTokenUtil jwtTokenUtil; + + @Resource + private RedisUtils redisUtils; + + @Resource + private SysRoleService roleService; + + @Resource + private SysPermissionService permissionService; + + @Resource + private SysUserRoleMapper sysUserRoleMapper; + + @Resource + private CacheCleanUtils cacheCleanUtils; + + @Autowired + private ObjectMapper objectMapper; + + @Override + public LoginResponseDTO login(LoginRequestDTO loginDTO) { + log.debug("login接口开始"); + // 1. 根据用户名查询用户 + SysUser user = getByUsername(loginDTO.getUsername()); + log.debug("用户查找完成"); + if (user == null) { + log.debug("用户不存在"); + throw new BusinessException(400, "用户名或密码错误"); + } + + log.debug("用户登录 - 用户名: {}, 数据库密码: {}", loginDTO.getUsername(), user.getPassword()); + + // 2. 校验密码 + boolean matches = passwordEncoder.matches(loginDTO.getPassword(), user.getPassword()); + log.debug("密码匹配结果: {}", matches); + if (!matches) { + log.debug("密码不匹配"); + throw new BusinessException(400, "用户名或密码错误"); + } + + log.debug("准备获取角色..."); + List roles = roleService.getRolesByUserId(user.getUserId()); + if (roles == null || roles.isEmpty()) { + log.debug("角色列表为空"); + throw new BusinessException(400, "账号未分配角色或者绑定角色被禁用无法登录,请联系管理员处理"); + } + log.debug("角色获取完成,准备获取权限..."); + List permissions = permissionService.getPermissionsByUserId(user.getUserId()); + // 4. 校验 loginType(优化:提取为单独方法,增加日志,异常信息更明确) + Integer requestedLoginType = loginDTO.getLoginType(); + if (!isLoginTypeAllowed(requestedLoginType, roles)) { + log.debug("loginType 校验不通过,禁止登录"); + throw new BusinessException(400, "该账号不支持此端登录"); + } + + log.debug("loginType 校验通过,准备生成token..."); + // 3. 生成token + String token = jwtTokenUtil.generateToken(user.getUserId(), user.getUsername()); + log.debug("token生成完成,准备写入Redis..."); + // 4. 将token存入Redis,key为user:token:,value为token字符串 + String userKey = String.format(RedisKeyConstants.USER_TOKEN, user.getUserId()); + redisUtils.set(userKey, token, 24 * 60 * 60); // 24小时过期 + log.debug("token写入Redis完成,准备构建返回结果..."); + // 5. 构建返回结果(提取为单独方法,减少重复代码) + LoginResponseDTO response = buildLoginResponse(user, roles, permissions, token); + log.debug("login接口结束"); + return response; + } + + // 修改:loginType 为 Integer 类型,例如 1 表示前台、2 表示后台 + private boolean isLoginTypeAllowed(Integer requestedLoginType, List roles) { + log.debug("校验 loginType: requestedLoginType={}, roles={}", requestedLoginType, roles); + // 如果角色 loginType 为 2,则前台和后台均可登录;如果为 1,则仅前台可登录 + boolean isAllowed = roles.stream().anyMatch(role -> { + Integer roleLoginType = role.getLoginType(); + return Integer.valueOf(2).equals(roleLoginType) || (Integer.valueOf(1).equals(roleLoginType) && Integer.valueOf(1).equals(requestedLoginType)); + }); + log.debug("loginType 校验结果: isAllowed={}", isAllowed); + return isAllowed; + } + + // 单独构建返回结果的方法(不变) + private LoginResponseDTO buildLoginResponse(SysUser user, List roles, List permissions, String token) { + LoginResponseDTO response = new LoginResponseDTO(); + response.setUserId(user.getUserId()); + response.setUsername(user.getUsername()); + response.setRealName(user.getRealName()); + response.setToken(token); + response.setRoles(roles.stream().map(SysRole::getRoleCode).collect(Collectors.toList())); + response.setPermissions(permissions.stream().map(SysPermission::getPermissionCode).collect(Collectors.toList())); + return response; + } + + @Override + public void logout(String token, String userId) { + // 1. 删除Redis中的用户信息 + String userKey = RedisKeyConstants.USER_TOKEN + token; + redisUtils.delete(userKey); + + // 2. 清理用户相关缓存 + cacheCleanUtils.clearUserCache(userId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean addUser(SysUser user) { + // 1. 检查用户名是否已存在 + if (getByUsername(user.getUsername()) != null) { + throw new BusinessException(400, "用户名已存在"); + } + // 2. 加密密码 + user.setPassword(passwordEncoder.encode(user.getPassword())); + // 3. 保存用户 + boolean saved = save(user); + if (!saved) { + throw new BusinessException(500, "用户创建失败请稍后再试"); + } + // 4. 自动分配USER基础角色 + SysRole userRole = roleService.getByRoleCode("USER"); + if (userRole == null) { + throw new BusinessException(400, "基础角色USER不存在,请联系管理员"); + } + SysUserRole userRoleRel = new SysUserRole(); + userRoleRel.setUserId(user.getId() != null ? user.getId() : user.getUserId()); + userRoleRel.setRoleId(userRole.getId()); + sysUserRoleMapper.insert(userRoleRel); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateUser(SysUser user) { + // 只在密码不为空时加密更新,否则不动原密码 + if (user.getPassword() != null && !user.getPassword().isEmpty()) { + user.setPassword(passwordEncoder.encode(user.getPassword())); + } else { + user.setPassword(null); // 防止被覆盖 + } + boolean result = updateById(user); + if (result) { + cacheCleanUtils.clearUserCache(user.getUserId()); + } + return result; + } + + @Override +// @RedisCache(key = "'sys:user:' + #p0") + public SysUser getByUsername(String username) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysUser::getUsername, username) + .eq(SysUser::getFlag, 0); + return getOne(wrapper); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateStatus(String id, Integer status) { + SysUser user = new SysUser(); + user.setId(id); + user.setStatus(status); + boolean result = updateById(user); + if (result) { + // 删除用户缓存 + redisUtils.delete(RedisKeyConstants.SYS_USER + getById(id).getUsername()); + } + return result; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updatePassword(String id, String oldPassword, String newPassword) { + SysUser user = getById(id); + if (user == null || !passwordEncoder.matches(oldPassword, user.getPassword())) { + return false; + } + + user.setPassword(passwordEncoder.encode(newPassword)); + boolean result = updateById(user); + if (result) { + // 删除用户缓存 + redisUtils.delete(RedisKeyConstants.SYS_USER + user.getUsername()); + } + return result; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public String resetPassword(String id) { + // 生成8位随机密码 + String newPassword = UUID.randomUUID().toString().substring(0, 8); + SysUser user = new SysUser(); + user.setId(id); + user.setPassword(passwordEncoder.encode(newPassword)); + boolean result = updateById(user); + if (result) { + // 删除用户缓存 + redisUtils.delete(RedisKeyConstants.SYS_USER + getById(id).getUsername()); + return newPassword; + } + return null; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateLoginInfo(String id, String ip) { + SysUser user = new SysUser(); + user.setId(id); + user.setLastLoginTime(LocalDateTime.now()); + user.setLastLoginIp(ip); + boolean result = updateById(user); + if (result) { + // 删除用户缓存 + redisUtils.delete(RedisKeyConstants.SYS_USER + getById(id).getUsername()); + } + return result; + } + + @Override + @RedisCache(key = "'user:info:' + #p0") + public UserInfoResponseDTO getUserInfo(String userId) { + log.debug("【getUserInfo】开始获取用户信息,userId={}", userId); + // 1. 获取用户基本信息 + SysUser user = getById(userId); + if (user == null) { + log.warn("【getUserInfo】用户不存在,userId={}", userId); + throw new BusinessException(400, "用户不存在"); + } + log.debug("【getUserInfo】获取到用户基本信息,userId={}, username={}", userId, user.getUsername()); + + // 2. 获取用户角色 + List roles = roleService.getRolesByUserId(userId); + log.debug("【getUserInfo】获取到用户角色,userId={}, roles={}", userId, roles); + + // 3. 获取用户权限 + List permissions = permissionService.getPermissionsByUserId(userId); + log.debug("【getUserInfo】获取到用户权限,userId={}, permissions={}", userId, permissions); + + // 4. 获取用户菜单 + List menus = buildUserMenus(permissions); + log.debug("【getUserInfo】构建用户菜单完成,userId={}, menus={}", userId, menus); + + // 5. 构建返回结果 + UserInfoResponseDTO userInfo = new UserInfoResponseDTO(); + BeanUtils.copyProperties(user, userInfo); + userInfo.setUserId(user.getUserId()); + userInfo.setRoles(roles.stream().map(SysRole::getRoleCode).collect(Collectors.toList())); + userInfo.setPermissions(permissions.stream().map(SysPermission::getPermissionCode).collect(Collectors.toList())); + userInfo.setMenus(menus); + + log.debug("【getUserInfo】用户信息获取完成,userId={}, userInfo={}", userId, userInfo); + return userInfo; + } + + /** + * 构建用户菜单树 + */ + private List buildUserMenus(List permissions) { + // 1. 过滤出菜单类型的权限 + List menuPermissions = permissions.stream() + .filter(p -> p.getPermissionType() != null && p.getPermissionType() <= 2) // 只取菜单类型 + .collect(Collectors.toList()); + + // 2. 转换为菜单DTO + List menuList = menuPermissions.stream().map(p -> { + MenuResponseDTO menu = new MenuResponseDTO(); + menu.setId(p.getId()); + menu.setParentId(p.getParentId()); + menu.setName(p.getPermissionName()); + menu.setCode(p.getPermissionCode()); + menu.setPath(p.getPath()); + menu.setIcon(p.getIcon()); + menu.setType(p.getPermissionType()); + menu.setSort(p.getSort()); + return menu; + }).collect(Collectors.toList()); + + // 3. 构建菜单树 + List rootMenus = menuList.stream() + .filter(m -> m.getParentId() == null || "0".equals(m.getParentId())) + .collect(Collectors.toList()); + + rootMenus.forEach(menu -> buildMenuTree(menu, menuList)); + + return rootMenus; + } + + /** + * 递归构建菜单树 + */ + private void buildMenuTree(MenuResponseDTO parent, List allMenus) { + List children = allMenus.stream() + .filter(m -> parent.getId().equals(m.getParentId())) + .collect(Collectors.toList()); + + if (!children.isEmpty()) { + parent.setChildren(children); + children.forEach(child -> buildMenuTree(child, allMenus)); + } else { + parent.setChildren(new ArrayList<>()); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void assignRoles(String userId, List roleIds) { + // 1. 删除原有角色 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SysUserRole::getUserId, userId); + sysUserRoleMapper.delete(wrapper); + + // 2. 批量插入新角色 + if (roleIds != null && !roleIds.isEmpty()) { + List userRoles = roleIds.stream() + .map(roleId -> { + SysUserRole ur = new SysUserRole(); + ur.setUserId(userId); + ur.setRoleId(roleId); + return ur; + }).collect(Collectors.toList()); + userRoles.forEach(sysUserRoleMapper::insert); + } + + // 3. 清理用户相关缓存 + cacheCleanUtils.clearUserCache(userId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean deleteUser(String userId) { + boolean result = removeById(userId); + if (result) { + cacheCleanUtils.clearUserCache(userId); + } + return result; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/service/impl/TalentBasicServiceImpl.java b/src/main/java/com/CUST/brain/service/impl/TalentBasicServiceImpl.java new file mode 100644 index 0000000..eaf0b96 --- /dev/null +++ b/src/main/java/com/CUST/brain/service/impl/TalentBasicServiceImpl.java @@ -0,0 +1,79 @@ +package com.CUST.brain.service.impl; + +import com.CUST.brain.common.annotation.RedisCache; +import com.CUST.brain.common.constant.RedisKeyConstants; +import com.CUST.brain.dao.domain.business.TalentBasic; +import com.CUST.brain.dao.mapper.TalentBasicMapper; +import com.CUST.brain.service.TalentBasicService; +import com.CUST.brain.common.utils.RedisUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 人才基本信息服务实现类 + */ +@Service +public class TalentBasicServiceImpl extends ServiceImpl implements TalentBasicService { + + @Resource + private RedisUtils redisUtils; + + @Override + @RedisCache(key = RedisKeyConstants.TALENT_BASIC + "${#name}", expire = 3600) + public List getByName(String name) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(TalentBasic::getName, name) + .eq(TalentBasic::getFlag, 0) + .orderByDesc(TalentBasic::getCreateTime); + return list(wrapper); + } + + @Override + @RedisCache(key = RedisKeyConstants.TALENT_UNIT + "${#unitId}", expire = 3600) + public List getByUnitId(String unitId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(TalentBasic::getUnitId, unitId) + .eq(TalentBasic::getFlag, 0) + .orderByDesc(TalentBasic::getCreateTime); + return list(wrapper); + } + + @Override + @RedisCache(key = RedisKeyConstants.TALENT_INFO + "title:${#title}", expire = 3600) + public List getByTitle(String title) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(TalentBasic::getTitle, title) + .eq(TalentBasic::getFlag, 0) + .orderByDesc(TalentBasic::getCreateTime); + return list(wrapper); + } + + @Override + @RedisCache(key = RedisKeyConstants.TALENT_INFO + "grade:${#classifyGrade}", expire = 3600) + public List getByClassifyGrade(String classifyGrade) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(TalentBasic::getClassifyGrade, classifyGrade) + .eq(TalentBasic::getFlag, 0) + .orderByDesc(TalentBasic::getCreateTime); + return list(wrapper); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateTalent(TalentBasic talent) { + boolean result = updateById(talent); + if (result) { + // 删除相关缓存 + redisUtils.delete(RedisKeyConstants.TALENT_BASIC + talent.getName()); + redisUtils.delete(RedisKeyConstants.TALENT_UNIT + talent.getUnitId()); + redisUtils.delete(RedisKeyConstants.TALENT_INFO + "title:" + talent.getTitle()); + redisUtils.delete(RedisKeyConstants.TALENT_INFO + "grade:" + talent.getClassifyGrade()); + } + return result; + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/web/controller/business/TalentBasicController.java b/src/main/java/com/CUST/brain/web/controller/business/TalentBasicController.java new file mode 100644 index 0000000..d391401 --- /dev/null +++ b/src/main/java/com/CUST/brain/web/controller/business/TalentBasicController.java @@ -0,0 +1,107 @@ +package com.CUST.brain.web.controller.business; + +import com.CUST.brain.common.api.CommonResult; +import com.CUST.brain.dao.domain.business.TalentBasic; +import com.CUST.brain.service.TalentBasicService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +/** + * 人才基本信息管理 + */ +@RestController +@RequestMapping("/business/talent") +@Api(tags = "人才基本信息管理") +public class TalentBasicController { + + @Resource + private TalentBasicService talentBasicService; + + @GetMapping("/list") + @ApiOperation("分页查询人才列表") + @PreAuthorize("hasAuthority('business:talent')") + public CommonResult> list( + @ApiParam("页码") @RequestParam(defaultValue = "1") Integer pageNum, + @ApiParam("每页数量") @RequestParam(defaultValue = "10") Integer pageSize, + @ApiParam("姓名") @RequestParam(required = false) String name, + @ApiParam("单位ID") @RequestParam(required = false) String unitId, + @ApiParam("职称") @RequestParam(required = false) String title, + @ApiParam("分类定级") @RequestParam(required = false) String classifyGrade) { + + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(name != null, TalentBasic::getName, name) + .eq(unitId != null, TalentBasic::getUnitId, unitId) + .eq(title != null, TalentBasic::getTitle, title) + .eq(classifyGrade != null, TalentBasic::getClassifyGrade, classifyGrade) + .eq(TalentBasic::getFlag, 0) + .orderByDesc(TalentBasic::getCreateTime); + + return CommonResult.success(talentBasicService.page(page, wrapper)); + } + + @GetMapping("/name/{name}") + @ApiOperation("根据姓名查询人才") + @PreAuthorize("hasAuthority('business:talent')") + public CommonResult> getByName(@PathVariable String name) { + return CommonResult.success(talentBasicService.getByName(name)); + } + + @GetMapping("/unit/{unitId}") + @ApiOperation("根据单位ID查询人才") + @PreAuthorize("hasAuthority('business:talent:query')") + public CommonResult> getByUnitId(@PathVariable String unitId) { + return CommonResult.success(talentBasicService.getByUnitId(unitId)); + } + + @GetMapping("/title/{title}") + @ApiOperation("根据职称查询人才") + @PreAuthorize("hasAuthority('business:talent')") + public CommonResult> getByTitle(@PathVariable String title) { + return CommonResult.success(talentBasicService.getByTitle(title)); + } + + @GetMapping("/grade/{classifyGrade}") + @ApiOperation("根据分类定级查询人才") + @PreAuthorize("hasAuthority('business:talent')") + public CommonResult> getByClassifyGrade(@PathVariable String classifyGrade) { + return CommonResult.success(talentBasicService.getByClassifyGrade(classifyGrade)); + } + + @GetMapping("/{id}") + @ApiOperation("获取人才详情") + @PreAuthorize("hasAuthority('business:talent')") + public CommonResult getById(@PathVariable String id) { + return CommonResult.success(talentBasicService.getById(id)); + } + + @PostMapping + @ApiOperation("新增人才") + @PreAuthorize("hasAuthority('business:talent')") + public CommonResult add(@Valid @RequestBody TalentBasic talent) { + return CommonResult.success(talentBasicService.save(talent)); + } + + @PutMapping + @ApiOperation("修改人才") + @PreAuthorize("hasAuthority('business:talent')") + public CommonResult update(@Valid @RequestBody TalentBasic talent) { + return CommonResult.success(talentBasicService.updateTalent(talent)); + } + + @DeleteMapping("/{id}") + @ApiOperation("删除人才") + @PreAuthorize("hasAuthority('business:talent')") + public CommonResult delete(@PathVariable String id) { + return CommonResult.success(talentBasicService.removeById(id)); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/web/controller/business/TalentBasicController.java~ b/src/main/java/com/CUST/brain/web/controller/business/TalentBasicController.java~ new file mode 100644 index 0000000..5243f16 --- /dev/null +++ b/src/main/java/com/CUST/brain/web/controller/business/TalentBasicController.java~ @@ -0,0 +1,107 @@ +package com.CUST.brain.web.controller.business; + +import com.CUST.brain.common.api.CommonResult; +import com.CUST.brain.dao.domain.business.TalentBasic; +import com.CUST.brain.service.TalentBasicService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +/** + * 人才基本信息管理 + */ +@RestController +@RequestMapping("/business/talent") +@Api(tags = "人才基本信息管理") +public class TalentBasicController { + + @Resource + private TalentBasicService talentBasicService; + + @GetMapping("/list") + @ApiOperation("分页查询人才列表") + @PreAuthorize("hasAuthority('business:talent')") + public CommonResult> list( + @ApiParam("页码") @RequestParam(defaultValue = "1") Integer pageNum, + @ApiParam("每页数量") @RequestParam(defaultValue = "10") Integer pageSize, + @ApiParam("姓名") @RequestParam(required = false) String name, + @ApiParam("单位ID") @RequestParam(required = false) String unitId, + @ApiParam("职称") @RequestParam(required = false) String title, + @ApiParam("分类定级") @RequestParam(required = false) String classifyGrade) { + + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(name != null, TalentBasic::getName, name) + .eq(unitId != null, TalentBasic::getUnitId, unitId) + .eq(title != null, TalentBasic::getTitle, title) + .eq(classifyGrade != null, TalentBasic::getClassifyGrade, classifyGrade) + .eq(TalentBasic::getFlag, 0) + .orderByDesc(TalentBasic::getCreateTime); + + return CommonResult.success(talentBasicService.page(page, wrapper)); + } + + @GetMapping("/name/{name}") + @ApiOperation("根据姓名查询人才") + @PreAuthorize("hasAuthority('business:talent:query')") + public CommonResult> getByName(@PathVariable String name) { + return CommonResult.success(talentBasicService.getByName(name)); + } + + @GetMapping("/unit/{unitId}") + @ApiOperation("根据单位ID查询人才") + @PreAuthorize("hasAuthority('business:talent:query')") + public CommonResult> getByUnitId(@PathVariable String unitId) { + return CommonResult.success(talentBasicService.getByUnitId(unitId)); + } + + @GetMapping("/title/{title}") + @ApiOperation("根据职称查询人才") + @PreAuthorize("hasAuthority('business:talent:query')") + public CommonResult> getByTitle(@PathVariable String title) { + return CommonResult.success(talentBasicService.getByTitle(title)); + } + + @GetMapping("/grade/{classifyGrade}") + @ApiOperation("根据分类定级查询人才") + @PreAuthorize("hasAuthority('business:talent:query')") + public CommonResult> getByClassifyGrade(@PathVariable String classifyGrade) { + return CommonResult.success(talentBasicService.getByClassifyGrade(classifyGrade)); + } + + @GetMapping("/{id}") + @ApiOperation("获取人才详情") + @PreAuthorize("hasAuthority('business:talent:query')") + public CommonResult getById(@PathVariable String id) { + return CommonResult.success(talentBasicService.getById(id)); + } + + @PostMapping + @ApiOperation("新增人才") + @PreAuthorize("hasAuthority('business:talent:add')") + public CommonResult add(@Valid @RequestBody TalentBasic talent) { + return CommonResult.success(talentBasicService.save(talent)); + } + + @PutMapping + @ApiOperation("修改人才") + @PreAuthorize("hasAuthority('business:talent:edit')") + public CommonResult update(@Valid @RequestBody TalentBasic talent) { + return CommonResult.success(talentBasicService.updateTalent(talent)); + } + + @DeleteMapping("/{id}") + @ApiOperation("删除人才") + @PreAuthorize("hasAuthority('business:talent:remove')") + public CommonResult delete(@PathVariable String id) { + return CommonResult.success(talentBasicService.removeById(id)); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/web/controller/system/LoginController.java b/src/main/java/com/CUST/brain/web/controller/system/LoginController.java new file mode 100644 index 0000000..1a7f18a --- /dev/null +++ b/src/main/java/com/CUST/brain/web/controller/system/LoginController.java @@ -0,0 +1,53 @@ +package com.CUST.brain.web.controller.system; + +import com.CUST.brain.common.api.CommonResult; +import com.CUST.brain.common.utils.JwtTokenUtil; +import com.CUST.brain.common.dto.system.LoginRequestDTO; +import com.CUST.brain.common.dto.system.LoginResponseDTO; +import com.CUST.brain.common.dto.system.UserInfoResponseDTO; +import com.CUST.brain.common.utils.SecurityUtils; +import com.CUST.brain.service.SysUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; + +/** + * 系统认证控制器 + */ +@Api(tags = "系统认证管理") +@RestController +@RequestMapping("/api/system/auth") +public class LoginController { + + @Resource + private SysUserService userService; + + @Resource + private JwtTokenUtil jwtTokenUtil; + + @PostMapping("/login") + @ApiOperation("用户登录") + public CommonResult login(@Valid @RequestBody LoginRequestDTO loginDTO) { + return CommonResult.success(userService.login(loginDTO)); + } + + @PostMapping("/logout") + @ApiOperation("用户登出") + public CommonResult logout(@RequestHeader("Authorization") String token) { + String userId = jwtTokenUtil.getUserIdFromToken(token); + userService.logout(token, userId); + return CommonResult.success(null); + } + + @GetMapping("/info") + @ApiOperation("获取当前用户信息") + public CommonResult getUserInfo() { + String userId = SecurityUtils.getCurrentUserId(); + UserInfoResponseDTO userInfo = userService.getUserInfo(userId); + return CommonResult.success(userInfo); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/web/controller/system/OssController.java b/src/main/java/com/CUST/brain/web/controller/system/OssController.java new file mode 100644 index 0000000..c80b5e5 --- /dev/null +++ b/src/main/java/com/CUST/brain/web/controller/system/OssController.java @@ -0,0 +1,45 @@ +package com.CUST.brain.web.controller.system; + +import com.CUST.brain.common.api.CommonResult; +import com.CUST.brain.common.utils.OssUtil; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +@RestController +@RequestMapping("/oss") +public class OssController { + + @Resource + private OssUtil ossUtil; + + @PostMapping("/upload") + public CommonResult uploadFile(@RequestParam("file") MultipartFile file, + @RequestParam(value = "type", required = false, defaultValue = "img") String type) { + String ext = ""; + String originalName = file.getOriginalFilename(); + if (originalName != null && originalName.lastIndexOf(".") != -1) { + ext = originalName.substring(originalName.lastIndexOf(".")); + } + String datePath = new SimpleDateFormat("yyyy/MM/dd").format(new Date()); + String folder; + switch (type) { + case "doc": folder = "doc"; break; + case "video": folder = "video"; break; + case "avatar": folder = "avatar"; break; + case "other": folder = "other"; break; + default: folder = "img"; + } + String objectName = folder + "/" + datePath + "/" + UUID.randomUUID() + ext; + String url = ossUtil.upload(file, objectName); + if (url != null) { + return CommonResult.success(url, "上传成功"); + } else { + return CommonResult.failed("上传失败"); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/web/controller/system/SysParamController.java b/src/main/java/com/CUST/brain/web/controller/system/SysParamController.java new file mode 100644 index 0000000..056d139 --- /dev/null +++ b/src/main/java/com/CUST/brain/web/controller/system/SysParamController.java @@ -0,0 +1,115 @@ +package com.CUST.brain.web.controller.system; + +import com.CUST.brain.common.api.CommonResult; +import com.CUST.brain.dao.domain.system.SysParam; +import com.CUST.brain.service.SysParamService; +import com.CUST.brain.common.utils.CacheCleanUtils; +import com.CUST.brain.common.cache.ParamCacheManager; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/system/param") +@Api(tags = "系统参数管理") +public class SysParamController { + + @Resource + private SysParamService sysParamService; + + @Resource + private CacheCleanUtils cacheCleanUtils; + + @Resource + private ParamCacheManager paramCacheManager; + + @GetMapping("/type/{typeCode}") + @ApiOperation("根据参数类型获取参数列表") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult> getParamsByType( + @ApiParam("参数类型编码") @PathVariable String typeCode) { + return CommonResult.success(sysParamService.getParamsByType(typeCode)); + } + + @GetMapping("/value") + @ApiOperation("获取参数值") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult getParamValue( + @ApiParam("参数类型编码") @RequestParam String typeCode, + @ApiParam("参数名称") @RequestParam String paramName) { + return CommonResult.success(sysParamService.getParamValue(typeCode, paramName)); + } + + @GetMapping("/list") + @ApiOperation("分页查询参数列表") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult> list( + @ApiParam("参数类型编码") @RequestParam String typeCode) { + return CommonResult.success(sysParamService.listByType(typeCode)); + } + + @GetMapping("/batch") + @ApiOperation("批量获取多个参数类型的参数列表") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult>> getParamsByTypes( + @ApiParam("参数类型编码列表,多个用逗号分隔") @RequestParam String typeCodes) { + return CommonResult.success(sysParamService.getParamsByTypes(Arrays.asList(typeCodes.split(",")))); + } + + @PostMapping + @ApiOperation("新增参数") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult add(@RequestBody SysParam param) { + boolean result = sysParamService.save(param); + if (result) { + cacheCleanUtils.clearParamCache(param.getParamType(), null); + } + return CommonResult.success(result); + } + + @PutMapping + @ApiOperation("修改参数") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult update(@RequestBody SysParam param) { + boolean result = sysParamService.updateParam(param); + if (result) { + cacheCleanUtils.clearParamCache(param.getParamType(), param.getParamName()); + } + return CommonResult.success(result); + } + + @DeleteMapping("/{id}") + @ApiOperation("删除参数") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult delete(@PathVariable String id) { + SysParam param = sysParamService.getById(id); + boolean result = sysParamService.removeById(id); + if (result && param != null) { + cacheCleanUtils.clearParamCache(param.getParamType(), param.getParamName()); + } + return CommonResult.success(result); + } + + @PostMapping("/refresh") + @ApiOperation("刷新参数缓存") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult refreshCache( + @ApiParam("参数类型编码,不传则刷新所有参数缓存") @RequestParam(required = false) String typeCode) { + if (typeCode != null) { + // 删除指定类型的缓存,下次访问时会自动重新加载 + paramCacheManager.removeParamCache(typeCode); + } else { + // 删除所有参数缓存,下次访问时会自动重新加载 + paramCacheManager.removeAllParamCache(); + } + return CommonResult.success(true); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/web/controller/system/SysParamTypeController.java b/src/main/java/com/CUST/brain/web/controller/system/SysParamTypeController.java new file mode 100644 index 0000000..5cd2807 --- /dev/null +++ b/src/main/java/com/CUST/brain/web/controller/system/SysParamTypeController.java @@ -0,0 +1,80 @@ +package com.CUST.brain.web.controller.system; + +import com.CUST.brain.common.api.CommonResult; +import com.CUST.brain.dao.domain.system.SysParamType; +import com.CUST.brain.service.SysParamTypeService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +/** + * 系统参数类型管理 + */ +@RestController +@RequestMapping("/system/param-type") +@Api(tags = "系统参数类型管理") +public class SysParamTypeController { + + @Resource + private SysParamTypeService sysParamTypeService; + + @GetMapping("/list") + @ApiOperation("分页查询参数类型列表") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult> list( + @ApiParam("页码") @RequestParam(defaultValue = "1") Integer pageNum, + @ApiParam("每页数量") @RequestParam(defaultValue = "10") Integer pageSize, + @ApiParam("类型名称") @RequestParam(required = false) String typeName) { + + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(typeName != null, SysParamType::getTypeName, typeName) + .eq(SysParamType::getFlag, 0) + .orderByAsc(SysParamType::getSortOrder); + + return CommonResult.success(sysParamTypeService.page(page, wrapper)); + } + + @GetMapping("/all") + @ApiOperation("获取所有参数类型") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult> listAll() { + return CommonResult.success(sysParamTypeService.listAll()); + } + + @GetMapping("/{id}") + @ApiOperation("获取参数类型详情") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult getById(@PathVariable String id) { + return CommonResult.success(sysParamTypeService.getById(id)); + } + + @PostMapping + @ApiOperation("新增参数类型") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult add(@Valid @RequestBody SysParamType paramType) { + return CommonResult.success(sysParamTypeService.save(paramType)); + } + + @PutMapping + @ApiOperation("修改参数类型") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult update(@Valid @RequestBody SysParamType paramType) { + return CommonResult.success(sysParamTypeService.updateParamType(paramType)); + } + + @DeleteMapping("/{id}") + @ApiOperation("删除参数类型") + @PreAuthorize("hasAuthority('system:param')") + public CommonResult delete(@PathVariable String id) { + return CommonResult.success(sysParamTypeService.removeById(id)); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/web/controller/system/SysPermissionController.java b/src/main/java/com/CUST/brain/web/controller/system/SysPermissionController.java new file mode 100644 index 0000000..a844b2d --- /dev/null +++ b/src/main/java/com/CUST/brain/web/controller/system/SysPermissionController.java @@ -0,0 +1,47 @@ +package com.CUST.brain.web.controller.system; + +import com.CUST.brain.common.api.CommonResult; +import com.CUST.brain.common.dto.system.PermissionTreeVO; +import com.CUST.brain.common.dto.system.UpdateRolePermissionsRequestDTO; +import com.CUST.brain.dao.domain.system.SysPermission; +import com.CUST.brain.service.SysPermissionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +@RestController +@RequestMapping("/api/permission") +@Api(tags = "系统权限管理") +public class SysPermissionController { + + @Resource + private SysPermissionService permissionService; + + @GetMapping("/listForRoleTree") + @ApiOperation("根据角色获取权限树") + public CommonResult> listForRoleTree(@RequestParam String roleId) { + List permissions = permissionService.listForRoleTree(roleId); + return CommonResult.success(permissions); + } + + @GetMapping("/role/{roleId}/permissionIds") + @ApiOperation("获取角色已分配的权限ID列表") + public CommonResult> getPermissionIdsByRole(@PathVariable String roleId) { + List permissions = permissionService.getPermissionIdsByRoleId(roleId); + return CommonResult.success(permissions); + } + + @PostMapping("/updateRolePermissions") + @ApiOperation("更新角色权限") + @Transactional(rollbackFor = Exception.class) + public CommonResult updateRolePermissions( + @RequestBody @Valid UpdateRolePermissionsRequestDTO requestDTO) { + permissionService.updateRolePermissions(requestDTO); + return CommonResult.success(true, "更新成功"); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/web/controller/system/SysRoleController.java b/src/main/java/com/CUST/brain/web/controller/system/SysRoleController.java new file mode 100644 index 0000000..564e7a2 --- /dev/null +++ b/src/main/java/com/CUST/brain/web/controller/system/SysRoleController.java @@ -0,0 +1,99 @@ +package com.CUST.brain.web.controller.system; + +import com.CUST.brain.dao.domain.system.SysRole; +import com.CUST.brain.service.SysRoleService; +import com.CUST.brain.common.api.CommonResult; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.CUST.brain.dao.domain.system.SysPermission; +import com.CUST.brain.service.SysPermissionService; + +import java.util.List; + +@RestController +@RequestMapping("/api/role") +@Api(tags = "系统角色管理") +public class SysRoleController { + + @Autowired + private SysRoleService sysRoleService; + + @Autowired + private SysPermissionService permissionService; + + // 新增角色 + @PostMapping("/add") + @ApiOperation("新增角色") + public CommonResult addRole(@RequestBody SysRole role) { + sysRoleService.addRole(role); + return CommonResult.success(null, "新增成功"); + } + + // 更新角色 + @PutMapping("/update") + @ApiOperation("更新角色") + public CommonResult updateRole(@RequestBody SysRole role) { + sysRoleService.updateRole(role); + return CommonResult.success(null, "更新成功"); + } + + // 禁用角色(逻辑删除) + @DeleteMapping("/delete/{roleId}") + @ApiOperation("删除角色") + public CommonResult deleteRole(@PathVariable String roleId) { + sysRoleService.deleteRole(roleId); + return CommonResult.success(null, "删除成功"); + } + + // 禁用角色 + @PutMapping("/disable/{roleId}") + @ApiOperation("禁用角色") + public CommonResult disableRole(@PathVariable String roleId) { + sysRoleService.disableRole(roleId); + return CommonResult.success(null, "禁用成功"); + } + + // 启用角色 + @PutMapping("/restore/{roleId}") + @ApiOperation("启用角色") + public CommonResult restoreRole(@PathVariable String roleId) { + sysRoleService.restoreRole(roleId); + return CommonResult.success(null, "启用成功"); + } + + @GetMapping("/detail/{roleId}") + @ApiOperation("获取角色详情") + @ApiParam(value = "角色ID", required = true) + public CommonResult getRoleDetail(@PathVariable String roleId) { + SysRole role = sysRoleService.getRoleDetail(roleId); + if (role == null) { + return CommonResult.failed("角色不存在"); + } + return CommonResult.success(role); + } + + @GetMapping("/page") + @ApiOperation("分页查询角色列表") + public CommonResult> pageRoles( + @ApiParam(value = "页码", required = true) @RequestParam Integer pageNum, + @ApiParam(value = "每页数量", required = true) @RequestParam Integer pageSize, + @ApiParam(value = "角色名称") @RequestParam(required = false) String roleName, + @ApiParam(value = "角色编码") @RequestParam(required = false) String roleCode, + @ApiParam(value = "状态:0-禁用,1-启用") @RequestParam(required = false) Integer status) { + Page page = sysRoleService.pageRoles(pageNum, pageSize, roleName, roleCode, status); + return CommonResult.success(page); + } + + @GetMapping("/list") + @ApiOperation("获取角色列表") + public CommonResult> listRoles( + @ApiParam(value = "角色名称(用于搜索)") @RequestParam(required = false) String roleName, + @ApiParam(value = "状态:1-启用") @RequestParam(required = false) Integer status) { + List roles = sysRoleService.listRoles(roleName, status); + return CommonResult.success(roles); + } +} \ No newline at end of file diff --git a/src/main/java/com/CUST/brain/web/controller/system/SysUserController.java b/src/main/java/com/CUST/brain/web/controller/system/SysUserController.java new file mode 100644 index 0000000..2d6b3bf --- /dev/null +++ b/src/main/java/com/CUST/brain/web/controller/system/SysUserController.java @@ -0,0 +1,116 @@ +package com.CUST.brain.web.controller.system; + +import com.CUST.brain.common.api.CommonResult; +import com.CUST.brain.common.dto.system.AssignRoleRequestDTO; +import com.CUST.brain.dao.domain.system.SysUser; +import com.CUST.brain.dao.domain.system.SysPermission; +import com.CUST.brain.service.SysUserService; +import com.CUST.brain.service.SysPermissionService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +/** + * 系统用户管理 + */ +@RestController +@RequestMapping("/system/user") +@Api(tags = "系统用户管理") +public class SysUserController { + + @Resource + private SysUserService sysUserService; + + @Resource + private SysPermissionService permissionService; + + @GetMapping("/page") + @ApiOperation("分页查询用户列表") + @PreAuthorize("hasAuthority('system:user')") + public CommonResult> page( + @ApiParam("页码") @RequestParam(defaultValue = "1") Integer pageNum, + @ApiParam("每页数量") @RequestParam(defaultValue = "10") Integer pageSize, + @ApiParam("用户名") @RequestParam(required = false) String username, + @ApiParam("真实姓名") @RequestParam(required = false) String realName, + @ApiParam("状态") @RequestParam(required = false) Integer status) { + + Page page = new Page<>(pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(username != null, SysUser::getUsername, username) + .like(realName != null, SysUser::getRealName, realName) + .eq(status != null, SysUser::getStatus, status) + .eq(SysUser::getFlag, 0) + .orderByDesc(SysUser::getCreateTime); + + return CommonResult.success(sysUserService.page(page, wrapper)); + } + + @GetMapping("/{id}") + @ApiOperation("获取用户详情") + @PreAuthorize("hasAuthority('system:user')") + public CommonResult getById(@PathVariable String id) { + return CommonResult.success(sysUserService.getById(id)); + } + + @PostMapping("/add") + @ApiOperation("新增用户") + @PreAuthorize("hasAuthority('system:user')") + public CommonResult add(@Valid @RequestBody SysUser user) { + return CommonResult.success(sysUserService.addUser(user)); + } + + @PutMapping("/update") + @ApiOperation("修改用户") + @PreAuthorize("hasAuthority('system:user')") + public CommonResult update(@Valid @RequestBody SysUser user) { + return CommonResult.success(sysUserService.updateUser(user)); + } + + @DeleteMapping("/delete/{id}") + @ApiOperation("删除用户") + @PreAuthorize("hasAuthority('system:user')") + public CommonResult delete(@PathVariable String id) { + return CommonResult.success(sysUserService.deleteUser(id)); + } + + @PutMapping("/status") + @ApiOperation("修改用户状态") + @PreAuthorize("hasAuthority('system:user')") + public CommonResult updateStatus( + @ApiParam("用户ID") @RequestParam String id, + @ApiParam("状态:0-禁用,1-启用") @RequestParam Integer status) { + return CommonResult.success(sysUserService.updateStatus(id, status)); + } + + @PutMapping("/password") + @ApiOperation("修改密码") + public CommonResult updatePassword( + @ApiParam("用户ID") @RequestParam String id, + @ApiParam("旧密码") @RequestParam String oldPassword, + @ApiParam("新密码") @RequestParam String newPassword) { + return CommonResult.success(sysUserService.updatePassword(id, oldPassword, newPassword)); + } + + @PutMapping("/reset-password/{id}") + @ApiOperation("重置密码") + @PreAuthorize("hasAuthority('system:user')") + public CommonResult resetPassword(@PathVariable String id) { + return CommonResult.success(sysUserService.resetPassword(id)); + } + + @PostMapping("/assignRoles") + @ApiOperation("分配用户角色") + @PreAuthorize("hasAuthority('system:user')") + public CommonResult assignRoles(@RequestBody AssignRoleRequestDTO request) { + sysUserService.assignRoles(request.getUserId(), request.getRoleIds()); + return CommonResult.success(null, "分配成功"); + } +} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..313be9e --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,127 @@ +server: + port: 8090 + servlet: + context-path: /brain + +spring: + application: + name: technological-brain + mvc: + pathmatch: + matching-strategy: ant_path_matcher + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://47.110.148.47:13306/technological_brain?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai + username: root + password: Cust123456 + druid: + initial-size: 5 + min-idle: 5 + max-active: 20 + max-wait: 60000 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat,wall + connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + redis: + host: 47.110.148.47 + port: 16379 + password: Cust123456 + database: 0 + timeout: 10s + lettuce: + pool: + min-idle: 0 + max-idle: 8 + max-active: 8 + max-wait: -1ms + +mybatis-plus: + mapper-locations: classpath*:/mapper/**/*.xml + type-aliases-package: com.CUST.brain.dao.domain + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + global-config: + db-config: + id-type: ASSIGN_UUID + logic-delete-value: 1 + logic-not-delete-value: 0 + +logging: + level: + com.CUST.brain: debug + org.springframework: warn + springfox.documentation: debug + +springfox: + documentation: + swagger-ui: + enabled: true + swagger: + v2: + enabled: true + +swagger: + enable: true + title: 科技大脑平台接口文档 + description: 科技大脑展示平台服务接口文档 + version: 1.0.0 + base-package: com.CUST.brain.web.controller + +knife4j: + enable: true + setting: + language: zh-CN + enable-swagger-models: true + enable-document-manage: true + swagger-model-name: 实体类列表 + enable-version: false + enable-reload-cache-parameter: false + enable-after-script: true + enable-filter-multipart-api-method-type: POST + enable-filter-multipart-apis: false + enable-request-cache: true + enable-host: false + enable-host-text: + enable-home-custom: false + home-custom-path: classpath:markdown/home.md + enable-search: true + enable-footer: false + enable-footer-custom: false + footer-custom-content: + enable-dynamic-parameter: false + enable-debug: true + enable-open-api: false + enable-group: true + cors: false + production: false + basic: + enable: false + username: test + password: 123456 + +# JWT配置 +jwt: + # JWT加解密使用的密钥(使用 Base64 编码的字符串) + secret: DTFlDDXXcyzxCBvrOkD7+OXpO8oEMTsjEpOIHP9Uh9DBzczp6YfJaa7jhh718XzUsU4TAkNJ9eBhEaUNF/mgew== + # JWT的超期限时间(单位:秒) + expiration: 86400 + # JWT负载中拿到开头 + tokenHeader: Authorization + # JWT负载中拿到开头 + tokenHead: Bearer + +oss: + endpoint: https://oss-cn-hangzhou.aliyuncs.com + access-key-id: LTAI5tENiNhfm8fJiyfU9QxB + access-key-secret: wmjKuJT970AbSQbzlkPnFaHWWwX5Nx + bucket-name: tecbrain + domain: https://tecbrain.oss-cn-hangzhou.aliyuncs.com \ No newline at end of file diff --git a/src/main/resources/application.yml~ b/src/main/resources/application.yml~ new file mode 100644 index 0000000..54c6113 --- /dev/null +++ b/src/main/resources/application.yml~ @@ -0,0 +1,126 @@ +server: + port: 8090 + servlet: + context-path: /brain + +spring: + application: + name: technological-brain + mvc: + pathmatch: + matching-strategy: ant_path_matcher + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://47.110.148.47:13306/technological_brain?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai + username: root + password: Cust123456 + druid: + initial-size: 5 + min-idle: 5 + max-active: 20 + max-wait: 60000 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat,wall + connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + redis: + host: 47.110.148.47 + port: 16379 + password: Cust123456 + database: 0 + timeout: 10s + lettuce: + pool: + min-idle: 0 + max-idle: 8 + max-active: 8 + max-wait: -1ms + +mybatis-plus: + mapper-locations: classpath*:/mapper/**/*.xml + type-aliases-package: com.CUST.brain.dao.domain + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + global-config: + db-config: + id-type: ASSIGN_UUID + logic-delete-value: 1 + logic-not-delete-value: 0 + +logging: + level: + com.CUST.brain: debug + org.springframework: warn + springfox.documentation: debug + +springfox: + documentation: + swagger-ui: + enabled: true + swagger: + v2: + enabled: true + +swagger: + enable: true + title: 科技大脑平台接口文档 + description: 科技大脑展示平台服务接口文档 + version: 1.0.0 + base-package: com.CUST.brain.web.controller + +knife4j: + enable: true + setting: + language: zh-CN + enable-swagger-models: true + enable-document-manage: true + swagger-model-name: 实体类列表 + enable-version: false + enable-reload-cache-parameter: false + enable-after-script: true + enable-filter-multipart-api-method-type: POST + enable-filter-multipart-apis: false + enable-request-cache: true + enable-host: false + enable-host-text: + enable-home-custom: false + home-custom-path: classpath:markdown/home.md + enable-search: true + enable-footer: false + enable-footer-custom: false + footer-custom-content: + enable-dynamic-parameter: false + enable-debug: true + enable-open-api: false + enable-group: true + cors: false + production: false + basic: + enable: false + username: test + password: 123456 + +# JWT配置 +jwt: + # JWT加解密使用的密钥(使用 Base64 编码的字符串) + secret: DTFlDDXXcyzxCBvrOkD7+OXpO8oEMTsjEpOIHP9Uh9DBzczp6YfJaa7jhh718XzUsU4TAkNJ9eBhEaUNF/mgew== + # JWT的超期限时间(单位:秒) + expiration: 86400 + # JWT负载中拿到开头 + tokenHeader: Authorization + # JWT负载中拿到开头 + tokenHead: Bearer + +oss: + endpoint: https://oss-cn-hangzhou.aliyuncs.com + access-key-id: LTAI5tENiNhfm8fJiyfU9QxB + access-key-secret: wmjKuJT970AbSQbzlkPnFaHWWwX5Nx + bucket-name: tecbrain diff --git a/src/main/resources/db/data.sql b/src/main/resources/db/data.sql new file mode 100644 index 0000000..3458796 --- /dev/null +++ b/src/main/resources/db/data.sql @@ -0,0 +1,508 @@ +-- 设置会话变量 +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +USE `technological_brain`; + +-- 开启事务 +START TRANSACTION; + +-- 清空所有相关表数据(注意顺序:先清空关联表,再清空主表) +DELETE FROM `sys_user_role`; +DELETE FROM `sys_role_permission`; +DELETE FROM `sys_user`; +DELETE FROM `sys_role`; +DELETE FROM `sys_permission`; + +-- 系统管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH system_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '系统管理', + 'system', + 1, + NULL, + '/system', + 'Layout', + 'setting', + 1, + 1, + 0, + NOW(), + NOW() +FROM system_menu; + +-- 系统管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '用户管理', + 'system:user', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/user', + 'system/user/index', + 'user', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '角色管理', + 'system:role', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/role', + 'system/role/index', + 'peoples', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '权限管理', + 'system:permission', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/permission', + 'system/permission/index', + 'tree-table', + 3, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '参数管理', + 'system:param', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/param', + 'system/param/index', + 'dict', + 4, + 1, + 0, + NOW(), + NOW(); + +-- 人才管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH talent_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '人才管理', + 'talent', + 1, + NULL, + '/talent', + 'Layout', + 'user', + 2, + 1, + 0, + NOW(), + NOW() +FROM talent_menu; + +-- 人才管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '人才信息', + 'talent:basic', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/basic', + 'talent/basic/index', + 'profile', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '工作单位', + 'talent:unit', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/unit', + 'talent/unit/index', + 'company', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '履历信息', + 'talent:resume', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/resume', + 'talent/resume/index', + 'education', + 3, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '工作领域', + 'talent:domain', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/domain', + 'talent/domain/index', + 'skill', + 4, + 1, + 0, + NOW(), + NOW(); + +-- 科研管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH research_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '科研管理', + 'research', + 1, + NULL, + '/research', + 'Layout', + 'research', + 3, + 1, + 0, + NOW(), + NOW() +FROM research_menu; + +-- 科研管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '科研项目', + 'research:project', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'research'), + '/research/project', + 'research/project/index', + 'project', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '立项项目', + 'research:initiation', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'research'), + '/research/initiation', + 'research/initiation/index', + 'form', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '科技报告', + 'research:report', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'research'), + '/research/report', + 'research/report/index', + 'documentation', + 3, + 1, + 0, + NOW(), + NOW(); + +-- 成果管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH achievement_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '成果管理', + 'achievement', + 1, + NULL, + '/achievement', + 'Layout', + 'trophy', + 4, + 1, + 0, + NOW(), + NOW() +FROM achievement_menu; + +-- 成果管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '论文专著', + 'achievement:paper', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/paper', + 'achievement/paper/index', + 'document', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '专利信息', + 'achievement:patent', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/patent', + 'achievement/patent/index', + 'patent', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '学术奖励', + 'achievement:award', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/award', + 'achievement/award/index', + 'award', + 3, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '荣誉称号', + 'achievement:honor', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/honor', + 'achievement/honor/index', + 'medal', + 4, + 1, + 0, + NOW(), + NOW(); + +-- 创建角色 +INSERT INTO `sys_role` (`id`, `role_name`, `role_code`, `role_desc`, `login_type`, `sort`, `status`, `flag`, `create_time`, `update_time`, `create_by`, `update_by`) +VALUES +-- 超级管理员角色 +(REPLACE(UUID(), '-', ''), +'超级管理员', +'SUPER_ADMIN', +'系统超级管理员,拥有所有权限', +2, +1, +1, +0, +NOW(), +NOW(), +'system', +'system'), +-- 普通管理员角色 +(REPLACE(UUID(), '-', ''), +'普通管理员', +'ADMIN', +'系统管理员,拥有除系统管理外的所有权限', +2, +2, +1, +0, +NOW(), +NOW(), +'system', +'system'); + +-- 创建用户 +INSERT INTO `sys_user` (`id`, `username`, `password`, `real_name`, `email`, `phone`, `status`, `flag`, `create_time`, `update_time`, `create_by`, `update_by`) +VALUES +-- 超级管理员用户 +(REPLACE(UUID(), '-', ''), +'admin', +'$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iKTVKIUi', -- 密码:admin123 +'系统超级管理员', +'admin@example.com', +'13800138000', +1, +0, +NOW(), +NOW(), +'system', +'system'), +-- 普通管理员用户 +(REPLACE(UUID(), '-', ''), +'manager', +'$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iKTVKIUi', -- 密码:manager123 +'系统管理员', +'manager@example.com', +'13800138001', +1, +0, +NOW(), +NOW(), +'system', +'system'); + +-- 建立用户角色关联 +INSERT INTO `sys_user_role` (`id`, `user_id`, `role_id`, `create_time`, `create_by`) +SELECT + REPLACE(UUID(), '-', ''), + u.id, + r.id, + NOW(), + 'system' +FROM `sys_user` u, `sys_role` r +WHERE (u.username = 'admin' AND r.role_code = 'SUPER_ADMIN') + OR (u.username = 'manager' AND r.role_code = 'ADMIN'); + +-- 为超级管理员角色分配所有权限 +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `create_time`, `create_by`) +SELECT + REPLACE(UUID(), '-', ''), + r.id, + p.id, + NOW(), + 'system' +FROM `sys_role` r, `sys_permission` p +WHERE r.role_code = 'SUPER_ADMIN'; + +-- 为普通管理员角色分配除系统管理外的所有权限 +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `create_time`, `create_by`) +SELECT + REPLACE(UUID(), '-', ''), + r.id, + p.id, + NOW(), + 'system' +FROM `sys_role` r, `sys_permission` p +WHERE r.role_code = 'ADMIN' +AND p.permission_code NOT LIKE 'system%'; + +-- 初始化参数类型 +-- 清空参数相关表 +DELETE FROM `sys_param`; +DELETE FROM `sys_param_type`; + +-- 插入参数类型 +INSERT INTO `sys_param_type` (`id`, `type_code`, `type_name`, `sort_order`, `status`, `is_system`, `remark`, `create_time`, `update_time`, `create_by`, `update_by`) VALUES +-- 基础信息类 +(REPLACE(UUID(), '-', ''), 'SEX', '性别', 1, 1, 1, '基础信息类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'HIGHEST_EDU', '最高学历', 2, 1, 1, '基础信息类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'HIGHEST_SCHOOL', '最高学历毕业学校', 3, 1, 1, '基础信息类参数', NOW(), NOW(), 'system', 'system'), +-- 人才相关 +(REPLACE(UUID(), '-', ''), 'CLASSIFY_GRADE', '分类定级人才', 4, 1, 1, '人才相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'TITLE', '职称', 5, 1, 1, '人才相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'HIGHEST_POSITION', '最高技术职务资格', 6, 1, 1, '人才相关参数', NOW(), NOW(), 'system', 'system'), +-- 项目相关 +(REPLACE(UUID(), '-', ''), 'PROJECT_TYPE', '项目类型', 7, 1, 1, '项目相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'PROJECT_STATUS', '项目当前状态', 8, 1, 1, '项目相关参数', NOW(), NOW(), 'system', 'system'), +-- 学科行业类 +(REPLACE(UUID(), '-', ''), 'PRIMARY_SUBJECT', '学科大类', 9, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'SUB_SUBJECT', '学科小类', 10, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'INDUSTRY_CATEGORY', '行业门类', 11, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'INDUSTRY_NAME', '行业名称', 12, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +-- 企业相关 +(REPLACE(UUID(), '-', ''), 'COMPANY_TYPE', '企业类型', 13, 1, 1, '企业相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'COMPANY_STATUS', '企业状态', 14, 1, 1, '企业相关参数', NOW(), NOW(), 'system', 'system'), +-- 资金相关 +(REPLACE(UUID(), '-', ''), 'CURRENCY_CODE', '货币代码', 15, 1, 1, '资金相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'FUNDING_FROM', '资金来源组织', 16, 1, 1, '资金相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'FUNDING_NAME', '资金名称', 17, 1, 1, '资金相关参数', NOW(), NOW(), 'system', 'system'); + +-- 插入参数值 +-- 性别参数值 +INSERT INTO `sys_param` (`id`, `param_type`, `param_code`, `param_name`, `param_value`, `sort_order`, `status`, `is_system`, `remark`, `create_time`, `update_time`, `create_by`, `update_by`) +SELECT + REPLACE(UUID(), '-', ''), + 'SEX', + 'MALE', + '男', + '0', + 1, + 1, + 1, + '性别-男', + NOW(), + NOW(), + 'system', + 'system' +UNION ALL +SELECT + REPLACE(UUID(), '-', ''), + 'SEX', + 'FEMALE', + '女', + '1', + 2, + 1, + 1, + '性别-女', + NOW(), + NOW(), + 'system', + 'system'; + +-- 提交事务 +COMMIT; + +-- 恢复外键检查 +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/src/main/resources/db/data.sql~ b/src/main/resources/db/data.sql~ new file mode 100644 index 0000000..1ca0c36 --- /dev/null +++ b/src/main/resources/db/data.sql~ @@ -0,0 +1,508 @@ +-- 设置会话变量 +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +USE `technological_brain`; + +-- 开启事务 +START TRANSACTION; + +-- 清空所有相关表数据(注意顺序:先清空关联表,再清空主表) +DELETE FROM `sys_user_role`; +DELETE FROM `sys_role_permission`; +DELETE FROM `sys_user`; +DELETE FROM `sys_role`; +DELETE FROM `sys_permission`; + +-- 系统管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH system_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '系统管理', + 'system', + 1, + NULL, + '/system', + 'Layout', + 'setting', + 1, + 1, + 0, + NOW(), + NOW() +FROM system_menu; + +-- 系统管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '用户管理', + 'system:user', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/user', + 'system/user/index', + 'user', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '角色管理', + 'system:role', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/role', + 'system/role/index', + 'peoples', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '权限管理', + 'system:permission', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/permission', + 'system/permission/index', + 'tree-table', + 3, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '参数管理', + 'system:param', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/param', + 'system/param/index', + 'dict', + 4, + 1, + 0, + NOW(), + NOW(); + +-- 人才管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH talent_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '人才管理', + 'talent', + 1, + NULL, + '/talent', + 'Layout', + 'user', + 2, + 1, + 0, + NOW(), + NOW() +FROM talent_menu; + +-- 人才管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '人才信息', + 'talent:basic', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/basic', + 'talent/basic/index', + 'profile', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '工作单位', + 'talent:unit', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/unit', + 'talent/unit/index', + 'company', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '履历信息', + 'talent:resume', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/resume', + 'talent/resume/index', + 'education', + 3, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '工作领域', + 'talent:domain', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/domain', + 'talent/domain/index', + 'skill', + 4, + 1, + 0, + NOW(), + NOW(); + +-- 科研管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH research_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '科研管理', + 'research', + 1, + NULL, + '/research', + 'Layout', + 'research', + 3, + 1, + 0, + NOW(), + NOW() +FROM research_menu; + +-- 科研管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '科研项目', + 'research:project', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'research'), + '/research/project', + 'research/project/index', + 'project', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '立项项目', + 'research:initiation', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'research'), + '/research/initiation', + 'research/initiation/index', + 'form', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '科技报告', + 'research:report', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'research'), + '/research/report', + 'research/report/index', + 'documentation', + 3, + 1, + 0, + NOW(), + NOW(); + +-- 成果管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH achievement_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '成果管理', + 'achievement', + 1, + NULL, + '/achievement', + 'Layout', + 'trophy', + 4, + 1, + 0, + NOW(), + NOW() +FROM achievement_menu; + +-- 成果管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '论文专著', + 'achievement:paper', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/paper', + 'achievement/paper/index', + 'document', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '专利信息', + 'achievement:patent', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/patent', + 'achievement/patent/index', + 'patent', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '学术奖励', + 'achievement:award', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/award', + 'achievement/award/index', + 'award', + 3, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '荣誉称号', + 'achievement:honor', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/honor', + 'achievement/honor/index', + 'medal', + 4, + 1, + 0, + NOW(), + NOW(); + +-- 创建角色 +INSERT INTO `sys_role` (`id`, `role_name`, `role_code`, `role_desc`, `login_type`, `sort`, `status`, `flag`, `create_time`, `update_time`, `create_by`, `update_by`) +VALUES +-- 超级管理员角色 +(REPLACE(UUID(), '-', ''), +'超级管理员', +'SUPER_ADMIN', +'系统超级管理员,拥有所有权限', +2, +1, +1, +0, +NOW(), +NOW(), +'system', +'system'), +-- 普通管理员角色 +(REPLACE(UUID(), '-', ''), +'普通管理员', +'ADMIN', +'系统管理员,拥有除系统管理外的所有权限', +2, +2, +1, +0, +NOW(), +NOW(), +'system', +'system'); + +-- 创建用户 +INSERT INTO `sys_user` (`id`, `username`, `password`, `real_name`, `email`, `phone`, `status`, `flag`, `create_time`, `update_time`, `create_by`, `update_by`) +VALUES +-- 超级管理员用户 +(REPLACE(UUID(), '-', ''), +'admin', +'$2a$10$X/uMNuiw1Uw1RaFqM/4wXe6hQhp3s5T5GK3F9YjzqGqGqGqGqGqGq', -- 密码:admin123 +'系统超级管理员', +'admin@example.com', +'13800138000', +1, +0, +NOW(), +NOW(), +'system', +'system'), +-- 普通管理员用户 +(REPLACE(UUID(), '-', ''), +'manager', +'$2a$10$X/uMNuiw1Uw1RaFqM/4wXe6hQhp3s5T5GK3F9YjzqGqGqGqGqGqGq', -- 密码:manager123 +'系统管理员', +'manager@example.com', +'13800138001', +1, +0, +NOW(), +NOW(), +'system', +'system'); + +-- 建立用户角色关联 +INSERT INTO `sys_user_role` (`id`, `user_id`, `role_id`, `create_time`, `create_by`) +SELECT + REPLACE(UUID(), '-', ''), + u.id, + r.id, + NOW(), + 'system' +FROM `sys_user` u, `sys_role` r +WHERE (u.username = 'admin' AND r.role_code = 'SUPER_ADMIN') + OR (u.username = 'manager' AND r.role_code = 'ADMIN'); + +-- 为超级管理员角色分配所有权限 +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `create_time`, `create_by`) +SELECT + REPLACE(UUID(), '-', ''), + r.id, + p.id, + NOW(), + 'system' +FROM `sys_role` r, `sys_permission` p +WHERE r.role_code = 'SUPER_ADMIN'; + +-- 为普通管理员角色分配除系统管理外的所有权限 +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `create_time`, `create_by`) +SELECT + REPLACE(UUID(), '-', ''), + r.id, + p.id, + NOW(), + 'system' +FROM `sys_role` r, `sys_permission` p +WHERE r.role_code = 'ADMIN' +AND p.permission_code NOT LIKE 'system%'; + +-- 初始化参数类型 +-- 清空参数相关表 +DELETE FROM `sys_param`; +DELETE FROM `sys_param_type`; + +-- 插入参数类型 +INSERT INTO `sys_param_type` (`id`, `type_code`, `type_name`, `sort_order`, `status`, `is_system`, `remark`, `create_time`, `update_time`, `create_by`, `update_by`) VALUES +-- 基础信息类 +(REPLACE(UUID(), '-', ''), 'SEX', '性别', 1, 1, 1, '基础信息类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'HIGHEST_EDU', '最高学历', 2, 1, 1, '基础信息类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'HIGHEST_SCHOOL', '最高学历毕业学校', 3, 1, 1, '基础信息类参数', NOW(), NOW(), 'system', 'system'), +-- 人才相关 +(REPLACE(UUID(), '-', ''), 'CLASSIFY_GRADE', '分类定级人才', 4, 1, 1, '人才相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'TITLE', '职称', 5, 1, 1, '人才相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'HIGHEST_POSITION', '最高技术职务资格', 6, 1, 1, '人才相关参数', NOW(), NOW(), 'system', 'system'), +-- 项目相关 +(REPLACE(UUID(), '-', ''), 'PROJECT_TYPE', '项目类型', 7, 1, 1, '项目相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'PROJECT_STATUS', '项目当前状态', 8, 1, 1, '项目相关参数', NOW(), NOW(), 'system', 'system'), +-- 学科行业类 +(REPLACE(UUID(), '-', ''), 'PRIMARY_SUBJECT', '学科大类', 9, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'SUB_SUBJECT', '学科小类', 10, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'INDUSTRY_CATEGORY', '行业门类', 11, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'INDUSTRY_NAME', '行业名称', 12, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +-- 企业相关 +(REPLACE(UUID(), '-', ''), 'COMPANY_TYPE', '企业类型', 13, 1, 1, '企业相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'COMPANY_STATUS', '企业状态', 14, 1, 1, '企业相关参数', NOW(), NOW(), 'system', 'system'), +-- 资金相关 +(REPLACE(UUID(), '-', ''), 'CURRENCY_CODE', '货币代码', 15, 1, 1, '资金相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'FUNDING_FROM', '资金来源组织', 16, 1, 1, '资金相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'FUNDING_NAME', '资金名称', 17, 1, 1, '资金相关参数', NOW(), NOW(), 'system', 'system'); + +-- 插入参数值 +-- 性别参数值 +INSERT INTO `sys_param` (`id`, `param_type`, `param_code`, `param_name`, `param_value`, `sort_order`, `status`, `is_system`, `remark`, `create_time`, `update_time`, `create_by`, `update_by`) +SELECT + REPLACE(UUID(), '-', ''), + 'SEX', + 'MALE', + '男', + '0', + 1, + 1, + 1, + '性别-男', + NOW(), + NOW(), + 'system', + 'system' +UNION ALL +SELECT + REPLACE(UUID(), '-', ''), + 'SEX', + 'FEMALE', + '女', + '1', + 2, + 1, + 1, + '性别-女', + NOW(), + NOW(), + 'system', + 'system'; + +-- 提交事务 +COMMIT; + +-- 恢复外键检查 +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/src/main/resources/db/demo.sql b/src/main/resources/db/demo.sql new file mode 100644 index 0000000..33fb275 --- /dev/null +++ b/src/main/resources/db/demo.sql @@ -0,0 +1,355 @@ +/* + Navicat Premium Data Transfer + + Source Server : local + Source Server Type : MySQL + Source Server Version : 80041 + Source Host : localhost:3306 + Source Schema : demo + + Target Server Type : MySQL + Target Server Version : 80041 + File Encoding : 65001 + + Date: 09/05/2025 20:09:53 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for academic_award +-- ---------------------------- +DROP TABLE IF EXISTS `academic_award`; +CREATE TABLE `academic_award` ( + `award_id` int NOT NULL COMMENT '奖项id', + `talent_id` int NOT NULL COMMENT '人才id', + `award_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '奖励名称', + `award_level` enum('国家级','省级','市级','其他') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '奖励级别', + `award_time` date NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '授予机构', + PRIMARY KEY (`award_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `academic_award_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '7学术奖励信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for department_basic +-- ---------------------------- +DROP TABLE IF EXISTS `department_basic`; +CREATE TABLE `department_basic` ( + `STIUL_id` int NOT NULL COMMENT '科室员工号', + `STIUL_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '人员姓名', + `STIUL_org` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '所属科室', + `STIUL_gender` enum('男','女') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '性别', + `STIUL_politicalstatus` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '政治面貌', + `STIUL_professionaltitle` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '职称', + `STIUL_entrydate` date NOT NULL COMMENT '入职时间', + `STIUL_email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '电子邮箱', + `STIUL_projectID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目验收证书编号', + `STIUL_registrationID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '成果登记编号', + `STIUL_ProjectDate` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '成果登记日期', + PRIMARY KEY (`STIUL_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '10科室基本信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for employment_unit +-- ---------------------------- +DROP TABLE IF EXISTS `employment_unit`; +CREATE TABLE `employment_unit` ( + `talent_id` int NOT NULL COMMENT '人才id', + `work_unit` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '工作单位', + `position` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '职务', + `professional_title` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '职称', + `entry_date` date NOT NULL COMMENT '入职时间', + PRIMARY KEY (`talent_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '11工作单位信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for enterprise_info +-- ---------------------------- +DROP TABLE IF EXISTS `enterprise_info`; +CREATE TABLE `enterprise_info` ( + `company_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '企业名称', + `taxpayer_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '纳税人识别号', + `company_type` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '企业类型', + `is_high_tech_certified` tinyint(1) NULL DEFAULT NULL COMMENT '是否高新技术企业认证(0:否,1:是)', + `qualification_certificate` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '资质证书', + `company_status` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '企业状态', + `legal_representative` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '法定代表人', + `talent_id` int NULL DEFAULT NULL COMMENT '法定代表人id', + `registered_capital` decimal(20, 2) NULL DEFAULT NULL COMMENT '注册资本(单位:万元)', + `company_address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '企业地址', + `province` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属省份', + `city` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属城市', + `district` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属区域', + `industry_category` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属行业门类', + `industry_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属行业名称', + `year_of_establishment` year NULL DEFAULT NULL COMMENT '成立年份', + `establishment_date` date NULL DEFAULT NULL COMMENT '成立日期', + `employee_count` int NULL DEFAULT NULL COMMENT '员工人数', + `website` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '网址', + `business_scope` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '经营范围', + `contact_phone` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '联系电话', + `contact_email` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '联系邮箱', + `update_date` date NULL DEFAULT NULL COMMENT '更新日期', + `resume_table` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '简历表格(可存储相关文件路径或内容)', + PRIMARY KEY (`taxpayer_id`) USING BTREE, + INDEX `enterprise_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `enterprise_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '18企业信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for honorary_title +-- ---------------------------- +DROP TABLE IF EXISTS `honorary_title`; +CREATE TABLE `honorary_title` ( + `honor_id` int NOT NULL COMMENT '荣誉ID', + `talent_id` int NOT NULL COMMENT '人才ID', + `honor_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '荣誉称号', + `award_time` datetime NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '授予机构', + PRIMARY KEY (`honor_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `honorary_title_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '13荣誉称号信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for papers_and_monographs +-- ---------------------------- +DROP TABLE IF EXISTS `papers_and_monographs`; +CREATE TABLE `papers_and_monographs` ( + `paper_book_id` int NOT NULL COMMENT '论文专著ID', + `talent_id` int NOT NULL COMMENT '人才ID', + `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', + `publication_time` datetime NOT NULL COMMENT '发表时间', + `journal_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '刊物名称', + `volume_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '卷号', + `issue_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '期号', + `page_range` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '页码', + `doi` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'DOI号', + `work_type` enum('论文','专著') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '著作类型', + PRIMARY KEY (`paper_book_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `papers_and_monographs_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '14论文专著信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for patent +-- ---------------------------- +DROP TABLE IF EXISTS `patent`; +CREATE TABLE `patent` ( + `patent_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '专利id', + `talent_id` int NOT NULL COMMENT '人才id', + `patent_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '专利名称', + `patent_number` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '专利编号', + `application_time` date NOT NULL COMMENT '申请时间', + `authorization_time` date NOT NULL COMMENT '授权时间', + PRIMARY KEY (`patent_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `patent_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '6专利信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for project_initiation +-- ---------------------------- +DROP TABLE IF EXISTS `project_initiation`; +CREATE TABLE `project_initiation` ( + `project_proposal_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '立项项目编号', + `STIUL_id` int NOT NULL COMMENT '科室人员工号', + `project_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目名称', + `project_from` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目来源', + `project_type` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目类型', + `funding_from` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '资金来源组织', + `undertaking_unit` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '承担单位', + `project_person` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目负责人', + `project_account` float NULL DEFAULT NULL COMMENT '项目金额', + `start_time` date NULL DEFAULT NULL COMMENT '项目启动时间', + `end_time` date NULL DEFAULT NULL COMMENT '项目终止时间', + `project_status` enum('在研','结项验收','自然结项') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目当前状态', + `id` int NOT NULL, + PRIMARY KEY (`project_proposal_id`, `id`) USING BTREE, + INDEX `project_proposal_id`(`project_proposal_id` ASC) USING BTREE, + INDEX `department_id`(`STIUL_id` ASC) USING BTREE, + CONSTRAINT `department_id` FOREIGN KEY (`STIUL_id`) REFERENCES `department_basic` (`STIUL_id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '4立项项目信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for research_project +-- ---------------------------- +DROP TABLE IF EXISTS `research_project`; +CREATE TABLE `research_project` ( + `project_id` int NOT NULL COMMENT '项目ID', + `TitleOriginal` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目名称', + `titleEnglish` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目名称英文版', + `projectType` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目类型', + `keywordOriginal` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检索关键词', + `keywordEn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检索关键词英文', + `applyAbstractOriginal` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '摘要', + `applyAbstractEn` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '摘要英文', + `Funding` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预算/财政拨款', + `Currency` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货币单位', + `FundingDollar` float NULL DEFAULT NULL COMMENT '项目金额(美元)', + `applyYear` float NULL DEFAULT NULL COMMENT '申请年份', + `planStartDate` datetime NULL DEFAULT NULL COMMENT '项目启动时间', + `planEndDate` datetime NULL DEFAULT NULL COMMENT '项目终止时间', + `PI` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目负责人', + `awardOrg` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '承担单位', + `awardOrgState` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '省份', + `awardOrgCountry` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '国家', + `FunderName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资金名称', + `FunderGroup` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资金来源组织', + `FunderCountry` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资金国家', + `originalOne` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '学科大类(第一学科)', + `originalTwo` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '学科小类', + `talent_id` int NULL DEFAULT NULL COMMENT '项目负责人id', + PRIMARY KEY (`project_id`) USING BTREE, + INDEX `id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '5科研项目信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for research_project_talent +-- ---------------------------- +DROP TABLE IF EXISTS `research_project_talent`; +CREATE TABLE `research_project_talent` ( + `project_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '科室人员工号', + `talent_id` int NOT NULL COMMENT '人才id', + PRIMARY KEY (`project_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `research_project_talent_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '15科研项目人才信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for resume +-- ---------------------------- +DROP TABLE IF EXISTS `resume`; +CREATE TABLE `resume` ( + `resume_id` int NOT NULL COMMENT '履历ID', + `talent_id` int NOT NULL COMMENT '人才ID', + `start_time` datetime NOT NULL COMMENT '起始时间', + `end_time` datetime NULL DEFAULT NULL COMMENT '结束时间', + `unit` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '所在单位', + `work_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '工作内容', + PRIMARY KEY (`resume_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `resume_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '12履历信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for review_experience +-- ---------------------------- +DROP TABLE IF EXISTS `review_experience`; +CREATE TABLE `review_experience` ( + `review_id` int NOT NULL COMMENT '评审id', + `talent_id` int NOT NULL COMMENT '人才id', + `review_project` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评审项目', + `review_time` datetime NOT NULL COMMENT '评审时间', + `reviewing_agency` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评审机构', + `review_role` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评审角色', + PRIMARY KEY (`review_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `review_experience_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '8评审经历信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for talent_basic +-- ---------------------------- +DROP TABLE IF EXISTS `talent_basic`; +CREATE TABLE `talent_basic` ( + `talent_id` int NOT NULL COMMENT '人才id', + `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '姓名', + `sex` enum('男','女') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '性别', + `age` int NULL DEFAULT NULL COMMENT '年龄', + `unit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '单位', + `highest_edu` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '最高学历', + `highest_school` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '最高学历毕业学校', + `Classify_grade` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '分类定级人才', + `pro` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '职称', + `pro_qual` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '职称等级', + `space` varchar(120) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '地区', + `image` varchar(120) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '人才图片路径', + `HTPQ` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '最高技术职务资格名称', + PRIMARY KEY (`talent_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '2人才基本信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for talent_project_initiation +-- ---------------------------- +DROP TABLE IF EXISTS `talent_project_initiation`; +CREATE TABLE `talent_project_initiation` ( + `talent_id` int NOT NULL, + `project_proposal_id` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + PRIMARY KEY (`talent_id`, `project_proposal_id`) USING BTREE, + INDEX `project_proposal_id`(`project_proposal_id` ASC) USING BTREE, + CONSTRAINT `talent_project_initiation_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + CONSTRAINT `talent_project_initiation_ibfk_2` FOREIGN KEY (`project_proposal_id`) REFERENCES `project_initiation` (`project_proposal_id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '17人才立项信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for talent_report +-- ---------------------------- +DROP TABLE IF EXISTS `talent_report`; +CREATE TABLE `talent_report` ( + `talent_id` int NOT NULL COMMENT '人才id', + `report_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告id', + PRIMARY KEY (`talent_id`, `report_id`) USING BTREE, + INDEX `report_id`(`report_id` ASC) USING BTREE, + CONSTRAINT `talent_report_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `talent_report_ibfk_2` FOREIGN KEY (`report_id`) REFERENCES `tech_report` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '16人才报告信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for tech_report +-- ---------------------------- +DROP TABLE IF EXISTS `tech_report`; +CREATE TABLE `tech_report` ( + `report_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告编号', + `project_id` int NOT NULL COMMENT '项目id', + `report_cname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告名称(中文)', + `report_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告名称(英文)', + `authorc` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者(中文)', + `author` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者(英文)', + `workplacec` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者单位(中文)', + `workplace` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者单位(英文)', + `keywordc` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关键词(中文)', + `keyword` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关键词(英文)', + `summaryc` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '摘要(中文)', + `summary` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '摘要(英文)', + `writing_time` datetime NOT NULL COMMENT '编撰时间', + `institution` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支持机构', + `project_name` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目名称', + `report_type` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报告类型', + `channel` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支持渠道', + `ispublic` enum('是','否') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '是否公开', + `report_status` enum('草稿','已发布','已撤回') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告状态', + `report_path` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报告全文路径', + PRIMARY KEY (`report_id`) USING BTREE, + INDEX `project_id_index`(`project_id` ASC) USING BTREE, + CONSTRAINT `tech_research_p_id` FOREIGN KEY (`project_id`) REFERENCES `research_project` (`project_id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '3科技报告信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for universal +-- ---------------------------- +DROP TABLE IF EXISTS `universal`; +CREATE TABLE `universal` ( + `created_time` datetime NOT NULL COMMENT '创建时间', + `updated_time` datetime NOT NULL COMMENT '更新时间' +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '1通用信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for work_domain +-- ---------------------------- +DROP TABLE IF EXISTS `work_domain`; +CREATE TABLE `work_domain` ( + `domain_id` int NOT NULL COMMENT '领域id', + `talent_id` int NOT NULL COMMENT '人才id', + `discipline_domain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '学科项目', + `industry_domain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '行业领域', + PRIMARY KEY (`domain_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `work_domain_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '9工作领域信息表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/src/main/resources/db/migration/V1.0.1__remove_param_code.sql b/src/main/resources/db/migration/V1.0.1__remove_param_code.sql new file mode 100644 index 0000000..b4089f9 --- /dev/null +++ b/src/main/resources/db/migration/V1.0.1__remove_param_code.sql @@ -0,0 +1,8 @@ +-- 删除原有的唯一索引 +ALTER TABLE `sys_param` DROP INDEX `uk_param_type_code`; + +-- 删除param_code字段 +ALTER TABLE `sys_param` DROP COLUMN `param_code`; + +-- 创建新的唯一索引 +ALTER TABLE `sys_param` ADD UNIQUE KEY `uk_param_type_name` (`param_type`, `param_name`); \ No newline at end of file diff --git a/src/main/resources/db/schema.sql b/src/main/resources/db/schema.sql new file mode 100644 index 0000000..ba4ab59 --- /dev/null +++ b/src/main/resources/db/schema.sql @@ -0,0 +1,550 @@ +-- 设置会话变量 +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- 创建数据库(如果不存在) +CREATE DATABASE IF NOT EXISTS `technological_brain` +DEFAULT CHARACTER SET utf8mb4 +COLLATE utf8mb4_general_ci; + +USE `technological_brain`; + +-- 开启事务 +START TRANSACTION; + +-- ---------------------------- +-- 系统相关表 +-- ---------------------------- + +-- 用户表 +DROP TABLE IF EXISTS `sys_user`; +CREATE TABLE `sys_user` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `username` varchar(50) NOT NULL COMMENT '用户名', + `password` varchar(100) NOT NULL COMMENT '密码', + `real_name` varchar(50) DEFAULT NULL COMMENT '真实姓名', + `email` varchar(100) DEFAULT NULL COMMENT '邮箱', + `phone` varchar(20) DEFAULT NULL COMMENT '手机号', + `avatar` varchar(255) DEFAULT NULL COMMENT '头像URL', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用,1-启用', + `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间', + `last_login_ip` varchar(50) DEFAULT NULL COMMENT '最后登录IP', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_username` (`username`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统用户表'; + +-- 角色表 +DROP TABLE IF EXISTS `sys_role`; +CREATE TABLE `sys_role` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `role_name` varchar(50) NOT NULL COMMENT '角色名称', + `role_code` varchar(50) NOT NULL COMMENT '角色编码', + `role_desc` varchar(200) DEFAULT NULL COMMENT '角色描述', + `login_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '登录类型:1-仅展示端,2-展示端和后台', + `sort` int(11) DEFAULT '0' COMMENT '排序', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用,1-启用', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_role_code` (`role_code`), + KEY `idx_status` (`status`), + KEY `idx_sort` (`sort`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统角色表'; + +-- 权限表 +DROP TABLE IF EXISTS `sys_permission`; +CREATE TABLE `sys_permission` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `permission_name` varchar(50) NOT NULL COMMENT '权限名称', + `permission_code` varchar(50) NOT NULL COMMENT '权限编码', + `permission_type` tinyint(1) NOT NULL COMMENT '权限类型:1-菜单,2-按钮,3-接口', + `parent_id` varchar(32) DEFAULT NULL COMMENT '父权限ID', + `path` varchar(200) DEFAULT NULL COMMENT '路径', + `component` varchar(200) DEFAULT NULL COMMENT '前端组件', + `icon` varchar(100) DEFAULT NULL COMMENT '图标', + `sort` int(11) DEFAULT '0' COMMENT '排序', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用,1-启用', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_permission_code` (`permission_code`), + KEY `idx_parent_id` (`parent_id`), + KEY `idx_status` (`status`), + KEY `idx_sort` (`sort`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统权限表'; + +-- 用户角色关联表 +DROP TABLE IF EXISTS `sys_user_role`; +CREATE TABLE `sys_user_role` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `user_id` varchar(32) NOT NULL COMMENT '用户ID', + `role_id` varchar(32) NOT NULL COMMENT '角色ID', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_role` (`user_id`,`role_id`), + KEY `idx_role_id` (`role_id`), + CONSTRAINT `fk_ur_user_id` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_ur_role_id` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户角色关联表'; + +-- 角色权限关联表 +DROP TABLE IF EXISTS `sys_role_permission`; +CREATE TABLE `sys_role_permission` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `role_id` varchar(32) NOT NULL COMMENT '角色ID', + `permission_id` varchar(32) NOT NULL COMMENT '权限ID', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_role_permission` (`role_id`,`permission_id`), + KEY `idx_permission_id` (`permission_id`), + CONSTRAINT `fk_rp_role_id` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_rp_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `sys_permission` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='角色权限关联表'; + +-- 参数表 +DROP TABLE IF EXISTS `sys_param`; +CREATE TABLE `sys_param` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `param_type` varchar(20) NOT NULL COMMENT '参数类型', + `param_name` varchar(50) NOT NULL COMMENT '参数名称', + `param_value` varchar(100) DEFAULT NULL COMMENT '参数值', + `data_type` varchar(10) NOT NULL DEFAULT 'STRING' COMMENT '数据类型:STRING-字符串,NUMBER-数字,BOOLEAN-布尔值,DATE-日期', + `sort_order` int(11) DEFAULT 0 COMMENT '排序号', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:0-禁用,1-启用', + `flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '标识:0-未删除,1-已删除', + `remark` varchar(200) DEFAULT NULL COMMENT '备注', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_param_type_name` (`param_type`, `param_name`), + KEY `idx_param_type` (`param_type`), + KEY `idx_status` (`status`), + KEY `idx_sort_order` (`sort_order`), + CONSTRAINT `fk_param_type` FOREIGN KEY (`param_type`) REFERENCES `sys_param_type` (`type_code`) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统参数表'; + +-- 参数类型表 +DROP TABLE IF EXISTS `sys_param_type`; +CREATE TABLE `sys_param_type` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `type_code` varchar(20) NOT NULL COMMENT '类型编码', + `type_name` varchar(50) NOT NULL COMMENT '类型名称', + `sort_order` int(11) DEFAULT 0 COMMENT '排序号', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:0-禁用,1-启用', + `flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '标识:0-未删除,1-已删除', + `remark` varchar(200) DEFAULT NULL COMMENT '备注', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_type_code` (`type_code`), + KEY `idx_status` (`status`), + KEY `idx_sort_order` (`sort_order`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='参数类型表'; + +-- ---------------------------- +-- 业务相关表 +-- ---------------------------- + +-- 人才基本信息表 +DROP TABLE IF EXISTS `talent_basic`; +CREATE TABLE `talent_basic` ( + `id` varchar(32) NOT NULL COMMENT '人才id', + `name` varchar(50) NOT NULL COMMENT '姓名', + `sex` tinyint(1) DEFAULT NULL COMMENT '性别(0-男,1-女)', + `birth_date` date DEFAULT NULL COMMENT '出生日期', + `unit_id` varchar(32) DEFAULT NULL COMMENT '单位id', + `unit_type` varchar(20) DEFAULT NULL COMMENT '单位类型:school-高校,company-企业', + `highest_edu` varchar(20) DEFAULT NULL COMMENT '最高学历', + `highest_school` varchar(100) DEFAULT NULL COMMENT '最高学历毕业学校', + `classify_grade` varchar(20) DEFAULT NULL COMMENT '分类定级人才', + `title` varchar(20) DEFAULT NULL COMMENT '职称', + `region` varchar(12) NOT NULL COMMENT '地区编码', + `image` varchar(255) DEFAULT NULL COMMENT '照片', + `highest_position` varchar(20) DEFAULT NULL COMMENT '最高技术职务资格', + `entry_date` date NOT NULL COMMENT '入职时间', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_unit_id` (`unit_id`), + KEY `idx_highest_edu` (`highest_edu`), + KEY `idx_classify_grade` (`classify_grade`), + KEY `idx_title` (`title`), + KEY `idx_highest_position` (`highest_position`), + KEY `idx_create_time` (`create_time`), +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='人才基本信息表'; + +-- 工作单位信息表 +DROP TABLE IF EXISTS `employment_unit`; +CREATE TABLE `employment_unit` ( + `id` varchar(32) NOT NULL COMMENT '工作单位id', + `unit_name` varchar(100) NOT NULL COMMENT '工作单位名称', + `unit_address` varchar(100) NOT NULL COMMENT '工作单位地址', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_unit_name` (`unit_name`), + KEY `idx_create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='工作单位信息表'; + +-- 科研项目信息表 +DROP TABLE IF EXISTS `research_project`; +CREATE TABLE `research_project` ( + `id` varchar(32) NOT NULL COMMENT '项目ID', + `name` varchar(255) NOT NULL COMMENT '项目名称', + `title_en` varchar(255) DEFAULT NULL COMMENT '项目名称英文版', + `project_type` varchar(20) DEFAULT NULL COMMENT '项目类型', + `keyword_original` varchar(100) DEFAULT NULL COMMENT '检索关键词', + `keyword_en` varchar(255) DEFAULT NULL COMMENT '检索关键词英文', + `summary_cn` text COMMENT '摘要', + `summary_en` text COMMENT '摘要英文', + `funding` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '预算/财政拨款', + `currency_code` char(3) NOT NULL DEFAULT 'CNY' COMMENT '货币代码', + `funding_dollar` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '项目金额(美元)', + `apply_year` year DEFAULT NULL COMMENT '申请年份', + `plan_start_date` date DEFAULT NULL COMMENT '项目启动时间', + `plan_end_date` date DEFAULT NULL COMMENT '项目终止时间', + `undertake_unit_id` varchar(32) DEFAULT NULL COMMENT '承担单位id', + `undertake_unit_state` varchar(50) DEFAULT NULL COMMENT '省份', + `undertake_unit_country` varchar(50) DEFAULT NULL COMMENT '国家', + `funder_name` varchar(50) DEFAULT NULL COMMENT '资金名称', + `funder_group` varchar(50) DEFAULT NULL COMMENT '资金来源组织', + `funder_country` varchar(30) DEFAULT NULL COMMENT '资金国家', + `primary_subject` varchar(20) DEFAULT NULL COMMENT '学科大类(第一学科)', + `sub_subject` varchar(20) DEFAULT NULL COMMENT '学科小类', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:1-草稿,2-已发布', + `flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_apply_year` (`apply_year`), + KEY `idx_project_type` (`project_type`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + KEY `idx_undertake_unit_id` (`undertake_unit_id`), + CONSTRAINT `fk_rp_undertake_unit_id` FOREIGN KEY (`undertake_unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='科研项目信息表'; + +-- 科研项目人才业务关联表 +DROP TABLE IF EXISTS `research_project_talent`; +CREATE TABLE `research_project_talent` ( + `id` varchar(32) NOT NULL COMMENT '立项项目id', + `project_id` varchar(32) NOT NULL COMMENT '项目编号', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + KEY `idx_project_id` (`project_id`), + KEY `idx_talent_id` (`talent_id`), + CONSTRAINT `fk_rpt_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_rpt_project_id` FOREIGN KEY (`project_id`) REFERENCES `research_project` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='科研项目人才信息表'; + +-- 科技报告信息表 +DROP TABLE IF EXISTS `tech_report`; +CREATE TABLE `tech_report` ( + `id` varchar(32) NOT NULL COMMENT '报告id', + `project_id` varchar(50) NOT NULL COMMENT '项目id', + `report_name_cn` varchar(200) NOT NULL COMMENT '报告名称(中文)', + `report_name` varchar(200) NOT NULL COMMENT '报告名称(英文)', + `author_cn` varchar(50) NOT NULL COMMENT '作者(中文)', + `author_en` varchar(50) NOT NULL COMMENT '作者(英文)', + `workplace_cn` varchar(200) NOT NULL COMMENT '作者单位(中文)', + `workplace_en` varchar(200) NOT NULL COMMENT '作者单位(英文)', + `keyword_cn` varchar(100) NOT NULL COMMENT '关键词(中文)', + `keyword_en` varchar(100) NOT NULL COMMENT '关键词(英文)', + `summary_cn` text NOT NULL COMMENT '摘要(中文)', + `summary_en` text NOT NULL COMMENT '摘要(英文)', + `writing_time` datetime NOT NULL COMMENT '编撰时间', + `institution` varchar(100) NOT NULL COMMENT '支持机构', + `report_type` varchar(20) DEFAULT NULL COMMENT '报告类型', + `channel` varchar(100) NOT NULL COMMENT '支持渠道', + `is_public` enum('是','否') NOT NULL COMMENT '是否公开', + `status` enum('草稿','已发布') NOT NULL COMMENT '报告状态', + `report_path` varchar(255) DEFAULT NULL COMMENT '报告全文路径', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_project_id` (`project_id`), + KEY `idx_report_name_cn` (`report_name_cn`), + KEY `idx_writing_time` (`writing_time`), + KEY `idx_report_type` (`report_type`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_tr_project_id` FOREIGN KEY (`project_id`) REFERENCES `research_project` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='科技报告信息表'; + +-- 人才报告关联表 +DROP TABLE IF EXISTS `talent_report`; +CREATE TABLE `talent_report` ( + `id` varchar(32) NOT NULL COMMENT '人才报告关联表id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `report_id` varchar(32) NOT NULL COMMENT '报告id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + KEY `idx_report_id` (`report_id`), + KEY `idx_talent_id` (`talent_id`), + CONSTRAINT `fk_tr_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_tr_report_id` FOREIGN KEY (`report_id`) REFERENCES `tech_report` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='人才报告关联表'; + +-- 学术奖励信息表 +DROP TABLE IF EXISTS `academic_award`; +CREATE TABLE `academic_award` ( + `id` varchar(32) NOT NULL COMMENT '奖项id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `award_name` varchar(100) NOT NULL COMMENT '奖励名称', + `award_level` varchar(20) NOT NULL COMMENT '奖励级别', + `award_time` date NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) NOT NULL COMMENT '授予机构', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_award_level` (`award_level`), + KEY `idx_award_time` (`award_time`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_aa_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='学术奖励信息表'; + +-- 企业信息表 +DROP TABLE IF EXISTS `enterprise_info`; +CREATE TABLE `enterprise_info` ( + `id` varchar(32) NOT NULL COMMENT '企业id', + `taxpayer_id` varchar(20) NOT NULL COMMENT '纳税人识别号', + `company_name` varchar(255) DEFAULT NULL COMMENT '企业名称', + `company_type` varchar(50) DEFAULT NULL COMMENT '企业类型', + `is_high_tech_certified` tinyint(1) DEFAULT NULL COMMENT '是否高新技术企业认证(0:否,1:是)', + `qualification_certificate` text COMMENT '资质证书', + `company_status` varchar(50) DEFAULT NULL COMMENT '企业状态参数表COMPANY_STATUS)', + `legal_representative_name` varchar(32) DEFAULT NULL COMMENT '法定代表人姓名', + `registered_capital` varchar(255) DEFAULT NULL COMMENT '注册资本', + `company_address` varchar(255) DEFAULT NULL COMMENT '企业地址', + `province` varchar(50) DEFAULT NULL COMMENT '所属省份', + `city` varchar(50) DEFAULT NULL COMMENT '所属城市', + `district` varchar(50) DEFAULT NULL COMMENT '所属区域', + `industry` varchar(20) DEFAULT NULL COMMENT '所属行业', + `establishment_date` date DEFAULT NULL COMMENT '成立日期', + `employee_count` int DEFAULT NULL COMMENT '员工人数', + `website` varchar(255) DEFAULT NULL COMMENT '网址', + `business_scope` text COMMENT '经营范围', + `contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话', + `contact_email` varchar(100) DEFAULT NULL COMMENT '联系邮箱', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_company_name` (`company_name`), + KEY `idx_company_status` (`company_status`), + KEY `idx_create_time` (`create_time`), +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='企业信息表'; + +-- 荣誉称号信息表 +DROP TABLE IF EXISTS `honorary_title`; +CREATE TABLE `honorary_title` ( + `id` varchar(32) NOT NULL COMMENT '荣誉ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `honor_title` varchar(100) NOT NULL COMMENT '荣誉称号', + `award_time` date NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) NOT NULL COMMENT '授予机构', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_award_time` (`award_time`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_ht_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='荣誉称号信息表'; + +-- 论文专著信息表 +DROP TABLE IF EXISTS `papers_and_monographs`; +CREATE TABLE `papers_and_monographs` ( + `id` varchar(32) NOT NULL COMMENT '论文专著ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `title` varchar(200) NOT NULL COMMENT '标题', + `publication_time` datetime NOT NULL COMMENT '发表时间', + `journal_name` varchar(100) NOT NULL COMMENT '刊物名称', + `volume_number` varchar(20) NOT NULL COMMENT '卷号', + `issue_number` varchar(20) NOT NULL COMMENT '期号', + `page_range` varchar(20) NOT NULL COMMENT '页码', + `doi` varchar(50) NOT NULL COMMENT 'DOI号', + `work_type` varchar(20) NOT NULL COMMENT '著作类型(参数表WORK_TYPE)', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:1-草稿,2-已发布', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_publication_time` (`publication_time`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_pm_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='论文专著信息表'; + +-- 论文专著关联表 +DROP TABLE IF EXISTS `papers_and_monographs_talent`; +CREATE TABLE `papers_and_monographs_talent` ( + `id` varchar(32) NOT NULL COMMENT '业务表ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `papers_and_monographs_id` varchar(32) NOT NULL COMMENT '论文专著id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_talent_papers` (`talent_id`,`papers_and_monographs_id`), + KEY `idx_papers_and_monographs_id` (`papers_and_monographs_id`), + CONSTRAINT `fk_pmt_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_pmt_papers_and_monographs_id` FOREIGN KEY (`papers_and_monographs_id`) REFERENCES `papers_and_monographs` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='论文专著关联表'; + +-- 专利信息表 +DROP TABLE IF EXISTS `patent`; +CREATE TABLE `patent` ( + `id` varchar(32) NOT NULL COMMENT '专利id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `patent_name` varchar(100) NOT NULL COMMENT '专利名称', + `patent_number` varchar(30) NOT NULL COMMENT '专利编号', + `application_time` date NOT NULL COMMENT '申请时间', + `authorization_time` date NOT NULL COMMENT '授权时间', + `status` varchar(10) NOT NULL DEFAULT '1' COMMENT '状态:1-草稿,2-已发布', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_application_time` (`application_time`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_p_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='专利信息表'; + +-- 专利信息关联表 +DROP TABLE IF EXISTS `patent_talent`; +CREATE TABLE `patent_talent` ( + `id` varchar(32) NOT NULL COMMENT '业务表id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `patent_id` varchar(32) NOT NULL COMMENT '专利id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_talent_patent` (`talent_id`,`patent_id`), + KEY `idx_patent_id` (`patent_id`), + CONSTRAINT `fk_pt_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_pt_patent_id` FOREIGN KEY (`patent_id`) REFERENCES `patent` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='专利信息关联表'; + +-- 立项项目信息表 +DROP TABLE IF EXISTS `project_initiation`; +CREATE TABLE `project_initiation` ( + `id` varchar(32) NOT NULL COMMENT '立项项目id', + `project_proposal_number` varchar(100) NOT NULL COMMENT '立项项目编号', + `project_name` varchar(100) DEFAULT NULL COMMENT '项目名称', + `project_from` varchar(100) DEFAULT NULL COMMENT '项目来源', + `project_type` varchar(100) DEFAULT NULL COMMENT '项目类型', + `funding_from` varchar(100) DEFAULT NULL COMMENT '资金来源组织', + `undertaking_unit_id` varchar(32) DEFAULT NULL COMMENT '承担单位id', + `project_account` decimal(12,2) DEFAULT NULL COMMENT '项目金额', + `start_time` date DEFAULT NULL COMMENT '项目启动时间', + `end_time` date DEFAULT NULL COMMENT '项目终止时间', + `project_status` varchar(20) DEFAULT NULL COMMENT '项目当前状态(PROJECT_STATUS)', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:1-草稿,2-已发布', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_project_name` (`project_name`), + KEY `idx_project_status` (`project_status`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + KEY `idx_undertaking_unit_id` (`undertaking_unit_id`), + CONSTRAINT `fk_pi_undertaking_unit_id` FOREIGN KEY (`undertaking_unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='立项项目信息表'; + +-- 人才立项关联表 +DROP TABLE IF EXISTS `talent_project_initiation`; +CREATE TABLE `talent_project_initiation` ( + `id` varchar(32) NOT NULL COMMENT '业务表id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `project_initiation_id` varchar(32) NOT NULL COMMENT '立项项目id', + `is_principal` boolean NOT NULL COMMENT '是否负责人(0:否,1:是)', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_talent_project` (`talent_id`,`project_initiation_id`), + KEY `idx_project_initiation_id` (`project_initiation_id`), + CONSTRAINT `fk_tpi_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_tpi_project_initiation_id` FOREIGN KEY (`project_initiation_id`) REFERENCES `project_initiation` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='人才立项关联表'; + +-- 履历信息表 +DROP TABLE IF EXISTS `resume`; +CREATE TABLE `resume` ( + `id` varchar(32) NOT NULL COMMENT '履历ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `start_time` datetime NOT NULL COMMENT '起始时间', + `end_time` datetime DEFAULT NULL COMMENT '结束时间', + `unit_id` varchar(32) NOT NULL COMMENT '所在单位id', + `work_content` text NOT NULL COMMENT '工作内容', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_r_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_r_unit_id` FOREIGN KEY (`unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='履历信息表'; + +ALTER TABLE employment_unit COMMENT = '高校信息表'; + +RENAME TABLE employment_unit TO school; + +ALTER TABLE `talent_basic` +ADD COLUMN `unit_type` varchar(20) DEFAULT NULL COMMENT '单位类型:school-高校,company-企业' AFTER `unit_id`; \ No newline at end of file diff --git a/src/main/resources/db/schema.sql~ b/src/main/resources/db/schema.sql~ new file mode 100644 index 0000000..44b9dde --- /dev/null +++ b/src/main/resources/db/schema.sql~ @@ -0,0 +1,551 @@ +-- 设置会话变量 +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- 创建数据库(如果不存在) +CREATE DATABASE IF NOT EXISTS `technological_brain` +DEFAULT CHARACTER SET utf8mb4 +COLLATE utf8mb4_general_ci; + +USE `technological_brain`; + +-- 开启事务 +START TRANSACTION; + +-- ---------------------------- +-- 系统相关表 +-- ---------------------------- + +-- 用户表 +DROP TABLE IF EXISTS `sys_user`; +CREATE TABLE `sys_user` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `username` varchar(50) NOT NULL COMMENT '用户名', + `password` varchar(100) NOT NULL COMMENT '密码', + `real_name` varchar(50) DEFAULT NULL COMMENT '真实姓名', + `email` varchar(100) DEFAULT NULL COMMENT '邮箱', + `phone` varchar(20) DEFAULT NULL COMMENT '手机号', + `avatar` varchar(255) DEFAULT NULL COMMENT '头像URL', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用,1-启用', + `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间', + `last_login_ip` varchar(50) DEFAULT NULL COMMENT '最后登录IP', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_username` (`username`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统用户表'; + +-- 角色表 +DROP TABLE IF EXISTS `sys_role`; +CREATE TABLE `sys_role` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `role_name` varchar(50) NOT NULL COMMENT '角色名称', + `role_code` varchar(50) NOT NULL COMMENT '角色编码', + `role_desc` varchar(200) DEFAULT NULL COMMENT '角色描述', + `login_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '登录类型:1-仅展示端,2-展示端和后台', + `sort` int(11) DEFAULT '0' COMMENT '排序', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用,1-启用', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_role_code` (`role_code`), + KEY `idx_status` (`status`), + KEY `idx_sort` (`sort`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统角色表'; + +-- 权限表 +DROP TABLE IF EXISTS `sys_permission`; +CREATE TABLE `sys_permission` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `permission_name` varchar(50) NOT NULL COMMENT '权限名称', + `permission_code` varchar(50) NOT NULL COMMENT '权限编码', + `permission_type` tinyint(1) NOT NULL COMMENT '权限类型:1-菜单,2-按钮,3-接口', + `parent_id` varchar(32) DEFAULT NULL COMMENT '父权限ID', + `path` varchar(200) DEFAULT NULL COMMENT '路径', + `component` varchar(200) DEFAULT NULL COMMENT '前端组件', + `icon` varchar(100) DEFAULT NULL COMMENT '图标', + `sort` int(11) DEFAULT '0' COMMENT '排序', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用,1-启用', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_permission_code` (`permission_code`), + KEY `idx_parent_id` (`parent_id`), + KEY `idx_status` (`status`), + KEY `idx_sort` (`sort`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统权限表'; + +-- 用户角色关联表 +DROP TABLE IF EXISTS `sys_user_role`; +CREATE TABLE `sys_user_role` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `user_id` varchar(32) NOT NULL COMMENT '用户ID', + `role_id` varchar(32) NOT NULL COMMENT '角色ID', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_role` (`user_id`,`role_id`), + KEY `idx_role_id` (`role_id`), + CONSTRAINT `fk_ur_user_id` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_ur_role_id` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户角色关联表'; + +-- 角色权限关联表 +DROP TABLE IF EXISTS `sys_role_permission`; +CREATE TABLE `sys_role_permission` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `role_id` varchar(32) NOT NULL COMMENT '角色ID', + `permission_id` varchar(32) NOT NULL COMMENT '权限ID', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_role_permission` (`role_id`,`permission_id`), + KEY `idx_permission_id` (`permission_id`), + CONSTRAINT `fk_rp_role_id` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_rp_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `sys_permission` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='角色权限关联表'; + +-- 参数表 +DROP TABLE IF EXISTS `sys_param`; +CREATE TABLE `sys_param` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `param_type` varchar(20) NOT NULL COMMENT '参数类型', + `param_name` varchar(50) NOT NULL COMMENT '参数名称', + `param_value` varchar(100) DEFAULT NULL COMMENT '参数值', + `data_type` varchar(10) NOT NULL DEFAULT 'STRING' COMMENT '数据类型:STRING-字符串,NUMBER-数字,BOOLEAN-布尔值,DATE-日期', + `sort_order` int(11) DEFAULT 0 COMMENT '排序号', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:0-禁用,1-启用', + `flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '标识:0-未删除,1-已删除', + `remark` varchar(200) DEFAULT NULL COMMENT '备注', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_param_type_name` (`param_type`, `param_name`), + KEY `idx_param_type` (`param_type`), + KEY `idx_status` (`status`), + KEY `idx_sort_order` (`sort_order`), + CONSTRAINT `fk_param_type` FOREIGN KEY (`param_type`) REFERENCES `sys_param_type` (`type_code`) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统参数表'; + +-- 参数类型表 +DROP TABLE IF EXISTS `sys_param_type`; +CREATE TABLE `sys_param_type` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `type_code` varchar(20) NOT NULL COMMENT '类型编码', + `type_name` varchar(50) NOT NULL COMMENT '类型名称', + `sort_order` int(11) DEFAULT 0 COMMENT '排序号', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:0-禁用,1-启用', + `flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '标识:0-未删除,1-已删除', + `remark` varchar(200) DEFAULT NULL COMMENT '备注', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_type_code` (`type_code`), + KEY `idx_status` (`status`), + KEY `idx_sort_order` (`sort_order`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='参数类型表'; + +-- ---------------------------- +-- 业务相关表 +-- ---------------------------- + +-- 人才基本信息表 +DROP TABLE IF EXISTS `talent_basic`; +CREATE TABLE `talent_basic` ( + `id` varchar(32) NOT NULL COMMENT '人才id', + `name` varchar(50) NOT NULL COMMENT '姓名', + `sex` tinyint(1) DEFAULT NULL COMMENT '性别(0-男,1-女)', + `birth_date` date DEFAULT NULL COMMENT '出生日期', + `unit_id` varchar(32) DEFAULT NULL COMMENT '单位id', + `unit_type` varchar(20) DEFAULT NULL COMMENT '单位类型:school-高校,company-企业', + `highest_edu` varchar(20) DEFAULT NULL COMMENT '最高学历', + `highest_school` varchar(100) DEFAULT NULL COMMENT '最高学历毕业学校', + `classify_grade` varchar(20) DEFAULT NULL COMMENT '分类定级人才', + `title` varchar(20) DEFAULT NULL COMMENT '职称', + `region` varchar(12) NOT NULL COMMENT '地区编码', + `image` varchar(255) DEFAULT NULL COMMENT '照片', + `highest_position` varchar(20) DEFAULT NULL COMMENT '最高技术职务资格', + `entry_date` date NOT NULL COMMENT '入职时间', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_unit_id` (`unit_id`), + KEY `idx_highest_edu` (`highest_edu`), + KEY `idx_classify_grade` (`classify_grade`), + KEY `idx_title` (`title`), + KEY `idx_highest_position` (`highest_position`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_talent_unit_id` FOREIGN KEY (`unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='人才基本信息表'; + +-- 工作单位信息表 +DROP TABLE IF EXISTS `employment_unit`; +CREATE TABLE `employment_unit` ( + `id` varchar(32) NOT NULL COMMENT '工作单位id', + `unit_name` varchar(100) NOT NULL COMMENT '工作单位名称', + `unit_address` varchar(100) NOT NULL COMMENT '工作单位地址', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_unit_name` (`unit_name`), + KEY `idx_create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='工作单位信息表'; + +-- 科研项目信息表 +DROP TABLE IF EXISTS `research_project`; +CREATE TABLE `research_project` ( + `id` varchar(32) NOT NULL COMMENT '项目ID', + `name` varchar(255) NOT NULL COMMENT '项目名称', + `title_en` varchar(255) DEFAULT NULL COMMENT '项目名称英文版', + `project_type` varchar(20) DEFAULT NULL COMMENT '项目类型', + `keyword_original` varchar(100) DEFAULT NULL COMMENT '检索关键词', + `keyword_en` varchar(255) DEFAULT NULL COMMENT '检索关键词英文', + `summary_cn` text COMMENT '摘要', + `summary_en` text COMMENT '摘要英文', + `funding` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '预算/财政拨款', + `currency_code` char(3) NOT NULL DEFAULT 'CNY' COMMENT '货币代码', + `funding_dollar` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '项目金额(美元)', + `apply_year` year DEFAULT NULL COMMENT '申请年份', + `plan_start_date` date DEFAULT NULL COMMENT '项目启动时间', + `plan_end_date` date DEFAULT NULL COMMENT '项目终止时间', + `undertake_unit_id` varchar(32) DEFAULT NULL COMMENT '承担单位id', + `undertake_unit_state` varchar(50) DEFAULT NULL COMMENT '省份', + `undertake_unit_country` varchar(50) DEFAULT NULL COMMENT '国家', + `funder_name` varchar(50) DEFAULT NULL COMMENT '资金名称', + `funder_group` varchar(50) DEFAULT NULL COMMENT '资金来源组织', + `funder_country` varchar(30) DEFAULT NULL COMMENT '资金国家', + `primary_subject` varchar(20) DEFAULT NULL COMMENT '学科大类(第一学科)', + `sub_subject` varchar(20) DEFAULT NULL COMMENT '学科小类', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:1-草稿,2-已发布', + `flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_apply_year` (`apply_year`), + KEY `idx_project_type` (`project_type`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + KEY `idx_undertake_unit_id` (`undertake_unit_id`), + CONSTRAINT `fk_rp_undertake_unit_id` FOREIGN KEY (`undertake_unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='科研项目信息表'; + +-- 科研项目人才业务关联表 +DROP TABLE IF EXISTS `research_project_talent`; +CREATE TABLE `research_project_talent` ( + `id` varchar(32) NOT NULL COMMENT '立项项目id', + `project_id` varchar(32) NOT NULL COMMENT '项目编号', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + KEY `idx_project_id` (`project_id`), + KEY `idx_talent_id` (`talent_id`), + CONSTRAINT `fk_rpt_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_rpt_project_id` FOREIGN KEY (`project_id`) REFERENCES `research_project` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='科研项目人才信息表'; + +-- 科技报告信息表 +DROP TABLE IF EXISTS `tech_report`; +CREATE TABLE `tech_report` ( + `id` varchar(32) NOT NULL COMMENT '报告id', + `project_id` varchar(50) NOT NULL COMMENT '项目id', + `report_name_cn` varchar(200) NOT NULL COMMENT '报告名称(中文)', + `report_name` varchar(200) NOT NULL COMMENT '报告名称(英文)', + `author_cn` varchar(50) NOT NULL COMMENT '作者(中文)', + `author_en` varchar(50) NOT NULL COMMENT '作者(英文)', + `workplace_cn` varchar(200) NOT NULL COMMENT '作者单位(中文)', + `workplace_en` varchar(200) NOT NULL COMMENT '作者单位(英文)', + `keyword_cn` varchar(100) NOT NULL COMMENT '关键词(中文)', + `keyword_en` varchar(100) NOT NULL COMMENT '关键词(英文)', + `summary_cn` text NOT NULL COMMENT '摘要(中文)', + `summary_en` text NOT NULL COMMENT '摘要(英文)', + `writing_time` datetime NOT NULL COMMENT '编撰时间', + `institution` varchar(100) NOT NULL COMMENT '支持机构', + `report_type` varchar(20) DEFAULT NULL COMMENT '报告类型', + `channel` varchar(100) NOT NULL COMMENT '支持渠道', + `is_public` enum('是','否') NOT NULL COMMENT '是否公开', + `status` enum('草稿','已发布') NOT NULL COMMENT '报告状态', + `report_path` varchar(255) DEFAULT NULL COMMENT '报告全文路径', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_project_id` (`project_id`), + KEY `idx_report_name_cn` (`report_name_cn`), + KEY `idx_writing_time` (`writing_time`), + KEY `idx_report_type` (`report_type`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_tr_project_id` FOREIGN KEY (`project_id`) REFERENCES `research_project` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='科技报告信息表'; + +-- 人才报告关联表 +DROP TABLE IF EXISTS `talent_report`; +CREATE TABLE `talent_report` ( + `id` varchar(32) NOT NULL COMMENT '人才报告关联表id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `report_id` varchar(32) NOT NULL COMMENT '报告id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + KEY `idx_report_id` (`report_id`), + KEY `idx_talent_id` (`talent_id`), + CONSTRAINT `fk_tr_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_tr_report_id` FOREIGN KEY (`report_id`) REFERENCES `tech_report` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='人才报告关联表'; + +-- 学术奖励信息表 +DROP TABLE IF EXISTS `academic_award`; +CREATE TABLE `academic_award` ( + `id` varchar(32) NOT NULL COMMENT '奖项id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `award_name` varchar(100) NOT NULL COMMENT '奖励名称', + `award_level` varchar(20) NOT NULL COMMENT '奖励级别', + `award_time` date NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) NOT NULL COMMENT '授予机构', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_award_level` (`award_level`), + KEY `idx_award_time` (`award_time`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_aa_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='学术奖励信息表'; + +-- 企业信息表 +DROP TABLE IF EXISTS `enterprise_info`; +CREATE TABLE `enterprise_info` ( + `id` varchar(32) NOT NULL COMMENT '企业id', + `taxpayer_id` varchar(20) NOT NULL COMMENT '纳税人识别号', + `company_name` varchar(255) DEFAULT NULL COMMENT '企业名称', + `company_type` varchar(50) DEFAULT NULL COMMENT '企业类型', + `is_high_tech_certified` tinyint(1) DEFAULT NULL COMMENT '是否高新技术企业认证(0:否,1:是)', + `qualification_certificate` text COMMENT '资质证书', + `company_status` varchar(50) DEFAULT NULL COMMENT '企业状态参数表COMPANY_STATUS)', + `legal_representative_name` varchar(32) DEFAULT NULL COMMENT '法定代表人姓名', + `registered_capital` varchar(255) DEFAULT NULL COMMENT '注册资本', + `company_address` varchar(255) DEFAULT NULL COMMENT '企业地址', + `province` varchar(50) DEFAULT NULL COMMENT '所属省份', + `city` varchar(50) DEFAULT NULL COMMENT '所属城市', + `district` varchar(50) DEFAULT NULL COMMENT '所属区域', + `industry` varchar(20) DEFAULT NULL COMMENT '所属行业', + `establishment_date` date DEFAULT NULL COMMENT '成立日期', + `employee_count` int DEFAULT NULL COMMENT '员工人数', + `website` varchar(255) DEFAULT NULL COMMENT '网址', + `business_scope` text COMMENT '经营范围', + `contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话', + `contact_email` varchar(100) DEFAULT NULL COMMENT '联系邮箱', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_company_name` (`company_name`), + KEY `idx_company_status` (`company_status`), + KEY `idx_create_time` (`create_time`), +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='企业信息表'; + +-- 荣誉称号信息表 +DROP TABLE IF EXISTS `honorary_title`; +CREATE TABLE `honorary_title` ( + `id` varchar(32) NOT NULL COMMENT '荣誉ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `honor_title` varchar(100) NOT NULL COMMENT '荣誉称号', + `award_time` date NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) NOT NULL COMMENT '授予机构', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_award_time` (`award_time`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_ht_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='荣誉称号信息表'; + +-- 论文专著信息表 +DROP TABLE IF EXISTS `papers_and_monographs`; +CREATE TABLE `papers_and_monographs` ( + `id` varchar(32) NOT NULL COMMENT '论文专著ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `title` varchar(200) NOT NULL COMMENT '标题', + `publication_time` datetime NOT NULL COMMENT '发表时间', + `journal_name` varchar(100) NOT NULL COMMENT '刊物名称', + `volume_number` varchar(20) NOT NULL COMMENT '卷号', + `issue_number` varchar(20) NOT NULL COMMENT '期号', + `page_range` varchar(20) NOT NULL COMMENT '页码', + `doi` varchar(50) NOT NULL COMMENT 'DOI号', + `work_type` varchar(20) NOT NULL COMMENT '著作类型(参数表WORK_TYPE)', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:1-草稿,2-已发布', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_publication_time` (`publication_time`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_pm_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='论文专著信息表'; + +-- 论文专著关联表 +DROP TABLE IF EXISTS `papers_and_monographs_talent`; +CREATE TABLE `papers_and_monographs_talent` ( + `id` varchar(32) NOT NULL COMMENT '业务表ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `papers_and_monographs_id` varchar(32) NOT NULL COMMENT '论文专著id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_talent_papers` (`talent_id`,`papers_and_monographs_id`), + KEY `idx_papers_and_monographs_id` (`papers_and_monographs_id`), + CONSTRAINT `fk_pmt_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_pmt_papers_and_monographs_id` FOREIGN KEY (`papers_and_monographs_id`) REFERENCES `papers_and_monographs` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='论文专著关联表'; + +-- 专利信息表 +DROP TABLE IF EXISTS `patent`; +CREATE TABLE `patent` ( + `id` varchar(32) NOT NULL COMMENT '专利id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `patent_name` varchar(100) NOT NULL COMMENT '专利名称', + `patent_number` varchar(30) NOT NULL COMMENT '专利编号', + `application_time` date NOT NULL COMMENT '申请时间', + `authorization_time` date NOT NULL COMMENT '授权时间', + `status` varchar(10) NOT NULL DEFAULT '1' COMMENT '状态:1-草稿,2-已发布', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_application_time` (`application_time`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_p_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='专利信息表'; + +-- 专利信息关联表 +DROP TABLE IF EXISTS `patent_talent`; +CREATE TABLE `patent_talent` ( + `id` varchar(32) NOT NULL COMMENT '业务表id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `patent_id` varchar(32) NOT NULL COMMENT '专利id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_talent_patent` (`talent_id`,`patent_id`), + KEY `idx_patent_id` (`patent_id`), + CONSTRAINT `fk_pt_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_pt_patent_id` FOREIGN KEY (`patent_id`) REFERENCES `patent` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='专利信息关联表'; + +-- 立项项目信息表 +DROP TABLE IF EXISTS `project_initiation`; +CREATE TABLE `project_initiation` ( + `id` varchar(32) NOT NULL COMMENT '立项项目id', + `project_proposal_number` varchar(100) NOT NULL COMMENT '立项项目编号', + `project_name` varchar(100) DEFAULT NULL COMMENT '项目名称', + `project_from` varchar(100) DEFAULT NULL COMMENT '项目来源', + `project_type` varchar(100) DEFAULT NULL COMMENT '项目类型', + `funding_from` varchar(100) DEFAULT NULL COMMENT '资金来源组织', + `undertaking_unit_id` varchar(32) DEFAULT NULL COMMENT '承担单位id', + `project_account` decimal(12,2) DEFAULT NULL COMMENT '项目金额', + `start_time` date DEFAULT NULL COMMENT '项目启动时间', + `end_time` date DEFAULT NULL COMMENT '项目终止时间', + `project_status` varchar(20) DEFAULT NULL COMMENT '项目当前状态(PROJECT_STATUS)', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:1-草稿,2-已发布', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_project_name` (`project_name`), + KEY `idx_project_status` (`project_status`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + KEY `idx_undertaking_unit_id` (`undertaking_unit_id`), + CONSTRAINT `fk_pi_undertaking_unit_id` FOREIGN KEY (`undertaking_unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='立项项目信息表'; + +-- 人才立项关联表 +DROP TABLE IF EXISTS `talent_project_initiation`; +CREATE TABLE `talent_project_initiation` ( + `id` varchar(32) NOT NULL COMMENT '业务表id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `project_initiation_id` varchar(32) NOT NULL COMMENT '立项项目id', + `is_principal` boolean NOT NULL COMMENT '是否负责人(0:否,1:是)', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_talent_project` (`talent_id`,`project_initiation_id`), + KEY `idx_project_initiation_id` (`project_initiation_id`), + CONSTRAINT `fk_tpi_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_tpi_project_initiation_id` FOREIGN KEY (`project_initiation_id`) REFERENCES `project_initiation` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='人才立项关联表'; + +-- 履历信息表 +DROP TABLE IF EXISTS `resume`; +CREATE TABLE `resume` ( + `id` varchar(32) NOT NULL COMMENT '履历ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `start_time` datetime NOT NULL COMMENT '起始时间', + `end_time` datetime DEFAULT NULL COMMENT '结束时间', + `unit_id` varchar(32) NOT NULL COMMENT '所在单位id', + `work_content` text NOT NULL COMMENT '工作内容', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_r_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_r_unit_id` FOREIGN KEY (`unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='履历信息表'; + +ALTER TABLE employment_unit COMMENT = '高校信息表'; + +RENAME TABLE employment_unit TO school; + +ALTER TABLE `talent_basic` +ADD COLUMN `unit_type` varchar(20) DEFAULT NULL COMMENT '单位类型:school-高校,company-企业' AFTER `unit_id`; \ No newline at end of file diff --git a/src/main/resources/mapper/AcademicAwardMapper.xml b/src/main/resources/mapper/AcademicAwardMapper.xml new file mode 100644 index 0000000..6d27e95 --- /dev/null +++ b/src/main/resources/mapper/AcademicAwardMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + id, talent_id, award_name, award_level, award_time, + awarding_agency, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/EmploymentUnitMapper.xml b/src/main/resources/mapper/EmploymentUnitMapper.xml new file mode 100644 index 0000000..cbd4a61 --- /dev/null +++ b/src/main/resources/mapper/EmploymentUnitMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + id, unit_name, unit_address, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/EnterpriseInfoMapper.xml b/src/main/resources/mapper/EnterpriseInfoMapper.xml new file mode 100644 index 0000000..12573af --- /dev/null +++ b/src/main/resources/mapper/EnterpriseInfoMapper.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, enterprise_name, enterprise_code, enterprise_type, + industry, legal_representative, registered_capital, establishment_date, + business_scope, address, contact_person, contact_phone, email, website, + flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/HonoraryTitleMapper.xml b/src/main/resources/mapper/HonoraryTitleMapper.xml new file mode 100644 index 0000000..8c3ef51 --- /dev/null +++ b/src/main/resources/mapper/HonoraryTitleMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, title_name, title_level, awarding_agency, + award_time, validity_period, flag, create_time, update_time, + create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/PapersAndMonographsMapper.xml b/src/main/resources/mapper/PapersAndMonographsMapper.xml new file mode 100644 index 0000000..6b44601 --- /dev/null +++ b/src/main/resources/mapper/PapersAndMonographsMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, work_name, work_type, publication_time, + publication_name, volume_number, issue_number, page_range, + status, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/PapersAndMonographsTalentMapper.xml b/src/main/resources/mapper/PapersAndMonographsTalentMapper.xml new file mode 100644 index 0000000..67b9f46 --- /dev/null +++ b/src/main/resources/mapper/PapersAndMonographsTalentMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, talent_id, papers_and_monographs_id, create_time, create_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/PatentMapper.xml b/src/main/resources/mapper/PatentMapper.xml new file mode 100644 index 0000000..24b06c2 --- /dev/null +++ b/src/main/resources/mapper/PatentMapper.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, patent_name, patent_type, patent_number, + application_time, publication_time, authorization_time, inventors, + patent_abstract, patent_status, flag, create_time, update_time, + create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/PatentTalentMapper.xml b/src/main/resources/mapper/PatentTalentMapper.xml new file mode 100644 index 0000000..44551b9 --- /dev/null +++ b/src/main/resources/mapper/PatentTalentMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, patent_id, talent_id, create_time, create_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/ProjectInitiationMapper.xml b/src/main/resources/mapper/ProjectInitiationMapper.xml new file mode 100644 index 0000000..7f44cd6 --- /dev/null +++ b/src/main/resources/mapper/ProjectInitiationMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, project_proposal_number, project_name, project_from, + project_type, project_level, project_funding, start_time, end_time, + project_status, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/ResearchProjectMapper.xml b/src/main/resources/mapper/ResearchProjectMapper.xml new file mode 100644 index 0000000..900775d --- /dev/null +++ b/src/main/resources/mapper/ResearchProjectMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, name, title_en, project_type, keyword_original, keyword_en, + summary_cn, summary_en, funding, currency_code, funding_dollar, + apply_year, plan_start_date, plan_end_date, undertake_unit_id, + undertake_unit_state, undertake_unit_country, funder_name, + funder_group, funder_country, primary_subject, sub_subject, + status, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/ResearchProjectTalentMapper.xml b/src/main/resources/mapper/ResearchProjectTalentMapper.xml new file mode 100644 index 0000000..d119c1e --- /dev/null +++ b/src/main/resources/mapper/ResearchProjectTalentMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, talent_id, project_id, create_time, create_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/ResumeMapper.xml b/src/main/resources/mapper/ResumeMapper.xml new file mode 100644 index 0000000..8dbb60d --- /dev/null +++ b/src/main/resources/mapper/ResumeMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/ReviewExperienceMapper.xml b/src/main/resources/mapper/ReviewExperienceMapper.xml new file mode 100644 index 0000000..e036224 --- /dev/null +++ b/src/main/resources/mapper/ReviewExperienceMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, review_project, review_time, reviewing_agency, + review_role, review_content, flag, create_time, update_time, + create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysParamMapper.xml b/src/main/resources/mapper/SysParamMapper.xml new file mode 100644 index 0000000..5c39a70 --- /dev/null +++ b/src/main/resources/mapper/SysParamMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + id, param_type, param_name, param_value, remark, sort_order, status, flag, + create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysParamTypeMapper.xml b/src/main/resources/mapper/SysParamTypeMapper.xml new file mode 100644 index 0000000..d315a84 --- /dev/null +++ b/src/main/resources/mapper/SysParamTypeMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + id, type_code, type_name, remark, sort_order, status, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysPermissionMapper.xml b/src/main/resources/mapper/SysPermissionMapper.xml new file mode 100644 index 0000000..3730b47 --- /dev/null +++ b/src/main/resources/mapper/SysPermissionMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + id, permission_name, permission_code, permission_type, parent_id, path, component, + icon, sort_order, status, create_time, update_time, create_by, update_by, deleted + + + INSERT INTO sys_role_permission (id, role_id, permission_id, create_time) + VALUES + + (#{item.id}, #{item.roleId}, #{item.permissionId}, NOW()) + + + + DELETE FROM sys_role_permission WHERE role_id = #{roleId} + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysRoleMapper.xml b/src/main/resources/mapper/SysRoleMapper.xml new file mode 100644 index 0000000..d9bc72f --- /dev/null +++ b/src/main/resources/mapper/SysRoleMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + id, role_name, role_code, description, status, sort_order, + create_time, update_time, create_by, update_by, deleted + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysRolePermissionMapper.xml b/src/main/resources/mapper/SysRolePermissionMapper.xml new file mode 100644 index 0000000..68ea464 --- /dev/null +++ b/src/main/resources/mapper/SysRolePermissionMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, role_id, permission_id, create_time, create_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysUserMapper.xml b/src/main/resources/mapper/SysUserMapper.xml new file mode 100644 index 0000000..0490110 --- /dev/null +++ b/src/main/resources/mapper/SysUserMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + id, username, password, real_name, phone, email, status, + create_time, update_time, create_by, update_by, deleted + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysUserRoleMapper.xml b/src/main/resources/mapper/SysUserRoleMapper.xml new file mode 100644 index 0000000..d50a178 --- /dev/null +++ b/src/main/resources/mapper/SysUserRoleMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, user_id, role_id, create_time, create_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TalentBasicMapper.xml b/src/main/resources/mapper/TalentBasicMapper.xml new file mode 100644 index 0000000..2745ecc --- /dev/null +++ b/src/main/resources/mapper/TalentBasicMapper.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, name, sex, birth_date, unit_id, unit_type, highest_edu, highest_school, + classify_grade, title, region, image, highest_position, entry_date, create_time, + update_time, create_by, update_by, flag + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TalentBasicMapper.xml~ b/src/main/resources/mapper/TalentBasicMapper.xml~ new file mode 100644 index 0000000..709c605 --- /dev/null +++ b/src/main/resources/mapper/TalentBasicMapper.xml~ @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, name, gender, birth_date, id_card, education, degree, title, work_unit, + contact_phone, email, address, create_time, update_time, create_by, update_by, deleted + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TalentProjectInitiationMapper.xml b/src/main/resources/mapper/TalentProjectInitiationMapper.xml new file mode 100644 index 0000000..5d71667 --- /dev/null +++ b/src/main/resources/mapper/TalentProjectInitiationMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, talent_id, project_initiation_id, create_time, create_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TalentReportMapper.xml b/src/main/resources/mapper/TalentReportMapper.xml new file mode 100644 index 0000000..f6e6cb2 --- /dev/null +++ b/src/main/resources/mapper/TalentReportMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, talent_id, report_id, create_time, create_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/TechReportMapper.xml b/src/main/resources/mapper/TechReportMapper.xml new file mode 100644 index 0000000..17dd705 --- /dev/null +++ b/src/main/resources/mapper/TechReportMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, project_id, report_name_cn, report_name, author_cn, author_en, + workplace_cn, workplace_en, keyword_cn, keyword_en, summary_cn, + summary_en, writing_time, institution, report_type, channel, + is_public, status, report_path, flag, create_time, update_time, + create_by, update_by + + + \ No newline at end of file diff --git a/src/main/resources/mapper/WorkDomainMapper.xml b/src/main/resources/mapper/WorkDomainMapper.xml new file mode 100644 index 0000000..1b4e151 --- /dev/null +++ b/src/main/resources/mapper/WorkDomainMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/brain-1.0.0.jar b/target/brain-1.0.0.jar new file mode 100644 index 0000000..691d70a Binary files /dev/null and b/target/brain-1.0.0.jar differ diff --git a/target/brain-1.0.0.jar.original b/target/brain-1.0.0.jar.original new file mode 100644 index 0000000..b366909 Binary files /dev/null and b/target/brain-1.0.0.jar.original differ diff --git a/target/classes/application.yml b/target/classes/application.yml new file mode 100644 index 0000000..313be9e --- /dev/null +++ b/target/classes/application.yml @@ -0,0 +1,127 @@ +server: + port: 8090 + servlet: + context-path: /brain + +spring: + application: + name: technological-brain + mvc: + pathmatch: + matching-strategy: ant_path_matcher + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://47.110.148.47:13306/technological_brain?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai + username: root + password: Cust123456 + druid: + initial-size: 5 + min-idle: 5 + max-active: 20 + max-wait: 60000 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + filters: stat,wall + connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + redis: + host: 47.110.148.47 + port: 16379 + password: Cust123456 + database: 0 + timeout: 10s + lettuce: + pool: + min-idle: 0 + max-idle: 8 + max-active: 8 + max-wait: -1ms + +mybatis-plus: + mapper-locations: classpath*:/mapper/**/*.xml + type-aliases-package: com.CUST.brain.dao.domain + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + global-config: + db-config: + id-type: ASSIGN_UUID + logic-delete-value: 1 + logic-not-delete-value: 0 + +logging: + level: + com.CUST.brain: debug + org.springframework: warn + springfox.documentation: debug + +springfox: + documentation: + swagger-ui: + enabled: true + swagger: + v2: + enabled: true + +swagger: + enable: true + title: 科技大脑平台接口文档 + description: 科技大脑展示平台服务接口文档 + version: 1.0.0 + base-package: com.CUST.brain.web.controller + +knife4j: + enable: true + setting: + language: zh-CN + enable-swagger-models: true + enable-document-manage: true + swagger-model-name: 实体类列表 + enable-version: false + enable-reload-cache-parameter: false + enable-after-script: true + enable-filter-multipart-api-method-type: POST + enable-filter-multipart-apis: false + enable-request-cache: true + enable-host: false + enable-host-text: + enable-home-custom: false + home-custom-path: classpath:markdown/home.md + enable-search: true + enable-footer: false + enable-footer-custom: false + footer-custom-content: + enable-dynamic-parameter: false + enable-debug: true + enable-open-api: false + enable-group: true + cors: false + production: false + basic: + enable: false + username: test + password: 123456 + +# JWT配置 +jwt: + # JWT加解密使用的密钥(使用 Base64 编码的字符串) + secret: DTFlDDXXcyzxCBvrOkD7+OXpO8oEMTsjEpOIHP9Uh9DBzczp6YfJaa7jhh718XzUsU4TAkNJ9eBhEaUNF/mgew== + # JWT的超期限时间(单位:秒) + expiration: 86400 + # JWT负载中拿到开头 + tokenHeader: Authorization + # JWT负载中拿到开头 + tokenHead: Bearer + +oss: + endpoint: https://oss-cn-hangzhou.aliyuncs.com + access-key-id: LTAI5tENiNhfm8fJiyfU9QxB + access-key-secret: wmjKuJT970AbSQbzlkPnFaHWWwX5Nx + bucket-name: tecbrain + domain: https://tecbrain.oss-cn-hangzhou.aliyuncs.com \ No newline at end of file diff --git a/target/classes/com/CUST/brain/BrainApplication.class b/target/classes/com/CUST/brain/BrainApplication.class new file mode 100644 index 0000000..a5da6b3 Binary files /dev/null and b/target/classes/com/CUST/brain/BrainApplication.class differ diff --git a/target/classes/com/CUST/brain/common/annotation/RedisCache.class b/target/classes/com/CUST/brain/common/annotation/RedisCache.class new file mode 100644 index 0000000..53eb8fd Binary files /dev/null and b/target/classes/com/CUST/brain/common/annotation/RedisCache.class differ diff --git a/target/classes/com/CUST/brain/common/api/CommonResult.class b/target/classes/com/CUST/brain/common/api/CommonResult.class new file mode 100644 index 0000000..9f033db Binary files /dev/null and b/target/classes/com/CUST/brain/common/api/CommonResult.class differ diff --git a/target/classes/com/CUST/brain/common/api/IErrorCode.class b/target/classes/com/CUST/brain/common/api/IErrorCode.class new file mode 100644 index 0000000..3ad14cf Binary files /dev/null and b/target/classes/com/CUST/brain/common/api/IErrorCode.class differ diff --git a/target/classes/com/CUST/brain/common/api/ResultCode.class b/target/classes/com/CUST/brain/common/api/ResultCode.class new file mode 100644 index 0000000..524c40b Binary files /dev/null and b/target/classes/com/CUST/brain/common/api/ResultCode.class differ diff --git a/target/classes/com/CUST/brain/common/aspect/RedisCacheAspect$1.class b/target/classes/com/CUST/brain/common/aspect/RedisCacheAspect$1.class new file mode 100644 index 0000000..405272d Binary files /dev/null and b/target/classes/com/CUST/brain/common/aspect/RedisCacheAspect$1.class differ diff --git a/target/classes/com/CUST/brain/common/aspect/RedisCacheAspect.class b/target/classes/com/CUST/brain/common/aspect/RedisCacheAspect.class new file mode 100644 index 0000000..f502d29 Binary files /dev/null and b/target/classes/com/CUST/brain/common/aspect/RedisCacheAspect.class differ diff --git a/target/classes/com/CUST/brain/common/cache/ParamCacheManager.class b/target/classes/com/CUST/brain/common/cache/ParamCacheManager.class new file mode 100644 index 0000000..eae1340 Binary files /dev/null and b/target/classes/com/CUST/brain/common/cache/ParamCacheManager.class differ diff --git a/target/classes/com/CUST/brain/common/config/MyMetaObjectHandler.class b/target/classes/com/CUST/brain/common/config/MyMetaObjectHandler.class new file mode 100644 index 0000000..227593e Binary files /dev/null and b/target/classes/com/CUST/brain/common/config/MyMetaObjectHandler.class differ diff --git a/target/classes/com/CUST/brain/common/config/OssProperties.class b/target/classes/com/CUST/brain/common/config/OssProperties.class new file mode 100644 index 0000000..04ac56a Binary files /dev/null and b/target/classes/com/CUST/brain/common/config/OssProperties.class differ diff --git a/target/classes/com/CUST/brain/common/config/RedisConfig.class b/target/classes/com/CUST/brain/common/config/RedisConfig.class new file mode 100644 index 0000000..3144308 Binary files /dev/null and b/target/classes/com/CUST/brain/common/config/RedisConfig.class differ diff --git a/target/classes/com/CUST/brain/common/config/SecurityConfig.class b/target/classes/com/CUST/brain/common/config/SecurityConfig.class new file mode 100644 index 0000000..3cb1833 Binary files /dev/null and b/target/classes/com/CUST/brain/common/config/SecurityConfig.class differ diff --git a/target/classes/com/CUST/brain/common/config/SwaggerConfig.class b/target/classes/com/CUST/brain/common/config/SwaggerConfig.class new file mode 100644 index 0000000..a4c0788 Binary files /dev/null and b/target/classes/com/CUST/brain/common/config/SwaggerConfig.class differ diff --git a/target/classes/com/CUST/brain/common/constant/RedisKeyConstants.class b/target/classes/com/CUST/brain/common/constant/RedisKeyConstants.class new file mode 100644 index 0000000..d5ec73a Binary files /dev/null and b/target/classes/com/CUST/brain/common/constant/RedisKeyConstants.class differ diff --git a/target/classes/com/CUST/brain/common/dto/system/AssignRoleRequestDTO.class b/target/classes/com/CUST/brain/common/dto/system/AssignRoleRequestDTO.class new file mode 100644 index 0000000..22d090f Binary files /dev/null and b/target/classes/com/CUST/brain/common/dto/system/AssignRoleRequestDTO.class differ diff --git a/target/classes/com/CUST/brain/common/dto/system/LoginRequestDTO.class b/target/classes/com/CUST/brain/common/dto/system/LoginRequestDTO.class new file mode 100644 index 0000000..5e095eb Binary files /dev/null and b/target/classes/com/CUST/brain/common/dto/system/LoginRequestDTO.class differ diff --git a/target/classes/com/CUST/brain/common/dto/system/LoginResponseDTO.class b/target/classes/com/CUST/brain/common/dto/system/LoginResponseDTO.class new file mode 100644 index 0000000..d872f1e Binary files /dev/null and b/target/classes/com/CUST/brain/common/dto/system/LoginResponseDTO.class differ diff --git a/target/classes/com/CUST/brain/common/dto/system/MenuResponseDTO.class b/target/classes/com/CUST/brain/common/dto/system/MenuResponseDTO.class new file mode 100644 index 0000000..9158129 Binary files /dev/null and b/target/classes/com/CUST/brain/common/dto/system/MenuResponseDTO.class differ diff --git a/target/classes/com/CUST/brain/common/dto/system/PermissionTreeVO.class b/target/classes/com/CUST/brain/common/dto/system/PermissionTreeVO.class new file mode 100644 index 0000000..22194c2 Binary files /dev/null and b/target/classes/com/CUST/brain/common/dto/system/PermissionTreeVO.class differ diff --git a/target/classes/com/CUST/brain/common/dto/system/SysRoleRequestDTO.class b/target/classes/com/CUST/brain/common/dto/system/SysRoleRequestDTO.class new file mode 100644 index 0000000..2be38b2 Binary files /dev/null and b/target/classes/com/CUST/brain/common/dto/system/SysRoleRequestDTO.class differ diff --git a/target/classes/com/CUST/brain/common/dto/system/SysRoleResponseDTO.class b/target/classes/com/CUST/brain/common/dto/system/SysRoleResponseDTO.class new file mode 100644 index 0000000..474bf83 Binary files /dev/null and b/target/classes/com/CUST/brain/common/dto/system/SysRoleResponseDTO.class differ diff --git a/target/classes/com/CUST/brain/common/dto/system/UpdateRolePermissionsRequestDTO.class b/target/classes/com/CUST/brain/common/dto/system/UpdateRolePermissionsRequestDTO.class new file mode 100644 index 0000000..58d73cf Binary files /dev/null and b/target/classes/com/CUST/brain/common/dto/system/UpdateRolePermissionsRequestDTO.class differ diff --git a/target/classes/com/CUST/brain/common/dto/system/UserInfoResponseDTO.class b/target/classes/com/CUST/brain/common/dto/system/UserInfoResponseDTO.class new file mode 100644 index 0000000..87ff30f Binary files /dev/null and b/target/classes/com/CUST/brain/common/dto/system/UserInfoResponseDTO.class differ diff --git a/target/classes/com/CUST/brain/common/enums/CacheUpdateStrategy.class b/target/classes/com/CUST/brain/common/enums/CacheUpdateStrategy.class new file mode 100644 index 0000000..3f2fd75 Binary files /dev/null and b/target/classes/com/CUST/brain/common/enums/CacheUpdateStrategy.class differ diff --git a/target/classes/com/CUST/brain/common/enums/EducationEnum.class b/target/classes/com/CUST/brain/common/enums/EducationEnum.class new file mode 100644 index 0000000..879d1c0 Binary files /dev/null and b/target/classes/com/CUST/brain/common/enums/EducationEnum.class differ diff --git a/target/classes/com/CUST/brain/common/enums/ParamTypeEnum.class b/target/classes/com/CUST/brain/common/enums/ParamTypeEnum.class new file mode 100644 index 0000000..6ba0277 Binary files /dev/null and b/target/classes/com/CUST/brain/common/enums/ParamTypeEnum.class differ diff --git a/target/classes/com/CUST/brain/common/enums/SexEnum.class b/target/classes/com/CUST/brain/common/enums/SexEnum.class new file mode 100644 index 0000000..36c7f8a Binary files /dev/null and b/target/classes/com/CUST/brain/common/enums/SexEnum.class differ diff --git a/target/classes/com/CUST/brain/common/enums/TitleEnum.class b/target/classes/com/CUST/brain/common/enums/TitleEnum.class new file mode 100644 index 0000000..e18e3f8 Binary files /dev/null and b/target/classes/com/CUST/brain/common/enums/TitleEnum.class differ diff --git a/target/classes/com/CUST/brain/common/exception/BusinessException.class b/target/classes/com/CUST/brain/common/exception/BusinessException.class new file mode 100644 index 0000000..3af3e58 Binary files /dev/null and b/target/classes/com/CUST/brain/common/exception/BusinessException.class differ diff --git a/target/classes/com/CUST/brain/common/exception/GlobalExceptionHandler.class b/target/classes/com/CUST/brain/common/exception/GlobalExceptionHandler.class new file mode 100644 index 0000000..3602cd1 Binary files /dev/null and b/target/classes/com/CUST/brain/common/exception/GlobalExceptionHandler.class differ diff --git a/target/classes/com/CUST/brain/common/security/LoginUser.class b/target/classes/com/CUST/brain/common/security/LoginUser.class new file mode 100644 index 0000000..e77b692 Binary files /dev/null and b/target/classes/com/CUST/brain/common/security/LoginUser.class differ diff --git a/target/classes/com/CUST/brain/common/security/filter/JwtAuthenticationTokenFilter.class b/target/classes/com/CUST/brain/common/security/filter/JwtAuthenticationTokenFilter.class new file mode 100644 index 0000000..da3d2c3 Binary files /dev/null and b/target/classes/com/CUST/brain/common/security/filter/JwtAuthenticationTokenFilter.class differ diff --git a/target/classes/com/CUST/brain/common/security/handler/RestAuthenticationEntryPoint.class b/target/classes/com/CUST/brain/common/security/handler/RestAuthenticationEntryPoint.class new file mode 100644 index 0000000..01f0d6d Binary files /dev/null and b/target/classes/com/CUST/brain/common/security/handler/RestAuthenticationEntryPoint.class differ diff --git a/target/classes/com/CUST/brain/common/security/handler/RestfulAccessDeniedHandler.class b/target/classes/com/CUST/brain/common/security/handler/RestfulAccessDeniedHandler.class new file mode 100644 index 0000000..3677cbd Binary files /dev/null and b/target/classes/com/CUST/brain/common/security/handler/RestfulAccessDeniedHandler.class differ diff --git a/target/classes/com/CUST/brain/common/security/service/UserDetailsServiceImpl.class b/target/classes/com/CUST/brain/common/security/service/UserDetailsServiceImpl.class new file mode 100644 index 0000000..49a8caf Binary files /dev/null and b/target/classes/com/CUST/brain/common/security/service/UserDetailsServiceImpl.class differ diff --git a/target/classes/com/CUST/brain/common/utils/CacheCleanUtils.class b/target/classes/com/CUST/brain/common/utils/CacheCleanUtils.class new file mode 100644 index 0000000..1030705 Binary files /dev/null and b/target/classes/com/CUST/brain/common/utils/CacheCleanUtils.class differ diff --git a/target/classes/com/CUST/brain/common/utils/JwtTokenUtil.class b/target/classes/com/CUST/brain/common/utils/JwtTokenUtil.class new file mode 100644 index 0000000..3098234 Binary files /dev/null and b/target/classes/com/CUST/brain/common/utils/JwtTokenUtil.class differ diff --git a/target/classes/com/CUST/brain/common/utils/OssUtil.class b/target/classes/com/CUST/brain/common/utils/OssUtil.class new file mode 100644 index 0000000..916be3d Binary files /dev/null and b/target/classes/com/CUST/brain/common/utils/OssUtil.class differ diff --git a/target/classes/com/CUST/brain/common/utils/PasswordEncoder.class b/target/classes/com/CUST/brain/common/utils/PasswordEncoder.class new file mode 100644 index 0000000..f5e8414 Binary files /dev/null and b/target/classes/com/CUST/brain/common/utils/PasswordEncoder.class differ diff --git a/target/classes/com/CUST/brain/common/utils/RedisUtils.class b/target/classes/com/CUST/brain/common/utils/RedisUtils.class new file mode 100644 index 0000000..d393d3b Binary files /dev/null and b/target/classes/com/CUST/brain/common/utils/RedisUtils.class differ diff --git a/target/classes/com/CUST/brain/common/utils/SecurityUtils.class b/target/classes/com/CUST/brain/common/utils/SecurityUtils.class new file mode 100644 index 0000000..7ae8778 Binary files /dev/null and b/target/classes/com/CUST/brain/common/utils/SecurityUtils.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/base/BaseEntity.class b/target/classes/com/CUST/brain/dao/domain/base/BaseEntity.class new file mode 100644 index 0000000..b81b032 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/base/BaseEntity.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/base/BaseRelationEntity.class b/target/classes/com/CUST/brain/dao/domain/base/BaseRelationEntity.class new file mode 100644 index 0000000..a5ebea2 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/base/BaseRelationEntity.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/AcademicAward.class b/target/classes/com/CUST/brain/dao/domain/business/AcademicAward.class new file mode 100644 index 0000000..a24bb8b Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/AcademicAward.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/EmploymentUnit.class b/target/classes/com/CUST/brain/dao/domain/business/EmploymentUnit.class new file mode 100644 index 0000000..461796e Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/EmploymentUnit.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/EnterpriseInfo.class b/target/classes/com/CUST/brain/dao/domain/business/EnterpriseInfo.class new file mode 100644 index 0000000..c6013b9 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/EnterpriseInfo.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/HonoraryTitle.class b/target/classes/com/CUST/brain/dao/domain/business/HonoraryTitle.class new file mode 100644 index 0000000..833be0b Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/HonoraryTitle.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/PapersAndMonographs.class b/target/classes/com/CUST/brain/dao/domain/business/PapersAndMonographs.class new file mode 100644 index 0000000..d73e8cd Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/PapersAndMonographs.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/Patent.class b/target/classes/com/CUST/brain/dao/domain/business/Patent.class new file mode 100644 index 0000000..15562b5 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/Patent.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/ProjectInitiation.class b/target/classes/com/CUST/brain/dao/domain/business/ProjectInitiation.class new file mode 100644 index 0000000..d773d9b Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/ProjectInitiation.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/ResearchProject.class b/target/classes/com/CUST/brain/dao/domain/business/ResearchProject.class new file mode 100644 index 0000000..08a001d Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/ResearchProject.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/Resume.class b/target/classes/com/CUST/brain/dao/domain/business/Resume.class new file mode 100644 index 0000000..7d33be8 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/Resume.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/ReviewExperience.class b/target/classes/com/CUST/brain/dao/domain/business/ReviewExperience.class new file mode 100644 index 0000000..932a767 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/ReviewExperience.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/TalentBasic.class b/target/classes/com/CUST/brain/dao/domain/business/TalentBasic.class new file mode 100644 index 0000000..e409acb Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/TalentBasic.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/TechReport.class b/target/classes/com/CUST/brain/dao/domain/business/TechReport.class new file mode 100644 index 0000000..5df923c Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/TechReport.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/business/WorkDomain.class b/target/classes/com/CUST/brain/dao/domain/business/WorkDomain.class new file mode 100644 index 0000000..723acb2 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/business/WorkDomain.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/relation/PapersAndMonographsTalent.class b/target/classes/com/CUST/brain/dao/domain/relation/PapersAndMonographsTalent.class new file mode 100644 index 0000000..1f9a7a6 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/relation/PapersAndMonographsTalent.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/relation/PatentTalent.class b/target/classes/com/CUST/brain/dao/domain/relation/PatentTalent.class new file mode 100644 index 0000000..cc4f37a Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/relation/PatentTalent.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/relation/ResearchProjectTalent.class b/target/classes/com/CUST/brain/dao/domain/relation/ResearchProjectTalent.class new file mode 100644 index 0000000..b9b7306 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/relation/ResearchProjectTalent.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/relation/SysRolePermission.class b/target/classes/com/CUST/brain/dao/domain/relation/SysRolePermission.class new file mode 100644 index 0000000..4aa0876 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/relation/SysRolePermission.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/relation/SysUserRole.class b/target/classes/com/CUST/brain/dao/domain/relation/SysUserRole.class new file mode 100644 index 0000000..0894095 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/relation/SysUserRole.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/relation/TalentProjectInitiation.class b/target/classes/com/CUST/brain/dao/domain/relation/TalentProjectInitiation.class new file mode 100644 index 0000000..529b291 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/relation/TalentProjectInitiation.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/relation/TalentReport.class b/target/classes/com/CUST/brain/dao/domain/relation/TalentReport.class new file mode 100644 index 0000000..a4dc985 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/relation/TalentReport.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/system/SysParam.class b/target/classes/com/CUST/brain/dao/domain/system/SysParam.class new file mode 100644 index 0000000..5c14d37 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/system/SysParam.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/system/SysParamType.class b/target/classes/com/CUST/brain/dao/domain/system/SysParamType.class new file mode 100644 index 0000000..37ce02b Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/system/SysParamType.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/system/SysPermission.class b/target/classes/com/CUST/brain/dao/domain/system/SysPermission.class new file mode 100644 index 0000000..f88d742 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/system/SysPermission.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/system/SysRole.class b/target/classes/com/CUST/brain/dao/domain/system/SysRole.class new file mode 100644 index 0000000..f29dd43 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/system/SysRole.class differ diff --git a/target/classes/com/CUST/brain/dao/domain/system/SysUser.class b/target/classes/com/CUST/brain/dao/domain/system/SysUser.class new file mode 100644 index 0000000..ab0397d Binary files /dev/null and b/target/classes/com/CUST/brain/dao/domain/system/SysUser.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/AcademicAwardMapper.class b/target/classes/com/CUST/brain/dao/mapper/AcademicAwardMapper.class new file mode 100644 index 0000000..bfb8298 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/AcademicAwardMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/EmploymentUnitMapper.class b/target/classes/com/CUST/brain/dao/mapper/EmploymentUnitMapper.class new file mode 100644 index 0000000..c79e357 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/EmploymentUnitMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/EnterpriseInfoMapper.class b/target/classes/com/CUST/brain/dao/mapper/EnterpriseInfoMapper.class new file mode 100644 index 0000000..9bbd9f4 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/EnterpriseInfoMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/HonoraryTitleMapper.class b/target/classes/com/CUST/brain/dao/mapper/HonoraryTitleMapper.class new file mode 100644 index 0000000..8fdc846 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/HonoraryTitleMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/PapersAndMonographsMapper.class b/target/classes/com/CUST/brain/dao/mapper/PapersAndMonographsMapper.class new file mode 100644 index 0000000..613bba3 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/PapersAndMonographsMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/PapersAndMonographsTalentMapper.class b/target/classes/com/CUST/brain/dao/mapper/PapersAndMonographsTalentMapper.class new file mode 100644 index 0000000..db525c8 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/PapersAndMonographsTalentMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/PatentMapper.class b/target/classes/com/CUST/brain/dao/mapper/PatentMapper.class new file mode 100644 index 0000000..23524ac Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/PatentMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/PatentTalentMapper.class b/target/classes/com/CUST/brain/dao/mapper/PatentTalentMapper.class new file mode 100644 index 0000000..900c2bf Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/PatentTalentMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/ProjectInitiationMapper.class b/target/classes/com/CUST/brain/dao/mapper/ProjectInitiationMapper.class new file mode 100644 index 0000000..0d17c0b Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/ProjectInitiationMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/ResearchProjectMapper.class b/target/classes/com/CUST/brain/dao/mapper/ResearchProjectMapper.class new file mode 100644 index 0000000..de18559 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/ResearchProjectMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/ResearchProjectTalentMapper.class b/target/classes/com/CUST/brain/dao/mapper/ResearchProjectTalentMapper.class new file mode 100644 index 0000000..ca86577 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/ResearchProjectTalentMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/ResumeMapper.class b/target/classes/com/CUST/brain/dao/mapper/ResumeMapper.class new file mode 100644 index 0000000..ea00ab7 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/ResumeMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/ReviewExperienceMapper.class b/target/classes/com/CUST/brain/dao/mapper/ReviewExperienceMapper.class new file mode 100644 index 0000000..41096a4 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/ReviewExperienceMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/SysParamMapper.class b/target/classes/com/CUST/brain/dao/mapper/SysParamMapper.class new file mode 100644 index 0000000..823e244 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/SysParamMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/SysParamTypeMapper.class b/target/classes/com/CUST/brain/dao/mapper/SysParamTypeMapper.class new file mode 100644 index 0000000..a81eba6 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/SysParamTypeMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/SysPermissionMapper.class b/target/classes/com/CUST/brain/dao/mapper/SysPermissionMapper.class new file mode 100644 index 0000000..b815fa0 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/SysPermissionMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/SysRoleMapper.class b/target/classes/com/CUST/brain/dao/mapper/SysRoleMapper.class new file mode 100644 index 0000000..25b6dd2 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/SysRoleMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/SysRolePermissionMapper.class b/target/classes/com/CUST/brain/dao/mapper/SysRolePermissionMapper.class new file mode 100644 index 0000000..76a9105 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/SysRolePermissionMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/SysUserMapper.class b/target/classes/com/CUST/brain/dao/mapper/SysUserMapper.class new file mode 100644 index 0000000..82b5773 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/SysUserMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/SysUserRoleMapper.class b/target/classes/com/CUST/brain/dao/mapper/SysUserRoleMapper.class new file mode 100644 index 0000000..cf4ac48 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/SysUserRoleMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/TalentBasicMapper.class b/target/classes/com/CUST/brain/dao/mapper/TalentBasicMapper.class new file mode 100644 index 0000000..69c39ac Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/TalentBasicMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/TalentProjectInitiationMapper.class b/target/classes/com/CUST/brain/dao/mapper/TalentProjectInitiationMapper.class new file mode 100644 index 0000000..2b9c655 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/TalentProjectInitiationMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/TalentReportMapper.class b/target/classes/com/CUST/brain/dao/mapper/TalentReportMapper.class new file mode 100644 index 0000000..1ee4d30 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/TalentReportMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/TechReportMapper.class b/target/classes/com/CUST/brain/dao/mapper/TechReportMapper.class new file mode 100644 index 0000000..be3da7c Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/TechReportMapper.class differ diff --git a/target/classes/com/CUST/brain/dao/mapper/WorkDomainMapper.class b/target/classes/com/CUST/brain/dao/mapper/WorkDomainMapper.class new file mode 100644 index 0000000..3987710 Binary files /dev/null and b/target/classes/com/CUST/brain/dao/mapper/WorkDomainMapper.class differ diff --git a/target/classes/com/CUST/brain/service/SysParamService.class b/target/classes/com/CUST/brain/service/SysParamService.class new file mode 100644 index 0000000..3f3ebc4 Binary files /dev/null and b/target/classes/com/CUST/brain/service/SysParamService.class differ diff --git a/target/classes/com/CUST/brain/service/SysParamTypeService.class b/target/classes/com/CUST/brain/service/SysParamTypeService.class new file mode 100644 index 0000000..75d3f3e Binary files /dev/null and b/target/classes/com/CUST/brain/service/SysParamTypeService.class differ diff --git a/target/classes/com/CUST/brain/service/SysPermissionService.class b/target/classes/com/CUST/brain/service/SysPermissionService.class new file mode 100644 index 0000000..8ede87e Binary files /dev/null and b/target/classes/com/CUST/brain/service/SysPermissionService.class differ diff --git a/target/classes/com/CUST/brain/service/SysRoleService.class b/target/classes/com/CUST/brain/service/SysRoleService.class new file mode 100644 index 0000000..77f28dd Binary files /dev/null and b/target/classes/com/CUST/brain/service/SysRoleService.class differ diff --git a/target/classes/com/CUST/brain/service/SysUserService.class b/target/classes/com/CUST/brain/service/SysUserService.class new file mode 100644 index 0000000..9ab46e6 Binary files /dev/null and b/target/classes/com/CUST/brain/service/SysUserService.class differ diff --git a/target/classes/com/CUST/brain/service/TalentBasicService.class b/target/classes/com/CUST/brain/service/TalentBasicService.class new file mode 100644 index 0000000..4573142 Binary files /dev/null and b/target/classes/com/CUST/brain/service/TalentBasicService.class differ diff --git a/target/classes/com/CUST/brain/service/impl/SysParamServiceImpl.class b/target/classes/com/CUST/brain/service/impl/SysParamServiceImpl.class new file mode 100644 index 0000000..4ac6b33 Binary files /dev/null and b/target/classes/com/CUST/brain/service/impl/SysParamServiceImpl.class differ diff --git a/target/classes/com/CUST/brain/service/impl/SysParamTypeServiceImpl.class b/target/classes/com/CUST/brain/service/impl/SysParamTypeServiceImpl.class new file mode 100644 index 0000000..b0f6efb Binary files /dev/null and b/target/classes/com/CUST/brain/service/impl/SysParamTypeServiceImpl.class differ diff --git a/target/classes/com/CUST/brain/service/impl/SysPermissionServiceImpl.class b/target/classes/com/CUST/brain/service/impl/SysPermissionServiceImpl.class new file mode 100644 index 0000000..7bbdcb0 Binary files /dev/null and b/target/classes/com/CUST/brain/service/impl/SysPermissionServiceImpl.class differ diff --git a/target/classes/com/CUST/brain/service/impl/SysRoleServiceImpl$1.class b/target/classes/com/CUST/brain/service/impl/SysRoleServiceImpl$1.class new file mode 100644 index 0000000..b602f64 Binary files /dev/null and b/target/classes/com/CUST/brain/service/impl/SysRoleServiceImpl$1.class differ diff --git a/target/classes/com/CUST/brain/service/impl/SysRoleServiceImpl.class b/target/classes/com/CUST/brain/service/impl/SysRoleServiceImpl.class new file mode 100644 index 0000000..1483fbc Binary files /dev/null and b/target/classes/com/CUST/brain/service/impl/SysRoleServiceImpl.class differ diff --git a/target/classes/com/CUST/brain/service/impl/SysUserServiceImpl.class b/target/classes/com/CUST/brain/service/impl/SysUserServiceImpl.class new file mode 100644 index 0000000..2504dcc Binary files /dev/null and b/target/classes/com/CUST/brain/service/impl/SysUserServiceImpl.class differ diff --git a/target/classes/com/CUST/brain/service/impl/TalentBasicServiceImpl.class b/target/classes/com/CUST/brain/service/impl/TalentBasicServiceImpl.class new file mode 100644 index 0000000..749558b Binary files /dev/null and b/target/classes/com/CUST/brain/service/impl/TalentBasicServiceImpl.class differ diff --git a/target/classes/com/CUST/brain/web/controller/business/TalentBasicController.class b/target/classes/com/CUST/brain/web/controller/business/TalentBasicController.class new file mode 100644 index 0000000..e347882 Binary files /dev/null and b/target/classes/com/CUST/brain/web/controller/business/TalentBasicController.class differ diff --git a/target/classes/com/CUST/brain/web/controller/system/LoginController.class b/target/classes/com/CUST/brain/web/controller/system/LoginController.class new file mode 100644 index 0000000..cab130e Binary files /dev/null and b/target/classes/com/CUST/brain/web/controller/system/LoginController.class differ diff --git a/target/classes/com/CUST/brain/web/controller/system/OssController.class b/target/classes/com/CUST/brain/web/controller/system/OssController.class new file mode 100644 index 0000000..76962a0 Binary files /dev/null and b/target/classes/com/CUST/brain/web/controller/system/OssController.class differ diff --git a/target/classes/com/CUST/brain/web/controller/system/SysParamController.class b/target/classes/com/CUST/brain/web/controller/system/SysParamController.class new file mode 100644 index 0000000..c14f514 Binary files /dev/null and b/target/classes/com/CUST/brain/web/controller/system/SysParamController.class differ diff --git a/target/classes/com/CUST/brain/web/controller/system/SysParamTypeController.class b/target/classes/com/CUST/brain/web/controller/system/SysParamTypeController.class new file mode 100644 index 0000000..73d56ec Binary files /dev/null and b/target/classes/com/CUST/brain/web/controller/system/SysParamTypeController.class differ diff --git a/target/classes/com/CUST/brain/web/controller/system/SysPermissionController.class b/target/classes/com/CUST/brain/web/controller/system/SysPermissionController.class new file mode 100644 index 0000000..5b8200d Binary files /dev/null and b/target/classes/com/CUST/brain/web/controller/system/SysPermissionController.class differ diff --git a/target/classes/com/CUST/brain/web/controller/system/SysRoleController.class b/target/classes/com/CUST/brain/web/controller/system/SysRoleController.class new file mode 100644 index 0000000..317b1cd Binary files /dev/null and b/target/classes/com/CUST/brain/web/controller/system/SysRoleController.class differ diff --git a/target/classes/com/CUST/brain/web/controller/system/SysUserController.class b/target/classes/com/CUST/brain/web/controller/system/SysUserController.class new file mode 100644 index 0000000..479e905 Binary files /dev/null and b/target/classes/com/CUST/brain/web/controller/system/SysUserController.class differ diff --git a/target/classes/db/data.sql b/target/classes/db/data.sql new file mode 100644 index 0000000..3458796 --- /dev/null +++ b/target/classes/db/data.sql @@ -0,0 +1,508 @@ +-- 设置会话变量 +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +USE `technological_brain`; + +-- 开启事务 +START TRANSACTION; + +-- 清空所有相关表数据(注意顺序:先清空关联表,再清空主表) +DELETE FROM `sys_user_role`; +DELETE FROM `sys_role_permission`; +DELETE FROM `sys_user`; +DELETE FROM `sys_role`; +DELETE FROM `sys_permission`; + +-- 系统管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH system_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '系统管理', + 'system', + 1, + NULL, + '/system', + 'Layout', + 'setting', + 1, + 1, + 0, + NOW(), + NOW() +FROM system_menu; + +-- 系统管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '用户管理', + 'system:user', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/user', + 'system/user/index', + 'user', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '角色管理', + 'system:role', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/role', + 'system/role/index', + 'peoples', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '权限管理', + 'system:permission', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/permission', + 'system/permission/index', + 'tree-table', + 3, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '参数管理', + 'system:param', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'system'), + '/system/param', + 'system/param/index', + 'dict', + 4, + 1, + 0, + NOW(), + NOW(); + +-- 人才管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH talent_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '人才管理', + 'talent', + 1, + NULL, + '/talent', + 'Layout', + 'user', + 2, + 1, + 0, + NOW(), + NOW() +FROM talent_menu; + +-- 人才管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '人才信息', + 'talent:basic', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/basic', + 'talent/basic/index', + 'profile', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '工作单位', + 'talent:unit', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/unit', + 'talent/unit/index', + 'company', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '履历信息', + 'talent:resume', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/resume', + 'talent/resume/index', + 'education', + 3, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '工作领域', + 'talent:domain', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'talent'), + '/talent/domain', + 'talent/domain/index', + 'skill', + 4, + 1, + 0, + NOW(), + NOW(); + +-- 科研管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH research_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '科研管理', + 'research', + 1, + NULL, + '/research', + 'Layout', + 'research', + 3, + 1, + 0, + NOW(), + NOW() +FROM research_menu; + +-- 科研管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '科研项目', + 'research:project', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'research'), + '/research/project', + 'research/project/index', + 'project', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '立项项目', + 'research:initiation', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'research'), + '/research/initiation', + 'research/initiation/index', + 'form', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '科技报告', + 'research:report', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'research'), + '/research/report', + 'research/report/index', + 'documentation', + 3, + 1, + 0, + NOW(), + NOW(); + +-- 成果管理模块 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +WITH achievement_menu AS ( + SELECT REPLACE(UUID(), '-', '') as id +) +SELECT + id, + '成果管理', + 'achievement', + 1, + NULL, + '/achievement', + 'Layout', + 'trophy', + 4, + 1, + 0, + NOW(), + NOW() +FROM achievement_menu; + +-- 成果管理子菜单 +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '论文专著', + 'achievement:paper', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/paper', + 'achievement/paper/index', + 'document', + 1, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '专利信息', + 'achievement:patent', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/patent', + 'achievement/patent/index', + 'patent', + 2, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '学术奖励', + 'achievement:award', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/award', + 'achievement/award/index', + 'award', + 3, + 1, + 0, + NOW(), + NOW(); + +INSERT INTO `sys_permission` (`id`, `permission_name`, `permission_code`, `permission_type`, `parent_id`, `path`, `component`, `icon`, `sort`, `status`, `flag`, `create_time`, `update_time`) +SELECT + REPLACE(UUID(), '-', ''), + '荣誉称号', + 'achievement:honor', + 1, + (SELECT id FROM `sys_permission` WHERE `permission_code` = 'achievement'), + '/achievement/honor', + 'achievement/honor/index', + 'medal', + 4, + 1, + 0, + NOW(), + NOW(); + +-- 创建角色 +INSERT INTO `sys_role` (`id`, `role_name`, `role_code`, `role_desc`, `login_type`, `sort`, `status`, `flag`, `create_time`, `update_time`, `create_by`, `update_by`) +VALUES +-- 超级管理员角色 +(REPLACE(UUID(), '-', ''), +'超级管理员', +'SUPER_ADMIN', +'系统超级管理员,拥有所有权限', +2, +1, +1, +0, +NOW(), +NOW(), +'system', +'system'), +-- 普通管理员角色 +(REPLACE(UUID(), '-', ''), +'普通管理员', +'ADMIN', +'系统管理员,拥有除系统管理外的所有权限', +2, +2, +1, +0, +NOW(), +NOW(), +'system', +'system'); + +-- 创建用户 +INSERT INTO `sys_user` (`id`, `username`, `password`, `real_name`, `email`, `phone`, `status`, `flag`, `create_time`, `update_time`, `create_by`, `update_by`) +VALUES +-- 超级管理员用户 +(REPLACE(UUID(), '-', ''), +'admin', +'$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iKTVKIUi', -- 密码:admin123 +'系统超级管理员', +'admin@example.com', +'13800138000', +1, +0, +NOW(), +NOW(), +'system', +'system'), +-- 普通管理员用户 +(REPLACE(UUID(), '-', ''), +'manager', +'$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iKTVKIUi', -- 密码:manager123 +'系统管理员', +'manager@example.com', +'13800138001', +1, +0, +NOW(), +NOW(), +'system', +'system'); + +-- 建立用户角色关联 +INSERT INTO `sys_user_role` (`id`, `user_id`, `role_id`, `create_time`, `create_by`) +SELECT + REPLACE(UUID(), '-', ''), + u.id, + r.id, + NOW(), + 'system' +FROM `sys_user` u, `sys_role` r +WHERE (u.username = 'admin' AND r.role_code = 'SUPER_ADMIN') + OR (u.username = 'manager' AND r.role_code = 'ADMIN'); + +-- 为超级管理员角色分配所有权限 +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `create_time`, `create_by`) +SELECT + REPLACE(UUID(), '-', ''), + r.id, + p.id, + NOW(), + 'system' +FROM `sys_role` r, `sys_permission` p +WHERE r.role_code = 'SUPER_ADMIN'; + +-- 为普通管理员角色分配除系统管理外的所有权限 +INSERT INTO `sys_role_permission` (`id`, `role_id`, `permission_id`, `create_time`, `create_by`) +SELECT + REPLACE(UUID(), '-', ''), + r.id, + p.id, + NOW(), + 'system' +FROM `sys_role` r, `sys_permission` p +WHERE r.role_code = 'ADMIN' +AND p.permission_code NOT LIKE 'system%'; + +-- 初始化参数类型 +-- 清空参数相关表 +DELETE FROM `sys_param`; +DELETE FROM `sys_param_type`; + +-- 插入参数类型 +INSERT INTO `sys_param_type` (`id`, `type_code`, `type_name`, `sort_order`, `status`, `is_system`, `remark`, `create_time`, `update_time`, `create_by`, `update_by`) VALUES +-- 基础信息类 +(REPLACE(UUID(), '-', ''), 'SEX', '性别', 1, 1, 1, '基础信息类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'HIGHEST_EDU', '最高学历', 2, 1, 1, '基础信息类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'HIGHEST_SCHOOL', '最高学历毕业学校', 3, 1, 1, '基础信息类参数', NOW(), NOW(), 'system', 'system'), +-- 人才相关 +(REPLACE(UUID(), '-', ''), 'CLASSIFY_GRADE', '分类定级人才', 4, 1, 1, '人才相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'TITLE', '职称', 5, 1, 1, '人才相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'HIGHEST_POSITION', '最高技术职务资格', 6, 1, 1, '人才相关参数', NOW(), NOW(), 'system', 'system'), +-- 项目相关 +(REPLACE(UUID(), '-', ''), 'PROJECT_TYPE', '项目类型', 7, 1, 1, '项目相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'PROJECT_STATUS', '项目当前状态', 8, 1, 1, '项目相关参数', NOW(), NOW(), 'system', 'system'), +-- 学科行业类 +(REPLACE(UUID(), '-', ''), 'PRIMARY_SUBJECT', '学科大类', 9, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'SUB_SUBJECT', '学科小类', 10, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'INDUSTRY_CATEGORY', '行业门类', 11, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'INDUSTRY_NAME', '行业名称', 12, 1, 1, '学科行业类参数', NOW(), NOW(), 'system', 'system'), +-- 企业相关 +(REPLACE(UUID(), '-', ''), 'COMPANY_TYPE', '企业类型', 13, 1, 1, '企业相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'COMPANY_STATUS', '企业状态', 14, 1, 1, '企业相关参数', NOW(), NOW(), 'system', 'system'), +-- 资金相关 +(REPLACE(UUID(), '-', ''), 'CURRENCY_CODE', '货币代码', 15, 1, 1, '资金相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'FUNDING_FROM', '资金来源组织', 16, 1, 1, '资金相关参数', NOW(), NOW(), 'system', 'system'), +(REPLACE(UUID(), '-', ''), 'FUNDING_NAME', '资金名称', 17, 1, 1, '资金相关参数', NOW(), NOW(), 'system', 'system'); + +-- 插入参数值 +-- 性别参数值 +INSERT INTO `sys_param` (`id`, `param_type`, `param_code`, `param_name`, `param_value`, `sort_order`, `status`, `is_system`, `remark`, `create_time`, `update_time`, `create_by`, `update_by`) +SELECT + REPLACE(UUID(), '-', ''), + 'SEX', + 'MALE', + '男', + '0', + 1, + 1, + 1, + '性别-男', + NOW(), + NOW(), + 'system', + 'system' +UNION ALL +SELECT + REPLACE(UUID(), '-', ''), + 'SEX', + 'FEMALE', + '女', + '1', + 2, + 1, + 1, + '性别-女', + NOW(), + NOW(), + 'system', + 'system'; + +-- 提交事务 +COMMIT; + +-- 恢复外键检查 +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/target/classes/db/demo.sql b/target/classes/db/demo.sql new file mode 100644 index 0000000..33fb275 --- /dev/null +++ b/target/classes/db/demo.sql @@ -0,0 +1,355 @@ +/* + Navicat Premium Data Transfer + + Source Server : local + Source Server Type : MySQL + Source Server Version : 80041 + Source Host : localhost:3306 + Source Schema : demo + + Target Server Type : MySQL + Target Server Version : 80041 + File Encoding : 65001 + + Date: 09/05/2025 20:09:53 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for academic_award +-- ---------------------------- +DROP TABLE IF EXISTS `academic_award`; +CREATE TABLE `academic_award` ( + `award_id` int NOT NULL COMMENT '奖项id', + `talent_id` int NOT NULL COMMENT '人才id', + `award_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '奖励名称', + `award_level` enum('国家级','省级','市级','其他') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '奖励级别', + `award_time` date NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '授予机构', + PRIMARY KEY (`award_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `academic_award_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '7学术奖励信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for department_basic +-- ---------------------------- +DROP TABLE IF EXISTS `department_basic`; +CREATE TABLE `department_basic` ( + `STIUL_id` int NOT NULL COMMENT '科室员工号', + `STIUL_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '人员姓名', + `STIUL_org` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '所属科室', + `STIUL_gender` enum('男','女') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '性别', + `STIUL_politicalstatus` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '政治面貌', + `STIUL_professionaltitle` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '职称', + `STIUL_entrydate` date NOT NULL COMMENT '入职时间', + `STIUL_email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '电子邮箱', + `STIUL_projectID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目验收证书编号', + `STIUL_registrationID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '成果登记编号', + `STIUL_ProjectDate` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '成果登记日期', + PRIMARY KEY (`STIUL_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '10科室基本信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for employment_unit +-- ---------------------------- +DROP TABLE IF EXISTS `employment_unit`; +CREATE TABLE `employment_unit` ( + `talent_id` int NOT NULL COMMENT '人才id', + `work_unit` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '工作单位', + `position` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '职务', + `professional_title` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '职称', + `entry_date` date NOT NULL COMMENT '入职时间', + PRIMARY KEY (`talent_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '11工作单位信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for enterprise_info +-- ---------------------------- +DROP TABLE IF EXISTS `enterprise_info`; +CREATE TABLE `enterprise_info` ( + `company_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '企业名称', + `taxpayer_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '纳税人识别号', + `company_type` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '企业类型', + `is_high_tech_certified` tinyint(1) NULL DEFAULT NULL COMMENT '是否高新技术企业认证(0:否,1:是)', + `qualification_certificate` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '资质证书', + `company_status` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '企业状态', + `legal_representative` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '法定代表人', + `talent_id` int NULL DEFAULT NULL COMMENT '法定代表人id', + `registered_capital` decimal(20, 2) NULL DEFAULT NULL COMMENT '注册资本(单位:万元)', + `company_address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '企业地址', + `province` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属省份', + `city` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属城市', + `district` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属区域', + `industry_category` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属行业门类', + `industry_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '所属行业名称', + `year_of_establishment` year NULL DEFAULT NULL COMMENT '成立年份', + `establishment_date` date NULL DEFAULT NULL COMMENT '成立日期', + `employee_count` int NULL DEFAULT NULL COMMENT '员工人数', + `website` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '网址', + `business_scope` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '经营范围', + `contact_phone` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '联系电话', + `contact_email` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '联系邮箱', + `update_date` date NULL DEFAULT NULL COMMENT '更新日期', + `resume_table` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '简历表格(可存储相关文件路径或内容)', + PRIMARY KEY (`taxpayer_id`) USING BTREE, + INDEX `enterprise_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `enterprise_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '18企业信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for honorary_title +-- ---------------------------- +DROP TABLE IF EXISTS `honorary_title`; +CREATE TABLE `honorary_title` ( + `honor_id` int NOT NULL COMMENT '荣誉ID', + `talent_id` int NOT NULL COMMENT '人才ID', + `honor_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '荣誉称号', + `award_time` datetime NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '授予机构', + PRIMARY KEY (`honor_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `honorary_title_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '13荣誉称号信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for papers_and_monographs +-- ---------------------------- +DROP TABLE IF EXISTS `papers_and_monographs`; +CREATE TABLE `papers_and_monographs` ( + `paper_book_id` int NOT NULL COMMENT '论文专著ID', + `talent_id` int NOT NULL COMMENT '人才ID', + `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题', + `publication_time` datetime NOT NULL COMMENT '发表时间', + `journal_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '刊物名称', + `volume_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '卷号', + `issue_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '期号', + `page_range` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '页码', + `doi` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'DOI号', + `work_type` enum('论文','专著') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '著作类型', + PRIMARY KEY (`paper_book_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `papers_and_monographs_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '14论文专著信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for patent +-- ---------------------------- +DROP TABLE IF EXISTS `patent`; +CREATE TABLE `patent` ( + `patent_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '专利id', + `talent_id` int NOT NULL COMMENT '人才id', + `patent_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '专利名称', + `patent_number` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '专利编号', + `application_time` date NOT NULL COMMENT '申请时间', + `authorization_time` date NOT NULL COMMENT '授权时间', + PRIMARY KEY (`patent_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `patent_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '6专利信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for project_initiation +-- ---------------------------- +DROP TABLE IF EXISTS `project_initiation`; +CREATE TABLE `project_initiation` ( + `project_proposal_id` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '立项项目编号', + `STIUL_id` int NOT NULL COMMENT '科室人员工号', + `project_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目名称', + `project_from` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目来源', + `project_type` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目类型', + `funding_from` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '资金来源组织', + `undertaking_unit` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '承担单位', + `project_person` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目负责人', + `project_account` float NULL DEFAULT NULL COMMENT '项目金额', + `start_time` date NULL DEFAULT NULL COMMENT '项目启动时间', + `end_time` date NULL DEFAULT NULL COMMENT '项目终止时间', + `project_status` enum('在研','结项验收','自然结项') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '项目当前状态', + `id` int NOT NULL, + PRIMARY KEY (`project_proposal_id`, `id`) USING BTREE, + INDEX `project_proposal_id`(`project_proposal_id` ASC) USING BTREE, + INDEX `department_id`(`STIUL_id` ASC) USING BTREE, + CONSTRAINT `department_id` FOREIGN KEY (`STIUL_id`) REFERENCES `department_basic` (`STIUL_id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '4立项项目信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for research_project +-- ---------------------------- +DROP TABLE IF EXISTS `research_project`; +CREATE TABLE `research_project` ( + `project_id` int NOT NULL COMMENT '项目ID', + `TitleOriginal` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目名称', + `titleEnglish` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目名称英文版', + `projectType` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目类型', + `keywordOriginal` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检索关键词', + `keywordEn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检索关键词英文', + `applyAbstractOriginal` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '摘要', + `applyAbstractEn` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '摘要英文', + `Funding` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预算/财政拨款', + `Currency` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '货币单位', + `FundingDollar` float NULL DEFAULT NULL COMMENT '项目金额(美元)', + `applyYear` float NULL DEFAULT NULL COMMENT '申请年份', + `planStartDate` datetime NULL DEFAULT NULL COMMENT '项目启动时间', + `planEndDate` datetime NULL DEFAULT NULL COMMENT '项目终止时间', + `PI` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目负责人', + `awardOrg` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '承担单位', + `awardOrgState` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '省份', + `awardOrgCountry` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '国家', + `FunderName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资金名称', + `FunderGroup` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资金来源组织', + `FunderCountry` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '资金国家', + `originalOne` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '学科大类(第一学科)', + `originalTwo` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '学科小类', + `talent_id` int NULL DEFAULT NULL COMMENT '项目负责人id', + PRIMARY KEY (`project_id`) USING BTREE, + INDEX `id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '5科研项目信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for research_project_talent +-- ---------------------------- +DROP TABLE IF EXISTS `research_project_talent`; +CREATE TABLE `research_project_talent` ( + `project_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '科室人员工号', + `talent_id` int NOT NULL COMMENT '人才id', + PRIMARY KEY (`project_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `research_project_talent_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '15科研项目人才信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for resume +-- ---------------------------- +DROP TABLE IF EXISTS `resume`; +CREATE TABLE `resume` ( + `resume_id` int NOT NULL COMMENT '履历ID', + `talent_id` int NOT NULL COMMENT '人才ID', + `start_time` datetime NOT NULL COMMENT '起始时间', + `end_time` datetime NULL DEFAULT NULL COMMENT '结束时间', + `unit` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '所在单位', + `work_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '工作内容', + PRIMARY KEY (`resume_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `resume_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '12履历信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for review_experience +-- ---------------------------- +DROP TABLE IF EXISTS `review_experience`; +CREATE TABLE `review_experience` ( + `review_id` int NOT NULL COMMENT '评审id', + `talent_id` int NOT NULL COMMENT '人才id', + `review_project` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评审项目', + `review_time` datetime NOT NULL COMMENT '评审时间', + `reviewing_agency` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评审机构', + `review_role` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '评审角色', + PRIMARY KEY (`review_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `review_experience_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '8评审经历信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for talent_basic +-- ---------------------------- +DROP TABLE IF EXISTS `talent_basic`; +CREATE TABLE `talent_basic` ( + `talent_id` int NOT NULL COMMENT '人才id', + `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '姓名', + `sex` enum('男','女') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '性别', + `age` int NULL DEFAULT NULL COMMENT '年龄', + `unit` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '单位', + `highest_edu` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '最高学历', + `highest_school` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '最高学历毕业学校', + `Classify_grade` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '分类定级人才', + `pro` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '职称', + `pro_qual` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '职称等级', + `space` varchar(120) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '地区', + `image` varchar(120) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '人才图片路径', + `HTPQ` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '最高技术职务资格名称', + PRIMARY KEY (`talent_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '2人才基本信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for talent_project_initiation +-- ---------------------------- +DROP TABLE IF EXISTS `talent_project_initiation`; +CREATE TABLE `talent_project_initiation` ( + `talent_id` int NOT NULL, + `project_proposal_id` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, + PRIMARY KEY (`talent_id`, `project_proposal_id`) USING BTREE, + INDEX `project_proposal_id`(`project_proposal_id` ASC) USING BTREE, + CONSTRAINT `talent_project_initiation_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, + CONSTRAINT `talent_project_initiation_ibfk_2` FOREIGN KEY (`project_proposal_id`) REFERENCES `project_initiation` (`project_proposal_id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '17人才立项信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for talent_report +-- ---------------------------- +DROP TABLE IF EXISTS `talent_report`; +CREATE TABLE `talent_report` ( + `talent_id` int NOT NULL COMMENT '人才id', + `report_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告id', + PRIMARY KEY (`talent_id`, `report_id`) USING BTREE, + INDEX `report_id`(`report_id` ASC) USING BTREE, + CONSTRAINT `talent_report_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `talent_report_ibfk_2` FOREIGN KEY (`report_id`) REFERENCES `tech_report` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '16人才报告信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for tech_report +-- ---------------------------- +DROP TABLE IF EXISTS `tech_report`; +CREATE TABLE `tech_report` ( + `report_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告编号', + `project_id` int NOT NULL COMMENT '项目id', + `report_cname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告名称(中文)', + `report_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告名称(英文)', + `authorc` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者(中文)', + `author` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者(英文)', + `workplacec` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者单位(中文)', + `workplace` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者单位(英文)', + `keywordc` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关键词(中文)', + `keyword` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关键词(英文)', + `summaryc` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '摘要(中文)', + `summary` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '摘要(英文)', + `writing_time` datetime NOT NULL COMMENT '编撰时间', + `institution` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支持机构', + `project_name` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '项目名称', + `report_type` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报告类型', + `channel` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支持渠道', + `ispublic` enum('是','否') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '是否公开', + `report_status` enum('草稿','已发布','已撤回') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '报告状态', + `report_path` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '报告全文路径', + PRIMARY KEY (`report_id`) USING BTREE, + INDEX `project_id_index`(`project_id` ASC) USING BTREE, + CONSTRAINT `tech_research_p_id` FOREIGN KEY (`project_id`) REFERENCES `research_project` (`project_id`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '3科技报告信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for universal +-- ---------------------------- +DROP TABLE IF EXISTS `universal`; +CREATE TABLE `universal` ( + `created_time` datetime NOT NULL COMMENT '创建时间', + `updated_time` datetime NOT NULL COMMENT '更新时间' +) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '1通用信息表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for work_domain +-- ---------------------------- +DROP TABLE IF EXISTS `work_domain`; +CREATE TABLE `work_domain` ( + `domain_id` int NOT NULL COMMENT '领域id', + `talent_id` int NOT NULL COMMENT '人才id', + `discipline_domain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '学科项目', + `industry_domain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '行业领域', + PRIMARY KEY (`domain_id`) USING BTREE, + INDEX `talent_id`(`talent_id` ASC) USING BTREE, + CONSTRAINT `work_domain_ibfk_1` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`talent_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '9工作领域信息表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/target/classes/db/migration/V1.0.1__remove_param_code.sql b/target/classes/db/migration/V1.0.1__remove_param_code.sql new file mode 100644 index 0000000..b4089f9 --- /dev/null +++ b/target/classes/db/migration/V1.0.1__remove_param_code.sql @@ -0,0 +1,8 @@ +-- 删除原有的唯一索引 +ALTER TABLE `sys_param` DROP INDEX `uk_param_type_code`; + +-- 删除param_code字段 +ALTER TABLE `sys_param` DROP COLUMN `param_code`; + +-- 创建新的唯一索引 +ALTER TABLE `sys_param` ADD UNIQUE KEY `uk_param_type_name` (`param_type`, `param_name`); \ No newline at end of file diff --git a/target/classes/db/schema.sql b/target/classes/db/schema.sql new file mode 100644 index 0000000..ba4ab59 --- /dev/null +++ b/target/classes/db/schema.sql @@ -0,0 +1,550 @@ +-- 设置会话变量 +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- 创建数据库(如果不存在) +CREATE DATABASE IF NOT EXISTS `technological_brain` +DEFAULT CHARACTER SET utf8mb4 +COLLATE utf8mb4_general_ci; + +USE `technological_brain`; + +-- 开启事务 +START TRANSACTION; + +-- ---------------------------- +-- 系统相关表 +-- ---------------------------- + +-- 用户表 +DROP TABLE IF EXISTS `sys_user`; +CREATE TABLE `sys_user` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `username` varchar(50) NOT NULL COMMENT '用户名', + `password` varchar(100) NOT NULL COMMENT '密码', + `real_name` varchar(50) DEFAULT NULL COMMENT '真实姓名', + `email` varchar(100) DEFAULT NULL COMMENT '邮箱', + `phone` varchar(20) DEFAULT NULL COMMENT '手机号', + `avatar` varchar(255) DEFAULT NULL COMMENT '头像URL', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用,1-启用', + `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间', + `last_login_ip` varchar(50) DEFAULT NULL COMMENT '最后登录IP', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_username` (`username`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统用户表'; + +-- 角色表 +DROP TABLE IF EXISTS `sys_role`; +CREATE TABLE `sys_role` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `role_name` varchar(50) NOT NULL COMMENT '角色名称', + `role_code` varchar(50) NOT NULL COMMENT '角色编码', + `role_desc` varchar(200) DEFAULT NULL COMMENT '角色描述', + `login_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '登录类型:1-仅展示端,2-展示端和后台', + `sort` int(11) DEFAULT '0' COMMENT '排序', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用,1-启用', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_role_code` (`role_code`), + KEY `idx_status` (`status`), + KEY `idx_sort` (`sort`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统角色表'; + +-- 权限表 +DROP TABLE IF EXISTS `sys_permission`; +CREATE TABLE `sys_permission` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `permission_name` varchar(50) NOT NULL COMMENT '权限名称', + `permission_code` varchar(50) NOT NULL COMMENT '权限编码', + `permission_type` tinyint(1) NOT NULL COMMENT '权限类型:1-菜单,2-按钮,3-接口', + `parent_id` varchar(32) DEFAULT NULL COMMENT '父权限ID', + `path` varchar(200) DEFAULT NULL COMMENT '路径', + `component` varchar(200) DEFAULT NULL COMMENT '前端组件', + `icon` varchar(100) DEFAULT NULL COMMENT '图标', + `sort` int(11) DEFAULT '0' COMMENT '排序', + `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态:0-禁用,1-启用', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_permission_code` (`permission_code`), + KEY `idx_parent_id` (`parent_id`), + KEY `idx_status` (`status`), + KEY `idx_sort` (`sort`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统权限表'; + +-- 用户角色关联表 +DROP TABLE IF EXISTS `sys_user_role`; +CREATE TABLE `sys_user_role` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `user_id` varchar(32) NOT NULL COMMENT '用户ID', + `role_id` varchar(32) NOT NULL COMMENT '角色ID', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_role` (`user_id`,`role_id`), + KEY `idx_role_id` (`role_id`), + CONSTRAINT `fk_ur_user_id` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_ur_role_id` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户角色关联表'; + +-- 角色权限关联表 +DROP TABLE IF EXISTS `sys_role_permission`; +CREATE TABLE `sys_role_permission` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `role_id` varchar(32) NOT NULL COMMENT '角色ID', + `permission_id` varchar(32) NOT NULL COMMENT '权限ID', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_role_permission` (`role_id`,`permission_id`), + KEY `idx_permission_id` (`permission_id`), + CONSTRAINT `fk_rp_role_id` FOREIGN KEY (`role_id`) REFERENCES `sys_role` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_rp_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `sys_permission` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='角色权限关联表'; + +-- 参数表 +DROP TABLE IF EXISTS `sys_param`; +CREATE TABLE `sys_param` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `param_type` varchar(20) NOT NULL COMMENT '参数类型', + `param_name` varchar(50) NOT NULL COMMENT '参数名称', + `param_value` varchar(100) DEFAULT NULL COMMENT '参数值', + `data_type` varchar(10) NOT NULL DEFAULT 'STRING' COMMENT '数据类型:STRING-字符串,NUMBER-数字,BOOLEAN-布尔值,DATE-日期', + `sort_order` int(11) DEFAULT 0 COMMENT '排序号', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:0-禁用,1-启用', + `flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '标识:0-未删除,1-已删除', + `remark` varchar(200) DEFAULT NULL COMMENT '备注', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_param_type_name` (`param_type`, `param_name`), + KEY `idx_param_type` (`param_type`), + KEY `idx_status` (`status`), + KEY `idx_sort_order` (`sort_order`), + CONSTRAINT `fk_param_type` FOREIGN KEY (`param_type`) REFERENCES `sys_param_type` (`type_code`) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统参数表'; + +-- 参数类型表 +DROP TABLE IF EXISTS `sys_param_type`; +CREATE TABLE `sys_param_type` ( + `id` varchar(32) NOT NULL COMMENT '主键ID', + `type_code` varchar(20) NOT NULL COMMENT '类型编码', + `type_name` varchar(50) NOT NULL COMMENT '类型名称', + `sort_order` int(11) DEFAULT 0 COMMENT '排序号', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:0-禁用,1-启用', + `flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '标识:0-未删除,1-已删除', + `remark` varchar(200) DEFAULT NULL COMMENT '备注', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_type_code` (`type_code`), + KEY `idx_status` (`status`), + KEY `idx_sort_order` (`sort_order`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='参数类型表'; + +-- ---------------------------- +-- 业务相关表 +-- ---------------------------- + +-- 人才基本信息表 +DROP TABLE IF EXISTS `talent_basic`; +CREATE TABLE `talent_basic` ( + `id` varchar(32) NOT NULL COMMENT '人才id', + `name` varchar(50) NOT NULL COMMENT '姓名', + `sex` tinyint(1) DEFAULT NULL COMMENT '性别(0-男,1-女)', + `birth_date` date DEFAULT NULL COMMENT '出生日期', + `unit_id` varchar(32) DEFAULT NULL COMMENT '单位id', + `unit_type` varchar(20) DEFAULT NULL COMMENT '单位类型:school-高校,company-企业', + `highest_edu` varchar(20) DEFAULT NULL COMMENT '最高学历', + `highest_school` varchar(100) DEFAULT NULL COMMENT '最高学历毕业学校', + `classify_grade` varchar(20) DEFAULT NULL COMMENT '分类定级人才', + `title` varchar(20) DEFAULT NULL COMMENT '职称', + `region` varchar(12) NOT NULL COMMENT '地区编码', + `image` varchar(255) DEFAULT NULL COMMENT '照片', + `highest_position` varchar(20) DEFAULT NULL COMMENT '最高技术职务资格', + `entry_date` date NOT NULL COMMENT '入职时间', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_unit_id` (`unit_id`), + KEY `idx_highest_edu` (`highest_edu`), + KEY `idx_classify_grade` (`classify_grade`), + KEY `idx_title` (`title`), + KEY `idx_highest_position` (`highest_position`), + KEY `idx_create_time` (`create_time`), +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='人才基本信息表'; + +-- 工作单位信息表 +DROP TABLE IF EXISTS `employment_unit`; +CREATE TABLE `employment_unit` ( + `id` varchar(32) NOT NULL COMMENT '工作单位id', + `unit_name` varchar(100) NOT NULL COMMENT '工作单位名称', + `unit_address` varchar(100) NOT NULL COMMENT '工作单位地址', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_unit_name` (`unit_name`), + KEY `idx_create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='工作单位信息表'; + +-- 科研项目信息表 +DROP TABLE IF EXISTS `research_project`; +CREATE TABLE `research_project` ( + `id` varchar(32) NOT NULL COMMENT '项目ID', + `name` varchar(255) NOT NULL COMMENT '项目名称', + `title_en` varchar(255) DEFAULT NULL COMMENT '项目名称英文版', + `project_type` varchar(20) DEFAULT NULL COMMENT '项目类型', + `keyword_original` varchar(100) DEFAULT NULL COMMENT '检索关键词', + `keyword_en` varchar(255) DEFAULT NULL COMMENT '检索关键词英文', + `summary_cn` text COMMENT '摘要', + `summary_en` text COMMENT '摘要英文', + `funding` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '预算/财政拨款', + `currency_code` char(3) NOT NULL DEFAULT 'CNY' COMMENT '货币代码', + `funding_dollar` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '项目金额(美元)', + `apply_year` year DEFAULT NULL COMMENT '申请年份', + `plan_start_date` date DEFAULT NULL COMMENT '项目启动时间', + `plan_end_date` date DEFAULT NULL COMMENT '项目终止时间', + `undertake_unit_id` varchar(32) DEFAULT NULL COMMENT '承担单位id', + `undertake_unit_state` varchar(50) DEFAULT NULL COMMENT '省份', + `undertake_unit_country` varchar(50) DEFAULT NULL COMMENT '国家', + `funder_name` varchar(50) DEFAULT NULL COMMENT '资金名称', + `funder_group` varchar(50) DEFAULT NULL COMMENT '资金来源组织', + `funder_country` varchar(30) DEFAULT NULL COMMENT '资金国家', + `primary_subject` varchar(20) DEFAULT NULL COMMENT '学科大类(第一学科)', + `sub_subject` varchar(20) DEFAULT NULL COMMENT '学科小类', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:1-草稿,2-已发布', + `flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_apply_year` (`apply_year`), + KEY `idx_project_type` (`project_type`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + KEY `idx_undertake_unit_id` (`undertake_unit_id`), + CONSTRAINT `fk_rp_undertake_unit_id` FOREIGN KEY (`undertake_unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='科研项目信息表'; + +-- 科研项目人才业务关联表 +DROP TABLE IF EXISTS `research_project_talent`; +CREATE TABLE `research_project_talent` ( + `id` varchar(32) NOT NULL COMMENT '立项项目id', + `project_id` varchar(32) NOT NULL COMMENT '项目编号', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + KEY `idx_project_id` (`project_id`), + KEY `idx_talent_id` (`talent_id`), + CONSTRAINT `fk_rpt_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_rpt_project_id` FOREIGN KEY (`project_id`) REFERENCES `research_project` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='科研项目人才信息表'; + +-- 科技报告信息表 +DROP TABLE IF EXISTS `tech_report`; +CREATE TABLE `tech_report` ( + `id` varchar(32) NOT NULL COMMENT '报告id', + `project_id` varchar(50) NOT NULL COMMENT '项目id', + `report_name_cn` varchar(200) NOT NULL COMMENT '报告名称(中文)', + `report_name` varchar(200) NOT NULL COMMENT '报告名称(英文)', + `author_cn` varchar(50) NOT NULL COMMENT '作者(中文)', + `author_en` varchar(50) NOT NULL COMMENT '作者(英文)', + `workplace_cn` varchar(200) NOT NULL COMMENT '作者单位(中文)', + `workplace_en` varchar(200) NOT NULL COMMENT '作者单位(英文)', + `keyword_cn` varchar(100) NOT NULL COMMENT '关键词(中文)', + `keyword_en` varchar(100) NOT NULL COMMENT '关键词(英文)', + `summary_cn` text NOT NULL COMMENT '摘要(中文)', + `summary_en` text NOT NULL COMMENT '摘要(英文)', + `writing_time` datetime NOT NULL COMMENT '编撰时间', + `institution` varchar(100) NOT NULL COMMENT '支持机构', + `report_type` varchar(20) DEFAULT NULL COMMENT '报告类型', + `channel` varchar(100) NOT NULL COMMENT '支持渠道', + `is_public` enum('是','否') NOT NULL COMMENT '是否公开', + `status` enum('草稿','已发布') NOT NULL COMMENT '报告状态', + `report_path` varchar(255) DEFAULT NULL COMMENT '报告全文路径', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_project_id` (`project_id`), + KEY `idx_report_name_cn` (`report_name_cn`), + KEY `idx_writing_time` (`writing_time`), + KEY `idx_report_type` (`report_type`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_tr_project_id` FOREIGN KEY (`project_id`) REFERENCES `research_project` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='科技报告信息表'; + +-- 人才报告关联表 +DROP TABLE IF EXISTS `talent_report`; +CREATE TABLE `talent_report` ( + `id` varchar(32) NOT NULL COMMENT '人才报告关联表id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `report_id` varchar(32) NOT NULL COMMENT '报告id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + KEY `idx_report_id` (`report_id`), + KEY `idx_talent_id` (`talent_id`), + CONSTRAINT `fk_tr_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_tr_report_id` FOREIGN KEY (`report_id`) REFERENCES `tech_report` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='人才报告关联表'; + +-- 学术奖励信息表 +DROP TABLE IF EXISTS `academic_award`; +CREATE TABLE `academic_award` ( + `id` varchar(32) NOT NULL COMMENT '奖项id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `award_name` varchar(100) NOT NULL COMMENT '奖励名称', + `award_level` varchar(20) NOT NULL COMMENT '奖励级别', + `award_time` date NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) NOT NULL COMMENT '授予机构', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_award_level` (`award_level`), + KEY `idx_award_time` (`award_time`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_aa_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='学术奖励信息表'; + +-- 企业信息表 +DROP TABLE IF EXISTS `enterprise_info`; +CREATE TABLE `enterprise_info` ( + `id` varchar(32) NOT NULL COMMENT '企业id', + `taxpayer_id` varchar(20) NOT NULL COMMENT '纳税人识别号', + `company_name` varchar(255) DEFAULT NULL COMMENT '企业名称', + `company_type` varchar(50) DEFAULT NULL COMMENT '企业类型', + `is_high_tech_certified` tinyint(1) DEFAULT NULL COMMENT '是否高新技术企业认证(0:否,1:是)', + `qualification_certificate` text COMMENT '资质证书', + `company_status` varchar(50) DEFAULT NULL COMMENT '企业状态参数表COMPANY_STATUS)', + `legal_representative_name` varchar(32) DEFAULT NULL COMMENT '法定代表人姓名', + `registered_capital` varchar(255) DEFAULT NULL COMMENT '注册资本', + `company_address` varchar(255) DEFAULT NULL COMMENT '企业地址', + `province` varchar(50) DEFAULT NULL COMMENT '所属省份', + `city` varchar(50) DEFAULT NULL COMMENT '所属城市', + `district` varchar(50) DEFAULT NULL COMMENT '所属区域', + `industry` varchar(20) DEFAULT NULL COMMENT '所属行业', + `establishment_date` date DEFAULT NULL COMMENT '成立日期', + `employee_count` int DEFAULT NULL COMMENT '员工人数', + `website` varchar(255) DEFAULT NULL COMMENT '网址', + `business_scope` text COMMENT '经营范围', + `contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话', + `contact_email` varchar(100) DEFAULT NULL COMMENT '联系邮箱', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_company_name` (`company_name`), + KEY `idx_company_status` (`company_status`), + KEY `idx_create_time` (`create_time`), +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='企业信息表'; + +-- 荣誉称号信息表 +DROP TABLE IF EXISTS `honorary_title`; +CREATE TABLE `honorary_title` ( + `id` varchar(32) NOT NULL COMMENT '荣誉ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `honor_title` varchar(100) NOT NULL COMMENT '荣誉称号', + `award_time` date NOT NULL COMMENT '授予时间', + `awarding_agency` varchar(100) NOT NULL COMMENT '授予机构', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_award_time` (`award_time`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_ht_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='荣誉称号信息表'; + +-- 论文专著信息表 +DROP TABLE IF EXISTS `papers_and_monographs`; +CREATE TABLE `papers_and_monographs` ( + `id` varchar(32) NOT NULL COMMENT '论文专著ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `title` varchar(200) NOT NULL COMMENT '标题', + `publication_time` datetime NOT NULL COMMENT '发表时间', + `journal_name` varchar(100) NOT NULL COMMENT '刊物名称', + `volume_number` varchar(20) NOT NULL COMMENT '卷号', + `issue_number` varchar(20) NOT NULL COMMENT '期号', + `page_range` varchar(20) NOT NULL COMMENT '页码', + `doi` varchar(50) NOT NULL COMMENT 'DOI号', + `work_type` varchar(20) NOT NULL COMMENT '著作类型(参数表WORK_TYPE)', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:1-草稿,2-已发布', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_publication_time` (`publication_time`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_pm_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='论文专著信息表'; + +-- 论文专著关联表 +DROP TABLE IF EXISTS `papers_and_monographs_talent`; +CREATE TABLE `papers_and_monographs_talent` ( + `id` varchar(32) NOT NULL COMMENT '业务表ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `papers_and_monographs_id` varchar(32) NOT NULL COMMENT '论文专著id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_talent_papers` (`talent_id`,`papers_and_monographs_id`), + KEY `idx_papers_and_monographs_id` (`papers_and_monographs_id`), + CONSTRAINT `fk_pmt_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_pmt_papers_and_monographs_id` FOREIGN KEY (`papers_and_monographs_id`) REFERENCES `papers_and_monographs` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='论文专著关联表'; + +-- 专利信息表 +DROP TABLE IF EXISTS `patent`; +CREATE TABLE `patent` ( + `id` varchar(32) NOT NULL COMMENT '专利id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `patent_name` varchar(100) NOT NULL COMMENT '专利名称', + `patent_number` varchar(30) NOT NULL COMMENT '专利编号', + `application_time` date NOT NULL COMMENT '申请时间', + `authorization_time` date NOT NULL COMMENT '授权时间', + `status` varchar(10) NOT NULL DEFAULT '1' COMMENT '状态:1-草稿,2-已发布', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_application_time` (`application_time`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_p_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='专利信息表'; + +-- 专利信息关联表 +DROP TABLE IF EXISTS `patent_talent`; +CREATE TABLE `patent_talent` ( + `id` varchar(32) NOT NULL COMMENT '业务表id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `patent_id` varchar(32) NOT NULL COMMENT '专利id', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_talent_patent` (`talent_id`,`patent_id`), + KEY `idx_patent_id` (`patent_id`), + CONSTRAINT `fk_pt_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_pt_patent_id` FOREIGN KEY (`patent_id`) REFERENCES `patent` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='专利信息关联表'; + +-- 立项项目信息表 +DROP TABLE IF EXISTS `project_initiation`; +CREATE TABLE `project_initiation` ( + `id` varchar(32) NOT NULL COMMENT '立项项目id', + `project_proposal_number` varchar(100) NOT NULL COMMENT '立项项目编号', + `project_name` varchar(100) DEFAULT NULL COMMENT '项目名称', + `project_from` varchar(100) DEFAULT NULL COMMENT '项目来源', + `project_type` varchar(100) DEFAULT NULL COMMENT '项目类型', + `funding_from` varchar(100) DEFAULT NULL COMMENT '资金来源组织', + `undertaking_unit_id` varchar(32) DEFAULT NULL COMMENT '承担单位id', + `project_account` decimal(12,2) DEFAULT NULL COMMENT '项目金额', + `start_time` date DEFAULT NULL COMMENT '项目启动时间', + `end_time` date DEFAULT NULL COMMENT '项目终止时间', + `project_status` varchar(20) DEFAULT NULL COMMENT '项目当前状态(PROJECT_STATUS)', + `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:1-草稿,2-已发布', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_project_name` (`project_name`), + KEY `idx_project_status` (`project_status`), + KEY `idx_status` (`status`), + KEY `idx_create_time` (`create_time`), + KEY `idx_undertaking_unit_id` (`undertaking_unit_id`), + CONSTRAINT `fk_pi_undertaking_unit_id` FOREIGN KEY (`undertaking_unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='立项项目信息表'; + +-- 人才立项关联表 +DROP TABLE IF EXISTS `talent_project_initiation`; +CREATE TABLE `talent_project_initiation` ( + `id` varchar(32) NOT NULL COMMENT '业务表id', + `talent_id` varchar(32) NOT NULL COMMENT '人才id', + `project_initiation_id` varchar(32) NOT NULL COMMENT '立项项目id', + `is_principal` boolean NOT NULL COMMENT '是否负责人(0:否,1:是)', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_talent_project` (`talent_id`,`project_initiation_id`), + KEY `idx_project_initiation_id` (`project_initiation_id`), + CONSTRAINT `fk_tpi_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_tpi_project_initiation_id` FOREIGN KEY (`project_initiation_id`) REFERENCES `project_initiation` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='人才立项关联表'; + +-- 履历信息表 +DROP TABLE IF EXISTS `resume`; +CREATE TABLE `resume` ( + `id` varchar(32) NOT NULL COMMENT '履历ID', + `talent_id` varchar(32) NOT NULL COMMENT '人才ID', + `start_time` datetime NOT NULL COMMENT '起始时间', + `end_time` datetime DEFAULT NULL COMMENT '结束时间', + `unit_id` varchar(32) NOT NULL COMMENT '所在单位id', + `work_content` text NOT NULL COMMENT '工作内容', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `create_by` varchar(32) DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) DEFAULT NULL COMMENT '更新人', + `flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-未删除,1-已删除', + PRIMARY KEY (`id`), + KEY `idx_talent_id` (`talent_id`), + KEY `idx_create_time` (`create_time`), + CONSTRAINT `fk_r_talent_id` FOREIGN KEY (`talent_id`) REFERENCES `talent_basic` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_r_unit_id` FOREIGN KEY (`unit_id`) REFERENCES `employment_unit` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='履历信息表'; + +ALTER TABLE employment_unit COMMENT = '高校信息表'; + +RENAME TABLE employment_unit TO school; + +ALTER TABLE `talent_basic` +ADD COLUMN `unit_type` varchar(20) DEFAULT NULL COMMENT '单位类型:school-高校,company-企业' AFTER `unit_id`; \ No newline at end of file diff --git a/target/classes/mapper/AcademicAwardMapper.xml b/target/classes/mapper/AcademicAwardMapper.xml new file mode 100644 index 0000000..6d27e95 --- /dev/null +++ b/target/classes/mapper/AcademicAwardMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + id, talent_id, award_name, award_level, award_time, + awarding_agency, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/EmploymentUnitMapper.xml b/target/classes/mapper/EmploymentUnitMapper.xml new file mode 100644 index 0000000..cbd4a61 --- /dev/null +++ b/target/classes/mapper/EmploymentUnitMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + id, unit_name, unit_address, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/EnterpriseInfoMapper.xml b/target/classes/mapper/EnterpriseInfoMapper.xml new file mode 100644 index 0000000..12573af --- /dev/null +++ b/target/classes/mapper/EnterpriseInfoMapper.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, enterprise_name, enterprise_code, enterprise_type, + industry, legal_representative, registered_capital, establishment_date, + business_scope, address, contact_person, contact_phone, email, website, + flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/HonoraryTitleMapper.xml b/target/classes/mapper/HonoraryTitleMapper.xml new file mode 100644 index 0000000..8c3ef51 --- /dev/null +++ b/target/classes/mapper/HonoraryTitleMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, title_name, title_level, awarding_agency, + award_time, validity_period, flag, create_time, update_time, + create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/PapersAndMonographsMapper.xml b/target/classes/mapper/PapersAndMonographsMapper.xml new file mode 100644 index 0000000..6b44601 --- /dev/null +++ b/target/classes/mapper/PapersAndMonographsMapper.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, work_name, work_type, publication_time, + publication_name, volume_number, issue_number, page_range, + status, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/PapersAndMonographsTalentMapper.xml b/target/classes/mapper/PapersAndMonographsTalentMapper.xml new file mode 100644 index 0000000..67b9f46 --- /dev/null +++ b/target/classes/mapper/PapersAndMonographsTalentMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, talent_id, papers_and_monographs_id, create_time, create_by + + + \ No newline at end of file diff --git a/target/classes/mapper/PatentMapper.xml b/target/classes/mapper/PatentMapper.xml new file mode 100644 index 0000000..24b06c2 --- /dev/null +++ b/target/classes/mapper/PatentMapper.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, patent_name, patent_type, patent_number, + application_time, publication_time, authorization_time, inventors, + patent_abstract, patent_status, flag, create_time, update_time, + create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/PatentTalentMapper.xml b/target/classes/mapper/PatentTalentMapper.xml new file mode 100644 index 0000000..44551b9 --- /dev/null +++ b/target/classes/mapper/PatentTalentMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, patent_id, talent_id, create_time, create_by + + + \ No newline at end of file diff --git a/target/classes/mapper/ProjectInitiationMapper.xml b/target/classes/mapper/ProjectInitiationMapper.xml new file mode 100644 index 0000000..7f44cd6 --- /dev/null +++ b/target/classes/mapper/ProjectInitiationMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, project_proposal_number, project_name, project_from, + project_type, project_level, project_funding, start_time, end_time, + project_status, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/ResearchProjectMapper.xml b/target/classes/mapper/ResearchProjectMapper.xml new file mode 100644 index 0000000..900775d --- /dev/null +++ b/target/classes/mapper/ResearchProjectMapper.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, name, title_en, project_type, keyword_original, keyword_en, + summary_cn, summary_en, funding, currency_code, funding_dollar, + apply_year, plan_start_date, plan_end_date, undertake_unit_id, + undertake_unit_state, undertake_unit_country, funder_name, + funder_group, funder_country, primary_subject, sub_subject, + status, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/ResearchProjectTalentMapper.xml b/target/classes/mapper/ResearchProjectTalentMapper.xml new file mode 100644 index 0000000..d119c1e --- /dev/null +++ b/target/classes/mapper/ResearchProjectTalentMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, talent_id, project_id, create_time, create_by + + + \ No newline at end of file diff --git a/target/classes/mapper/ResumeMapper.xml b/target/classes/mapper/ResumeMapper.xml new file mode 100644 index 0000000..8dbb60d --- /dev/null +++ b/target/classes/mapper/ResumeMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/classes/mapper/ReviewExperienceMapper.xml b/target/classes/mapper/ReviewExperienceMapper.xml new file mode 100644 index 0000000..e036224 --- /dev/null +++ b/target/classes/mapper/ReviewExperienceMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + id, talent_id, review_project, review_time, reviewing_agency, + review_role, review_content, flag, create_time, update_time, + create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/SysParamMapper.xml b/target/classes/mapper/SysParamMapper.xml new file mode 100644 index 0000000..5c39a70 --- /dev/null +++ b/target/classes/mapper/SysParamMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + id, param_type, param_name, param_value, remark, sort_order, status, flag, + create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/SysParamTypeMapper.xml b/target/classes/mapper/SysParamTypeMapper.xml new file mode 100644 index 0000000..d315a84 --- /dev/null +++ b/target/classes/mapper/SysParamTypeMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + id, type_code, type_name, remark, sort_order, status, flag, create_time, update_time, create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/SysPermissionMapper.xml b/target/classes/mapper/SysPermissionMapper.xml new file mode 100644 index 0000000..3730b47 --- /dev/null +++ b/target/classes/mapper/SysPermissionMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + id, permission_name, permission_code, permission_type, parent_id, path, component, + icon, sort_order, status, create_time, update_time, create_by, update_by, deleted + + + INSERT INTO sys_role_permission (id, role_id, permission_id, create_time) + VALUES + + (#{item.id}, #{item.roleId}, #{item.permissionId}, NOW()) + + + + DELETE FROM sys_role_permission WHERE role_id = #{roleId} + + + + + + \ No newline at end of file diff --git a/target/classes/mapper/SysRoleMapper.xml b/target/classes/mapper/SysRoleMapper.xml new file mode 100644 index 0000000..d9bc72f --- /dev/null +++ b/target/classes/mapper/SysRoleMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + id, role_name, role_code, description, status, sort_order, + create_time, update_time, create_by, update_by, deleted + + + + \ No newline at end of file diff --git a/target/classes/mapper/SysRolePermissionMapper.xml b/target/classes/mapper/SysRolePermissionMapper.xml new file mode 100644 index 0000000..68ea464 --- /dev/null +++ b/target/classes/mapper/SysRolePermissionMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, role_id, permission_id, create_time, create_by + + + \ No newline at end of file diff --git a/target/classes/mapper/SysUserMapper.xml b/target/classes/mapper/SysUserMapper.xml new file mode 100644 index 0000000..0490110 --- /dev/null +++ b/target/classes/mapper/SysUserMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + id, username, password, real_name, phone, email, status, + create_time, update_time, create_by, update_by, deleted + + + \ No newline at end of file diff --git a/target/classes/mapper/SysUserRoleMapper.xml b/target/classes/mapper/SysUserRoleMapper.xml new file mode 100644 index 0000000..d50a178 --- /dev/null +++ b/target/classes/mapper/SysUserRoleMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, user_id, role_id, create_time, create_by + + + \ No newline at end of file diff --git a/target/classes/mapper/TalentBasicMapper.xml b/target/classes/mapper/TalentBasicMapper.xml new file mode 100644 index 0000000..2745ecc --- /dev/null +++ b/target/classes/mapper/TalentBasicMapper.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, name, sex, birth_date, unit_id, unit_type, highest_edu, highest_school, + classify_grade, title, region, image, highest_position, entry_date, create_time, + update_time, create_by, update_by, flag + + + \ No newline at end of file diff --git a/target/classes/mapper/TalentProjectInitiationMapper.xml b/target/classes/mapper/TalentProjectInitiationMapper.xml new file mode 100644 index 0000000..5d71667 --- /dev/null +++ b/target/classes/mapper/TalentProjectInitiationMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, talent_id, project_initiation_id, create_time, create_by + + + \ No newline at end of file diff --git a/target/classes/mapper/TalentReportMapper.xml b/target/classes/mapper/TalentReportMapper.xml new file mode 100644 index 0000000..f6e6cb2 --- /dev/null +++ b/target/classes/mapper/TalentReportMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + id, talent_id, report_id, create_time, create_by + + + \ No newline at end of file diff --git a/target/classes/mapper/TechReportMapper.xml b/target/classes/mapper/TechReportMapper.xml new file mode 100644 index 0000000..17dd705 --- /dev/null +++ b/target/classes/mapper/TechReportMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, project_id, report_name_cn, report_name, author_cn, author_en, + workplace_cn, workplace_en, keyword_cn, keyword_en, summary_cn, + summary_en, writing_time, institution, report_type, channel, + is_public, status, report_path, flag, create_time, update_time, + create_by, update_by + + + \ No newline at end of file diff --git a/target/classes/mapper/WorkDomainMapper.xml b/target/classes/mapper/WorkDomainMapper.xml new file mode 100644 index 0000000..1b4e151 --- /dev/null +++ b/target/classes/mapper/WorkDomainMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..9a9183d --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=brain +groupId=com.CUST +version=1.0.0 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..de863bf --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,111 @@ +com\CUST\brain\service\impl\SysParamServiceImpl.class +com\CUST\brain\web\controller\business\TalentBasicController.class +com\CUST\brain\dao\mapper\SysUserRoleMapper.class +com\CUST\brain\common\exception\GlobalExceptionHandler.class +com\CUST\brain\dao\domain\business\ProjectInitiation.class +com\CUST\brain\dao\domain\relation\TalentReport.class +com\CUST\brain\common\dto\system\PermissionTreeVO.class +com\CUST\brain\web\controller\system\SysParamController.class +com\CUST\brain\dao\mapper\PatentTalentMapper.class +com\CUST\brain\BrainApplication.class +com\CUST\brain\dao\mapper\AcademicAwardMapper.class +com\CUST\brain\common\security\LoginUser.class +com\CUST\brain\dao\mapper\EmploymentUnitMapper.class +com\CUST\brain\dao\mapper\PapersAndMonographsTalentMapper.class +com\CUST\brain\common\constant\RedisKeyConstants.class +com\CUST\brain\dao\domain\system\SysRole.class +com\CUST\brain\service\impl\SysParamTypeServiceImpl.class +com\CUST\brain\dao\domain\relation\ResearchProjectTalent.class +com\CUST\brain\dao\domain\base\BaseRelationEntity.class +com\CUST\brain\common\config\MyMetaObjectHandler.class +com\CUST\brain\dao\mapper\TalentProjectInitiationMapper.class +com\CUST\brain\dao\domain\base\BaseEntity.class +com\CUST\brain\dao\domain\business\PapersAndMonographs.class +com\CUST\brain\dao\domain\business\ResearchProject.class +com\CUST\brain\web\controller\system\SysParamTypeController.class +com\CUST\brain\dao\mapper\WorkDomainMapper.class +com\CUST\brain\dao\domain\relation\PapersAndMonographsTalent.class +com\CUST\brain\dao\domain\business\Patent.class +com\CUST\brain\dao\mapper\EnterpriseInfoMapper.class +com\CUST\brain\common\cache\ParamCacheManager.class +com\CUST\brain\service\TalentBasicService.class +com\CUST\brain\service\impl\SysPermissionServiceImpl.class +com\CUST\brain\common\dto\system\LoginResponseDTO.class +com\CUST\brain\service\SysRoleService.class +com\CUST\brain\common\enums\TitleEnum.class +com\CUST\brain\dao\domain\business\TechReport.class +com\CUST\brain\dao\mapper\ResearchProjectMapper.class +com\CUST\brain\dao\mapper\ResumeMapper.class +com\CUST\brain\common\api\CommonResult.class +com\CUST\brain\common\config\SecurityConfig.class +com\CUST\brain\common\utils\CacheCleanUtils.class +com\CUST\brain\common\enums\EducationEnum.class +com\CUST\brain\dao\domain\system\SysParamType.class +com\CUST\brain\common\security\handler\RestfulAccessDeniedHandler.class +com\CUST\brain\web\controller\system\SysRoleController.class +com\CUST\brain\dao\mapper\SysRoleMapper.class +com\CUST\brain\dao\domain\business\ReviewExperience.class +com\CUST\brain\common\security\filter\JwtAuthenticationTokenFilter.class +com\CUST\brain\common\utils\PasswordEncoder.class +com\CUST\brain\common\config\SwaggerConfig.class +com\CUST\brain\dao\domain\relation\PatentTalent.class +com\CUST\brain\web\controller\system\SysPermissionController.class +com\CUST\brain\dao\mapper\SysParamMapper.class +com\CUST\brain\service\impl\TalentBasicServiceImpl.class +com\CUST\brain\common\enums\CacheUpdateStrategy.class +com\CUST\brain\common\utils\RedisUtils.class +com\CUST\brain\common\enums\ParamTypeEnum.class +com\CUST\brain\dao\domain\system\SysPermission.class +com\CUST\brain\common\dto\system\MenuResponseDTO.class +com\CUST\brain\dao\mapper\TalentBasicMapper.class +com\CUST\brain\service\impl\SysRoleServiceImpl.class +com\CUST\brain\common\api\IErrorCode.class +com\CUST\brain\service\SysParamTypeService.class +com\CUST\brain\dao\mapper\ResearchProjectTalentMapper.class +com\CUST\brain\dao\mapper\ReviewExperienceMapper.class +com\CUST\brain\common\exception\BusinessException.class +com\CUST\brain\dao\domain\business\EmploymentUnit.class +com\CUST\brain\dao\domain\business\HonoraryTitle.class +com\CUST\brain\dao\domain\relation\TalentProjectInitiation.class +com\CUST\brain\dao\domain\business\AcademicAward.class +com\CUST\brain\common\security\service\UserDetailsServiceImpl.class +com\CUST\brain\dao\domain\system\SysParam.class +com\CUST\brain\service\SysPermissionService.class +com\CUST\brain\dao\mapper\SysPermissionMapper.class +com\CUST\brain\dao\mapper\TechReportMapper.class +com\CUST\brain\service\SysParamService.class +com\CUST\brain\common\dto\system\AssignRoleRequestDTO.class +com\CUST\brain\dao\mapper\ProjectInitiationMapper.class +com\CUST\brain\common\utils\SecurityUtils.class +com\CUST\brain\common\aspect\RedisCacheAspect$1.class +com\CUST\brain\dao\domain\relation\SysRolePermission.class +com\CUST\brain\dao\mapper\TalentReportMapper.class +com\CUST\brain\dao\mapper\SysUserMapper.class +com\CUST\brain\common\annotation\RedisCache.class +com\CUST\brain\service\impl\SysRoleServiceImpl$1.class +com\CUST\brain\web\controller\system\LoginController.class +com\CUST\brain\dao\domain\system\SysUser.class +com\CUST\brain\dao\domain\relation\SysUserRole.class +com\CUST\brain\common\utils\JwtTokenUtil.class +com\CUST\brain\dao\domain\business\TalentBasic.class +com\CUST\brain\common\dto\system\UpdateRolePermissionsRequestDTO.class +com\CUST\brain\common\config\RedisConfig.class +com\CUST\brain\common\dto\system\SysRoleResponseDTO.class +com\CUST\brain\dao\domain\business\EnterpriseInfo.class +com\CUST\brain\common\enums\SexEnum.class +com\CUST\brain\dao\mapper\SysRolePermissionMapper.class +com\CUST\brain\dao\domain\business\Resume.class +com\CUST\brain\common\aspect\RedisCacheAspect.class +com\CUST\brain\dao\mapper\SysParamTypeMapper.class +com\CUST\brain\service\SysUserService.class +com\CUST\brain\dao\mapper\HonoraryTitleMapper.class +com\CUST\brain\common\dto\system\LoginRequestDTO.class +com\CUST\brain\common\dto\system\UserInfoResponseDTO.class +com\CUST\brain\web\controller\system\SysUserController.class +com\CUST\brain\dao\mapper\PapersAndMonographsMapper.class +com\CUST\brain\dao\mapper\PatentMapper.class +com\CUST\brain\service\impl\SysUserServiceImpl.class +com\CUST\brain\common\dto\system\SysRoleRequestDTO.class +com\CUST\brain\common\security\handler\RestAuthenticationEntryPoint.class +com\CUST\brain\dao\domain\business\WorkDomain.class +com\CUST\brain\common\api\ResultCode.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..0958cbe --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,110 @@ +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\utils\SecurityUtils.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\relation\SysRolePermission.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\WorkDomain.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\system\SysParamType.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\TalentBasicService.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\PapersAndMonographsMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\PatentMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\enums\EducationEnum.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\relation\PatentTalent.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\AcademicAward.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\EmploymentUnit.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\dto\system\UserInfoResponseDTO.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\PatentTalentMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\relation\TalentReport.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\utils\CacheCleanUtils.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\dto\system\AssignRoleRequestDTO.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\dto\system\LoginResponseDTO.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\Resume.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\config\SwaggerConfig.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\security\handler\RestAuthenticationEntryPoint.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\impl\SysRoleServiceImpl.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\config\MyMetaObjectHandler.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\Patent.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\SysUserMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\SysRoleMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\TalentProjectInitiationMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\web\controller\business\TalentBasicController.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\impl\SysUserServiceImpl.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\impl\SysPermissionServiceImpl.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\HonoraryTitle.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\web\controller\system\SysUserController.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\dto\system\PermissionTreeVO.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\SysUserRoleMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\config\RedisConfig.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\constant\RedisKeyConstants.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\HonoraryTitleMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\EnterpriseInfo.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\ReviewExperienceMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\SysParamMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\EmploymentUnitMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\api\CommonResult.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\web\controller\system\SysParamTypeController.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\PapersAndMonographsTalentMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\dto\system\MenuResponseDTO.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\SysParamService.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\ResumeMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\dto\system\LoginRequestDTO.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\ResearchProjectTalentMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\base\BaseEntity.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\annotation\RedisCache.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\dto\system\UpdateRolePermissionsRequestDTO.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\SysUserService.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\enums\ParamTypeEnum.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\dto\system\SysRoleResponseDTO.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\TalentReportMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\ProjectInitiation.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\SysPermissionMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\SysRolePermissionMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\TalentBasicMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\BrainApplication.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\security\service\UserDetailsServiceImpl.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\AcademicAwardMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\web\controller\system\SysParamController.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\utils\RedisUtils.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\security\filter\JwtAuthenticationTokenFilter.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\web\controller\system\SysPermissionController.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\cache\ParamCacheManager.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\system\SysParam.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\EnterpriseInfoMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\relation\PapersAndMonographsTalent.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\utils\PasswordEncoder.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\TechReportMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\SysPermissionService.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\ResearchProject.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\enums\TitleEnum.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\web\controller\system\SysRoleController.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\aspect\RedisCacheAspect.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\PapersAndMonographs.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\web\controller\system\LoginController.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\base\BaseRelationEntity.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\system\SysPermission.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\impl\SysParamTypeServiceImpl.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\SysParamTypeService.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\relation\TalentProjectInitiation.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\enums\CacheUpdateStrategy.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\TechReport.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\SysRoleService.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\impl\SysParamServiceImpl.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\WorkDomainMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\exception\BusinessException.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\relation\ResearchProjectTalent.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\enums\SexEnum.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\relation\SysUserRole.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\utils\ParamUtils.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\ProjectInitiationMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\utils\JwtTokenUtil.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\system\SysRole.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\ResearchProjectMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\config\SecurityConfig.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\service\impl\TalentBasicServiceImpl.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\dto\system\SysRoleRequestDTO.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\api\IErrorCode.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\ReviewExperience.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\mapper\SysParamTypeMapper.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\system\SysUser.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\exception\GlobalExceptionHandler.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\dao\domain\business\TalentBasic.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\api\ResultCode.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\security\LoginUser.java +D:\technological_brain\technological_brain\src\main\java\com\CUST\brain\common\security\handler\RestfulAccessDeniedHandler.java diff --git a/technological-brain.iml b/technological-brain.iml new file mode 100644 index 0000000..056f882 --- /dev/null +++ b/technological-brain.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file