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.
63 lines
2.5 KiB
63 lines
2.5 KiB
package modelssystempermission
|
|
|
|
import (
|
|
"appPlatform/overall"
|
|
"strings"
|
|
)
|
|
|
|
// 新版赋权表单
|
|
type AuthPower struct {
|
|
Id int64 `gorm:"column:id;type:bigint(20) unsigned;primary_key" json:"id"`
|
|
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"`
|
|
AppType string `gorm:"column:appType;type:varchar(30);comment:系统类型(system:系统平台;app:自定义表单与应用)" json:"appType"`
|
|
AppKey int64 `gorm:"column:appKey;type:bigint(20) unsigned;default:0;comment:自定义应用App" json:"appKey"`
|
|
Time int64 `gorm:"column:time;type:bigint(20) unsigned;default:0;comment:编辑时间;NOT NULL" json:"time"`
|
|
IsTrue int `gorm:"column:isTrue;type:int(1) unsigned;default:0;comment:是否有权(1:有;非1:无);NOT NULL" json:"isTrue"`
|
|
PowerInfo string `gorm:"column:powerInfo;type:text;comment:权限结构体" json:"powerInfo"`
|
|
}
|
|
|
|
func (cont *AuthPower) TableName() string {
|
|
return "auth_power"
|
|
}
|
|
|
|
// 编辑内容
|
|
func (cont *AuthPower) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取内容
|
|
func (cont *AuthPower) 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 *AuthPower) CountCont(whereMap interface{}) (countId int64) {
|
|
overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|
|
// 读取全部信息
|
|
func (cont *AuthPower) ContMap(whereMap interface{}, field ...string) (countAry []AuthPower, 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 *AuthPower) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_System_Permission.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|