| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392 |
- package main
-
- import (
- "bytes"
- "encoding/json"
- "io"
- "net/http"
- "testing"
-
- "git.x2erp.com/qdy/go-base/model/request/queryreq"
- "git.x2erp.com/qdy/go-svc-configure/internal/service/aliasmanagement"
- )
-
- // 测试常量(使用唯一名称避免包级别冲突)
- const (
- dicAliasBaseURL = "http://localhost:8080"
- dicAliasTestTableID = "dic_alias_test_table_001"
- dicAliasTestTableAlias = "测试表别名001"
- dicAliasTestTableAliasUpdated = "测试表别名001_更新"
- dicAliasTestFieldID = "dic_alias_test_table_001.id"
- dicAliasTestFieldName = "id"
- dicAliasTestFieldAlias = "主键ID别名"
- dicAliasTestFieldAliasUpdated = "主键ID别名_更新"
- dicAliasTestTenantID = "dic_alias_test_tenant_001"
- dicAliasTestApprover = "admin"
- )
-
- // TestDicAliasCRUD 测试数据库别名字典的增删改查
- func TestDicAliasCRUD(t *testing.T) {
- // 表别名字典管理
- t.Run("TableAliasCRUD", dicAliasTestTableAliasCRUD)
-
- // 字段别名字典管理
- t.Run("TableFieldAliasCRUD", testTableFieldAliasCRUD)
-
- // 表别名字典流水审批工作流
- t.Run("TableAliasFlowWorkflow", dicAliasTestTableAliasFlowWorkflow)
-
- // 字段别名字典流水审批工作流
- t.Run("TableFieldAliasFlowWorkflow", testTableFieldAliasFlowWorkflow)
- }
-
- // 表别名字典管理测试
- func dicAliasTestTableAliasCRUD(t *testing.T) {
- // 1. 创建表别名字典
- tableAliasID := testCreateTableAlias(t)
-
- // 2. 查询表别名字典列表
- testListTableAliases(t)
-
- // 3. 查询表别名字典详情
- testGetTableAliasDetail(t, tableAliasID)
-
- // 4. 更新表别名字典
- testUpdateTableAlias(t, tableAliasID)
-
- // 5. 查询更新后的表别名字典详情
- testGetUpdatedTableAliasDetail(t, tableAliasID)
-
- // 6. 批量保存表别名字典
- testBatchSaveTableAliases(t)
-
- // 7. 删除表别名字典
- testDeleteTableAlias(t, tableAliasID)
-
- // 8. 验证表别名字典已删除
- testVerifyTableAliasDeleted(t, tableAliasID)
- }
-
- // 字段别名字典管理测试
- func testTableFieldAliasCRUD(t *testing.T) {
- // 1. 创建字段别名字典
- tableFieldAliasID := testCreateTableFieldAlias(t)
-
- // 2. 查询字段别名字典列表
- testListTableFieldAliases(t)
-
- // 3. 查询字段别名字典详情
- testGetTableFieldAliasDetail(t, tableFieldAliasID)
-
- // 4. 更新字段别名字典
- testUpdateTableFieldAlias(t, tableFieldAliasID)
-
- // 5. 查询更新后的字段别名字典详情
- testGetUpdatedTableFieldAliasDetail(t, tableFieldAliasID)
-
- // 6. 批量保存字段别名字典
- testBatchSaveTableFieldAliases(t)
-
- // 7. 删除字段别名字典
- testDeleteTableFieldAlias(t, tableFieldAliasID)
-
- // 8. 验证字段别名字典已删除
- testVerifyTableFieldAliasDeleted(t, tableFieldAliasID)
- }
-
- // 表别名字典流水审批工作流测试
- func dicAliasTestTableAliasFlowWorkflow(t *testing.T) {
- // 1. 批量保存表别名字典流水
- flowIDs := testBatchSaveTableAliasFlow(t)
-
- // 2. 查询表别名字典流水列表
- testListTableAliasFlow(t)
-
- // 3. 批量审批表别名字典流水
- testBatchApprovalTableAliasFlow(t, flowIDs)
-
- // 4. 查询审批后的流水列表
- testListApprovedTableAliasFlow(t)
- }
-
- // 字段别名字典流水审批工作流测试
- func testTableFieldAliasFlowWorkflow(t *testing.T) {
- // 1. 批量保存字段别名字典流水
- flowIDs := testBatchSaveTableFieldAliasFlow(t)
-
- // 2. 查询字段别名字典流水列表
- testListTableFieldAliasFlow(t)
-
- // 3. 批量审批字段别名字典流水
- testBatchApprovalTableFieldAliasFlow(t, flowIDs)
-
- // 4. 查询审批后的流水列表
- testListApprovedTableFieldAliasFlow(t)
- }
-
- // 创建表别名字典
- func testCreateTableAlias(t *testing.T) string {
- httpClient := &http.Client{}
- url := dicAliasBaseURL + "/api/dic-table-alias/save"
-
- reqBody := aliasmanagement.TableAliasRequest{
- TableID: dicAliasTestTableID,
- TableAlias: dicAliasTestTableAlias,
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("创建表别名字典失败: %v", result)
- }
-
- // 提取创建的ID
- var tableAliasID string
- if data, ok := result["data"].(map[string]interface{}); ok {
- if tableAlias, ok := data["tableAlias"].(map[string]interface{}); ok {
- if id, ok := tableAlias["id"].(string); ok {
- tableAliasID = id
- }
- }
- }
-
- if tableAliasID == "" {
- t.Errorf("未能获取创建的表别名字典ID")
- }
-
- t.Logf("创建表别名字典成功,ID: %s, 响应: %s", tableAliasID, string(body))
- return tableAliasID
- }
-
- // 查询表别名字典列表
- func testListTableAliases(t *testing.T) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias/list"
-
- queryReq := aliasmanagement.TableAliasQueryRequest{
- QueryRequest: queryreq.QueryRequest{
- Page: 0,
- PageSize: 10,
- },
- TableID: dicAliasTestTableID,
- TableAlias: dicAliasTestTableAlias,
- }
-
- jsonData, err := json.Marshal(queryReq)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询表别名字典列表失败: %v", result)
- }
-
- // 验证返回的数据
- if count, ok := result["totalCount"].(float64); !ok || count < 0 {
- t.Errorf("表别名字典列表计数错误: %v", result)
- }
-
- t.Logf("查询表别名字典列表成功: %s", string(body))
- }
-
- // 查询表别名字典详情
- func testGetTableAliasDetail(t *testing.T, tableAliasID string) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias/detail/" + tableAliasID
-
- req, err := http.NewRequest("POST", url, nil)
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询表别名字典详情失败: %v", result)
- }
-
- // 验证详情信息
- if data, ok := result["data"].(map[string]interface{}); ok {
- if tableAlias, ok := data["tableAlias"].(map[string]interface{}); ok {
- if tableID, ok := tableAlias["tableID"].(string); !ok || tableID != dicAliasTestTableID {
- t.Errorf("表ID不匹配: 期望 %s, 实际 %v", dicAliasTestTableID, tableAlias["tableID"])
- }
- if tableAliasValue, ok := tableAlias["tableAlias"].(string); !ok || tableAliasValue != dicAliasTestTableAlias {
- t.Errorf("表别名不匹配: 期望 %s, 实际 %v", dicAliasTestTableAlias, tableAlias["tableAlias"])
- }
- }
- }
-
- t.Logf("查询表别名字典详情成功: %s", string(body))
- }
-
- // 更新表别名字典
- func testUpdateTableAlias(t *testing.T, tableAliasID string) {
- httpClient := &http.Client{}
- url := dicAliasBaseURL + "/api/dic-table-alias/save"
-
- reqBody := aliasmanagement.TableAliasRequest{
- ID: tableAliasID,
- TableID: dicAliasTestTableID,
- TableAlias: dicAliasTestTableAliasUpdated,
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("更新表别名字典失败: %v", result)
- }
-
- t.Logf("更新表别名字典成功: %s", string(body))
- }
-
- // 查询更新后的表别名字典详情
- func testGetUpdatedTableAliasDetail(t *testing.T, tableAliasID string) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias/detail/" + tableAliasID
-
- req, err := http.NewRequest("POST", url, nil)
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询更新后的表别名字典详情失败: %v", result)
- }
-
- // 验证更新后的信息
- if data, ok := result["data"].(map[string]interface{}); ok {
- if tableAlias, ok := data["tableAlias"].(map[string]interface{}); ok {
- if tableAliasValue, ok := tableAlias["tableAlias"].(string); !ok || tableAliasValue != dicAliasTestTableAliasUpdated {
- t.Errorf("表别名未更新: 期望 %s, 实际 %v", dicAliasTestTableAliasUpdated, tableAlias["tableAlias"])
- }
- }
- }
-
- t.Logf("查询更新后的表别名字典详情成功: %s", string(body))
- }
-
- // 批量保存表别名字典
- func testBatchSaveTableAliases(t *testing.T) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias/batch-save"
-
- reqBody := aliasmanagement.BatchTableAliasRequest{
- Items: []aliasmanagement.TableAliasRequest{
- {
- TableID: dicAliasTestTableID,
- TableAlias: dicAliasTestTableAlias + "_batch1",
- },
- {
- TableID: dicAliasTestTableID,
- TableAlias: dicAliasTestTableAlias + "_batch2",
- },
- },
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("批量保存表别名字典失败: %v", result)
- }
-
- t.Logf("批量保存表别名字典成功: %s", string(body))
- }
-
- // 删除表别名字典
- func testDeleteTableAlias(t *testing.T, tableAliasID string) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias/delete/" + tableAliasID
-
- req, err := http.NewRequest("POST", url, nil)
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("删除表别名字典失败: %v", result)
- }
-
- t.Logf("删除表别名字典成功: %s", string(body))
- }
-
- // 验证表别名字典已删除
- func testVerifyTableAliasDeleted(t *testing.T, tableAliasID string) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias/detail/" + tableAliasID
-
- req, err := http.NewRequest("POST", url, nil)
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- // 期望查询失败,因为表别名字典已删除
- if success, ok := result["success"].(bool); ok && success {
- t.Errorf("表别名字典删除验证失败: 表别名字典仍存在")
- }
-
- t.Logf("表别名字典删除验证成功: 表别名字典已不存在")
- }
-
- // 创建字段别名字典
- func testCreateTableFieldAlias(t *testing.T) string {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias/save"
-
- reqBody := aliasmanagement.TableFieldAliasRequest{
- FieldID: dicAliasTestFieldID,
- TableID: dicAliasTestTableID,
- FieldName: dicAliasTestFieldName,
- FieldAlias: dicAliasTestFieldAlias,
- Description: "字段别名描述",
- WhereCondition: "查询条件描述",
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("创建字段别名字典失败: %v", result)
- }
-
- // 提取创建的ID
- var tableFieldAliasID string
- if data, ok := result["data"].(map[string]interface{}); ok {
- if tableFieldAlias, ok := data["tableFieldAlias"].(map[string]interface{}); ok {
- if id, ok := tableFieldAlias["id"].(string); ok {
- tableFieldAliasID = id
- }
- }
- }
-
- if tableFieldAliasID == "" {
- t.Errorf("未能获取创建的字段别名字典ID")
- }
-
- t.Logf("创建字段别名字典成功,ID: %s, 响应: %s", tableFieldAliasID, string(body))
- return tableFieldAliasID
- }
-
- // 查询字段别名字典列表
- func testListTableFieldAliases(t *testing.T) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias/list"
-
- queryReq := aliasmanagement.TableFieldAliasQueryRequest{
- QueryRequest: queryreq.QueryRequest{
- Page: 0,
- PageSize: 10,
- },
- TableID: dicAliasTestTableID,
- FieldID: dicAliasTestFieldID,
- FieldName: dicAliasTestFieldName,
- FieldAlias: dicAliasTestFieldAlias,
- }
-
- jsonData, err := json.Marshal(queryReq)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询字段别名字典列表失败: %v", result)
- }
-
- // 验证返回的数据
- if count, ok := result["totalCount"].(float64); !ok || count < 0 {
- t.Errorf("字段别名字典列表计数错误: %v", result)
- }
-
- t.Logf("查询字段别名字典列表成功: %s", string(body))
- }
-
- // 查询字段别名字典详情
- func testGetTableFieldAliasDetail(t *testing.T, tableFieldAliasID string) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias/detail/" + tableFieldAliasID
-
- req, err := http.NewRequest("POST", url, nil)
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询字段别名字典详情失败: %v", result)
- }
-
- // 验证详情信息
- if data, ok := result["data"].(map[string]interface{}); ok {
- if tableFieldAlias, ok := data["tableFieldAlias"].(map[string]interface{}); ok {
- if tableID, ok := tableFieldAlias["tableID"].(string); !ok || tableID != dicAliasTestTableID {
- t.Errorf("表ID不匹配: 期望 %s, 实际 %v", dicAliasTestTableID, tableFieldAlias["tableID"])
- }
- if fieldID, ok := tableFieldAlias["fieldID"].(string); !ok || fieldID != dicAliasTestFieldID {
- t.Errorf("字段ID不匹配: 期望 %s, 实际 %v", dicAliasTestFieldID, tableFieldAlias["fieldID"])
- }
- if fieldAlias, ok := tableFieldAlias["fieldAlias"].(string); !ok || fieldAlias != dicAliasTestFieldAlias {
- t.Errorf("字段别名不匹配: 期望 %s, 实际 %v", dicAliasTestFieldAlias, tableFieldAlias["fieldAlias"])
- }
- }
- }
-
- t.Logf("查询字段别名字典详情成功: %s", string(body))
- }
-
- // 更新字段别名字典
- func testUpdateTableFieldAlias(t *testing.T, tableFieldAliasID string) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias/save"
-
- reqBody := aliasmanagement.TableFieldAliasRequest{
- ID: tableFieldAliasID,
- FieldID: dicAliasTestFieldID,
- TableID: dicAliasTestTableID,
- FieldName: dicAliasTestFieldName,
- FieldAlias: dicAliasTestFieldAliasUpdated,
- Description: "更新后的字段别名描述",
- WhereCondition: "更新后的查询条件描述",
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("更新字段别名字典失败: %v", result)
- }
-
- t.Logf("更新字段别名字典成功: %s", string(body))
- }
-
- // 查询更新后的字段别名字典详情
- func testGetUpdatedTableFieldAliasDetail(t *testing.T, tableFieldAliasID string) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias/detail/" + tableFieldAliasID
-
- req, err := http.NewRequest("POST", url, nil)
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询更新后的字段别名字典详情失败: %v", result)
- }
-
- // 验证更新后的信息
- if data, ok := result["data"].(map[string]interface{}); ok {
- if tableFieldAlias, ok := data["tableFieldAlias"].(map[string]interface{}); ok {
- if fieldAlias, ok := tableFieldAlias["fieldAlias"].(string); !ok || fieldAlias != dicAliasTestFieldAliasUpdated {
- t.Errorf("字段别名未更新: 期望 %s, 实际 %v", dicAliasTestFieldAliasUpdated, tableFieldAlias["fieldAlias"])
- }
- if description, ok := tableFieldAlias["description"].(string); !ok || description != "更新后的字段别名描述" {
- t.Errorf("字段描述未更新: 期望 '更新后的字段别名描述', 实际 %v", tableFieldAlias["description"])
- }
- }
- }
-
- t.Logf("查询更新后的字段别名字典详情成功: %s", string(body))
- }
-
- // 批量保存字段别名字典
- func testBatchSaveTableFieldAliases(t *testing.T) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias/batch-save"
-
- reqBody := aliasmanagement.BatchTableFieldAliasRequest{
- Items: []aliasmanagement.TableFieldAliasRequest{
- {
- FieldID: dicAliasTestFieldID + "_batch1",
- TableID: dicAliasTestTableID,
- FieldName: "status",
- FieldAlias: "状态别名_batch1",
- Description: "批量保存的字段别名1",
- WhereCondition: "批量保存的查询条件1",
- },
- {
- FieldID: dicAliasTestFieldID + "_batch2",
- TableID: dicAliasTestTableID,
- FieldName: "name",
- FieldAlias: "名称别名_batch2",
- Description: "批量保存的字段别名2",
- WhereCondition: "批量保存的查询条件2",
- },
- },
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("批量保存字段别名字典失败: %v", result)
- }
-
- t.Logf("批量保存字段别名字典成功: %s", string(body))
- }
-
- // 删除字段别名字典
- func testDeleteTableFieldAlias(t *testing.T, tableFieldAliasID string) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias/delete/" + tableFieldAliasID
-
- req, err := http.NewRequest("POST", url, nil)
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("删除字段别名字典失败: %v", result)
- }
-
- t.Logf("删除字段别名字典成功: %s", string(body))
- }
-
- // 验证字段别名字典已删除
- func testVerifyTableFieldAliasDeleted(t *testing.T, tableFieldAliasID string) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias/detail/" + tableFieldAliasID
-
- req, err := http.NewRequest("POST", url, nil)
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- // 期望查询失败,因为字段别名字典已删除
- if success, ok := result["success"].(bool); ok && success {
- t.Errorf("字段别名字典删除验证失败: 字段别名字典仍存在")
- }
-
- t.Logf("字段别名字典删除验证成功: 字段别名字典已不存在")
- }
-
- // 批量保存表别名字典流水
- func testBatchSaveTableAliasFlow(t *testing.T) []string {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias-flow/batch-save"
-
- // 注意:路由定义需要tenantID作为路径参数,但根据alias_management_routes.go第85-89行,
- // 实际路由是"/api/dic-table-alias-flow/batch-save",接受两个参数:req和tenantID
- // 我们需要在URL中传递tenantID,或者查看实际实现
- // 这里按照路由定义,tenantID应该是路径参数
- urlWithTenant := url + "?tenantID=" + testTenantID
-
- reqBody := aliasmanagement.BatchTableAliasRequest{
- Items: []aliasmanagement.TableAliasRequest{
- {
- TableID: dicAliasTestTableID,
- TableAlias: dicAliasTestTableAlias + "_flow1",
- },
- {
- TableID: dicAliasTestTableID,
- TableAlias: dicAliasTestTableAlias + "_flow2",
- },
- },
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", urlWithTenant, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("批量保存表别名字典流水失败: %v", result)
- }
-
- // 提取创建的流水ID
- var flowIDs []string
- if data, ok := result["data"].([]interface{}); ok {
- for _, item := range data {
- if flow, ok := item.(map[string]interface{}); ok {
- if id, ok := flow["id"].(string); ok {
- flowIDs = append(flowIDs, id)
- }
- }
- }
- }
-
- if len(flowIDs) == 0 {
- t.Errorf("未能获取创建的表别名字典流水ID")
- }
-
- t.Logf("批量保存表别名字典流水成功,创建了 %d 条记录, 响应: %s", len(flowIDs), string(body))
- return flowIDs
- }
-
- // 查询表别名字典流水列表
- func testListTableAliasFlow(t *testing.T) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias-flow/list"
-
- queryReq := aliasmanagement.TableAliasFlowQueryRequest{
- QueryRequest: queryreq.QueryRequest{
- Page: 0,
- PageSize: 10,
- },
- TableID: dicAliasTestTableID,
- TableAlias: dicAliasTestTableAlias + "_flow",
- TenantID: testTenantID,
- ApprovalStatus: 0, // 待审批
- }
-
- jsonData, err := json.Marshal(queryReq)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询表别名字典流水列表失败: %v", result)
- }
-
- // 验证返回的数据
- if count, ok := result["totalCount"].(float64); !ok || count < 0 {
- t.Errorf("表别名字典流水列表计数错误: %v", result)
- }
-
- t.Logf("查询表别名字典流水列表成功: %s", string(body))
- }
-
- // 批量审批表别名字典流水
- func testBatchApprovalTableAliasFlow(t *testing.T, flowIDs []string) {
- if len(flowIDs) == 0 {
- t.Skip("没有可审批的流水记录")
- return
- }
-
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias-flow/batch-approval"
-
- reqBody := aliasmanagement.BatchApprovalFlowRequest{
- IDs: flowIDs,
- ApprovalStatus: 1, // 通过
- Approver: dicAliasTestApprover,
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("批量审批表别名字典流水失败: %v", result)
- }
-
- t.Logf("批量审批表别名字典流水成功: %s", string(body))
- }
-
- // 查询审批后的表别名字典流水列表
- func testListApprovedTableAliasFlow(t *testing.T) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-alias-flow/list"
-
- queryReq := aliasmanagement.TableAliasFlowQueryRequest{
- QueryRequest: queryreq.QueryRequest{
- Page: 0,
- PageSize: 10,
- },
- TenantID: testTenantID,
- ApprovalStatus: 1, // 已通过
- }
-
- jsonData, err := json.Marshal(queryReq)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询审批后的表别名字典流水列表失败: %v", result)
- }
-
- t.Logf("查询审批后的表别名字典流水列表成功: %s", string(body))
- }
-
- // 批量保存字段别名字典流水
- func testBatchSaveTableFieldAliasFlow(t *testing.T) []string {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias-flow/batch-save"
-
- // tenantID作为路径参数传递
- urlWithTenant := url + "?tenantID=" + testTenantID
-
- reqBody := aliasmanagement.BatchTableFieldAliasRequest{
- Items: []aliasmanagement.TableFieldAliasRequest{
- {
- FieldID: dicAliasTestFieldID + "_flow1",
- TableID: dicAliasTestTableID,
- FieldName: "status",
- FieldAlias: "状态别名_flow1",
- Description: "流水字段别名1",
- WhereCondition: "流水查询条件1",
- },
- {
- FieldID: dicAliasTestFieldID + "_flow2",
- TableID: dicAliasTestTableID,
- FieldName: "name",
- FieldAlias: "名称别名_flow2",
- Description: "流水字段别名2",
- WhereCondition: "流水查询条件2",
- },
- },
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", urlWithTenant, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("批量保存字段别名字典流水失败: %v", result)
- }
-
- // 提取创建的流水ID
- var flowIDs []string
- if data, ok := result["data"].([]interface{}); ok {
- for _, item := range data {
- if flow, ok := item.(map[string]interface{}); ok {
- if id, ok := flow["id"].(string); ok {
- flowIDs = append(flowIDs, id)
- }
- }
- }
- }
-
- if len(flowIDs) == 0 {
- t.Errorf("未能获取创建的字段别名字典流水ID")
- }
-
- t.Logf("批量保存字段别名字典流水成功,创建了 %d 条记录, 响应: %s", len(flowIDs), string(body))
- return flowIDs
- }
-
- // 查询字段别名字典流水列表
- func testListTableFieldAliasFlow(t *testing.T) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias-flow/list"
-
- queryReq := aliasmanagement.TableFieldAliasFlowQueryRequest{
- QueryRequest: queryreq.QueryRequest{
- Page: 0,
- PageSize: 10,
- },
- TableID: dicAliasTestTableID,
- FieldAlias: "_flow",
- TenantID: testTenantID,
- ApprovalStatus: 0, // 待审批
- }
-
- jsonData, err := json.Marshal(queryReq)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询字段别名字典流水列表失败: %v", result)
- }
-
- // 验证返回的数据
- if count, ok := result["totalCount"].(float64); !ok || count < 0 {
- t.Errorf("字段别名字典流水列表计数错误: %v", result)
- }
-
- t.Logf("查询字段别名字典流水列表成功: %s", string(body))
- }
-
- // 批量审批字段别名字典流水
- func testBatchApprovalTableFieldAliasFlow(t *testing.T, flowIDs []string) {
- if len(flowIDs) == 0 {
- t.Skip("没有可审批的流水记录")
- return
- }
-
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias-flow/batch-approval"
-
- reqBody := aliasmanagement.BatchApprovalFlowRequest{
- IDs: flowIDs,
- ApprovalStatus: 1, // 通过
- Approver: dicAliasTestApprover,
- }
-
- jsonData, err := json.Marshal(reqBody)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("批量审批字段别名字典流水失败: %v", result)
- }
-
- t.Logf("批量审批字段别名字典流水成功: %s", string(body))
- }
-
- // 查询审批后的字段别名字典流水列表
- func testListApprovedTableFieldAliasFlow(t *testing.T) {
- httpClient := &http.Client{}
- url := baseURL + "/api/dic-table-field-alias-flow/list"
-
- queryReq := aliasmanagement.TableFieldAliasFlowQueryRequest{
- QueryRequest: queryreq.QueryRequest{
- Page: 0,
- PageSize: 10,
- },
- TenantID: testTenantID,
- ApprovalStatus: 1, // 已通过
- }
-
- jsonData, err := json.Marshal(queryReq)
- if err != nil {
- t.Fatalf("JSON序列化失败: %v", err)
- }
-
- req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
- if err != nil {
- t.Fatalf("创建请求失败: %v", err)
- }
-
- req.SetBasicAuth("admin", "123")
- req.Header.Set("Content-Type", "application/json")
-
- resp, err := httpClient.Do(req)
- if err != nil {
- t.Fatalf("请求失败: %v", err)
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- t.Fatalf("读取响应失败: %v", err)
- }
-
- var result map[string]interface{}
- if err := json.Unmarshal(body, &result); err != nil {
- t.Fatalf("JSON解析失败: %v", err)
- }
-
- if success, ok := result["success"].(bool); !ok || !success {
- t.Errorf("查询审批后的字段别名字典流水列表失败: %v", result)
- }
-
- t.Logf("查询审批后的字段别名字典流水列表成功: %s", string(body))
- }
|