Browse Source

Merge branch 'feature/eta1.7.6_permission' into debug

xyxie 1 year ago
parent
commit
c171999166

+ 3 - 3
models/tables/chart_permission/chart_permission.go

@@ -98,7 +98,7 @@ func GetYbChartPermissionFirstByName(classifyName string) (item *YbChartPermissi
 // GetChartPermissionById 主键获取权限
 func GetChartPermissionByRemark(remark string) (item *ChartPermission, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM chart_permission WHERE remark = ? LIMIT 1`
+	sql := `SELECT * FROM chart_permission WHERE remark = ? and parent_id > 0 LIMIT 1`
 	err = o.Raw(sql, remark).QueryRow(&item)
 	return
 }
@@ -136,7 +136,7 @@ func GetChartPermissionByNames(permissionNames []string) (list []*ChartPermissio
 // GetChartPermissionList 获取品种权限列表
 func GetChartPermissionList() (list []*ChartPermission, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM chart_permission `
+	sql := `SELECT * FROM chart_permission where parent_id > 0 `
 	_, err = o.Raw(sql).QueryRows(&list)
 	return
 }
@@ -144,7 +144,7 @@ func GetChartPermissionList() (list []*ChartPermission, err error) {
 // 获取权益主观权限
 func GetChartPermissionListRaiSubjectivity() (items []*ChartPermission, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM chart_permission WHERE product_id=2  AND permission_type = 1  ORDER BY sort ASC `
+	sql := `SELECT * FROM chart_permission WHERE product_id=2  AND permission_type = 1 and parent_id > 0  ORDER BY sort ASC `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }

+ 1 - 1
models/tables/company_report_permission/company_report_permission.go

@@ -75,7 +75,7 @@ func GetCompanyPermissionCheckItem(companyId, permissionId int) (item *Permissio
 
 func GetPermissionLookItems(productId int, classifyName string) (items []*PermissionLookItem, err error) {
 	o := orm.NewOrm()
-	sql := ` SELECT * FROM chart_permission WHERE enabled=1 AND product_id=? AND classify_name=? ORDER BY sort ASC `
+	sql := ` SELECT * FROM chart_permission WHERE enabled=1 AND parent_id > 0 AND product_id=? AND classify_name=? ORDER BY sort ASC `
 	_, err = o.Raw(sql, productId, classifyName).QueryRows(&items)
 	return
 }