更新测试文档及初始数据的错误,修复in条件查询, gormv2取消()的占位符,更新模板文件的()占位符
This commit is contained in:
@@ -70,11 +70,11 @@ func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err
|
||||
dataId = append(dataId, v.AuthorityId)
|
||||
}
|
||||
var CustomerList []model.ExaCustomer
|
||||
err = db.Where("sys_user_authority_id in (?)", dataId).Count(&total).Error
|
||||
err = db.Where("sys_user_authority_id in ?", dataId).Count(&total).Error
|
||||
if err != nil {
|
||||
return err, CustomerList, total
|
||||
} else {
|
||||
err = db.Limit(limit).Offset(offset).Preload("SysUser").Where("sys_user_authority_id in (?)", dataId).Find(&CustomerList).Error
|
||||
err = db.Limit(limit).Offset(offset).Preload("SysUser").Where("sys_user_authority_id in ?", dataId).Find(&CustomerList).Error
|
||||
}
|
||||
return err, CustomerList, total
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ type SysAuthorityMenus struct {
|
||||
}
|
||||
|
||||
type SysDataAuthorityId struct {
|
||||
SysAuthorityAuthorityId string
|
||||
SysBaseMenuId string
|
||||
SysAuthorityAuthorityId string
|
||||
DataAuthorityIdAuthorityId string
|
||||
}
|
||||
|
||||
func InitSysApi() (err error) {
|
||||
@@ -44,8 +44,8 @@ func InitExaCustomer() (err error) {
|
||||
}
|
||||
|
||||
func InitCasbinModel() (err error) {
|
||||
if !global.GVA_DB.Migrator().HasTable("casbin_rule"){
|
||||
if err := global.GVA_DB.Migrator().CreateTable(&gormadapter.CasbinRule{}); err != nil{
|
||||
if !global.GVA_DB.Migrator().HasTable("casbin_rule") {
|
||||
if err := global.GVA_DB.Migrator().CreateTable(&gormadapter.CasbinRule{}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -162,16 +162,10 @@ func InitSysDataAuthorityId() (err error) {
|
||||
{"888", "888"},
|
||||
{"888", "8881"},
|
||||
{"888", "9528"},
|
||||
{"888222", "888"},
|
||||
{"888222", "8881"},
|
||||
{"888222", "9528"},
|
||||
{"8883", "888"},
|
||||
{"8883", "8881"},
|
||||
{"8883", "9528"},
|
||||
{"9528", "8881"},
|
||||
{"9528", "9528"},
|
||||
}
|
||||
if tx.Table("sys_authority_menus").Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
if tx.Table("sys_data_authority_ids").Create(&insert).Error != nil { // 遇到错误时回滚事务
|
||||
tx.Rollback()
|
||||
}
|
||||
return tx.Commit().Error
|
||||
|
||||
Reference in New Issue
Block a user