|
@@ -240,8 +240,10 @@ func GetSecondaryChartPermissions() (list []*ChartPermission, err error) {
|
|
|
}
|
|
|
|
|
|
type SimpleChartPermission struct {
|
|
|
- ChartPermissionId int `description:"品种ID"`
|
|
|
- ChartPermissionName string `description:"品种名称"`
|
|
|
+ ChartPermissionId int `description:"品种ID"`
|
|
|
+ ChartPermissionName string `description:"品种名称"`
|
|
|
+ Sort int `description:"排序"`
|
|
|
+ Children []*SimpleChartPermission `description:"子分类"`
|
|
|
}
|
|
|
|
|
|
func FormatChartPermission2Simple(origin *ChartPermission) (item *SimpleChartPermission) {
|
|
@@ -251,5 +253,14 @@ func FormatChartPermission2Simple(origin *ChartPermission) (item *SimpleChartPer
|
|
|
item = new(SimpleChartPermission)
|
|
|
item.ChartPermissionId = origin.ChartPermissionId
|
|
|
item.ChartPermissionName = origin.PermissionName
|
|
|
+ item.Sort = origin.Sort
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// GetChartPermissionsByProductId 获取权限列表
|
|
|
+func GetChartPermissionsByProductId() (list []*ChartPermission, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT * FROM chart_permission WHERE product_id = ? AND enabled = 1 ORDER BY parent_id ASC, sort ASC, created_time ASC`
|
|
|
+ _, err = o.Raw(sql, FiccProductId).QueryRows(&list)
|
|
|
return
|
|
|
}
|