取插入ID

This commit is contained in:
TsMask committed 2023-08-31 16:50:44 +08:00
1 parent bb7fee6c20
commit 291c251fd7
2 files changed
+24 -2

No files matched your search

+12 -1
View File
@@ -295,8 +295,19 @@ func (r *RepoSysRole) InsertRole(sysRole model.SysRole) string {
log.Errorf("insert row : %v", err.Error())
return ""
}
//取插入ID
if rows > 0 {
results, err := datasource.RawDB("", "SELECT MAX(role_id) AS str FROM sys_role;", nil)
if err != nil {
log.Errorf("query err %v", err)
return ""
}
if len(results) > 0 {
return fmt.Sprintf("%v", results[0]["str"])
}
}
return fmt.Sprint(rows)
return ""
}
// DeleteRoleByIds 批量删除角色信息