作者 yangfu

模型修改

... ... @@ -20,7 +20,7 @@ func RetCustomizeMenu(menus []*domain.Menu, customizeMenus []*domain.CustomizeMe
}
for i := range menus {
fieldMenu := utils.LoadCustomFieldToMap(menus[i], "MenuId", "ParentId", "MenuName", "Code", "Icon", "MenuAlias", "MenuType", "Remark", "Sort")
fieldMenu := utils.LoadCustomFieldToMap(menus[i], "MenuId", "ParentId", "MenuName", "Code", "Icon", "MenuAlias", "MenuType", "Remark", "Sort", "EnableStatus")
fieldMenu["parentMenuName"] = ""
if menu, ok := menusMap[menus[i].ParentId]; ok {
fieldMenu["parentMenuName"] = menu.MenuName
... ...
... ... @@ -7,7 +7,9 @@ var (
REDIS_PORT = "6379"
REDIS_AUTH = ""
// 是否启用仓储层缓存
ENABLE_REPOSITORY_CACHE = true
DISABLE_REPOSITORY_CACHE = false
// 缓存过期时间 单位秒
REPOSITORY_CACHE_EXPIRE = 30 * 60
)
func init() {
... ... @@ -22,9 +24,9 @@ func init() {
REDIS_AUTH = os.Getenv("REDIS_AUTH")
}
if os.Getenv("ENABLE_REPOSITORY_CACHE") != "" {
ENABLE_REPOSITORY_CACHE = true
DISABLE_REPOSITORY_CACHE = false
}
if os.Getenv("DISABLE_REPOSITORY_CACHE") != "" {
ENABLE_REPOSITORY_CACHE = false
DISABLE_REPOSITORY_CACHE = true
}
}
... ...
... ... @@ -61,15 +61,15 @@ func (company *Company) Update(data map[string]interface{}) error {
if industryCategory, ok := data["industryCategory"]; ok {
company.CompanyInfo.IndustryCategory = industryCategory.(string)
}
if contacts, ok := data["contacts"]; ok {
company.CompanyInfo.Contacts = contacts.(string)
}
//if contacts, ok := data["contacts"]; ok {
// company.CompanyInfo.Contacts = contacts.(string)
//}
if registTime, ok := data["registTime"]; ok {
company.CompanyInfo.RegisteredTime = registTime.(time.Time)
}
if registStatus, ok := data["registStatus"]; ok {
company.CompanyInfo.status = registStatus.(int)
}
//if registStatus, ok := data["registStatus"]; ok {
// company.CompanyInfo.Status = registStatus.(int)
//}
if status, ok := data["status"]; ok {
company.Status = status.(int)
}
... ...
... ... @@ -15,9 +15,9 @@ type CompanyInfo struct {
// 所属行业
IndustryCategory string `json:"industryCategory"`
// 联系人
Contacts string `json:"contacts"`
//Contacts string `json:"contacts"`
// 注册时间
RegisteredTime time.Time `json:"registeredTime"`
// 状态 1:已注册 2:待认证 3:已认证
status int `json:"status"`
//Status int `json:"status"`
}
... ...
... ... @@ -3,6 +3,7 @@ package domain
import (
"errors"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
"strconv"
"strings"
)
... ... @@ -170,10 +171,23 @@ func (menu *Menu) ValidMenuType() bool {
return false
}
// 实现 TreeNode
/***** 1.实现树 *****/
/*1.1 实现树的方法*/
func (menu *Menu) PID() string {
return menu.ParentPath
}
func (menu *Menu) ID() string {
return menu.GetFullPath()
}
/***** 2.缓存 *****/
/*2.1 缓存键值*/
func (m *Menu) CacheKeyFunc() string {
if constant.DISABLE_REPOSITORY_CACHE {
return ""
}
if m.MenuId == 0 {
return ""
}
return fmt.Sprintf("%v:cache:menu:id:%v", constant.CACHE_PREFIX, m.MenuId)
}
... ...
... ... @@ -80,9 +80,9 @@ func (user *User) Update(data map[string]interface{}) error {
if userBaseId, ok := data["userBaseId"]; ok {
user.UserBaseId = userBaseId.(int64)
}
if userType, ok := data["userType"]; ok {
user.UserType = userType.(int)
}
//if userType, ok := data["userType"]; ok {
// user.UserType = userType.(int)
//}
if userCode, ok := data["userCode"]; ok {
user.UserCode = userCode.(string)
}
... ...
... ... @@ -31,6 +31,11 @@ func init() {
for _, model := range []interface{}{
(*models.Menu)(nil),
(*models.CustomizeMenu)(nil),
(*models.Company)(nil),
(*models.Org)(nil),
(*models.Role)(nil),
(*models.User)(nil),
(*models.UserBase)(nil),
//(*models.User)(nil),
} {
err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type Company struct {
tableName string `pg:"users.company,alias:company" comment:"企业"`
tableName string `pg:"users.company" comment:"企业"`
// 企业id
CompanyId int64 `pg:",pk" comment:"企业id"`
// 企业配置信息
... ...
package models
type Menu struct {
tableName string `pg:"users.menu,alias:menu" comment:"菜单"`
tableName string `pg:"users.menu" comment:"菜单"`
// 菜单编号
MenuId int64 `pg:",pk" comment:"菜单编号"`
// 父级id
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type Org struct {
tableName string `pg:"users.org,alias:org" comment:"组织"`
tableName string `pg:"users.org" comment:"组织"`
// 组织ID
OrgId int64 `pg:",pk" comment:"组织ID"`
// 企业id
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type Role struct {
tableName string `pg:"users.role,alias:role" comment:"角色"`
tableName string `pg:"users.role" comment:"角色"`
// 角色ID
RoleId int64 `pg:",pk" comment:"角色ID"`
// 企业id
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type User struct {
tableName string `pg:"users.user,alias:user"`
tableName string `pg:"users.user"`
// 用户Id 用户唯一标识
UserId int64 `pg:",pk" comment:"用户Id"`
// 企业id
... ... @@ -24,11 +24,11 @@ type User struct {
// 用户信息 (冗余,数据存在userBase里面)
//UserInfo *domain.UserInfo
// 用户关联的组织
UserOrg []*domain.Org `pg:",array" comment:"用户关联的组织"`
UserOrg []*domain.Org `comment:"用户关联的组织"`
// 用户关联的角色
UserRole []*domain.Role `pg:",array" comment:"用户关联的角色"`
UserRole []*domain.Role `comment:"用户关联的角色"`
// 收藏的菜单(工作台)(菜单编码列表)
FavoriteMenus []string `pg:",array" comment:"收藏的菜单"`
FavoriteMenus []string `comment:"收藏的菜单"`
// 共创信息 (共创用户有效)
CooperationInfo *domain.CooperationInfo `comment:"共创信息 (共创用户有效)"`
// 状态(1:启用 2:禁用 3:注销)
... ...
... ... @@ -6,7 +6,7 @@ import (
)
type UserBase struct {
tableName string `pg:"users.user_base,alias:user_base" comment:"用户基础"`
tableName string `pg:"users.user_base" comment:"用户基础"`
// 用户基础数据id
UserBaseId int64 `pg:",pk" comment:"用户基础数据id"`
// 用户信息
... ...
... ... @@ -79,6 +79,7 @@ func (controller *CompanyController) SearchCompanyCustomizeMenus() {
companyService := service.NewCompanyService(nil)
listCompanyCustomizeMenusCommand := &command.ListCompanyCustomizeMenusCommand{}
controller.Unmarshal(listCompanyCustomizeMenusCommand)
// TODO:待移除
listCompanyCustomizeMenusCommand.CompanyId = 1
data, err := companyService.ListCompanyCustomizeMenus(listCompanyCustomizeMenusCommand)
controller.Response(data, err)
... ... @@ -88,6 +89,7 @@ func (controller *CompanyController) AdapterUpdateCompanyCustomizeMenus() {
companyService := service.NewCompanyService(nil)
updateCompanyCustomizeMenusCommand := &command.UpdateCompanyCustomizeMenusCommand{}
controller.Unmarshal(updateCompanyCustomizeMenusCommand)
// TODO:待移除
updateCompanyCustomizeMenusCommand.CompanyId = 1
data, err := companyService.UpdateCompanyCustomizeMenus(updateCompanyCustomizeMenusCommand)
controller.Response(data, err)
... ...