You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.3 KiB
61 lines
2.3 KiB
package modelssystempermission
|
|
|
|
import (
|
|
"appPlatform/overall"
|
|
"strings"
|
|
)
|
|
|
|
// 自定义应用分组授权
|
|
type AuthGroupPower struct {
|
|
Id int64 `gorm:"column:id;type:bigint(20) unsigned;primary_key" json:"id"`
|
|
AppType string `gorm:"column:appType;type:varchar(30);comment:系统类型(system:系统平台;app:自定义表单与应用)" json:"appType"`
|
|
OrgPowerType string `gorm:"column:orgPowerType;type:varchar(20);comment:赋权类型(org:组织;job:岗位;role:角色;person:个人)" json:"orgPowerType"`
|
|
OrgOrUserKey int64 `gorm:"column:orgOrUserKey;type:bigint(20) unsigned;default:0;comment:行政组织或角色、人员识别符;NOT NULL" json:"orgOrUserKey"`
|
|
Time int64 `gorm:"column:time;type:bigint(20) unsigned;default:0;comment:编辑时间;NOT NULL" json:"time"`
|
|
PowerInfo string `gorm:"column:powerInfo;type:text;comment:权限结构体" json:"powerInfo"`
|
|
}
|
|
|
|
func (cont *AuthGroupPower) TableName() string {
|
|
return "auth_group_power"
|
|
}
|
|
|
|
// 编辑内容
|
|
func (cont *AuthGroupPower) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取内容
|
|
func (cont *AuthGroupPower) GetCont(whereMap interface{}, field ...string) (err error) {
|
|
gormDb := overall.CONSTANT_DB_System_Permission.Model(&cont)
|
|
if len(field) > 0 {
|
|
fieldStr := strings.Join(field, ",")
|
|
gormDb = gormDb.Select(fieldStr)
|
|
}
|
|
gormDb = gormDb.Where(whereMap)
|
|
err = gormDb.First(&cont).Error
|
|
return
|
|
}
|
|
|
|
// 根据条件获取总数
|
|
func (cont *AuthGroupPower) CountCont(whereMap interface{}) (countId int64) {
|
|
overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|
|
// 读取全部信息
|
|
func (cont *AuthGroupPower) ContMap(whereMap interface{}, field ...string) (countAry []AuthGroupPower, err error) {
|
|
gormDb := overall.CONSTANT_DB_System_Permission.Model(&cont)
|
|
if len(field) > 0 {
|
|
fieldStr := strings.Join(field, ",")
|
|
gormDb = gormDb.Select(fieldStr)
|
|
}
|
|
err = gormDb.Where(whereMap).Find(&countAry).Error
|
|
return
|
|
}
|
|
|
|
// 删除内容
|
|
func (cont *AuthGroupPower) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_System_Permission.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|