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

86 lines
3.4 KiB

package modelAppPlatform
import (
"appPlatform/overall"
"strings"
)
/*
*
@ 作者: 秦东
@ 时间: 2024-04-23 11:25:43
@ 功能: 自定义应用菜单表
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
type Appmenus struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
Label string `json:"label" gorm:"column:label;type:varchar(255) unsigned;default:'';not null;comment:节点名称"`
Types int `json:"type" gorm:"column:type;type:int(1) unsigned;default:1;not null;comment:节点类型 1:目录;2:菜单"`
Svg string `json:"svg" gorm:"column:svg;type:varchar(255) DEFAULT '' comment:图标"`
PcIsShow int `json:"pcIsShow" gorm:"column:pcIsShow;type:int(1) unsigned DEFAULT '1' comment:pc端显示与隐藏(1:显示;非1:隐藏)"`
WapIsShow int `json:"wapIsShow" gorm:"column:wapIsShow;type:int(1) unsigned DEFAULT '1' comment:移动端显示与隐藏(1:显示;非1:隐藏)"`
Parent int64 `json:"parent" gorm:"column:parent;type:bigint(20) unsigned;default:0;not null;comment:上级"`
Appkey int64 `json:"appkey" gorm:"column:appkey;type:bigint(20) unsigned;default:0;not null;comment:归属哪个应用"`
CreaterTime int64 `json:"creater_time" gorm:"column:creater_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
EditTime int64 `json:"edit_time" gorm:"column:edit_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:创建人"`
IsLock int `json:"isLock" gorm:"column:isLock;type:int(1) unsigned NOT NULL DEFAULT '2' comment:是否为固定菜单(1:是;2:否)"`
Sort int64 `json:"sort" gorm:"column:sort;type:int(5) unsigned NOT NULL DEFAULT '50' comment:排序"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned NOT NULL DEFAULT '1' comment:状态(1:启用;2:禁用;3:删除)"`
IsMain int `json:"isMain" gorm:"column:isMain;type:int(1) unsigned NOT NULL DEFAULT '2' comment:1:入口;2:不是入口"`
}
func (Appmenus *Appmenus) TableName() string {
return "appmenus"
}
// 编辑内容
func (cont *Appmenus) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *Appmenus) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.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 *Appmenus) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *Appmenus) ContMap(whereMap interface{}, field ...string) (countAry []Appmenus, err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *Appmenus) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error
return
}