feat:完善项目
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
package model
|
||||
|
||||
// SysRole 角色管理数据模型
|
||||
type SysRole struct {
|
||||
Model
|
||||
ModelTenant
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:角色名" json:"name"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:角色备注" json:"remark"`
|
||||
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序" json:"-"`
|
||||
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:角色名" json:"name"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:角色备注" json:"remark"`
|
||||
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package role
|
||||
|
||||
import (
|
||||
model2 "ArmedPolice/app/common/model"
|
||||
"ArmedPolice/app/controller/basic"
|
||||
"ArmedPolice/app/model"
|
||||
"ArmedPolice/app/service"
|
||||
)
|
||||
|
||||
@ -9,8 +11,20 @@ type Instance struct{ *service.Session }
|
||||
|
||||
type InstanceHandle func(session *service.Session) *Instance
|
||||
|
||||
func (c *Instance) List() (*basic.ReturnPages, error) {
|
||||
return &basic.ReturnPages{Data: nil, Count: 0}, nil
|
||||
func (c *Instance) List() (*basic.PageDataResponse, error) {
|
||||
mSysRole := model.NewSysRole()
|
||||
|
||||
where := make([]*model2.ModelWhereOrder, 0)
|
||||
|
||||
//if {
|
||||
//
|
||||
//}
|
||||
|
||||
out := make([]*model2.SysRole, 0)
|
||||
|
||||
model2.Find(mSysRole.SysRole, &out, where...)
|
||||
|
||||
return &basic.PageDataResponse{Data: nil, Count: 0}, nil
|
||||
}
|
||||
|
||||
func (c *Instance) Form() error {
|
||||
|
@ -8,35 +8,8 @@ type SysRole struct {
|
||||
*model.SysRole
|
||||
}
|
||||
|
||||
// SysRoleBasic 基本信息
|
||||
type SysRoleBasic struct {
|
||||
ID uint64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
func (m *SysRole) Roles() {
|
||||
|
||||
// SysRoleUserInfo 用户角色信息
|
||||
type SysRoleUserInfo struct {
|
||||
*SysRoleBasic
|
||||
UserRoleID uint64 `json:"user_role_id"`
|
||||
}
|
||||
|
||||
// UserRole 用户角色信息
|
||||
func (m *SysRole) UserRole(uid uint64) ([]*SysRoleUserInfo, error) {
|
||||
//mSysUserRole := NewSysUserRole()
|
||||
//
|
||||
//db := orm.GetDB().Table(m.TableName()+" AS r").
|
||||
// Select("r.is, r.name, u_r.id AS user_role_id").
|
||||
// Joins(fmt.Sprintf("LEFT JOIN %s AS u_r ON r.id = u_r.role_id AND u_r.uid = %d AND u_r.is_deleted = %d",
|
||||
// mSysUserRole.TableName(), uid, model.DeleteStatusForNot)).
|
||||
// Where("r.is_deleted = ?", model.DeleteStatusForNot)
|
||||
//
|
||||
//out := make([]*SysRoleUserInfo, 0)
|
||||
//
|
||||
//if err := db.Order("r.id " + model.OrderModeToDesc).Scan(&out).Error; err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
//return out, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func NewSysRole() *SysRole {
|
||||
|
Reference in New Issue
Block a user