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.
70 lines
3.4 KiB
70 lines
3.4 KiB
|
6 months ago
|
package modelssystempermission
|
||
|
|
|
||
|
|
import (
|
||
|
|
"appPlatform/overall"
|
||
|
|
"strings"
|
||
|
|
)
|
||
|
|
|
||
|
|
/*
|
||
|
|
*
|
||
|
|
@ 作者: 秦东
|
||
|
|
@ 时间: 2025-05-19 14:01:12
|
||
|
|
@ 功能: 自定义表单权限设置
|
||
|
|
*/
|
||
|
|
type CustomTableAuthorize struct {
|
||
|
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` // 编辑时间
|
||
|
|
Roleid int64 `json:"role_id" gorm:"column:role_id;type:bigint(20) unsigned;default:0;not null;comment:角色ID"` // 角色ID
|
||
|
|
TableSignCode int64 `json:"table_sign_code" gorm:"column:table_sign_code;type:bigint(20) unsigned;default:0;not null;comment:app表格唯一识别符"` // app表格唯一识别符
|
||
|
|
AppCignCode int64 `json:"app_sign_code" gorm:"column:app_sign_code;type:bigint(20) unsigned;default:0;not null;comment:归谁哪个App"` // 归谁哪个App
|
||
|
|
TablePower string `json:"table_power" gorm:column:table_power;type:varchar(255) ;comment:表格权限"` // 表格权限
|
||
|
|
ListPower string `json:"list_power" gorm:"column:list_power;type:varchar(255) ;comment:列表权限"` // 列表权限
|
||
|
|
PowerLerver int `json:"power_lerver" gorm:"column:power_lerver;type:tinyint(1) unsigned;default:1;not null;comment:授权范围等级(1:本岗位;2:本部门;3:本分部;4:指定行政组织;5:所有)"` // 授权范围等级(1:本岗位;2:本部门;3:本分部;4:指定行政组织;5:所有)
|
||
|
|
Organization string `json:"organization" gorm:"column:organization;type:text;comment:授权范围属性"` // 授权范围属性
|
||
|
|
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` // 编辑时间
|
||
|
|
}
|
||
|
|
|
||
|
|
func (CustomTableAuthorize *CustomTableAuthorize) TableName() string {
|
||
|
|
return "custom_table_authorize"
|
||
|
|
}
|
||
|
|
|
||
|
|
// 编辑内容
|
||
|
|
func (cont *CustomTableAuthorize) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
||
|
|
err = overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Updates(saveData).Error
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
// 获取内容
|
||
|
|
func (cont *CustomTableAuthorize) 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 *CustomTableAuthorize) CountCont(whereMap interface{}) (countId int64) {
|
||
|
|
overall.CONSTANT_DB_System_Permission.Model(&cont).Where(whereMap).Count(&countId)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
// 读取全部信息
|
||
|
|
func (cont *CustomTableAuthorize) ContMap(whereMap interface{}, field ...string) (countAry []CustomTableAuthorize, 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 *CustomTableAuthorize) DelCont(whereMap interface{}) (err error) {
|
||
|
|
err = overall.CONSTANT_DB_System_Permission.Where(whereMap).Delete(&cont).Error
|
||
|
|
return
|
||
|
|
}
|