mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 10:13:01 +00:00
Update role.go
This commit is contained in:
+4
-4
@@ -29,7 +29,7 @@ type SysRole struct {
|
|||||||
//备注
|
//备注
|
||||||
Remark string `gorm:"column:remark" json:"remark"`
|
Remark string `gorm:"column:remark" json:"remark"`
|
||||||
Params string `gorm:"column:params" json:"params"`
|
Params string `gorm:"column:params" json:"params"`
|
||||||
DataScope string `gorm:"_" json:"dataScope"`
|
DataScope string `gorm:"-" json:"dataScope"`
|
||||||
IsDel string `gorm:"column:is_del" json:"isDel"`
|
IsDel string `gorm:"column:is_del" json:"isDel"`
|
||||||
|
|
||||||
Admin bool `gorm:"column:admin" json:"admin"`
|
Admin bool `gorm:"column:admin" json:"admin"`
|
||||||
@@ -117,9 +117,9 @@ func (role *SysRole) GetRoleMeunId() ([]int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (role *SysRole) Insert() (id int64, err error) {
|
func (role *SysRole) Insert() (id int64, err error) {
|
||||||
role.CreateTime = time.Now().Format("2006/01/02 15:04:05")
|
role.CreateTime = utils.GetCurrntTime()
|
||||||
role.UpdateBy = ""
|
role.UpdateBy = ""
|
||||||
role.UpdateTime = time.Now().Format("2006/01/02 15:04:05")
|
role.UpdateTime = utils.GetCurrntTime()
|
||||||
role.IsDel = "0"
|
role.IsDel = "0"
|
||||||
result := orm.Eloquent.Table("sys_role").Create(&role)
|
result := orm.Eloquent.Table("sys_role").Create(&role)
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
@@ -150,7 +150,7 @@ func (role *SysRole) GetRoleDeptId() ([]int64, error) {
|
|||||||
|
|
||||||
//修改
|
//修改
|
||||||
func (role *SysRole) Update(id int64) (update SysRole, err error) {
|
func (role *SysRole) Update(id int64) (update SysRole, err error) {
|
||||||
role.UpdateTime = time.Now().Format("2006/01/02 15:04:05.9999")
|
role.UpdateTime = utils.GetCurrntTime()
|
||||||
if err = orm.Eloquent.Table("sys_role").First(&update, id).Error; err != nil {
|
if err = orm.Eloquent.Table("sys_role").First(&update, id).Error; err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user