|
@@ -21,14 +21,19 @@ type ChartPermission struct {
|
|
ClassifyName string `description:"分类"`
|
|
ClassifyName string `description:"分类"`
|
|
PermissionType int `description:"1主观,2客观"`
|
|
PermissionType int `description:"1主观,2客观"`
|
|
Checked bool `description:"选中状态"`
|
|
Checked bool `description:"选中状态"`
|
|
|
|
+ ParentId int `description:"父级权限id"`
|
|
|
|
+ IsPublic int `description:"是否是公有权限1:公有权限,0私有权限"`
|
|
}
|
|
}
|
|
|
|
|
|
type PermissionSetItem struct {
|
|
type PermissionSetItem struct {
|
|
- ChartPermissionId int `description:"权限id"`
|
|
|
|
- PermissionName string `description:"权限名称"`
|
|
|
|
- PermissionType int `description:"1主观,2客观"`
|
|
|
|
- Checked bool `description:"选中状态"`
|
|
|
|
- Child []*PermissionSetItem `description:"具体的主客观-方便前端的排版用的"`
|
|
|
|
|
|
+ ChartPermissionId int `description:"权限id"`
|
|
|
|
+ PermissionName string `description:"权限名称"`
|
|
|
|
+ PermissionType int `description:"1主观,2客观"`
|
|
|
|
+ ParentId int `description:"父级权限id"`
|
|
|
|
+ IsPublic int `description:"是否是公有权限1:公有权限,0私有权限"`
|
|
|
|
+ Checked bool `description:"选中状态"`
|
|
|
|
+
|
|
|
|
+ Child []*PermissionSetItem `description:"具体的主客观-方便前端的排版用的"`
|
|
}
|
|
}
|
|
|
|
|
|
type PermissionSetItemType struct {
|
|
type PermissionSetItemType struct {
|
|
@@ -68,6 +73,12 @@ func GetPermissionSetItems(productId int, classifyName string) (items []*Permiss
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func GetPermissionByProductId(productId int) (items []*PermissionSetItem, err error) {
|
|
|
|
+ o := orm.NewOrm()
|
|
|
|
+ sql := ` SELECT * FROM chart_permission WHERE enabled=1 AND product_id=? AND permission_type=0 ORDER BY sort ASC `
|
|
|
|
+ _, err = o.Raw(sql, productId).QueryRows(&items)
|
|
|
|
+ return
|
|
|
|
+}
|
|
func GetPermissionSetItemsByType(productId int, classifyName string) (items []*PermissionSetItem, err error) {
|
|
func GetPermissionSetItemsByType(productId int, classifyName string) (items []*PermissionSetItem, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := ` SELECT * FROM chart_permission WHERE enabled=1 AND product_id=? AND classify_name=? AND permission_type!=2 ORDER BY sort ASC `
|
|
sql := ` SELECT * FROM chart_permission WHERE enabled=1 AND product_id=? AND classify_name=? AND permission_type!=2 ORDER BY sort ASC `
|
|
@@ -164,9 +175,12 @@ type PermissionLookItem struct {
|
|
IsUpgrade int `description:"是否升级,1是,0否"`
|
|
IsUpgrade int `description:"是否升级,1是,0否"`
|
|
ExpensiveYx int `description:"权益研选: 0-3w; 1-5w ,2: 10W"`
|
|
ExpensiveYx int `description:"权益研选: 0-3w; 1-5w ,2: 10W"`
|
|
Points float64 `description:"研选扣点包点数"`
|
|
Points float64 `description:"研选扣点包点数"`
|
|
|
|
+ ParentId int `description:"父级权限id"`
|
|
|
|
+ IsPublic int `description:"是否是公有权限1:公有权限,0私有权限"`
|
|
Child []*PermissionLookItem `description:"子权限"`
|
|
Child []*PermissionLookItem `description:"子权限"`
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// todo 确认是否需要删除
|
|
func GetPermissionLookItems(productId int, classifyName string) (items []*PermissionLookItem, err error) {
|
|
func GetPermissionLookItems(productId int, classifyName string) (items []*PermissionLookItem, err error) {
|
|
o := orm.NewOrm()
|
|
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 product_id=? AND classify_name=? ORDER BY sort ASC `
|
|
@@ -174,6 +188,13 @@ func GetPermissionLookItems(productId int, classifyName string) (items []*Permis
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func GetPermissionLookItemsByProductId(productId int) (items []*PermissionLookItem, err error) {
|
|
|
|
+ o := orm.NewOrm()
|
|
|
|
+ sql := ` SELECT * FROM chart_permission WHERE enabled=1 AND product_id=? ORDER BY sort ASC `
|
|
|
|
+ _, err = o.Raw(sql, productId).QueryRows(&items)
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
func GetCompanyPermissionCheck(companyId, permissionId int) (count int, err error) {
|
|
func GetCompanyPermissionCheck(companyId, permissionId int) (count int, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := `SELECT COUNT(1) AS count FROM company_report_permission AS a WHERE a.company_id=? AND a.chart_permission_id=? `
|
|
sql := `SELECT COUNT(1) AS count FROM company_report_permission AS a WHERE a.company_id=? AND a.chart_permission_id=? `
|