作者 yangfu

字典修改

... ... @@ -5,7 +5,6 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
... ... @@ -18,14 +17,53 @@ func NewCommonService(options map[string]interface{}) *CommonService {
//GetDictionaryByCode 根据code获取字典数据
func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDictionaryByCodeQuery) (interface{}, error) {
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(domain.Operator{})
result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{
DictCode: getDictionaryQuery.DictCode,
//creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(domain.Operator{})
//result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{
// DictCode: getDictionaryQuery.DictCode,
//})
//if err != nil {
// return nil, err
//}
//return result, nil
// TODO:测试使用,后期移除掉
type dictItem struct {
ItemCode string `json:"itemCode"`
ItemValue string `json:"itemValue"`
}
dictionaries := make([]interface{}, 0)
for i := range getDictionaryQuery.DictCode {
switch getDictionaryQuery.DictCode[i] {
case "MenuType":
dictionaries = append(dictionaries, map[string]interface{}{
"dictName": "菜单类型",
"dictItems": []dictItem{
{"目录", "catalog"},
{"菜单", "menu"},
{"按钮", "button"},
},
})
if err != nil {
return nil, err
case "scale":
dictionaries = append(dictionaries, map[string]interface{}{
"dictName": "规模",
"dictItems": []dictItem{
{"50~100人", "50~100人"},
{"100~500人", "100~500人"},
{"500人以上", "500人以上"},
},
})
case "industry":
dictionaries = append(dictionaries, map[string]interface{}{
"dictName": "产业类型",
"dictItems": []dictItem{
{"食品行业", "食品行业"},
{"金融行业", "金融行业"},
{"保险行业", "保险行业"},
{"计算机行业", "计算机行业"},
},
})
}
}
return result, nil
return map[string]interface{}{"dictionarys": dictionaries}, nil
}
//CompanySignUp 公司注册
... ...
... ... @@ -2,11 +2,11 @@ package constant
import "os"
var POSTGRESQL_DB_NAME = "project"
var POSTGRESQL_DB_NAME = "terms"
var POSTGRESQL_USER = "postgres"
var POSTGRESQL_PASSWORD = ""
var POSTGRESQL_PASSWORD = "123456"
var POSTGRESQL_HOST = "127.0.0.1"
var POSTGRESQL_PORT = "32432"
var POSTGRESQL_PORT = "5432"
var DISABLE_CREATE_TABLE = false
var DISABLE_SQL_GENERATE_PRINT = false
... ...
... ... @@ -13,9 +13,9 @@ type CommonController struct {
func (controller *CommonController) GetDictionaryByCode() {
commonService := service.NewCommonService(nil)
queryParm := query.GetDictionaryByCodeQuery{}
_ = controller.Unmarshal(queryParm)
data, err := commonService.GetDictionaryByCode(&queryParm)
queryParam := &query.GetDictionaryByCodeQuery{}
_ = controller.Unmarshal(queryParam)
data, err := commonService.GetDictionaryByCode(queryParam)
controller.Response(data, err)
}
... ...
... ... @@ -7,4 +7,5 @@ import (
func init() {
web.Router("/common/dictionary/search", &common_controller.CommonController{}, "Post:GetDictionaryByCode")
//web.Router("/common/dictionary/search", &common_controller.CommonController{}, "Post:GetDictionaryByCode")
}
... ...