|
@@ -77,3 +77,23 @@ func CheckUserAaiPerssionByMobile(mobile string) (count int, err error) {
|
|
|
err = o.Raw(sql, mobile).QueryRow(&count)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func GetCompanyPermissionByMobile(mobile string) (permission string, err error) {
|
|
|
+ sql := ` SELECT
|
|
|
+ GROUP_CONCAT( DISTINCT b.remark ORDER BY b.sort ASC SEPARATOR ',' ) AS permission
|
|
|
+ FROM
|
|
|
+ company_report_permission AS a
|
|
|
+ INNER JOIN chart_permission AS b ON a.chart_permission_id = b.chart_permission_id
|
|
|
+ INNER JOIN company_product AS c ON a.company_id = c.company_id
|
|
|
+ INNER JOIN wx_user AS u ON u.company_id = c.company_id
|
|
|
+ AND a.product_id = c.product_id
|
|
|
+ WHERE
|
|
|
+ u.mobile = ?
|
|
|
+ AND c.is_suspend = 0
|
|
|
+ AND b.cygx_auth = 1
|
|
|
+ AND c.STATUS IN ( '正式', '试用', '永续' )
|
|
|
+ AND a.STATUS IN ( '正式', '试用', '永续' ) `
|
|
|
+ o := orm.NewOrm()
|
|
|
+ err = o.Raw(sql, mobile).QueryRow(&permission)
|
|
|
+ return
|
|
|
+}
|