应用集成平台服务端
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.
 
 
 

72 lines
3.5 KiB

package modelssystempermission
import (
"appPlatform/overall"
"strings"
)
// 新版赋权表单
type AuthPowerList struct {
Id int64 `gorm:"column:id;type:bigint(20) unsigned;primary_key;AUTO_INCREMENT" json:"id"`
AuthId int64 `gorm:"column:authId;type:bigint(20) unsigned;default:0;comment:归属权限;NOT NULL" json:"authId"`
ItemId int64 `gorm:"column:itemId;type:bigint(20) unsigned;default:0;comment:项目ID;NOT NULL" json:"itemId"`
IsPick int `gorm:"column:isPick;type:int(1) unsigned;default:0;comment:是否有权(1:有;非1:无);NOT NULL" json:"isPick"`
TablePower string `gorm:"column:tablePower;type:text;comment:表单权限" json:"tablePower"`
ListPower string `gorm:"column:listPower;type:text;comment:列表权限" json:"listPower"`
VisibleRange int `gorm:"column:visibleRange;type:int(1);comment:可见范围(1:本人;2:本岗位;3:本部门;4:本分部;5:指定行政组织;6:所有);NOT NULL" json:"visibleRange"`
VisibleOrg string `gorm:"column:visibleOrg;type:text;comment:可见范围辅助参数" json:"visibleOrg"`
ButPower string `gorm:"column:butPower;type:text;comment:按钮权限" json:"butPower"`
Time int64 `gorm:"column:time;type:bigint(20) unsigned;default:0;comment:编辑时间;NOT NULL" json:"time"`
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"`
IsTrue int `gorm:"column:isTrue;type:int(1) unsigned;default:0;comment:是否有权(1:有;非1:无);NOT NULL" json:"isTrue"`
PowerInfo string `json:"powerInfo" gorm:"column:powerInfo;type:text;comment:权限结构体"`
}
func (cont *AuthPowerList) TableName() string {
return "authpowerlist"
}
// 编辑内容
func (cont *AuthPowerList) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *AuthPowerList) 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 *AuthPowerList) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *AuthPowerList) ContMap(whereMap interface{}, field ...string) (countAry []AuthPowerList, 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 *AuthPowerList) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_System_Permission.Where(whereMap).Delete(&cont).Error
return
}