|
@@ -68,7 +68,16 @@ type ChartPermissionView struct {
|
|
|
PermissionName string `description:"权限名" json:"permission_name"`
|
|
|
}
|
|
|
|
|
|
-func GetChartPermissionList(condition string, pars []interface{}) (items []*ChartPermission, err error) {
|
|
|
+type ChartPermissionListTree struct {
|
|
|
+ ChartPermissionId int `description:"权限ID"`
|
|
|
+ PermissionName string `description:"权限名"`
|
|
|
+ ParentId int `description:"父权限ID"`
|
|
|
+ IsPublic int `description:"是否是公有权限"`
|
|
|
+ PublicChild []*ChartPermissionListTree `description:"公有权限"`
|
|
|
+ PrivateChild []*ChartPermissionListTree `description:"私有权限"`
|
|
|
+}
|
|
|
+
|
|
|
+func GetChartPermissionListByCondition(condition string, pars []interface{}) (items []*ChartPermission, err error) {
|
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT * FROM chart_permission WHERE enabled=1 `
|
|
|
if condition != "" {
|
|
@@ -104,6 +113,13 @@ func GetChildChartPermissionListById(chartPermissionId int) (items []*ChartPermi
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func GetChartPermissionList() (items []*ChartPermissionListTree, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ sql := `SELECT * FROM chart_permission WHERE enabled=1 `
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func GetChartPermissionByParentId(parentId int) (items []*ChartPermissionList, err error) {
|
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
|
sql := `SELECT * FROM chart_permission WHERE enabled=1 AND chart_permission_id=?`
|