feat(location): 设计新增货位领域实体 #13
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
yingmo/PharmacyERP!13
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/location/entity"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request overview
该 PR 新增“货位(Location)”领域实体,用于在领域层封装货位的状态与基础业务校验,并提供与 GORM 数据模型之间的转换。
Changes:
Location领域实体结构体,承载货位核心字段与状态FromModel/ToModel用于领域实体与model.LocationInfo间转换IsEnabled/ToggleStatus)与基础必填校验(Validate)💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -0,0 +36,4 @@// ToModel 将领域实体转换为 GORM 数据库模型,供仓储层写入使用。// ID 为零时表示新建,GORM 将自动填充自增主键。func (l *Location) ToModel() *model.LocationInfo {return &model.LocationInfo{ToModel()的注释说明“ID 为零时表示新建”,但当前返回的model.LocationInfo没有带上领域实体的l.ID(嵌入的BaseModel.ID会保持为 0)。如果仓储层使用 GORM 的Save/基于主键的更新逻辑,这会导致本应更新时被当作新建插入;同时注释与实现不一致。建议在构造后显式把ID写回(例如构造完后m.ID = l.ID,或初始化BaseModel),或修改注释明确该方法仅用于创建。