Bladeren bron

Merge remote-tracking branch 'origin/master'

master
huangjiajun 1 week geleden
bovenliggende
commit
49c46bad02
7 gewijzigde bestanden met toevoegingen van 79 en 6 verwijderingen
  1. +3
    -1
      src/super/dao/user_list_dao.go
  2. +16
    -0
      src/super/dao/user_open_permission_dao.go
  3. +14
    -0
      src/super/implement/user_list_implement.go
  4. +21
    -0
      src/super/implement/user_open_permission_implement.go
  5. +10
    -0
      src/super/model/open_permission.go
  6. +6
    -5
      src/super/model/user_list.go
  7. +9
    -0
      src/super/model/user_open_permission.go

+ 3
- 1
src/super/dao/user_list_dao.go Bestand weergeven

@@ -1,5 +1,7 @@
package dao

import "code.fnuoos.com/zhimeng/model.git/src/super/model"

type UserListDao interface {
//TODO:: You can add specific method definitions here
GetUserListByOpenAppSecret(appSecret string) (m *model.UserList, err error)
}

+ 16
- 0
src/super/dao/user_open_permission_dao.go Bestand weergeven

@@ -0,0 +1,16 @@
package dao

import "code.fnuoos.com/zhimeng/model.git/src/super/model"

type UserOpenPermissionDao interface {
GetUserOpenPermission(masterId int) (list []*GetUserOpenPermissionResp, total int64, err error)
}

type GetUserOpenPermissionResp struct {
model.UserOpenPermission `xorm:"extends"`
model.OpenPermission `xorm:"extends"`
}

func (GetUserOpenPermissionResp) TableName() string {
return "user_open_permission"
}

+ 14
- 0
src/super/implement/user_list_implement.go Bestand weergeven

@@ -2,6 +2,8 @@ package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
"code.fnuoos.com/zhimeng/model.git/src/super/model"
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx"
"xorm.io/xorm"
)

@@ -12,3 +14,15 @@ func NewUserListDb(engine *xorm.Engine) dao.UserListDao {
type UserListDb struct {
Db *xorm.Engine
}

func (u UserListDb) GetUserListByOpenAppSecret(appSecret string) (m *model.UserList, err error) {
m = new(model.UserList)
has, err := u.Db.Where("open_app_secret =?", appSecret).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

+ 21
- 0
src/super/implement/user_open_permission_implement.go Bestand weergeven

@@ -0,0 +1,21 @@
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
"xorm.io/xorm"
)

func NewUserOpenPermissionDb(engine *xorm.Engine) dao.UserOpenPermissionDao {
return &UserOpenPermissionDb{Db: engine}
}

type UserOpenPermissionDb struct {
Db *xorm.Engine
}

func (u UserOpenPermissionDb) GetUserOpenPermission(masterId int) (list []*dao.GetUserOpenPermissionResp, total int64, err error) {
total, err = u.Db.Where("user_open_permission.master_id =?", masterId).
Join("LEFT", "open_permission", "user_open_permission.permission_id = open_permission.id").
FindAndCount(&list)
return
}

+ 10
- 0
src/super/model/open_permission.go Bestand weergeven

@@ -0,0 +1,10 @@
package model

type OpenPermission struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"`
Action string `json:"action" xorm:"not null default '' comment('路由') unique VARCHAR(255)"`
State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 6
- 5
src/super/model/user_list.go Bestand weergeven

@@ -5,9 +5,10 @@ import (
)

type UserList struct {
Uuid int `json:"uuid" xorm:"not null default 0 comment('msater_id') INT(10)"`
Name string `json:"name" xorm:"not null default '' comment('昵称') VARCHAR(32)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"`
State int `json:"state" xorm:"not null default 1 comment('状态0未激活,1正常.2禁用') TINYINT(1)"`
DeleteAt time.Time `json:"delete_at" xorm:"comment('删除时间') TIMESTAMP"`
Uuid int `json:"uuid" xorm:"not null default 0 comment('msater_id') INT(10)"`
Name string `json:"name" xorm:"not null default '' comment('昵称') VARCHAR(32)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"`
OpenAppSecret string `json:"open_app_secret" xorm:"not null default '' comment('开放平台秘钥') VARCHAR(255)"`
State int `json:"state" xorm:"not null default 1 comment('状态0未激活,1正常.2禁用') TINYINT(1)"`
DeleteAt time.Time `json:"delete_at" xorm:"comment('删除时间') TIMESTAMP"`
}

+ 9
- 0
src/super/model/user_open_permission.go Bestand weergeven

@@ -0,0 +1,9 @@
package model

type UserOpenPermission struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
MasterId int `json:"master_id" xorm:"not null default 0 comment('站长id') INT(11)"`
PermissionId int `json:"permission_id" xorm:"not null default 0 comment('权限id') INT(11)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

Laden…
Annuleren
Opslaan