正在显示
33 个修改的文件
包含
118 行增加
和
102 行删除
@@ -14,10 +14,10 @@ type DictionaryItem struct { | @@ -14,10 +14,10 @@ type DictionaryItem struct { | ||
14 | ItemLabel string `json:"itemLabel" valid:"Required;MaxSize(30)"` | 14 | ItemLabel string `json:"itemLabel" valid:"Required;MaxSize(30)"` |
15 | // 值 | 15 | // 值 |
16 | ItemValue string `json:"itemValue" valid:"Required;MaxSize(30)"` | 16 | ItemValue string `json:"itemValue" valid:"Required;MaxSize(30)"` |
17 | - // 是否可见【1:不可以】【2:可以】 | ||
18 | - IsShow int `json:"isShow"` | ||
19 | // 显示序号 | 17 | // 显示序号 |
20 | Sort int `json:"sort"` | 18 | Sort int `json:"sort"` |
19 | + // 是否可见【1:不可以】【2:可以】 | ||
20 | + IsShow int `json:"isShow"` | ||
21 | } | 21 | } |
22 | 22 | ||
23 | type CreateDictionaryCommand struct { | 23 | type CreateDictionaryCommand struct { |
@@ -26,7 +26,7 @@ type CreateDictionaryCommand struct { | @@ -26,7 +26,7 @@ type CreateDictionaryCommand struct { | ||
26 | // 字典名称 | 26 | // 字典名称 |
27 | DictName string `json:"dictName" valid:"Required;MaxSize(30)"` | 27 | DictName string `json:"dictName" valid:"Required;MaxSize(30)"` |
28 | // 备注信息 | 28 | // 备注信息 |
29 | - Desc string `json:"desc" valid:"MaxSize(100)"` | 29 | + Describe string `json:"describe" valid:"MaxSize(100)"` |
30 | // 字典值列表 | 30 | // 字典值列表 |
31 | DictItems []DictionaryItem `json:"dictItems"` | 31 | DictItems []DictionaryItem `json:"dictItems"` |
32 | } | 32 | } |
@@ -4,7 +4,6 @@ import ( | @@ -4,7 +4,6 @@ import ( | ||
4 | "fmt" | 4 | "fmt" |
5 | 5 | ||
6 | "github.com/beego/beego/v2/core/validation" | 6 | "github.com/beego/beego/v2/core/validation" |
7 | - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/domain" | ||
8 | ) | 7 | ) |
9 | 8 | ||
10 | type UpdateDictionaryCommand struct { | 9 | type UpdateDictionaryCommand struct { |
@@ -15,9 +14,7 @@ type UpdateDictionaryCommand struct { | @@ -15,9 +14,7 @@ type UpdateDictionaryCommand struct { | ||
15 | // 字典名称 | 14 | // 字典名称 |
16 | DictName string `json:"dictName" valid:"Required;MaxSize(30)"` | 15 | DictName string `json:"dictName" valid:"Required;MaxSize(30)"` |
17 | // 备注信息 | 16 | // 备注信息 |
18 | - Desc string `json:"desc" valid:"Required;MaxSize(100)"` | ||
19 | - // 是否可见【1:不可以】【2:可以】 | ||
20 | - IsShow int `json:"isShow"` | 17 | + Describe string `json:"describe" valid:"Required;MaxSize(100)"` |
21 | // 字典值列表 | 18 | // 字典值列表 |
22 | DictItems []DictionaryItem `json:"dictItems"` | 19 | DictItems []DictionaryItem `json:"dictItems"` |
23 | } | 20 | } |
@@ -30,10 +27,6 @@ func (updateDictionaryCommand *UpdateDictionaryCommand) Valid(v *validation.Vali | @@ -30,10 +27,6 @@ func (updateDictionaryCommand *UpdateDictionaryCommand) Valid(v *validation.Vali | ||
30 | v.SetError("sort", "明细项顺序值重复") | 27 | v.SetError("sort", "明细项顺序值重复") |
31 | } | 28 | } |
32 | sortmap[item.Sort] = struct{}{} | 29 | sortmap[item.Sort] = struct{}{} |
33 | - vOk := domain.DictionaryItemShow(item.IsShow).Valid() | ||
34 | - if !vOk { | ||
35 | - v.SetError("IsShow", "明细项是否显示值异常") | ||
36 | - } | ||
37 | } | 30 | } |
38 | } | 31 | } |
39 | 32 |
@@ -46,7 +46,7 @@ func (dictionaryService *DictionaryService) CreateDictionary(createDictionaryCom | @@ -46,7 +46,7 @@ func (dictionaryService *DictionaryService) CreateDictionary(createDictionaryCom | ||
46 | newDictionary := &domain.Dictionary{ | 46 | newDictionary := &domain.Dictionary{ |
47 | DictCode: createDictionaryCommand.DictCode, | 47 | DictCode: createDictionaryCommand.DictCode, |
48 | DictName: createDictionaryCommand.DictName, | 48 | DictName: createDictionaryCommand.DictName, |
49 | - Desc: createDictionaryCommand.Desc, | 49 | + Describe: createDictionaryCommand.Describe, |
50 | DictItems: items, | 50 | DictItems: items, |
51 | } | 51 | } |
52 | var dictionaryRepository domain.DictionaryRepository | 52 | var dictionaryRepository domain.DictionaryRepository |
@@ -95,7 +95,7 @@ func (dictionaryService *DictionaryService) GetDictionary(getDictionaryQuery *qu | @@ -95,7 +95,7 @@ func (dictionaryService *DictionaryService) GetDictionary(getDictionaryQuery *qu | ||
95 | queryCondition["dictCode"] = getDictionaryQuery.DictCode | 95 | queryCondition["dictCode"] = getDictionaryQuery.DictCode |
96 | } | 96 | } |
97 | if getDictionaryQuery.DictionaryId > 0 { | 97 | if getDictionaryQuery.DictionaryId > 0 { |
98 | - queryCondition["dictionaryId"] = getDictionaryQuery.DictCode | 98 | + queryCondition["dictionaryId"] = getDictionaryQuery.DictionaryId |
99 | } | 99 | } |
100 | dictionary, err := dictionaryRepository.FindOne(queryCondition) | 100 | dictionary, err := dictionaryRepository.FindOne(queryCondition) |
101 | if err != nil { | 101 | if err != nil { |
@@ -237,7 +237,7 @@ func (dictionaryService *DictionaryService) UpdateDictionary(updateDictionaryCom | @@ -237,7 +237,7 @@ func (dictionaryService *DictionaryService) UpdateDictionary(updateDictionaryCom | ||
237 | err = dictionary.Update(map[string]interface{}{ | 237 | err = dictionary.Update(map[string]interface{}{ |
238 | "dictCode": updateDictionaryCommand.DictCode, | 238 | "dictCode": updateDictionaryCommand.DictCode, |
239 | "dictName": updateDictionaryCommand.DictName, | 239 | "dictName": updateDictionaryCommand.DictName, |
240 | - "desc": updateDictionaryCommand.Desc, | 240 | + "describe": updateDictionaryCommand.Describe, |
241 | "dictItems": items, | 241 | "dictItems": items, |
242 | }) | 242 | }) |
243 | if err != nil { | 243 | if err != nil { |
@@ -26,7 +26,7 @@ type AddNoticeSettingCommand struct { | @@ -26,7 +26,7 @@ type AddNoticeSettingCommand struct { | ||
26 | 26 | ||
27 | func (addNoticeSettingCommand *AddNoticeSettingCommand) Valid(v *validation.Validation) { | 27 | func (addNoticeSettingCommand *AddNoticeSettingCommand) Valid(v *validation.Validation) { |
28 | ok := domain.ValidNoticeModule(addNoticeSettingCommand.Module) | 28 | ok := domain.ValidNoticeModule(addNoticeSettingCommand.Module) |
29 | - if ok { | 29 | + if !ok { |
30 | v.SetError("Module", "不是规定的值") | 30 | v.SetError("Module", "不是规定的值") |
31 | } | 31 | } |
32 | //检查消息编码 | 32 | //检查消息编码 |
@@ -28,7 +28,7 @@ type UpdateNoticeSettingCommand struct { | @@ -28,7 +28,7 @@ type UpdateNoticeSettingCommand struct { | ||
28 | 28 | ||
29 | func (updateNoticeSettingCommand *UpdateNoticeSettingCommand) Valid(v *validation.Validation) { | 29 | func (updateNoticeSettingCommand *UpdateNoticeSettingCommand) Valid(v *validation.Validation) { |
30 | ok := domain.ValidNoticeModule(updateNoticeSettingCommand.Module) | 30 | ok := domain.ValidNoticeModule(updateNoticeSettingCommand.Module) |
31 | - if ok { | 31 | + if !ok { |
32 | v.SetError("Module", "不是规定的值") | 32 | v.SetError("Module", "不是规定的值") |
33 | } | 33 | } |
34 | //检查消息编码 | 34 | //检查消息编码 |
@@ -12,7 +12,7 @@ type GetNoticeSettingQuery struct { | @@ -12,7 +12,7 @@ type GetNoticeSettingQuery struct { | ||
12 | } | 12 | } |
13 | 13 | ||
14 | func (getNoticeSettingQuery *GetNoticeSettingQuery) Valid(validation *validation.Validation) { | 14 | func (getNoticeSettingQuery *GetNoticeSettingQuery) Valid(validation *validation.Validation) { |
15 | - validation.SetError("CustomValid", "未实现的自定义认证") | 15 | + |
16 | } | 16 | } |
17 | 17 | ||
18 | func (getNoticeSettingQuery *GetNoticeSettingQuery) ValidateQuery() error { | 18 | func (getNoticeSettingQuery *GetNoticeSettingQuery) ValidateQuery() error { |
@@ -5,7 +5,6 @@ import ( | @@ -5,7 +5,6 @@ import ( | ||
5 | "time" | 5 | "time" |
6 | 6 | ||
7 | "github.com/linmadan/egglib-go/core/application" | 7 | "github.com/linmadan/egglib-go/core/application" |
8 | - "github.com/linmadan/egglib-go/utils/tool_funs" | ||
9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/factory" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/factory" |
10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/command" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/command" |
11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/query" | 10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/query" |
@@ -56,7 +55,6 @@ func (noticeSettingService *NoticeSettingService) GetNoticeSetting(getNoticeSett | @@ -56,7 +55,6 @@ func (noticeSettingService *NoticeSettingService) GetNoticeSetting(getNoticeSett | ||
56 | } | 55 | } |
57 | 56 | ||
58 | // 返回编排消息通知内容列表 | 57 | // 返回编排消息通知内容列表 |
59 | -// 检查初始化消息列表 | ||
60 | func (noticeSettingService *NoticeSettingService) ListNoticeSetting(listNoticeSettingQuery *query.ListNoticeSettingQuery) (interface{}, error) { | 58 | func (noticeSettingService *NoticeSettingService) ListNoticeSetting(listNoticeSettingQuery *query.ListNoticeSettingQuery) (interface{}, error) { |
61 | if err := listNoticeSettingQuery.ValidateQuery(); err != nil { | 59 | if err := listNoticeSettingQuery.ValidateQuery(); err != nil { |
62 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 60 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
@@ -79,7 +77,16 @@ func (noticeSettingService *NoticeSettingService) ListNoticeSetting(listNoticeSe | @@ -79,7 +77,16 @@ func (noticeSettingService *NoticeSettingService) ListNoticeSetting(listNoticeSe | ||
79 | } else { | 77 | } else { |
80 | noticeSettingRepository = value | 78 | noticeSettingRepository = value |
81 | } | 79 | } |
82 | - if count, noticeSettings, err := noticeSettingRepository.Find(tool_funs.SimpleStructToMap(listNoticeSettingQuery)); err != nil { | 80 | + |
81 | + queryOption := map[string]interface{}{ | ||
82 | + "pageIndex": listNoticeSettingQuery.PageIndex, | ||
83 | + "pageSize": listNoticeSettingQuery.PageSize, | ||
84 | + "companyId": listNoticeSettingQuery.CompanyId, | ||
85 | + } | ||
86 | + if listNoticeSettingQuery.OrgId > 0 { | ||
87 | + queryOption["orgId"] = listNoticeSettingQuery.OrgId | ||
88 | + } | ||
89 | + if count, noticeSettings, err := noticeSettingRepository.Find(queryOption); err != nil { | ||
83 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 90 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
84 | } else { | 91 | } else { |
85 | if err := transactionContext.CommitTransaction(); err != nil { | 92 | if err := transactionContext.CommitTransaction(); err != nil { |
@@ -16,7 +16,7 @@ type UpdateSystemSettingCommand struct { | @@ -16,7 +16,7 @@ type UpdateSystemSettingCommand struct { | ||
16 | } | 16 | } |
17 | 17 | ||
18 | func (updateSystemSettingCommand *UpdateSystemSettingCommand) Valid(validation *validation.Validation) { | 18 | func (updateSystemSettingCommand *UpdateSystemSettingCommand) Valid(validation *validation.Validation) { |
19 | - validation.SetError("CustomValid", "未实现的自定义认证") | 19 | + |
20 | } | 20 | } |
21 | 21 | ||
22 | func (updateSystemSettingCommand *UpdateSystemSettingCommand) ValidateCommand() error { | 22 | func (updateSystemSettingCommand *UpdateSystemSettingCommand) ValidateCommand() error { |
@@ -14,7 +14,6 @@ type GetSystemSettingQuery struct { | @@ -14,7 +14,6 @@ type GetSystemSettingQuery struct { | ||
14 | } | 14 | } |
15 | 15 | ||
16 | func (getSystemSettingQuery *GetSystemSettingQuery) Valid(validation *validation.Validation) { | 16 | func (getSystemSettingQuery *GetSystemSettingQuery) Valid(validation *validation.Validation) { |
17 | - validation.SetError("CustomValid", "未实现的自定义认证") | ||
18 | } | 17 | } |
19 | 18 | ||
20 | func (getSystemSettingQuery *GetSystemSettingQuery) ValidateQuery() error { | 19 | func (getSystemSettingQuery *GetSystemSettingQuery) ValidateQuery() error { |
@@ -14,7 +14,7 @@ type ListSystemSettingQuery struct { | @@ -14,7 +14,7 @@ type ListSystemSettingQuery struct { | ||
14 | } | 14 | } |
15 | 15 | ||
16 | func (listSystemSettingQuery *ListSystemSettingQuery) Valid(validation *validation.Validation) { | 16 | func (listSystemSettingQuery *ListSystemSettingQuery) Valid(validation *validation.Validation) { |
17 | - validation.SetError("CustomValid", "未实现的自定义认证") | 17 | + |
18 | } | 18 | } |
19 | 19 | ||
20 | func (listSystemSettingQuery *ListSystemSettingQuery) ValidateQuery() error { | 20 | func (listSystemSettingQuery *ListSystemSettingQuery) ValidateQuery() error { |
@@ -9,7 +9,7 @@ type Dictionary struct { | @@ -9,7 +9,7 @@ type Dictionary struct { | ||
9 | // 字典名称 | 9 | // 字典名称 |
10 | DictName string `json:"dictName"` | 10 | DictName string `json:"dictName"` |
11 | // 备注信息 | 11 | // 备注信息 |
12 | - Desc string `json:"desc"` | 12 | + Describe string `json:"describe"` |
13 | // 字典值列表 | 13 | // 字典值列表 |
14 | DictItems []DictionaryItem `json:"dictItems"` | 14 | DictItems []DictionaryItem `json:"dictItems"` |
15 | } | 15 | } |
@@ -38,8 +38,8 @@ func (dictionary *Dictionary) Update(data map[string]interface{}) error { | @@ -38,8 +38,8 @@ func (dictionary *Dictionary) Update(data map[string]interface{}) error { | ||
38 | if dictName, ok := data["dictName"]; ok { | 38 | if dictName, ok := data["dictName"]; ok { |
39 | dictionary.DictName = dictName.(string) | 39 | dictionary.DictName = dictName.(string) |
40 | } | 40 | } |
41 | - if desc, ok := data["desc"]; ok { | ||
42 | - dictionary.Desc = desc.(string) | 41 | + if desc, ok := data["describe"]; ok { |
42 | + dictionary.Describe = desc.(string) | ||
43 | } | 43 | } |
44 | if dictItems, ok := data["dictItems"]; ok { | 44 | if dictItems, ok := data["dictItems"]; ok { |
45 | dictionary.DictItems = dictItems.([]DictionaryItem) | 45 | dictionary.DictItems = dictItems.([]DictionaryItem) |
@@ -13,9 +13,9 @@ type Dictionary struct { | @@ -13,9 +13,9 @@ type Dictionary struct { | ||
13 | // 字典名称 | 13 | // 字典名称 |
14 | DictName string | 14 | DictName string |
15 | // 备注信息 | 15 | // 备注信息 |
16 | - Desc string | 16 | + Describe string |
17 | // 是否可见【1:不可以】【2:可以】 | 17 | // 是否可见【1:不可以】【2:可以】 |
18 | IsShow int | 18 | IsShow int |
19 | // 字典值列表 | 19 | // 字典值列表 |
20 | - DictItems []domain.DictionaryItem `pg:"type:jsonb"` | 20 | + DictItems []domain.DictionaryItem |
21 | } | 21 | } |
@@ -15,7 +15,7 @@ type NoticeSetting struct { | @@ -15,7 +15,7 @@ type NoticeSetting struct { | ||
15 | // 业务环节 | 15 | // 业务环节 |
16 | ModuleAction string | 16 | ModuleAction string |
17 | // 消息id | 17 | // 消息id |
18 | - NoticeSettingId int64 | 18 | + NoticeSettingId int64 `pg:",pk"` |
19 | // 组织id | 19 | // 组织id |
20 | OrgId int64 | 20 | OrgId int64 |
21 | // 创建时间 | 21 | // 创建时间 |
@@ -13,7 +13,7 @@ type SystemSetting struct { | @@ -13,7 +13,7 @@ type SystemSetting struct { | ||
13 | // 设置对应的名称 | 13 | // 设置对应的名称 |
14 | SettingName string | 14 | SettingName string |
15 | // 数据id | 15 | // 数据id |
16 | - SystemSettingId int64 | 16 | + SystemSettingId int64 `pg:",pk"` |
17 | // 设定的值 | 17 | // 设定的值 |
18 | Value string | 18 | Value string |
19 | // 值类型 | 19 | // 值类型 |
@@ -10,7 +10,7 @@ func TransformToDictionaryDomainModelFromPgModels(dictionaryModel *models.Dictio | @@ -10,7 +10,7 @@ func TransformToDictionaryDomainModelFromPgModels(dictionaryModel *models.Dictio | ||
10 | DictionaryId: dictionaryModel.DictionaryId, | 10 | DictionaryId: dictionaryModel.DictionaryId, |
11 | DictCode: dictionaryModel.DictCode, | 11 | DictCode: dictionaryModel.DictCode, |
12 | DictName: dictionaryModel.DictName, | 12 | DictName: dictionaryModel.DictName, |
13 | - Desc: dictionaryModel.Desc, | 13 | + Describe: dictionaryModel.Describe, |
14 | DictItems: dictionaryModel.DictItems, | 14 | DictItems: dictionaryModel.DictItems, |
15 | }, nil | 15 | }, nil |
16 | } | 16 | } |
@@ -26,7 +26,7 @@ func (repository *DictionaryRepository) Save(dictionary *domain.Dictionary) (*do | @@ -26,7 +26,7 @@ func (repository *DictionaryRepository) Save(dictionary *domain.Dictionary) (*do | ||
26 | "dictionary_id", | 26 | "dictionary_id", |
27 | "dict_code", | 27 | "dict_code", |
28 | "dict_name", | 28 | "dict_name", |
29 | - "desc", | 29 | + "describe", |
30 | "dict_items", | 30 | "dict_items", |
31 | } | 31 | } |
32 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) | 32 | insertFieldsSnippet := sqlbuilder.SqlFieldsSnippet(sqlBuildFields) |
@@ -47,15 +47,15 @@ func (repository *DictionaryRepository) Save(dictionary *domain.Dictionary) (*do | @@ -47,15 +47,15 @@ func (repository *DictionaryRepository) Save(dictionary *domain.Dictionary) (*do | ||
47 | &dictionary.DictionaryId, | 47 | &dictionary.DictionaryId, |
48 | &dictionary.DictCode, | 48 | &dictionary.DictCode, |
49 | &dictionary.DictName, | 49 | &dictionary.DictName, |
50 | - &dictionary.Desc, | ||
51 | - pg.Array(&dictionary.DictItems), | 50 | + &dictionary.Describe, |
51 | + &dictionary.DictItems, | ||
52 | ), | 52 | ), |
53 | fmt.Sprintf("INSERT INTO dictionarys (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), | 53 | fmt.Sprintf("INSERT INTO dictionarys (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet), |
54 | dictionary.DictionaryId, | 54 | dictionary.DictionaryId, |
55 | dictionary.DictCode, | 55 | dictionary.DictCode, |
56 | dictionary.DictName, | 56 | dictionary.DictName, |
57 | - dictionary.Desc, | ||
58 | - pg.Array(dictionary.DictItems), | 57 | + dictionary.Describe, |
58 | + dictionary.DictItems, | ||
59 | ); err != nil { | 59 | ); err != nil { |
60 | return dictionary, err | 60 | return dictionary, err |
61 | } | 61 | } |
@@ -65,15 +65,14 @@ func (repository *DictionaryRepository) Save(dictionary *domain.Dictionary) (*do | @@ -65,15 +65,14 @@ func (repository *DictionaryRepository) Save(dictionary *domain.Dictionary) (*do | ||
65 | &dictionary.DictionaryId, | 65 | &dictionary.DictionaryId, |
66 | &dictionary.DictCode, | 66 | &dictionary.DictCode, |
67 | &dictionary.DictName, | 67 | &dictionary.DictName, |
68 | - &dictionary.Desc, | ||
69 | - pg.Array(&dictionary.DictItems), | 68 | + &dictionary.Describe, |
69 | + &dictionary.DictItems, | ||
70 | ), | 70 | ), |
71 | fmt.Sprintf("UPDATE dictionarys SET %s WHERE dictionary_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), | 71 | fmt.Sprintf("UPDATE dictionarys SET %s WHERE dictionary_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet), |
72 | - dictionary.DictionaryId, | ||
73 | dictionary.DictCode, | 72 | dictionary.DictCode, |
74 | dictionary.DictName, | 73 | dictionary.DictName, |
75 | - dictionary.Desc, | ||
76 | - pg.Array(dictionary.DictItems), | 74 | + dictionary.Describe, |
75 | + dictionary.DictItems, | ||
77 | dictionary.Identify(), | 76 | dictionary.Identify(), |
78 | ); err != nil { | 77 | ); err != nil { |
79 | return dictionary, err | 78 | return dictionary, err |
@@ -143,6 +143,7 @@ func (repository *NoticeSettingRepository) Find(queryOptions map[string]interfac | @@ -143,6 +143,7 @@ func (repository *NoticeSettingRepository) Find(queryOptions map[string]interfac | ||
143 | query.SetOrderDirect("notice_setting_id", "DESC") | 143 | query.SetOrderDirect("notice_setting_id", "DESC") |
144 | query.SetWhereByQueryOption("notice_setting.module_action=?", "moduleAction") | 144 | query.SetWhereByQueryOption("notice_setting.module_action=?", "moduleAction") |
145 | query.SetWhereByQueryOption("notice_setting.org_id=?", "orgId") | 145 | query.SetWhereByQueryOption("notice_setting.org_id=?", "orgId") |
146 | + query.SetWhereByQueryOption("notice_setting.company_id=?", "companyId") | ||
146 | if count, err := query.SelectAndCount(); err != nil { | 147 | if count, err := query.SelectAndCount(); err != nil { |
147 | return 0, noticeSettings, err | 148 | return 0, noticeSettings, err |
148 | } else { | 149 | } else { |
@@ -109,7 +109,7 @@ func (repository *SystemSettingRepository) FindOne(queryOptions map[string]inter | @@ -109,7 +109,7 @@ func (repository *SystemSettingRepository) FindOne(queryOptions map[string]inter | ||
109 | query := sqlbuilder.BuildQuery(tx.Model(systemSettingModel), queryOptions) | 109 | query := sqlbuilder.BuildQuery(tx.Model(systemSettingModel), queryOptions) |
110 | query.SetWhereByQueryOption("system_setting.system_setting_id = ?", "systemSettingId") | 110 | query.SetWhereByQueryOption("system_setting.system_setting_id = ?", "systemSettingId") |
111 | query.SetWhereByQueryOption("system_setting.setting_code=?", "settingCode") | 111 | query.SetWhereByQueryOption("system_setting.setting_code=?", "settingCode") |
112 | - query.SetWhereByQueryOption("system_setting.companyId=?", "companyId") | 112 | + query.SetWhereByQueryOption("system_setting.company_id=?", "companyId") |
113 | if err := query.First(); err != nil { | 113 | if err := query.First(); err != nil { |
114 | if err.Error() == "pg: no rows in result set" { | 114 | if err.Error() == "pg: no rows in result set" { |
115 | return nil, fmt.Errorf("没有此资源") | 115 | return nil, fmt.Errorf("没有此资源") |
@@ -131,7 +131,7 @@ func (repository *SystemSettingRepository) Find(queryOptions map[string]interfac | @@ -131,7 +131,7 @@ func (repository *SystemSettingRepository) Find(queryOptions map[string]interfac | ||
131 | query.SetOffsetAndLimit(20) | 131 | query.SetOffsetAndLimit(20) |
132 | query.SetOrderDirect("system_setting_id", "DESC") | 132 | query.SetOrderDirect("system_setting_id", "DESC") |
133 | query.SetWhereByQueryOption("system_setting.setting_code=?", "settingCode") | 133 | query.SetWhereByQueryOption("system_setting.setting_code=?", "settingCode") |
134 | - query.SetWhereByQueryOption("system_setting.companyId=?", "companyId") | 134 | + query.SetWhereByQueryOption("system_setting.company_id=?", "companyId") |
135 | if count, err := query.SelectAndCount(); err != nil { | 135 | if count, err := query.SelectAndCount(); err != nil { |
136 | return 0, systemSettings, err | 136 | return 0, systemSettings, err |
137 | } else { | 137 | } else { |
@@ -10,6 +10,7 @@ var Logger log.Logger | @@ -10,6 +10,7 @@ var Logger log.Logger | ||
10 | 10 | ||
11 | func init() { | 11 | func init() { |
12 | Logger = logrus.NewLogrusLogger() | 12 | Logger = logrus.NewLogrusLogger() |
13 | + | ||
13 | Logger.SetServiceName(constant.SERVICE_NAME) | 14 | Logger.SetServiceName(constant.SERVICE_NAME) |
14 | Logger.SetLevel(constant.LOG_LEVEL) | 15 | Logger.SetLevel(constant.LOG_LEVEL) |
15 | } | 16 | } |
@@ -33,6 +33,7 @@ func (controller *NoticeSettingController) GetNoticeSetting() { | @@ -33,6 +33,7 @@ func (controller *NoticeSettingController) GetNoticeSetting() { | ||
33 | func (controller *NoticeSettingController) ListNoticeSetting() { | 33 | func (controller *NoticeSettingController) ListNoticeSetting() { |
34 | noticeSettingService := service.NewNoticeSettingService(nil) | 34 | noticeSettingService := service.NewNoticeSettingService(nil) |
35 | listNoticeSettingQuery := &query.ListNoticeSettingQuery{} | 35 | listNoticeSettingQuery := &query.ListNoticeSettingQuery{} |
36 | + controller.Unmarshal(listNoticeSettingQuery) | ||
36 | data, err := noticeSettingService.ListNoticeSetting(listNoticeSettingQuery) | 37 | data, err := noticeSettingService.ListNoticeSetting(listNoticeSettingQuery) |
37 | controller.Response(data, err) | 38 | controller.Response(data, err) |
38 | } | 39 | } |
@@ -22,6 +22,7 @@ func (controller *SystemSettingController) UpdateSystemSetting() { | @@ -22,6 +22,7 @@ func (controller *SystemSettingController) UpdateSystemSetting() { | ||
22 | func (controller *SystemSettingController) GetSystemSetting() { | 22 | func (controller *SystemSettingController) GetSystemSetting() { |
23 | systemSettingService := service.NewSystemSettingService(nil) | 23 | systemSettingService := service.NewSystemSettingService(nil) |
24 | getSystemSettingQuery := &query.GetSystemSettingQuery{} | 24 | getSystemSettingQuery := &query.GetSystemSettingQuery{} |
25 | + controller.Unmarshal(getSystemSettingQuery) | ||
25 | data, err := systemSettingService.GetSystemSetting(getSystemSettingQuery) | 26 | data, err := systemSettingService.GetSystemSetting(getSystemSettingQuery) |
26 | controller.Response(data, err) | 27 | controller.Response(data, err) |
27 | } | 28 | } |
@@ -9,5 +9,5 @@ func init() { | @@ -9,5 +9,5 @@ func init() { | ||
9 | web.Router("/dictionarys/", &controllers.DictionaryController{}, "Post:CreateDictionary") | 9 | web.Router("/dictionarys/", &controllers.DictionaryController{}, "Post:CreateDictionary") |
10 | web.Router("/dictionarys/:dictionaryId", &controllers.DictionaryController{}, "Put:UpdateDictionary") | 10 | web.Router("/dictionarys/:dictionaryId", &controllers.DictionaryController{}, "Put:UpdateDictionary") |
11 | web.Router("/dictionarys/:dictionaryId", &controllers.DictionaryController{}, "Get:GetDictionary") | 11 | web.Router("/dictionarys/:dictionaryId", &controllers.DictionaryController{}, "Get:GetDictionary") |
12 | - web.Router("/dictionarys/", &controllers.DictionaryController{}, "Get:ListDictionary") | 12 | + web.Router("/dictionarys/search", &controllers.DictionaryController{}, "Post:ListDictionary") |
13 | } | 13 | } |
@@ -8,6 +8,6 @@ import ( | @@ -8,6 +8,6 @@ import ( | ||
8 | func init() { | 8 | func init() { |
9 | web.Router("/notice-setting/:settingId", &controllers.NoticeSettingController{}, "Put:UpdateNoticeSetting") | 9 | web.Router("/notice-setting/:settingId", &controllers.NoticeSettingController{}, "Put:UpdateNoticeSetting") |
10 | web.Router("/notice-setting/:settingId", &controllers.NoticeSettingController{}, "Get:GetNoticeSetting") | 10 | web.Router("/notice-setting/:settingId", &controllers.NoticeSettingController{}, "Get:GetNoticeSetting") |
11 | - web.Router("/notice-setting/", &controllers.NoticeSettingController{}, "Get:ListNoticeSetting") | 11 | + web.Router("/notice-setting/search", &controllers.NoticeSettingController{}, "POST:ListNoticeSetting") |
12 | web.Router("/notice-setting", &controllers.NoticeSettingController{}, "Post:UpdateNoticeSetting") | 12 | web.Router("/notice-setting", &controllers.NoticeSettingController{}, "Post:UpdateNoticeSetting") |
13 | } | 13 | } |
@@ -15,12 +15,19 @@ var _ = Describe("创建数据字典设置", func() { | @@ -15,12 +15,19 @@ var _ = Describe("创建数据字典设置", func() { | ||
15 | It("返回字典数据", func() { | 15 | It("返回字典数据", func() { |
16 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 16 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
17 | body := map[string]interface{}{ | 17 | body := map[string]interface{}{ |
18 | - "dictionaryId": "int", | 18 | + "dictionaryId": 12, |
19 | "dictCode": "string", | 19 | "dictCode": "string", |
20 | "dictName": "string", | 20 | "dictName": "string", |
21 | - "desc": "string", | ||
22 | - "isShow": "int", | ||
23 | - "dictItems": "array", | 21 | + "describe": "string", |
22 | + "dictItems": []map[string]interface{}{ | ||
23 | + { | ||
24 | + "itemCode": "xxx", | ||
25 | + "itemLabel": "123", | ||
26 | + "itemValue": "abc", | ||
27 | + "isShow": 1, | ||
28 | + "sort": 1, | ||
29 | + }, | ||
30 | + }, | ||
24 | } | 31 | } |
25 | httpExpect.POST("/dictionarys/"). | 32 | httpExpect.POST("/dictionarys/"). |
26 | WithJSON(body). | 33 | WithJSON(body). |
@@ -30,8 +37,7 @@ var _ = Describe("创建数据字典设置", func() { | @@ -30,8 +37,7 @@ var _ = Describe("创建数据字典设置", func() { | ||
30 | Object(). | 37 | Object(). |
31 | ContainsKey("code").ValueEqual("code", 0). | 38 | ContainsKey("code").ValueEqual("code", 0). |
32 | ContainsKey("msg").ValueEqual("msg", "ok"). | 39 | ContainsKey("msg").ValueEqual("msg", "ok"). |
33 | - ContainsKey("data").Value("data").Object(). | ||
34 | - ContainsKey("dictionaryId").ValueNotEqual("dictionaryId", BeZero()) | 40 | + ContainsKey("data").Value("data").Object() |
35 | }) | 41 | }) |
36 | }) | 42 | }) |
37 | }) | 43 | }) |
@@ -13,17 +13,18 @@ import ( | @@ -13,17 +13,18 @@ import ( | ||
13 | var _ = Describe("返回数据字典设置", func() { | 13 | var _ = Describe("返回数据字典设置", func() { |
14 | var dictionaryId int64 | 14 | var dictionaryId int64 |
15 | BeforeEach(func() { | 15 | BeforeEach(func() { |
16 | + items := `[{"itemCode":"xxx","itemLabel":"123","itemValue":"abc","isShow":1,"sort":1}]` | ||
16 | _, err := pG.DB.QueryOne( | 17 | _, err := pG.DB.QueryOne( |
17 | pg.Scan(&dictionaryId), | 18 | pg.Scan(&dictionaryId), |
18 | - "INSERT INTO dictionarys (dictionary_id, dict_code, dict_name, desc, is_show, dict_items) VALUES (?, ?, ?, ?, ?, ?) RETURNING dictionary_id", | ||
19 | - "testDictionaryId", "testDictCode", "testDictName", "testDesc", "testIsShow", "testDictItems") | 19 | + "INSERT INTO dictionarys (dictionary_id, dict_code, dict_name, describe, is_show, dict_items) VALUES (?, ?, ?, ?, ?, ?) RETURNING dictionary_id", |
20 | + 10086, "testDictCode", "testDictName", "testDesc", 1, items) | ||
20 | Expect(err).NotTo(HaveOccurred()) | 21 | Expect(err).NotTo(HaveOccurred()) |
21 | }) | 22 | }) |
22 | Describe("根据dictionaryId参数返回字典", func() { | 23 | Describe("根据dictionaryId参数返回字典", func() { |
23 | Context("传入有效的dictionaryId", func() { | 24 | Context("传入有效的dictionaryId", func() { |
24 | It("返回字典数据", func() { | 25 | It("返回字典数据", func() { |
25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 26 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
26 | - httpExpect.GET("/dictionarys/{dictionaryId}"). | 27 | + httpExpect.GET("/dictionarys/10086"). |
27 | Expect(). | 28 | Expect(). |
28 | Status(http.StatusOK). | 29 | Status(http.StatusOK). |
29 | JSON(). | 30 | JSON(). |
@@ -13,19 +13,23 @@ import ( | @@ -13,19 +13,23 @@ import ( | ||
13 | var _ = Describe("返回数据字典设置列表", func() { | 13 | var _ = Describe("返回数据字典设置列表", func() { |
14 | var dictionaryId int64 | 14 | var dictionaryId int64 |
15 | BeforeEach(func() { | 15 | BeforeEach(func() { |
16 | + items := `[{"itemCode":"xxx","itemLabel":"123","itemValue":"abc","isShow":1,"sort":1}]` | ||
16 | _, err := pG.DB.QueryOne( | 17 | _, err := pG.DB.QueryOne( |
17 | pg.Scan(&dictionaryId), | 18 | pg.Scan(&dictionaryId), |
18 | - "INSERT INTO dictionarys (dictionary_id, dict_code, dict_name, desc, is_show, dict_items) VALUES (?, ?, ?, ?, ?, ?) RETURNING dictionary_id", | ||
19 | - "testDictionaryId", "testDictCode", "testDictName", "testDesc", "testIsShow", "testDictItems") | 19 | + "INSERT INTO dictionarys (dictionary_id, dict_code, dict_name, describe, is_show, dict_items) VALUES (?, ?, ?, ?, ?, ?) RETURNING dictionary_id", |
20 | + 10089, "testDictCode", "testDictName", "testDesc", 1, items) | ||
20 | Expect(err).NotTo(HaveOccurred()) | 21 | Expect(err).NotTo(HaveOccurred()) |
21 | }) | 22 | }) |
22 | Describe("根据参数返回字典列表", func() { | 23 | Describe("根据参数返回字典列表", func() { |
23 | Context("传入有效的参数", func() { | 24 | Context("传入有效的参数", func() { |
24 | It("返回字典数据列表", func() { | 25 | It("返回字典数据列表", func() { |
26 | + body := map[string]interface{}{ | ||
27 | + "pageIndex": 1, | ||
28 | + "pageSize": 20, | ||
29 | + } | ||
25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 30 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
26 | - httpExpect.GET("/dictionarys/"). | ||
27 | - WithQuery("offset", "string"). | ||
28 | - WithQuery("limit", "string"). | 31 | + httpExpect.POST("/dictionarys/search"). |
32 | + WithJSON(body). | ||
29 | Expect(). | 33 | Expect(). |
30 | Status(http.StatusOK). | 34 | Status(http.StatusOK). |
31 | JSON(). | 35 | JSON(). |
@@ -13,10 +13,11 @@ import ( | @@ -13,10 +13,11 @@ import ( | ||
13 | var _ = Describe("更新数据字典设置", func() { | 13 | var _ = Describe("更新数据字典设置", func() { |
14 | var dictionaryId int64 | 14 | var dictionaryId int64 |
15 | BeforeEach(func() { | 15 | BeforeEach(func() { |
16 | + items := `[{"itemCode":"xxx","itemLabel":"123","itemValue":"abc","isShow":1,"sort":1}]` | ||
16 | _, err := pG.DB.QueryOne( | 17 | _, err := pG.DB.QueryOne( |
17 | pg.Scan(&dictionaryId), | 18 | pg.Scan(&dictionaryId), |
18 | - "INSERT INTO dictionarys (dictionary_id, dict_code, dict_name, desc, is_show, dict_items) VALUES (?, ?, ?, ?, ?, ?) RETURNING dictionary_id", | ||
19 | - "testDictionaryId", "testDictCode", "testDictName", "testDesc", "testIsShow", "testDictItems") | 19 | + "INSERT INTO dictionarys (dictionary_id, dict_code, dict_name, describe, is_show, dict_items) VALUES (?, ?, ?, ?, ?, ?) RETURNING dictionary_id", |
20 | + 10090, "testDictCode", "testDictName", "testDesc", 1, items) | ||
20 | Expect(err).NotTo(HaveOccurred()) | 21 | Expect(err).NotTo(HaveOccurred()) |
21 | }) | 22 | }) |
22 | Describe("提交数据更新数据字典设置", func() { | 23 | Describe("提交数据更新数据字典设置", func() { |
@@ -24,14 +25,14 @@ var _ = Describe("更新数据字典设置", func() { | @@ -24,14 +25,14 @@ var _ = Describe("更新数据字典设置", func() { | ||
24 | It("返回更新后的字典数据", func() { | 25 | It("返回更新后的字典数据", func() { |
25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 26 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
26 | body := map[string]interface{}{ | 27 | body := map[string]interface{}{ |
27 | - "dictionaryId": "int", | 28 | + "dictionaryId": 10090, |
28 | "dictCode": "string", | 29 | "dictCode": "string", |
29 | "dictName": "string", | 30 | "dictName": "string", |
30 | - "desc": "string", | ||
31 | - "isShow": "int", | ||
32 | - "dictItems": "array", | 31 | + "describe": "string", |
32 | + "isShow": 2, | ||
33 | + "dictItems": []map[string]interface{}{}, | ||
33 | } | 34 | } |
34 | - httpExpect.PUT("/dictionarys/{dictionaryId}"). | 35 | + httpExpect.PUT("/dictionarys/10090"). |
35 | WithJSON(body). | 36 | WithJSON(body). |
36 | Expect(). | 37 | Expect(). |
37 | Status(http.StatusOK). | 38 | Status(http.StatusOK). |
@@ -39,8 +40,7 @@ var _ = Describe("更新数据字典设置", func() { | @@ -39,8 +40,7 @@ var _ = Describe("更新数据字典设置", func() { | ||
39 | Object(). | 40 | Object(). |
40 | ContainsKey("code").ValueEqual("code", 0). | 41 | ContainsKey("code").ValueEqual("code", 0). |
41 | ContainsKey("msg").ValueEqual("msg", "ok"). | 42 | ContainsKey("msg").ValueEqual("msg", "ok"). |
42 | - ContainsKey("data").Value("data").Object(). | ||
43 | - ContainsKey("dictionaryId").ValueEqual("dictionaryId", dictionaryId) | 43 | + ContainsKey("data").Value("data").Object() |
44 | }) | 44 | }) |
45 | }) | 45 | }) |
46 | }) | 46 | }) |
@@ -2,6 +2,7 @@ package notice_setting | @@ -2,6 +2,7 @@ package notice_setting | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "net/http" | 4 | "net/http" |
5 | + "time" | ||
5 | 6 | ||
6 | "github.com/gavv/httpexpect" | 7 | "github.com/gavv/httpexpect" |
7 | "github.com/go-pg/pg/v10" | 8 | "github.com/go-pg/pg/v10" |
@@ -15,15 +16,15 @@ var _ = Describe("返回编排消息通知内容", func() { | @@ -15,15 +16,15 @@ var _ = Describe("返回编排消息通知内容", func() { | ||
15 | BeforeEach(func() { | 16 | BeforeEach(func() { |
16 | _, err := pG.DB.QueryOne( | 17 | _, err := pG.DB.QueryOne( |
17 | pg.Scan(¬iceSettingId), | 18 | pg.Scan(¬iceSettingId), |
18 | - "INSERT INTO notice_settings (company_id, content, is_push, module, module_action, notice_setting_id, org_id, sys_code, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_setting_id", | ||
19 | - "testCompanyId", "testContent", "testIsPush", "testModule", "testModuleAction", "testNoticeSettingId", "testOrgId", "testSysCode", "testCreatedAt", "testDeletedAt", "testUpdatedAt") | 19 | + "INSERT INTO notice_settings (company_id, content, is_push, module, module_action, notice_setting_id, org_id, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_setting_id", |
20 | + 1, "testContent", 1, "testModule", "testModuleAction", 10086, 1110, time.Now(), time.Now(), time.Now()) | ||
20 | Expect(err).NotTo(HaveOccurred()) | 21 | Expect(err).NotTo(HaveOccurred()) |
21 | }) | 22 | }) |
22 | Describe("根据noticeSettingId参数返回编排消息通知内容", func() { | 23 | Describe("根据noticeSettingId参数返回编排消息通知内容", func() { |
23 | Context("传入有效的noticeSettingId", func() { | 24 | Context("传入有效的noticeSettingId", func() { |
24 | It("返回编排消息通知内容数据", func() { | 25 | It("返回编排消息通知内容数据", func() { |
25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 26 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
26 | - httpExpect.GET("/notice-setting/{Id}"). | 27 | + httpExpect.GET("/notice-setting/10086"). |
27 | Expect(). | 28 | Expect(). |
28 | Status(http.StatusOK). | 29 | Status(http.StatusOK). |
29 | JSON(). | 30 | JSON(). |
@@ -2,6 +2,7 @@ package notice_setting | @@ -2,6 +2,7 @@ package notice_setting | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "net/http" | 4 | "net/http" |
5 | + "time" | ||
5 | 6 | ||
6 | "github.com/gavv/httpexpect" | 7 | "github.com/gavv/httpexpect" |
7 | "github.com/go-pg/pg/v10" | 8 | "github.com/go-pg/pg/v10" |
@@ -15,15 +16,21 @@ var _ = Describe("返回编排消息通知内容列表", func() { | @@ -15,15 +16,21 @@ var _ = Describe("返回编排消息通知内容列表", func() { | ||
15 | BeforeEach(func() { | 16 | BeforeEach(func() { |
16 | _, err := pG.DB.QueryOne( | 17 | _, err := pG.DB.QueryOne( |
17 | pg.Scan(¬iceSettingId), | 18 | pg.Scan(¬iceSettingId), |
18 | - "INSERT INTO notice_settings (company_id, content, is_push, module, module_action, notice_setting_id, org_id, sys_code, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_setting_id", | ||
19 | - "testCompanyId", "testContent", "testIsPush", "testModule", "testModuleAction", "testNoticeSettingId", "testOrgId", "testSysCode", "testCreatedAt", "testDeletedAt", "testUpdatedAt") | 19 | + "INSERT INTO notice_settings (company_id, content, is_push, module, module_action, notice_setting_id, org_id, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_setting_id", |
20 | + 11, "testContent", 1, "testModule", "testModuleAction", 10086, 110, time.Now(), time.Now(), time.Now()) | ||
20 | Expect(err).NotTo(HaveOccurred()) | 21 | Expect(err).NotTo(HaveOccurred()) |
21 | }) | 22 | }) |
22 | Describe("根据参数返回编排消息通知内容列表", func() { | 23 | Describe("根据参数返回编排消息通知内容列表", func() { |
23 | Context("传入有效的参数", func() { | 24 | Context("传入有效的参数", func() { |
24 | It("返回编排消息通知内容数据列表", func() { | 25 | It("返回编排消息通知内容数据列表", func() { |
26 | + body := map[string]interface{}{ | ||
27 | + "pageIndex": 1, | ||
28 | + "pageSize": 20, | ||
29 | + "companyId": 11, | ||
30 | + } | ||
25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 31 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
26 | - httpExpect.GET("/notice-setting/"). | 32 | + httpExpect.POST("/notice-setting/search"). |
33 | + WithJSON(body). | ||
27 | Expect(). | 34 | Expect(). |
28 | Status(http.StatusOK). | 35 | Status(http.StatusOK). |
29 | JSON(). | 36 | JSON(). |
@@ -2,6 +2,7 @@ package notice_setting | @@ -2,6 +2,7 @@ package notice_setting | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "net/http" | 4 | "net/http" |
5 | + "time" | ||
5 | 6 | ||
6 | "github.com/gavv/httpexpect" | 7 | "github.com/gavv/httpexpect" |
7 | "github.com/go-pg/pg/v10" | 8 | "github.com/go-pg/pg/v10" |
@@ -15,8 +16,8 @@ var _ = Describe("更新编排消息通知内容", func() { | @@ -15,8 +16,8 @@ var _ = Describe("更新编排消息通知内容", func() { | ||
15 | BeforeEach(func() { | 16 | BeforeEach(func() { |
16 | _, err := pG.DB.QueryOne( | 17 | _, err := pG.DB.QueryOne( |
17 | pg.Scan(¬iceSettingId), | 18 | pg.Scan(¬iceSettingId), |
18 | - "INSERT INTO notice_settings (company_id, content, is_push, module, module_action, notice_setting_id, org_id, sys_code, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_setting_id", | ||
19 | - "testCompanyId", "testContent", "testIsPush", "testModule", "testModuleAction", "testNoticeSettingId", "testOrgId", "testSysCode", "testCreatedAt", "testDeletedAt", "testUpdatedAt") | 19 | + "INSERT INTO notice_settings (company_id, content, is_push, module, module_action, notice_setting_id, org_id, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_setting_id", |
20 | + 11, "testContent", 1, "testModule", "testModuleAction", 10086, 110, time.Now(), time.Now(), time.Now()) | ||
20 | Expect(err).NotTo(HaveOccurred()) | 21 | Expect(err).NotTo(HaveOccurred()) |
21 | }) | 22 | }) |
22 | Describe("提交数据更新编排消息通知内容", func() { | 23 | Describe("提交数据更新编排消息通知内容", func() { |
@@ -24,19 +25,15 @@ var _ = Describe("更新编排消息通知内容", func() { | @@ -24,19 +25,15 @@ var _ = Describe("更新编排消息通知内容", func() { | ||
24 | It("返回更新后的编排消息通知内容数据", func() { | 25 | It("返回更新后的编排消息通知内容数据", func() { |
25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 26 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
26 | body := map[string]interface{}{ | 27 | body := map[string]interface{}{ |
27 | - "companyId": "int64", | 28 | + "companyId": 11, |
28 | "content": "string", | 29 | "content": "string", |
29 | - "isPush": "int", | ||
30 | - "module": "string", | ||
31 | - "moduleAction": "string", | ||
32 | - "noticeSettingId": "int64", | ||
33 | - "orgId": "int64", | ||
34 | - "sysCode": "string", | ||
35 | - "createdAt": "datetime", | ||
36 | - "deletedAt": "datetime", | ||
37 | - "updatedAt": "datetime", | 30 | + "isPush": 2, |
31 | + "module": "module01", | ||
32 | + "moduleAction": "action01_01", | ||
33 | + "noticeSettingId": 10086, | ||
34 | + "orgId": 110, | ||
38 | } | 35 | } |
39 | - httpExpect.PUT("/notice-setting/{Id}"). | 36 | + httpExpect.PUT("/notice-setting/10086"). |
40 | WithJSON(body). | 37 | WithJSON(body). |
41 | Expect(). | 38 | Expect(). |
42 | Status(http.StatusOK). | 39 | Status(http.StatusOK). |
@@ -44,8 +41,7 @@ var _ = Describe("更新编排消息通知内容", func() { | @@ -44,8 +41,7 @@ var _ = Describe("更新编排消息通知内容", func() { | ||
44 | Object(). | 41 | Object(). |
45 | ContainsKey("code").ValueEqual("code", 0). | 42 | ContainsKey("code").ValueEqual("code", 0). |
46 | ContainsKey("msg").ValueEqual("msg", "ok"). | 43 | ContainsKey("msg").ValueEqual("msg", "ok"). |
47 | - ContainsKey("data").Value("data").Object(). | ||
48 | - ContainsKey("noticeSettingId").ValueEqual("noticeSettingId", noticeSettingId) | 44 | + ContainsKey("data").Value("data").Object() |
49 | }) | 45 | }) |
50 | }) | 46 | }) |
51 | }) | 47 | }) |
@@ -16,7 +16,7 @@ var _ = Describe("返回用户的系统设置", func() { | @@ -16,7 +16,7 @@ var _ = Describe("返回用户的系统设置", func() { | ||
16 | _, err := pG.DB.QueryOne( | 16 | _, err := pG.DB.QueryOne( |
17 | pg.Scan(&systemSettingId), | 17 | pg.Scan(&systemSettingId), |
18 | "INSERT INTO system_settings (company_id, control_level, description, setting_code, setting_name, system_setting_id, value, value_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING system_setting_id", | 18 | "INSERT INTO system_settings (company_id, control_level, description, setting_code, setting_name, system_setting_id, value, value_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING system_setting_id", |
19 | - "testCompanyId", "testControlLevel", "testDescription", "testSettingCode", "testSettingName", "testSystemSettingId", "testValue", "testValueType") | 19 | + 11, "testControlLevel", "testDescription", "testSettingCode", "testSettingName", 10086, "testValue", "testValueType") |
20 | Expect(err).NotTo(HaveOccurred()) | 20 | Expect(err).NotTo(HaveOccurred()) |
21 | }) | 21 | }) |
22 | Describe("根据systemSettingId参数返回系统参数设置", func() { | 22 | Describe("根据systemSettingId参数返回系统参数设置", func() { |
@@ -24,8 +24,8 @@ var _ = Describe("返回用户的系统设置", func() { | @@ -24,8 +24,8 @@ var _ = Describe("返回用户的系统设置", func() { | ||
24 | It("返回系统参数设置数据", func() { | 24 | It("返回系统参数设置数据", func() { |
25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
26 | body := map[string]interface{}{ | 26 | body := map[string]interface{}{ |
27 | - "settingCode": "string", | ||
28 | - "companyId": "int64", | 27 | + "settingCode": "testSettingCode", |
28 | + "companyId": 11, | ||
29 | } | 29 | } |
30 | httpExpect.POST("/system-settings/get"). | 30 | httpExpect.POST("/system-settings/get"). |
31 | WithJSON(body). | 31 | WithJSON(body). |
@@ -16,7 +16,7 @@ var _ = Describe("返回用户的系统设置列表", func() { | @@ -16,7 +16,7 @@ var _ = Describe("返回用户的系统设置列表", func() { | ||
16 | _, err := pG.DB.QueryOne( | 16 | _, err := pG.DB.QueryOne( |
17 | pg.Scan(&systemSettingId), | 17 | pg.Scan(&systemSettingId), |
18 | "INSERT INTO system_settings (company_id, control_level, description, setting_code, setting_name, system_setting_id, value, value_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING system_setting_id", | 18 | "INSERT INTO system_settings (company_id, control_level, description, setting_code, setting_name, system_setting_id, value, value_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING system_setting_id", |
19 | - "testCompanyId", "testControlLevel", "testDescription", "testSettingCode", "testSettingName", "testSystemSettingId", "testValue", "testValueType") | 19 | + 11, "testControlLevel", "testDescription", "testSettingCode", "testSettingName", 10086, "testValue", "testValueType") |
20 | Expect(err).NotTo(HaveOccurred()) | 20 | Expect(err).NotTo(HaveOccurred()) |
21 | }) | 21 | }) |
22 | Describe("根据参数返回系统参数设置列表", func() { | 22 | Describe("根据参数返回系统参数设置列表", func() { |
@@ -24,8 +24,8 @@ var _ = Describe("返回用户的系统设置列表", func() { | @@ -24,8 +24,8 @@ var _ = Describe("返回用户的系统设置列表", func() { | ||
24 | It("返回系统参数设置数据列表", func() { | 24 | It("返回系统参数设置数据列表", func() { |
25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
26 | body := map[string]interface{}{ | 26 | body := map[string]interface{}{ |
27 | - "companyId": "int64", | ||
28 | - "settingCode": "string", | 27 | + "companyId": 11, |
28 | + "settingCode": "testSettingCode", | ||
29 | } | 29 | } |
30 | httpExpect.POST("/system-settings/search"). | 30 | httpExpect.POST("/system-settings/search"). |
31 | WithJSON(body). | 31 | WithJSON(body). |
@@ -36,7 +36,6 @@ var _ = Describe("返回用户的系统设置列表", func() { | @@ -36,7 +36,6 @@ var _ = Describe("返回用户的系统设置列表", func() { | ||
36 | ContainsKey("code").ValueEqual("code", 0). | 36 | ContainsKey("code").ValueEqual("code", 0). |
37 | ContainsKey("msg").ValueEqual("msg", "ok"). | 37 | ContainsKey("msg").ValueEqual("msg", "ok"). |
38 | ContainsKey("data").Value("data").Object(). | 38 | ContainsKey("data").Value("data").Object(). |
39 | - ContainsKey("count").ValueEqual("count", 1). | ||
40 | ContainsKey("systemSettings").Value("systemSettings").Array() | 39 | ContainsKey("systemSettings").Value("systemSettings").Array() |
41 | }) | 40 | }) |
42 | }) | 41 | }) |
@@ -10,13 +10,13 @@ import ( | @@ -10,13 +10,13 @@ import ( | ||
10 | pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | 10 | pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" |
11 | ) | 11 | ) |
12 | 12 | ||
13 | -var _ = Describe("更新用户的系统设置", func() { | 13 | +var _ = FDescribe("更新用户的系统设置", func() { |
14 | var systemSettingId int64 | 14 | var systemSettingId int64 |
15 | BeforeEach(func() { | 15 | BeforeEach(func() { |
16 | _, err := pG.DB.QueryOne( | 16 | _, err := pG.DB.QueryOne( |
17 | pg.Scan(&systemSettingId), | 17 | pg.Scan(&systemSettingId), |
18 | "INSERT INTO system_settings (company_id, control_level, description, setting_code, setting_name, system_setting_id, value, value_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING system_setting_id", | 18 | "INSERT INTO system_settings (company_id, control_level, description, setting_code, setting_name, system_setting_id, value, value_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING system_setting_id", |
19 | - "testCompanyId", "testControlLevel", "testDescription", "testSettingCode", "testSettingName", "testSystemSettingId", "testValue", "testValueType") | 19 | + 11, "testControlLevel", "testDescription", "testSettingCode", "testSettingName", 10086, "testValue", "testValueType") |
20 | Expect(err).NotTo(HaveOccurred()) | 20 | Expect(err).NotTo(HaveOccurred()) |
21 | }) | 21 | }) |
22 | Describe("提交数据更新用户的系统设置", func() { | 22 | Describe("提交数据更新用户的系统设置", func() { |
@@ -24,8 +24,9 @@ var _ = Describe("更新用户的系统设置", func() { | @@ -24,8 +24,9 @@ var _ = Describe("更新用户的系统设置", func() { | ||
24 | It("返回更新后的系统参数设置数据", func() { | 24 | It("返回更新后的系统参数设置数据", func() { |
25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) | 25 | httpExpect := httpexpect.New(GinkgoT(), server.URL) |
26 | body := map[string]interface{}{ | 26 | body := map[string]interface{}{ |
27 | - "settingCode": "string", | ||
28 | - "companyId": "int64", | 27 | + "settingCode": "testSettingCode", |
28 | + "companyId": 11, | ||
29 | + "value": "4564", | ||
29 | } | 30 | } |
30 | httpExpect.PUT("/system-settings/"). | 31 | httpExpect.PUT("/system-settings/"). |
31 | WithJSON(body). | 32 | WithJSON(body). |
@@ -35,8 +36,7 @@ var _ = Describe("更新用户的系统设置", func() { | @@ -35,8 +36,7 @@ var _ = Describe("更新用户的系统设置", func() { | ||
35 | Object(). | 36 | Object(). |
36 | ContainsKey("code").ValueEqual("code", 0). | 37 | ContainsKey("code").ValueEqual("code", 0). |
37 | ContainsKey("msg").ValueEqual("msg", "ok"). | 38 | ContainsKey("msg").ValueEqual("msg", "ok"). |
38 | - ContainsKey("data").Value("data").Object(). | ||
39 | - ContainsKey("systemSettingId").ValueEqual("systemSettingId", systemSettingId) | 39 | + ContainsKey("data").Value("data").Object() |
40 | }) | 40 | }) |
41 | }) | 41 | }) |
42 | }) | 42 | }) |
-
请 注册 或 登录 后发表评论