Merge branch 'main' of ssh://git.njcqit.com:2222/eric/ar-inspection

This commit is contained in:
2025-12-02 13:31:38 +08:00
20 changed files with 1578 additions and 147 deletions

View File

@@ -0,0 +1,11 @@
{
"permissions": {
"allow": [
"Bash(tree:*)",
"Bash(mvn clean package:*)",
"Bash(echo:*)"
],
"deny": [],
"ask": []
}
}

View File

@@ -0,0 +1,29 @@
---
description: 分析项目结构并生成架构文档
---
# 项目架构分析
执行以下操作:
1. **分析项目结构**:
- 统计各模块的文件数量
- 识别主要的业务模块
- 分析依赖关系
2. **检查关键配置**:
- pom.xml 依赖版本
- application.yml 配置项
- 前端 package.json 依赖
3. **生成架构概览**:
- 模块依赖图
- 技术栈清单
- 开发环境要求
4. **识别潜在问题**:
- 过时的依赖
- 配置不一致
- 代码规范问题
输出格式化的架构分析报告。

20
.claude/commands/build.md Normal file
View File

@@ -0,0 +1,20 @@
---
description: 构建整个 Maven 项目并运行测试
---
# Maven 项目构建和测试
执行以下操作:
1. 清理之前的构建文件
2. 编译整个项目(跳过测试)
3. 显示构建结果
4. 检查是否有编译错误
使用 Maven 命令:
```bash
mvn clean install -DskipTests
```
如果构建成功,输出项目的模块结构和构建时间。
如果有错误,分析错误信息并提供解决建议。

24
.claude/commands/lint.md Normal file
View File

@@ -0,0 +1,24 @@
---
description: 运行前端代码检查和格式化
---
# 前端代码质量检查
执行以下操作:
1. 切换到 plus-ui 目录
2. 运行 ESLint 检查并自动修复
3. 运行 Prettier 格式化代码
4. 显示检查结果
使用命令:
```bash
cd plus-ui
npm run lint:eslint:fix
npm run prettier
```
检查以下文件类型:
- *.vue (Vue 组件)
- *.ts (TypeScript 文件)
- *.tsx (TypeScript JSX)

View File

@@ -0,0 +1,39 @@
---
description: 创建新的业务模块(Controller, Service, Mapper, Domain)
---
# 创建新的业务模块
根据提供的模块名称和功能描述,创建完整的业务模块结构:
1. **确定模块位置**: ruoyi-modules/ 下的对应业务模块
2. **创建实体类 (Domain)**:
- 位置: src/main/java/**/domain/
- 使用 Lombok 注解
- 继承 BaseEntity
- 添加字段注释和验证注解
3. **创建 Mapper 接口**:
- 位置: src/main/java/**/mapper/
- 继承 BaseMapperPlus
- 添加自定义查询方法
4. **创建 Service 接口和实现**:
- 位置: src/main/java/**/service/ 和 service/impl/
- 实现 CRUD 基础方法
- 添加业务逻辑方法
5. **创建 Controller**:
- 位置: src/main/java/**/controller/
- 使用 @RestController@RequestMapping
- 实现 RESTful API
- 添加 Swagger 文档注解
6. **创建对应的 Mapper XML**:
- 位置: src/main/resources/mapper/**/
示例:
- 实体类使用 @Data, @EqualsAndHashCode(callSuper = true)
- Service 使用 @RequiredArgsConstructor
- Controller 返回 R<> 统一响应格式
- 使用 @SaCheckPermission 进行权限控制

View File

@@ -0,0 +1,22 @@
---
description: 启动后端 Spring Boot 应用
---
# 启动后端服务
执行以下操作:
1. 检查后端服务是否已经在运行(端口 8080)
2. 如果没有运行,启动 Spring Boot 应用
3. 监控启动日志,确认服务正常启动
4. 显示可访问的地址和 API 文档地址
使用命令:
```bash
cd ruoyi-admin && mvn spring-boot:run -Dspring-boot.run.profiles=dev
```
启动后提示:
- 应用地址: http://localhost:8080
- API文档: http://localhost:8080/doc.html
- 监控中心: http://localhost:9090/admin

View File

@@ -0,0 +1,26 @@
---
description: 启动前端 Vue3 开发服务器
---
# 启动前端开发服务器
执行以下操作:
1. 切换到前端目录 plus-ui
2. 检查 node_modules 是否存在,如果没有则先安装依赖
3. 启动 Vite 开发服务器
4. 显示访问地址
使用命令:
```bash
cd plus-ui
# 如果需要安装依赖
npm install --registry=https://registry.npmmirror.com
# 启动开发服务器
npm run dev
```
启动后提示:
- 前端地址: http://localhost:80
- 确保后端服务已启动: http://localhost:8080

View File

@@ -0,0 +1,248 @@
# Spring Boot + MyBatis-Plus 业务模块生成提示词
当需要创建新的业务模块时,按照以下模板生成代码:
## 实体类模板 (Domain)
```java
package com.ruoyi.{module}.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* {业务名称}对象 {表名}
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("{表名}")
public class {实体类名} extends BaseEntity {
/** 主键ID */
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 字段说明 */
private String fieldName;
// ... 其他字段
}
```
## Mapper 接口模板
```java
package com.ruoyi.{module}.mapper;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.ruoyi.{module}.domain.{实体类名};
import com.ruoyi.{module}.domain.vo.{实体类名}Vo;
/**
* {业务名称}Mapper接口
*/
public interface {实体类名}Mapper extends BaseMapperPlus<{实体类名}Mapper, {实体类名}, {实体类名}Vo> {
}
```
## Service 接口模板
```java
package com.ruoyi.{module}.service;
import com.ruoyi.{module}.domain.vo.{实体类名}Vo;
import com.ruoyi.{module}.domain.bo.{实体类名}Bo;
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
import com.ruoyi.common.mybatis.core.page.PageQuery;
/**
* {业务名称}Service接口
*/
public interface I{实体类名}Service {
/**
* 查询{业务名称}
*/
{实体类名}Vo queryById(Long id);
/**
* 查询{业务名称}列表
*/
TableDataInfo<{实体类名}Vo> queryPageList({实体类名}Bo bo, PageQuery pageQuery);
/**
* 新增{业务名称}
*/
Boolean insertByBo({实体类名}Bo bo);
/**
* 修改{业务名称}
*/
Boolean updateByBo({实体类名}Bo bo);
/**
* 删除{业务名称}
*/
Boolean deleteByIds(Long[] ids);
}
```
## Service 实现类模板
```java
package com.ruoyi.{module}.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.core.utils.MapstructUtils;
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
import com.ruoyi.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.ruoyi.{module}.domain.bo.{实体类名}Bo;
import com.ruoyi.{module}.domain.vo.{实体类名}Vo;
import com.ruoyi.{module}.domain.{实体类名};
import com.ruoyi.{module}.mapper.{实体类名}Mapper;
import com.ruoyi.{module}.service.I{实体类名}Service;
/**
* {业务名称}Service业务层处理
*/
@RequiredArgsConstructor
@Service
public class {实体类名}ServiceImpl implements I{实体类名}Service {
private final {实体类名}Mapper baseMapper;
@Override
public {实体类名}Vo queryById(Long id) {
return baseMapper.selectVoById(id);
}
@Override
public TableDataInfo<{实体类名}Vo> queryPageList({实体类名}Bo bo, PageQuery pageQuery) {
LambdaQueryWrapper<{实体类名}> lqw = buildQueryWrapper(bo);
Page<{实体类名}Vo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
private LambdaQueryWrapper<{实体类名}> buildQueryWrapper({实体类名}Bo bo) {
LambdaQueryWrapper<{实体类名}> lqw = Wrappers.lambdaQuery();
// 添加查询条件
return lqw;
}
@Override
public Boolean insertByBo({实体类名}Bo bo) {
{实体类名} entity = MapstructUtils.convert(bo, {实体类名}.class);
return baseMapper.insert(entity) > 0;
}
@Override
public Boolean updateByBo({实体类名}Bo bo) {
{实体类名} entity = MapstructUtils.convert(bo, {实体类名}.class);
return baseMapper.updateById(entity) > 0;
}
@Override
public Boolean deleteByIds(Long[] ids) {
return baseMapper.deleteByIds(Arrays.asList(ids)) > 0;
}
}
```
## Controller 模板
```java
package com.ruoyi.{module}.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.mybatis.core.page.PageQuery;
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
import com.ruoyi.common.web.core.BaseController;
import com.ruoyi.{module}.domain.bo.{实体类名}Bo;
import com.ruoyi.{module}.domain.vo.{实体类名}Vo;
import com.ruoyi.{module}.service.I{实体类名}Service;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
* {业务名称}Controller
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/{module}/{路径}")
@Tag(name = "{业务名称}管理", description = "{业务名称}管理")
public class {实体类名}Controller extends BaseController {
private final I{实体类名}Service service;
/**
* 查询{业务名称}列表
*/
@Operation(summary = "查询{业务名称}列表")
@SaCheckPermission("{模块}:{功能}:list")
@GetMapping("/list")
public TableDataInfo<{实体类名}Vo> list({实体类名}Bo bo, PageQuery pageQuery) {
return service.queryPageList(bo, pageQuery);
}
/**
* 获取{业务名称}详细信息
*/
@Operation(summary = "获取{业务名称}详细信息")
@SaCheckPermission("{模块}:{功能}:query")
@GetMapping("/{id}")
public R<{实体类名}Vo> getInfo(@PathVariable Long id) {
return R.ok(service.queryById(id));
}
/**
* 新增{业务名称}
*/
@Operation(summary = "新增{业务名称}")
@SaCheckPermission("{模块}:{功能}:add")
@PostMapping()
public R<Void> add(@Validated @RequestBody {实体类名}Bo bo) {
return toAjax(service.insertByBo(bo));
}
/**
* 修改{业务名称}
*/
@Operation(summary = "修改{业务名称}")
@SaCheckPermission("{模块}:{功能}:edit")
@PutMapping()
public R<Void> edit(@Validated @RequestBody {实体类名}Bo bo) {
return toAjax(service.updateByBo(bo));
}
/**
* 删除{业务名称}
*/
@Operation(summary = "删除{业务名称}")
@SaCheckPermission("{模块}:{功能}:remove")
@DeleteMapping("/{ids}")
public R<Void> remove(@PathVariable Long[] ids) {
return toAjax(service.deleteByIds(ids));
}
}
```
## 注意事项
1. 所有占位符 `{xxx}` 需要替换为实际值
2. 权限字符串格式: `模块:功能:操作` (如 `inspection:task:add`)
3. 实体类字段需要添加合适的验证注解
4. VO 和 BO 类需要单独创建
5. 复杂查询逻辑在 `buildQueryWrapper` 方法中实现

View File

@@ -0,0 +1,329 @@
# Vue3 + TypeScript + Element Plus 页面生成提示词
当需要创建新的前端页面时,按照以下模板生成代码:
## API 接口定义模板
```typescript
// src/api/{module}/{name}.ts
import request from '@/utils/request'
/**
* {业务名称} VO 接口
*/
export interface {Name}VO {
id?: number | string
// ... 其他字段
}
/**
* {业务名称} Form 接口
*/
export interface {Name}Form {
id?: number | string
// ... 其他字段
}
/**
* {业务名称} 查询参数
*/
export interface {Name}Query {
pageNum: number
pageSize: number
// ... 其他查询字段
}
/**
* 查询{业务名称}列表
*/
export const list{Name} = (params: {Name}Query) => {
return request({
url: '/{module}/{path}/list',
method: 'get',
params
})
}
/**
* 查询{业务名称}详情
*/
export const get{Name} = (id: number | string) => {
return request({
url: `/{module}/{path}/${id}`,
method: 'get'
})
}
/**
* 新增{业务名称}
*/
export const add{Name} = (data: {Name}Form) => {
return request({
url: '/{module}/{path}',
method: 'post',
data
})
}
/**
* 修改{业务名称}
*/
export const update{Name} = (data: {Name}Form) => {
return request({
url: '/{module}/{path}',
method: 'put',
data
})
}
/**
* 删除{业务名称}
*/
export const del{Name} = (ids: (number | string)[]) => {
return request({
url: `/{module}/{path}/${ids}`,
method: 'delete'
})
}
```
## 列表页面模板
```vue
<!-- src/views/{module}/{name}/index.vue -->
<script setup lang="ts" name="{Name}">
import { ref, reactive } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { {Name}VO, {Name}Query } from '@/api/{module}/{name}'
import { list{Name}, del{Name} } from '@/api/{module}/{name}'
// 查询参数
const queryParams = reactive<{Name}Query>({
pageNum: 1,
pageSize: 10
})
// 数据
const dataList = ref<{Name}VO[]>([])
const total = ref(0)
const loading = ref(false)
// 对话框
const dialogVisible = ref(false)
const dialogTitle = ref('')
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const res = await list{Name}(queryParams)
dataList.value = res.rows
total.value = res.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNum = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryParams.pageNum = 1
queryParams.pageSize = 10
// 重置其他查询字段
getList()
}
/** 新增按钮操作 */
const handleAdd = () => {
dialogTitle.value = '添加{业务名称}'
dialogVisible.value = true
}
/** 修改按钮操作 */
const handleUpdate = (row: {Name}VO) => {
dialogTitle.value = '修改{业务名称}'
dialogVisible.value = true
}
/** 删除按钮操作 */
const handleDelete = async (row: {Name}VO) => {
try {
await ElMessageBox.confirm(`是否确认删除该{业务名称}?`, '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
await del{Name}([row.id!])
ElMessage.success('删除成功')
await getList()
} catch (error) {
console.error(error)
}
}
// 初始化
getList()
</script>
<template>
<div class="p-2">
<!-- 搜索栏 -->
<el-form :model="queryParams" :inline="true">
<el-form-item label="关键词" prop="keyword">
<el-input
v-model="queryParams.keyword"
placeholder="请输入关键词"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">
<i-ep-search /> 搜索
</el-button>
<el-button @click="resetQuery">
<i-ep-refresh /> 重置
</el-button>
</el-form-item>
</el-form>
<!-- 工具栏 -->
<el-row :gutter="10" class="mb-2">
<el-col :span="1.5">
<el-button
type="primary"
plain
@click="handleAdd"
v-hasPermi="['{module}:{function}:add']"
>
<i-ep-plus /> 新增
</el-button>
</el-col>
</el-row>
<!-- 表格 -->
<el-table
v-loading="loading"
:data="dataList"
border
stripe
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" prop="id" width="100" />
<!-- 其他列 -->
<el-table-column label="操作" align="center" width="150" fixed="right">
<template #default="{ row }">
<el-button
link
type="primary"
@click="handleUpdate(row)"
v-hasPermi="['{module}:{function}:edit']"
>
修改
</el-button>
<el-button
link
type="danger"
@click="handleDelete(row)"
v-hasPermi="['{module}:{function}:remove']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 表单对话框 -->
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="600px">
<!-- 表单内容 -->
<template #footer>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitForm">确定</el-button>
</template>
</el-dialog>
</div>
</template>
```
## 表单组件模板
```vue
<!-- src/views/{module}/{name}/components/{Name}Form.vue -->
<script setup lang="ts">
import { ref, reactive } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import type { {Name}Form } from '@/api/{module}/{name}'
import { add{Name}, update{Name} } from '@/api/{module}/{name}'
const props = defineProps<{
id?: number | string
}>()
const emit = defineEmits<{
success: []
cancel: []
}>()
const formRef = ref<FormInstance>()
const formData = reactive<{Name}Form>({})
const rules = reactive<FormRules<{Name}Form>>({
// 字段验证规则
})
const submitForm = async () => {
if (!formRef.value) return
await formRef.value.validate()
try {
if (props.id) {
await update{Name}(formData)
} else {
await add{Name}(formData)
}
emit('success')
} catch (error) {
console.error(error)
}
}
defineExpose({
submitForm
})
</script>
<template>
<el-form
ref="formRef"
:model="formData"
:rules="rules"
label-width="100px"
>
<!-- 表单项 -->
</el-form>
</template>
```
## 注意事项
1. 所有占位符 `{xxx}` 需要替换为实际值
2. 使用 Composition API 和 `<script setup>` 语法
3. 权限指令格式: `v-hasPermi="['模块:功能:操作']"`
4. 使用 Element Plus 图标: `<i-ep-icon-name />`
5. 表单验证规则根据实际需求添加
6. 使用 TypeScript 进行类型约束
7. 组件命名使用 PascalCase

60
.claude/settings.json Normal file
View File

@@ -0,0 +1,60 @@
{
"name": "AR智能巡检平台",
"description": "基于 Spring Boot 3.5.7 + Vue 3 + TypeScript 的 AR 智能巡检管理系统",
"permissions": {
"allow": [
"Bash(mvn clean package:*)",
"Bash(mvn clean install:*)",
"Bash(mvn spring-boot\\:run:*)",
"Bash(mvn test:*)",
"Bash(npm install:*)",
"Bash(npm run dev:*)",
"Bash(npm run build\\:*)",
"Bash(npm run lint\\:*)",
"Bash(git status:*)",
"Bash(git diff:*)",
"Bash(git log:*)"
],
"deny": [
"Bash(rm -rf:*)",
"Bash(mvn clean:* -Pprod)"
],
"ask": [
"Bash(git push:*)",
"Bash(git commit:*)",
"Bash(mvn deploy:*)"
]
},
"rules": {
"codeStyle": {
"java": {
"indent": 4,
"lineLength": 120,
"naming": {
"class": "PascalCase",
"method": "camelCase",
"constant": "UPPER_SNAKE_CASE"
}
},
"typescript": {
"indent": 2,
"lineLength": 100,
"quotes": "single"
}
},
"patterns": {
"backend": {
"controller": "ruoyi-modules/*/src/main/java/**/controller/*.java",
"service": "ruoyi-modules/*/src/main/java/**/service/**/*.java",
"mapper": "ruoyi-modules/*/src/main/java/**/mapper/*.java",
"domain": "ruoyi-modules/*/src/main/java/**/domain/*.java"
},
"frontend": {
"views": "plus-ui/src/views/**/*.vue",
"components": "plus-ui/src/components/**/*.vue",
"api": "plus-ui/src/api/**/*.ts",
"store": "plus-ui/src/store/**/*.ts"
}
}
}
}

View File

@@ -1,7 +1,9 @@
{
"permissions": {
"allow": [
"Bash(tree:*)"
"Bash(tree:*)",
"Bash(mvn clean package:*)",
"Bash(echo:*)"
],
"deny": [],
"ask": []

600
CLAUDE.md
View File

@@ -4,100 +4,44 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## 项目概述
这是一个基于 RuoYi-Vue-Plus 5.5.1 的分布式多租户管理系统,采用前后端分离架构:
- **后端**: Spring Boot 3.5.7 + JDK 17/21 + MyBatis-Plus
- **前端**: Vue 3 + TypeScript + Element Plus + Vite
这是一个基于 **RuoYi-Vue-Plus 5.5.1** 框架的 **AR 智能巡检平台**,采用前后端分离架构:
## 开发环境要求
- **后端**: Spring Boot 3.5.7 + Java 17 + Maven 多模块
- **前端**: Vue 3.5.13 + TypeScript 5.8.3 + Vite 6.3.2
- **数据库**: MySQL / PostgreSQL / Oracle + MyBatis-Plus 3.5.14
- **缓存**: Redis + Redisson 3.51.0 (非 Lettuce)
- **认证**: Sa-Token 1.44.0 (非 Spring Security)
### 后端
### 开发环境要求
**后端环境:**
- JDK 17 或 JDK 21
- Maven 3.6+
- MySQL 5.7+ / Oracle / PostgreSQL / SQL Server
- MySQL 5.7+ / PostgreSQL / Oracle / SQL Server
- Redis 5.0+
### 前端
**前端环境:**
- Node.js >= 18.18.0
- npm >= 8.9.0
## 常用命令
### 后端开发
```bash
# 编译项目(跳过测试)
mvn clean install -DskipTests
# 运行项目(默认 dev 环境)
mvn spring-boot:run
# 运行项目(指定环境)
mvn spring-boot:run -Plocal
mvn spring-boot:run -Pprod
# 运行单元测试
mvn test
# 打包生产环境
mvn clean package -Pprod
# 主应用入口
# ruoyi-admin/src/main/java/org/dromara/DromaraApplication.java
```
### 前端开发
```bash
# 进入前端目录
cd plus-ui
# 安装依赖
npm install --registry=https://registry.npmmirror.com
# 启动开发服务器 (http://localhost:80)
npm run dev
# 构建生产环境
npm run build:prod
# 构建开发环境
npm run build:dev
# 代码检查和修复
npm run lint:eslint:fix
# 代码格式化
npm prettier
```
### Docker 部署
```bash
# 使用 docker-compose 启动所有服务(MySQL + Redis + Nginx 等)
cd script/docker
docker-compose up -d
# 停止所有服务
docker-compose down
```
## 项目架构
## 项目架构详解
### 后端模块结构
```
ruoyi-vue-plus/
ar-inspection/
├── ruoyi-admin/ # 主应用模块,Web服务入口
├── ruoyi-common/ # 通用模块(插件化架构)
│ ├── ruoyi-common-core/ # 核心模块
├── ruoyi-common/ # 通用功能模块(插件化架构)
│ ├── ruoyi-common-core/ # 核心工具包
│ ├── ruoyi-common-mybatis/ # MyBatis-Plus 集成
│ ├── ruoyi-common-security/ # Sa-Token 安全认证
│ ├── ruoyi-common-oss/ # 对象存储(S3/Minio)
│ ├── ruoyi-common-doc/ # SpringDoc API文档
│ ├── ruoyi-common-redis/ # Redis 缓存
│ ├── ruoyi-common-job/ # SnailJob 定时任务
│ ├── ruoyi-common-oss/ # 对象存储(S3/MinIO)
│ ├── ruoyi-common-doc/ # SpringDoc API文档
│ ├── ruoyi-common-web/ # Web 配置
│ ├── ruoyi-common-json/ # Jackson 序列化
│ ├── ruoyi-common-log/ # 操作日志
│ ├── ruoyi-common-web/ # Web 配置
│ ├── ruoyi-common-job/ # SnailJob 定时任务
│ ├── ruoyi-common-translation/# 数据翻译
│ ├── ruoyi-common-encrypt/ # 数据加解密
│ ├── ruoyi-common-sensitive/ # 数据脱敏
@@ -107,14 +51,15 @@ ruoyi-vue-plus/
│ ├── ruoyi-common-sms/ # 短信服务
│ ├── ruoyi-common-mail/ # 邮件服务
│ └── ruoyi-common-websocket/ # WebSocket/SSE
├── ruoyi-modules/ # 业务模块
├── ruoyi-modules/ # 业务功能模块
│ ├── ruoyi-system/ # 系统管理模块
│ ├── ruoyi-inspection/ # AR智能巡检模块
│ ├── ruoyi-generator/ # 代码生成器
│ ├── ruoyi-demo/ # 演示案例
│ ├── ruoyi-workflow/ # 工作流模块(Warm-Flow)
│ └── ruoyi-job/ # 任务调度
└── ruoyi-extend/ # 扩展模块
├── ruoyi-monitor-admin/ # SpringBoot Admin 监控
├── ruoyi-monitor-admin/ # Spring Boot Admin 监控
└── ruoyi-snailjob-server/ # SnailJob 调度中心
```
@@ -149,67 +94,206 @@ plus-ui/
### 后端核心组件
1. **权限认证**: Sa-Token + JWT (非 Spring Security)
- 支持登录校验、角色校验、权限校验、二级认证
1. **权限认证: Sa-Token + JWT** (非 Spring Security)
- 支持登录校验、角色校验、权限校验、二级认证
- 支持复杂权限表达式 (AND/OR)
- 轻量级,性能优于 Spring Security
2. **ORM 框架**: MyBatis-Plus
2. **ORM 框架: MyBatis-Plus**
- 雪花ID主键 (ASSIGN_ID)
- 多租户插件 (默认启用)
- 数据权限插件
- 分页插件
- 逻辑删除支持
3. **缓存方案**: Redisson (非 Lettuce)
3. **缓存方案: Redisson** (非 Lettuce)
- 支持分布式锁 (Lock4j)
- 支持 Spring Cache 注解
- 更强大的分布式特性
4. **多数据源**: Dynamic-Datasource
4. **多数据源: Dynamic-Datasource**
- 支持异构数据库动态切换
- 支持多主多从、混合模式
5. **任务调度**: SnailJob (非 Quartz)
5. **任务调度: SnailJob** (非 Quartz)
- 分布式任务调度
- 支持分片、重试、DAG 任务流
- 可视化管理界面
6. **工作流引擎**: Warm-Flow
6. **工作流引擎: Warm-Flow**
- 国产工作流引擎
- 支持复杂审批流程
- 轻量级,易于扩展
7. **文件存储**: MinIO / AWS S3
7. **文件存储: MinIO / AWS S3**
- 支持七牛、阿里云、腾讯云等
- 统一的 OSS 抽象接口
8. **API 文档**: SpringDoc (非 Springfox)
8. **API 文档: SpringDoc** (非 Springfox)
- 基于 javadoc 注释自动生成
- 零注解入侵
- 符合 OpenAPI 3.0 规范
### 前端核心特性
1. **UI 框架**: Element Plus
2. **状态管理**: Pinia (非 Vuex)
3. **路由**: Vue Router 4
4. **HTTP 客户端**: Axios
5. **表格组件**: vxe-table
1. **UI 框架**: Element Plus 2.9.8
2. **状态管理**: Pinia 3.0.2 (非 Vuex)
3. **路由**: Vue Router 4.5.0
4. **HTTP 客户端**: Axios 1.8.4
5. **表格组件**: vxe-table 4.13.7
6. **接口加密**: RSA + AES 动态加密
7. **原子化CSS**: UnoCSS
## 项目特定技术规范
### 后端开发规范
1. **模块结构**:
- `ruoyi-admin/` - 主应用入口,负责启动和全局配置
- `ruoyi-common/` - 通用功能模块(不要随意修改)
- `ruoyi-modules/` - 业务模块目录
- `ruoyi-system/` - 系统管理模块
- `ruoyi-inspection/` - AR巡检核心业务模块
- 其他业务模块按功能划分
2. **代码分层**:
```
controller/ # 控制器层,处理HTTP请求
service/ # 业务逻辑层接口
service/impl/ # 业务逻辑实现
mapper/ # 数据访问层
domain/ # 实体类
vo/ # 视图对象
bo/ # 业务对象
```
3. **必须遵循的规范**:
- 实体类必须继承 `BaseEntity` 并使用 Lombok 注解
- Mapper 接口继承 `BaseMapperPlus<实体类Mapper, 实体类, VO类>`
- Service 实现类使用 `@RequiredArgsConstructor` 注入依赖
- Controller 统一返回 `R<T>` 类型
- 使用 `@SaCheckPermission` 进行权限控制
- 所有 API 添加 Swagger 注解: `@Tag`, `@Operation`, `@Parameters`
4. **命名约定**:
- 实体类: `XxxEntity` 或直接 `Xxx`
- Mapper: `XxxMapper`
- Service: `IXxxService` (接口) / `XxxServiceImpl` (实现)
- Controller: `XxxController`
- VO: `XxxVo`
- BO: `XxxBo`
5. **数据库操作**:
- 优先使用 MyBatis-Plus 的内置方法
- 复杂查询在 Mapper XML 中编写
- 使用 `LambdaQueryWrapper` 构建动态查询
- 分页使用 `TableDataInfo<T>` 和 `PageQuery`
### 前端开发规范
1. **目录结构**:
```
plus-ui/
├── src/
│ ├── api/ # API接口定义
│ ├── views/ # 页面视图
│ ├── components/ # 可复用组件
│ ├── store/ # Pinia状态管理
│ ├── router/ # 路由配置
│ ├── utils/ # 工具函数
│ └── types/ # TypeScript类型定义
```
2. **组件开发**:
- 使用 Vue 3 Composition API (`<script setup lang="ts">`)
- 优先使用 Element Plus 组件
- 表单使用 `el-form` + 表单验证规则
- 表格使用 `vxe-table` 或 `el-table`
- 使用 `useRouter`, `useRoute` 进行路由操作
3. **API 调用规范**:
- API 定义在 `src/api/` 目录,按模块分文件
- 使用 `request` 工具发起请求
- 统一错误处理,使用 `ElMessage` 显示提示
- 类型定义使用 TypeScript interface
4. **状态管理**:
- 使用 Pinia 管理全局状态
- Store 文件放在 `src/store/modules/`
- 使用组合式 API: `defineStore`
5. **样式规范**:
- 使用 `<style scoped lang="scss">`
- 优先使用 UnoCSS 原子类
- 遵循 BEM 命名规范
- 响应式布局使用 Element Plus 的栅格系统
### 常用命令
**后端开发**:
```bash
# 构建项目(跳过测试)
mvn clean install -DskipTests
# 启动后端服务
cd ruoyi-admin && mvn spring-boot:run -Dspring-boot.run.profiles=dev
# 运行测试
mvn test
# 打包生产环境
mvn clean package -Pprod -DskipTests
```
**前端开发**:
```bash
# 安装依赖
cd plus-ui && npm install --registry=https://registry.npmmirror.com
# 启动开发服务器
npm run dev
# 构建生产环境
npm run build:prod
# 代码检查和修复
npm run lint:eslint:fix
# 代码格式化
npm run prettier
```
### 自定义斜杠命令
- `/build` - 构建整个 Maven 项目
- `/start-backend` - 启动后端 Spring Boot 服务
- `/start-frontend` - 启动前端 Vue3 开发服务器
- `/lint` - 运行前端代码检查和格式化
- `/new-module` - 创建新的业务模块脚手架
- `/analyze` - 分析项目架构和依赖关系
## 配置说明
### 后端配置
- **主配置文件**: `ruoyi-admin/src/main/resources/application.yml`
- **环境配置**:
- `application-dev.yml` (开发)
- `application-prod.yml` (生产)
- `application-local.yml` (本地)
**主配置文件**: `ruoyi-admin/src/main/resources/application.yml`
- **环境切换**: 通过 Maven Profile 切换
```xml
<profiles.active>dev|prod|local</profiles.active>
```
**环境配置文件**:
- `application-dev.yml` - 开发环境
- `application-prod.yml` - 生产环境
- `application-local.yml` - 本地环境
### 前端配置
**多环境切换**: 通过 Maven Profile 切换
```bash
# 开发环境(默认)
mvn spring-boot:run -Pdev
- **环境变量**: `.env.development` / `.env.production`
- **代理配置**: `vite.config.ts` 中配置后端代理
- 默认代理到 `http://localhost:8080`
# 本地环境
mvn spring-boot:run -Plocal
# 生产环境
mvn spring-boot:run -Pprod
```
### 重要配置项
@@ -218,56 +302,294 @@ plus-ui/
3. **数据加密**: `mybatis-encryptor.enable=false` (默认关闭)
4. **WebSocket**: 默认关闭,推荐使用 SSE
5. **验证码**: `captcha.enable=true`
6. **逻辑删除**: `mybatis-plus.enableLogicDelete=true`
## 数据库说明
### 前端配置
- **主键策略**: 雪花ID (ASSIGN_ID),不使用数据库自增
- **逻辑删除**: 默认启用 (`mybatis-plus.enableLogicDelete=true`)
- **多租户表**: 自动添加 `tenant_id` 字段 (排除表在配置中指定)
**环境变量**: `.env.development` / `.env.production`
## 代码生成器
```bash
# 应用标题
VITE_APP_TITLE = AR智能巡检平台
位于系统管理 -> 代码生成模块:
- 支持多数据源代码生成
- 自动生成 Controller、Service、Mapper、Vue 页面
- 符合项目规范的代码风格
# 后端接口地址
VITE_APP_BASE_API = /dev-api
# 应用访问路径
VITE_APP_CONTEXT_PATH = /
```
**代理配置**: `vite.config.ts` 中配置后端代理,默认代理到 `http://localhost:8080`
## 数据库设计
### 主键策略
- 使用 **雪花ID** (ASSIGN_ID),不使用数据库自增
- 分布式友好,全局唯一
- 64位长整型
### 逻辑删除
- 默认启用逻辑删除
- 删除字段: `del_flag` (0=正常, 1=删除)
- 查询时自动过滤已删除数据
### 多租户设计
- 自动添加 `tenant_id` 字段
- 支持租户隔离
- 排除表在配置中指定
- 使用 `@TenantIgnore` 注解排除租户过滤
### 数据权限
- 基于部门和角色的数据权限
- 支持本部门、本部门及以下、仅本人等权限范围
- 通过 MyBatis-Plus 插件实现
## 监控与运维
1. **应用监控**: Spring Boot Admin
- 访问地址: `http://localhost:9090/admin`
- 用户名/密码: 配置文件中设置
### 服务端口
2. **任务调度中心**: SnailJob
- 访问地址: `http://localhost:8800/snail-job`
- **后端应用**: 8080
- **前端应用**: 80
- **Spring Boot Admin**: 9090
- **SnailJob Server**: 8800
- **SnailJob Client**: 28080
3. **API 文档**: SpringDoc
- 开发环境访问: `http://localhost:8080/doc.html`
### 监控工具
4. **日志**: Logback
1. **应用监控: Spring Boot Admin**
- 访问地址: http://localhost:9090/admin
- 用户名/密码: 在 `application.yml` 中配置
- 功能: 应用健康检查、日志查看、环境信息
2. **任务调度中心: SnailJob**
- 访问地址: http://localhost:8800/snail-job
- 功能: 任务管理、执行日志、任务编排
3. **API 文档: SpringDoc**
- 开发环境: http://localhost:8080/doc.html
- 生产环境: 根据需要启用/禁用
- 零注解,基于 Javadoc 自动生成
4. **日志管理**
- 日志路径: `./logs/sys-console.log`
- 使用 Logback
- 支持在线日志查看(通过监控中心)
## 测试
### 代码生成器
- **单元测试**: 使用 JUnit 5 + Spring Boot Test
- 位置: 系统管理 -> 代码生成
- 访问: http://localhost:8080/tool/gen
- 功能:
- 支持多数据源代码生成
- 自动生成 Controller、Service、Mapper、Vue 页面
- 符合项目规范的代码风格
- 生成后需根据业务需求调整
### 项目特定注意事项
1. **AR 巡检业务模块** (`ruoyi-inspection`):
- 核心业务逻辑,修改需谨慎
- 涉及设备点位、巡检任务、缺陷记录等核心功能
- 修改前先阅读业务设计文档: `AR-INSPECTION-DESIGN.md`
2. **权限控制**:
- 使用 Sa-Token 进行权限认证
- 权限字符串格式: `模块:功能:操作` (如 `system:user:add`)
- 菜单权限在数据库 `sys_menu` 表管理
3. **文件存储**:
- 使用 OSS 进行文件存储(支持 MinIO, 阿里云OSS等)
- 配置在 `application-*.yml` 中的 `oss` 节点
4. **多租户支持**:
- 框架内置多租户功能
- 通过 `@TenantIgnore` 注解排除租户过滤
5. **代码生成器**:
- 访问 http://localhost:8080/tool/gen
- 可快速生成 CRUD 代码
- 生成后需根据业务需求调整
### 问题排查
1. **后端启动失败**:
- 检查数据库连接配置
- 检查 Redis 是否启动
- 查看日志: `logs/sys-console.log`
2. **前端启动失败**:
- 删除 `node_modules` 重新安装
- 检查 Node.js 版本 >= 18.18.0
- 检查端口 80 是否被占用
3. **接口调用失败**:
- 检查后端服务是否启动
- 检查跨域配置
- 查看浏览器控制台和网络请求
## 框架技术注意事项
### 架构特点
1. **插件化架构**
- 各 `ruoyi-common-*` 模块相互独立
- 可按需引入功能模块
- 易于扩展和维护
2. **编码规范**
- 严格遵守 Alibaba Java 编码规范
- 使用 Lombok 简化代码
- IDE 需要安装 Lombok 插件
3. **对象转换**
- 使用 MapStruct-Plus 进行对象转换
- 避免使用 BeanUtils.copyProperties
- 性能优于反射方式
### 技术选型说明
1. **数据库连接池**: HikariCP (非 Druid)
- 性能更优
- Spring Boot 默认连接池
2. **Web 容器**: Undertow (非 Tomcat)
- 非阻塞 IO
- 内存占用更小
- 高并发性能更好
3. **JSON 序列化**: Jackson (非 Fastjson)
- 安全性更高
- Spring Boot 默认选择
4. **接口加密**
- 前后端需同时开启/关闭
- RSA + AES 混合加密
- 开发环境建议关闭
### 测试
- **单元测试**: JUnit 5 + Spring Boot Test
- **运行测试**: `mvn test`
- **测试分组**: 通过 `@Tag` 注解标记,根据环境执行
- `@Tag("dev")` - 开发环境测试
- `@Tag("prod")` - 生产环境测试
- `@Tag("exclude")` - 排除的测试
## 注意事项
### Docker 部署
1. 项目采用插件化架构,各 `ruoyi-common-*` 模块相互独立,易于扩展
2. 严格遵守 Alibaba Java 编码规范
3. 使用 Lombok 简化代码,需要IDE安装 Lombok 插件
4. 使用 MapStruct-Plus 进行对象转换
5. 前端使用 TypeScript,需要注意类型定义
6. 接口加密功能前后端需同时开启/关闭
7. 数据库连接池使用 HikariCP (非 Druid)
8. Web 容器使用 Undertow (非 Tomcat)
```bash
# 使用 docker-compose 启动所有服务
cd script/docker
docker-compose up -d
## 部署端口
# 包含: MySQL + Redis + Nginx + 应用服务
- 后端应用: 8080
- 前端应用: 80
- SnailJob 客户端: 28080
- Spring Boot Admin: 9090
- SnailJob Server: 8800
# 停止所有服务
docker-compose down
```
## Universal Development Guidelines
### Code Quality Standards
- Write clean, readable, and maintainable code
- Follow consistent naming conventions across the project
- Use meaningful variable and function names
- Keep functions focused and single-purpose
- Add comments for complex logic and business rules
### Git Workflow
- Use descriptive commit messages following conventional commits format
- Create feature branches for new development
- Keep commits atomic and focused on single changes
- Use pull requests for code review before merging
- Maintain a clean commit history
### Documentation
- Keep README.md files up to date
- Document public APIs and interfaces
- Include usage examples for complex features
- Maintain inline code documentation
- Update documentation when making changes
### Testing Approach
- Write tests for new features and bug fixes
- Maintain good test coverage
- Use descriptive test names that explain the expected behavior
- Organize tests logically by feature or module
- Run tests before committing changes
### Security Best Practices
- Never commit sensitive information (API keys, passwords, tokens)
- Use environment variables for configuration
- Validate input data and sanitize outputs
- Follow principle of least privilege
- Keep dependencies updated
## Project Structure Guidelines
### File Organization
- Group related files in logical directories
- Use consistent file and folder naming conventions
- Separate source code from configuration files
- Keep build artifacts out of version control
- Organize assets and resources appropriately
### Configuration Management
- Use configuration files for environment-specific settings
- Centralize configuration in dedicated files
- Use environment variables for sensitive or environment-specific data
- Document configuration options and their purposes
- Provide example configuration files
## Development Workflow
### Before Starting Work
1. Pull latest changes from main branch
2. Create a new feature branch
3. Review existing code and architecture
4. Plan the implementation approach
### During Development
1. Make incremental commits with clear messages
2. Run tests frequently to catch issues early
3. Follow established coding standards
4. Update documentation as needed
### Before Submitting
1. Run full test suite
2. Check code quality and formatting
3. Update documentation if necessary
4. Create clear pull request description
## Common Patterns
### Error Handling
- Use appropriate error handling mechanisms for the language
- Provide meaningful error messages
- Log errors appropriately for debugging
- Handle edge cases gracefully
- Don't expose sensitive information in error messages
### Performance Considerations
- Profile code for performance bottlenecks
- Optimize database queries and API calls
- Use caching where appropriate
- Consider memory usage and resource management
- Monitor and measure performance metrics
### Code Reusability
- Extract common functionality into reusable modules
- Use dependency injection for better testability
- Create utility functions for repeated operations
- Design interfaces for extensibility
- Follow DRY (Don't Repeat Yourself) principle
## Review Checklist
Before marking any task as complete:
- [ ] Code follows established conventions
- [ ] Tests are written and passing
- [ ] Documentation is updated
- [ ] Security considerations are addressed
- [ ] Performance impact is considered
- [ ] Code is reviewed for maintainability

View File

@@ -0,0 +1,273 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## 项目概述
这是一个基于 RuoYi-Vue-Plus 5.5.1 的分布式多租户管理系统,采用前后端分离架构:
- **后端**: Spring Boot 3.5.7 + JDK 17/21 + MyBatis-Plus
- **前端**: Vue 3 + TypeScript + Element Plus + Vite
## 开发环境要求
### 后端
- JDK 17 或 JDK 21
- Maven 3.6+
- MySQL 5.7+ / Oracle / PostgreSQL / SQL Server
### 前端
- Node.js >= 18.18.0
- npm >= 8.9.0
## 常用命令
### 后端开发
```bash
# 编译项目(跳过测试)
mvn clean install -DskipTests
# 运行项目(默认 dev 环境)
mvn spring-boot:run
# 运行项目(指定环境)
mvn spring-boot:run -Plocal
mvn spring-boot:run -Pprod
# 运行单元测试
mvn test
# 打包生产环境
mvn clean package -Pprod
# 主应用入口
# ruoyi-admin/src/main/java/org/dromara/DromaraApplication.java
```
### 前端开发
```bash
# 进入前端目录
cd plus-ui
# 安装依赖
npm install --registry=https://registry.npmmirror.com
# 启动开发服务器 (http://localhost:80)
npm run dev
# 构建生产环境
npm run build:prod
# 构建开发环境
npm run build:dev
# 代码检查和修复
npm run lint:eslint:fix
# 代码格式化
npm prettier
```
### Docker 部署
```bash
# 使用 docker-compose 启动所有服务(MySQL + Redis + Nginx 等)
cd script/docker
docker-compose up -d
# 停止所有服务
docker-compose down
```
## 项目架构
### 后端模块结构
```
ruoyi-vue-plus/
├── ruoyi-admin/ # 主应用模块,Web服务入口
├── ruoyi-common/ # 通用模块(插件化架构)
│ ├── ruoyi-common-core/ # 核心模块
│ ├── ruoyi-common-mybatis/ # MyBatis-Plus 集成
│ ├── ruoyi-common-security/ # Sa-Token 安全认证
│ ├── ruoyi-common-oss/ # 对象存储(S3/Minio)
│ ├── ruoyi-common-doc/ # SpringDoc API文档
│ ├── ruoyi-common-redis/ # Redis 缓存
│ ├── ruoyi-common-job/ # SnailJob 定时任务
│ ├── ruoyi-common-json/ # Jackson 序列化
│ ├── ruoyi-common-log/ # 操作日志
│ ├── ruoyi-common-web/ # Web 配置
│ ├── ruoyi-common-translation/# 数据翻译
│ ├── ruoyi-common-encrypt/ # 数据加解密
│ ├── ruoyi-common-sensitive/ # 数据脱敏
│ ├── ruoyi-common-idempotent/ # 幂等处理
│ ├── ruoyi-common-ratelimiter/# 限流
│ ├── ruoyi-common-social/ # 第三方登录
│ ├── ruoyi-common-sms/ # 短信服务
│ ├── ruoyi-common-mail/ # 邮件服务
│ └── ruoyi-common-websocket/ # WebSocket/SSE
├── ruoyi-modules/ # 业务模块
│ ├── ruoyi-system/ # 系统管理模块
│ ├── ruoyi-generator/ # 代码生成器
│ ├── ruoyi-demo/ # 演示案例
│ ├── ruoyi-workflow/ # 工作流模块(Warm-Flow)
│ └── ruoyi-job/ # 任务调度
└── ruoyi-extend/ # 扩展模块
├── ruoyi-monitor-admin/ # SpringBoot Admin 监控
└── ruoyi-snailjob-server/ # SnailJob 调度中心
```
### 前端目录结构
```
plus-ui/
├── src/
│ ├── api/ # API 接口定义
│ │ ├── demo/ # 演示模块
│ │ ├── monitor/ # 监控模块
│ │ ├── system/ # 系统管理
│ │ ├── tool/ # 工具模块
│ │ └── workflow/ # 工作流
│ ├── assets/ # 静态资源
│ ├── components/ # 公共组件
│ ├── directive/ # 自定义指令
│ ├── hooks/ # 组合式函数
│ ├── layout/ # 布局组件
│ ├── lang/ # 国际化
│ ├── plugins/ # 插件封装
│ ├── router/ # 路由配置
│ ├── store/ # Pinia 状态管理
│ ├── types/ # TypeScript 类型定义
│ ├── utils/ # 工具函数
│ └── views/ # 页面视图
├── vite/ # Vite 插件配置
└── vite.config.ts # Vite 配置文件
```
## 核心技术架构
### 后端核心组件
1. **权限认证**: Sa-Token + JWT (非 Spring Security)
- 支持登录校验、角色校验、权限校验、二级认证等
- 支持复杂权限表达式 (AND/OR)
2. **ORM 框架**: MyBatis-Plus
- 雪花ID主键 (ASSIGN_ID)
- 多租户插件 (默认启用)
- 数据权限插件
- 分页插件
3. **缓存方案**: Redisson (非 Lettuce)
- 支持分布式锁 (Lock4j)
- 支持 Spring Cache 注解
4. **多数据源**: Dynamic-Datasource
- 支持异构数据库动态切换
5. **任务调度**: SnailJob (非 Quartz)
- 分布式任务调度
- 支持分片、重试、DAG 任务流
6. **工作流引擎**: Warm-Flow
- 国产工作流引擎
- 支持复杂审批流程
7. **文件存储**: MinIO / AWS S3
- 支持七牛、阿里云、腾讯云等
8. **API 文档**: SpringDoc (非 Springfox)
- 基于 javadoc 注释自动生成
- 零注解入侵
### 前端核心特性
1. **UI 框架**: Element Plus
2. **状态管理**: Pinia (非 Vuex)
3. **路由**: Vue Router 4
4. **HTTP 客户端**: Axios
5. **表格组件**: vxe-table
6. **接口加密**: RSA + AES 动态加密
## 配置说明
### 后端配置
- **主配置文件**: `ruoyi-admin/src/main/resources/application.yml`
- **环境配置**:
- `application-dev.yml` (开发)
- `application-prod.yml` (生产)
- `application-local.yml` (本地)
- **多环境切换**: 通过 Maven Profile 切换
```xml
<profiles.active>dev|prod|local</profiles.active>
```
### 前端配置
- **环境变量**: `.env.development` / `.env.production`
- **代理配置**: `vite.config.ts` 中配置后端代理
- 默认代理到 `http://localhost:8080`
### 重要配置项
1. **多租户**: `tenant.enable=true` (默认开启)
2. **接口加密**: `api-decrypt.enabled=true`
3. **数据加密**: `mybatis-encryptor.enable=false` (默认关闭)
4. **WebSocket**: 默认关闭,推荐使用 SSE
5. **验证码**: `captcha.enable=true`
## 数据库说明
- **主键策略**: 雪花ID (ASSIGN_ID),不使用数据库自增
- **逻辑删除**: 默认启用 (`mybatis-plus.enableLogicDelete=true`)
- **多租户表**: 自动添加 `tenant_id` 字段 (排除表在配置中指定)
## 代码生成器
位于系统管理 -> 代码生成模块:
- 支持多数据源代码生成
- 自动生成 Controller、Service、Mapper、Vue 页面
- 符合项目规范的代码风格
## 监控与运维
1. **应用监控**: Spring Boot Admin
- 访问地址: `http://localhost:9090/admin`
- 用户名/密码: 配置文件中设置
2. **任务调度中心**: SnailJob
- 访问地址: `http://localhost:8800/snail-job`
3. **API 文档**: SpringDoc
- 开发环境访问: `http://localhost:8080/doc.html`
4. **日志**: Logback
- 日志路径: `./logs/sys-console.log`
## 测试
- **单元测试**: 使用 JUnit 5 + Spring Boot Test
- **运行测试**: `mvn test`
- **测试分组**: 通过 `@Tag` 注解标记,根据环境执行
## 注意事项
1. 项目采用插件化架构,各 `ruoyi-common-*` 模块相互独立,易于扩展
2. 严格遵守 Alibaba Java 编码规范
3. 使用 Lombok 简化代码,需要IDE安装 Lombok 插件
4. 使用 MapStruct-Plus 进行对象转换
5. 前端使用 TypeScript,需要注意类型定义
6. 接口加密功能前后端需同时开启/关闭
7. 数据库连接池使用 HikariCP (非 Druid)
8. Web 容器使用 Undertow (非 Tomcat)
## 部署端口
- 后端应用: 8080
- 前端应用: 80
- SnailJob 客户端: 28080
- Spring Boot Admin: 9090
- SnailJob Server: 8800

View File

@@ -357,6 +357,13 @@
<version>${revision}</version>
</dependency>
<!-- AR智能巡检模块 -->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-inspection</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@@ -3,6 +3,8 @@ package org.dromara.inspection.domain.vo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.inspection.domain.ArDevice;
@@ -55,7 +57,8 @@ public class ArDeviceVo implements Serializable {
/**
* 状态(0启用 1停用)
*/
@ExcelProperty(value = "状态", readConverterExp = "0=启用,1=停用")
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "0=启用,1=停用")
private String status;
/**

View File

@@ -3,6 +3,8 @@ package org.dromara.inspection.domain.vo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.inspection.domain.ArExecution;
@@ -120,7 +122,8 @@ public class ArExecutionVo implements Serializable {
/**
* 状态
*/
@ExcelProperty(value = "状态", readConverterExp = "pending=待执行,in_progress=执行中,completed=已完成,cancelled=已取消")
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "pending=待执行,in_progress=执行中,completed=已完成,cancelled=已取消")
private String status;
/**

View File

@@ -3,6 +3,8 @@ package org.dromara.inspection.domain.vo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.inspection.domain.ArRegion;
@@ -54,7 +56,8 @@ public class ArRegionVo implements Serializable {
/**
* 状态(0正常 1停用)
*/
@ExcelProperty(value = "状态", readConverterExp = "0=正常,1=停用")
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
private String status;
/**

View File

@@ -3,6 +3,8 @@ package org.dromara.inspection.domain.vo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.inspection.domain.ArStepMedia;
@@ -40,7 +42,8 @@ public class ArStepMediaVo implements Serializable {
/**
* 媒体类型
*/
@ExcelProperty(value = "媒体类型", readConverterExp = "image=图片,video=视频,audio=音频")
@ExcelProperty(value = "媒体类型", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "image=图片,video=视频,audio=音频")
private String mediaType;
/**

View File

@@ -3,6 +3,8 @@ package org.dromara.inspection.domain.vo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.inspection.domain.ArStepRecord;
@@ -48,13 +50,15 @@ public class ArStepRecordVo implements Serializable {
/**
* 状态
*/
@ExcelProperty(value = "状态", readConverterExp = "pending=待执行,completed=已完成,skipped=已跳过")
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "pending=待执行,completed=已完成,skipped=已跳过")
private String status;
/**
* 是否完成
*/
@ExcelProperty(value = "是否完成", readConverterExp = "0=否,1=是")
@ExcelProperty(value = "是否完成", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "0=否,1=是")
private String isDone;
/**

View File

@@ -3,6 +3,8 @@ package org.dromara.inspection.domain.vo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.format.DateTimeFormat;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.inspection.domain.ArTask;
@@ -60,7 +62,8 @@ public class ArTaskVo implements Serializable {
/**
* 状态(0正常 1停用)
*/
@ExcelProperty(value = "状态", readConverterExp = "0=正常,1=停用")
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
private String status;
/**