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.
65 lines
2.6 KiB
65 lines
2.6 KiB
package modelssystempermission
|
|
|
|
import (
|
|
"appPlatform/overall"
|
|
"strings"
|
|
)
|
|
|
|
// 权限配置详情
|
|
type PowerInfo 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"`
|
|
}
|
|
|
|
func (cont *PowerInfo) TableName() string {
|
|
return "power_info"
|
|
}
|
|
|
|
// 编辑内容
|
|
func (cont *PowerInfo) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取内容
|
|
func (cont *PowerInfo) 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 *PowerInfo) CountCont(whereMap interface{}) (countId int64) {
|
|
overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|
|
// 读取全部信息
|
|
func (cont *PowerInfo) ContMap(whereMap interface{}, field ...string) (countAry []PowerInfo, 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 *PowerInfo) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_System_Permission.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|