优化智能气阀生产商关联展示
智能气阀列表改为显示生产商名称,并提供生产商唯一标识复制入口;无关联数据时显示‘未填写’。修复未来 Mock 数据生成时缺少生产商关联的问题,但不执行 Mock、迁移或 SQL,不修改当前数据库及历史数据。补充种子测试、操作日志和项目文档。
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"git.apinb.com/heqiapp/platforms/backend/api/internal/logic/common"
|
||||
"git.apinb.com/heqiapp/platforms/backend/api/internal/models"
|
||||
)
|
||||
|
||||
func TestMockEntityIdentitiesAreStableAndUnique(t *testing.T) {
|
||||
@@ -27,6 +28,21 @@ func TestMockEntityIdentitiesAreStableAndUnique(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestLinkMockProductProducer 验证未来 Mock 智能气阀始终关联已落库生产商。
|
||||
func TestLinkMockProductProducer(t *testing.T) {
|
||||
product := models.ProductInfo{}
|
||||
producer := models.ProducerAccount{Entity: models.Entity{ID: 9}}
|
||||
if err := linkMockProductProducer(&product, producer); err != nil {
|
||||
t.Fatalf("关联 Mock 生产商失败:%v", err)
|
||||
}
|
||||
if product.ProducerAccountID != producer.ID {
|
||||
t.Fatalf("生产商关联错误:got %d, want %d", product.ProducerAccountID, producer.ID)
|
||||
}
|
||||
if err := linkMockProductProducer(&models.ProductInfo{}, models.ProducerAccount{}); err == nil {
|
||||
t.Fatal("未落库生产商不应建立 Mock 关联")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIdentityOfEmbeddedEntity(t *testing.T) {
|
||||
record := struct {
|
||||
Entity struct {
|
||||
|
||||
Reference in New Issue
Block a user