Files

89 lines
2.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2026-05-23 会话记忆
## 项目:tiny-erp
### 核心决策
1. **包路径确定**`com.witsoft.erp`(不是 com.example 或 com.witsoft.tinyerp
- tiny 是项目别名,包名使用正式名称 erp
2. **技术栈确认**
- JDK 11+(不是 1.8
- Spring Boot 2.7.18
- MyBatis Plus 3.5.3.1
- PostgreSQL 14+
- Spring Security + JWT (jjwt 0.11.5)
- SpringDoc OpenAPI 3(不是 Knife4j
3. **多租户方案**ecid 字段隔离 + TenantLineHandler 自动拦截
- 系统表(sys_*)不进行租户隔离(登录时需要查询)
- 业务表全部需要 ecid 隔离
- **所有表的 ecid 字段为 NOT NULL**
4. **API 设计规范**
- 分页列表接口使用 POST(不是 GET)
- 请求体携带查询条件 + 分页参数
- 统一返回格式:{code, message, data}
5. **异常处理规范**
- BusinessException 支持自定义错误码
- GlobalExceptionHandler 统一处理各类异常
- 参数校验失败返回 400 + 具体错误信息
6. **模块命名**:基础数据模块(bd)替代主数据模块(md)
### 已完成模块
| 模块 | 功能 | 状态 |
|------|------|------|
| system | 租户、用户、字典、JWT 认证 | ✅ |
| bd | 物料分类、工厂、仓库、物料 | ✅ |
| om | 销售订单、发货单(含库存扣减) | ✅ |
| mc | 采购订单 | ✅ |
| im | 库存查询、库存流水 | ✅ |
### 数据库脚本结构
```
scripts/postgresql/
├── 00-init.sql # 数据库初始化
├── 10-system.sql # 系统模块
├── 20-basic-data.sql # 基础数据模块
├── 30-sales.sql # 销售模块
├── 40-purchase.sql # 采购模块
├── 50-inventory.sql # 库存模块
└── 99-data.sql # 初始化数据
```
### 默认账号
- admin / admin123 / default
- test / admin123 / default
### 待开发功能
1. 采购收货单 + 库存增加(P0
2. 销售退货单(P1
3. 采购申请单(P1
4. 库存调拨(P1
5. 库存盘点(P1
6. 操作日志、登录日志(P1/P2
7. 报表统计(P2
### 关键代码位置
- JWT 工具:`framework/security/JwtUtil.java`
- 租户上下文:`framework/tenant/TenantContext.java`
- 租户拦截器:`framework/tenant/TenantLineHandlerImpl.java`
- 全局异常:`common/core/GlobalExceptionHandler.java`
- 业务异常:`common/core/BusinessException.java`
### 文档位置
- README.md:项目根目录
- 开发方案:`yangxuan/设计/01-开发方案.md`
---
> ⚠️ 2026-05-26: 当前只关注 md(主数据)和 im(库存)模块。om/mc/fin/system/home 代码已存在但不再关注。