作者 yangfu

字典修改

@@ -5,7 +5,6 @@ import ( @@ -5,7 +5,6 @@ import (
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/command" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/command"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"  
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
10 ) 9 )
11 10
@@ -18,14 +17,53 @@ func NewCommonService(options map[string]interface{}) *CommonService { @@ -18,14 +17,53 @@ func NewCommonService(options map[string]interface{}) *CommonService {
18 17
19 //GetDictionaryByCode 根据code获取字典数据 18 //GetDictionaryByCode 根据code获取字典数据
20 func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDictionaryByCodeQuery) (interface{}, error) { 19 func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDictionaryByCodeQuery) (interface{}, error) {
21 - creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(domain.Operator{})  
22 - result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{  
23 - DictCode: getDictionaryQuery.DictCode,  
24 - })  
25 - if err != nil {  
26 - return nil, err 20 + //creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(domain.Operator{})
  21 + //result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{
  22 + // DictCode: getDictionaryQuery.DictCode,
  23 + //})
  24 + //if err != nil {
  25 + // return nil, err
  26 + //}
  27 + //return result, nil
  28 + // TODO:测试使用,后期移除掉
  29 + type dictItem struct {
  30 + ItemCode string `json:"itemCode"`
  31 + ItemValue string `json:"itemValue"`
  32 + }
  33 + dictionaries := make([]interface{}, 0)
  34 + for i := range getDictionaryQuery.DictCode {
  35 + switch getDictionaryQuery.DictCode[i] {
  36 + case "MenuType":
  37 + dictionaries = append(dictionaries, map[string]interface{}{
  38 + "dictName": "菜单类型",
  39 + "dictItems": []dictItem{
  40 + {"目录", "catalog"},
  41 + {"菜单", "menu"},
  42 + {"按钮", "button"},
  43 + },
  44 + })
  45 + case "scale":
  46 + dictionaries = append(dictionaries, map[string]interface{}{
  47 + "dictName": "规模",
  48 + "dictItems": []dictItem{
  49 + {"50~100人", "50~100人"},
  50 + {"100~500人", "100~500人"},
  51 + {"500人以上", "500人以上"},
  52 + },
  53 + })
  54 + case "industry":
  55 + dictionaries = append(dictionaries, map[string]interface{}{
  56 + "dictName": "产业类型",
  57 + "dictItems": []dictItem{
  58 + {"食品行业", "食品行业"},
  59 + {"金融行业", "金融行业"},
  60 + {"保险行业", "保险行业"},
  61 + {"计算机行业", "计算机行业"},
  62 + },
  63 + })
  64 + }
27 } 65 }
28 - return result, nil 66 + return map[string]interface{}{"dictionarys": dictionaries}, nil
29 } 67 }
30 68
31 //CompanySignUp 公司注册 69 //CompanySignUp 公司注册
@@ -2,11 +2,11 @@ package constant @@ -2,11 +2,11 @@ package constant
2 2
3 import "os" 3 import "os"
4 4
5 -var POSTGRESQL_DB_NAME = "project" 5 +var POSTGRESQL_DB_NAME = "terms"
6 var POSTGRESQL_USER = "postgres" 6 var POSTGRESQL_USER = "postgres"
7 -var POSTGRESQL_PASSWORD = "" 7 +var POSTGRESQL_PASSWORD = "123456"
8 var POSTGRESQL_HOST = "127.0.0.1" 8 var POSTGRESQL_HOST = "127.0.0.1"
9 -var POSTGRESQL_PORT = "32432" 9 +var POSTGRESQL_PORT = "5432"
10 var DISABLE_CREATE_TABLE = false 10 var DISABLE_CREATE_TABLE = false
11 var DISABLE_SQL_GENERATE_PRINT = false 11 var DISABLE_SQL_GENERATE_PRINT = false
12 12
@@ -13,9 +13,9 @@ type CommonController struct { @@ -13,9 +13,9 @@ type CommonController struct {
13 13
14 func (controller *CommonController) GetDictionaryByCode() { 14 func (controller *CommonController) GetDictionaryByCode() {
15 commonService := service.NewCommonService(nil) 15 commonService := service.NewCommonService(nil)
16 - queryParm := query.GetDictionaryByCodeQuery{}  
17 - _ = controller.Unmarshal(queryParm)  
18 - data, err := commonService.GetDictionaryByCode(&queryParm) 16 + queryParam := &query.GetDictionaryByCodeQuery{}
  17 + _ = controller.Unmarshal(queryParam)
  18 + data, err := commonService.GetDictionaryByCode(queryParam)
19 controller.Response(data, err) 19 controller.Response(data, err)
20 } 20 }
21 21
@@ -7,4 +7,5 @@ import ( @@ -7,4 +7,5 @@ import (
7 7
8 func init() { 8 func init() {
9 web.Router("/common/dictionary/search", &common_controller.CommonController{}, "Post:GetDictionaryByCode") 9 web.Router("/common/dictionary/search", &common_controller.CommonController{}, "Post:GetDictionaryByCode")
  10 + //web.Router("/common/dictionary/search", &common_controller.CommonController{}, "Post:GetDictionaryByCode")
10 } 11 }