|
@@ -22,7 +22,7 @@ type ChartPermissionResp struct {
|
|
}
|
|
}
|
|
|
|
|
|
func GetChartPermissionAll(condition string) (items []*ChartPermission, err error) {
|
|
func GetChartPermissionAll(condition string) (items []*ChartPermission, err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `SELECT * FROM chart_permission WHERE product_id=2 AND show_type=1 AND permission_type!=2 ` + condition + ` ORDER BY sort ASC `
|
|
sql := `SELECT * FROM chart_permission WHERE product_id=2 AND show_type=1 AND permission_type!=2 ` + condition + ` ORDER BY sort ASC `
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
return
|
|
return
|
|
@@ -39,21 +39,21 @@ func GetCategoryId(chartPermissionId int) (category_id string, err error) {
|
|
}
|
|
}
|
|
|
|
|
|
func GetChartPermissionReportAll(condition string) (items []*ChartPermission, err error) {
|
|
func GetChartPermissionReportAll(condition string) (items []*ChartPermission, err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `SELECT * FROM chart_permission WHERE product_id=2 AND is_report=1 AND permission_type!=2 ` + condition + ` ORDER BY sort ASC `
|
|
sql := `SELECT * FROM chart_permission WHERE product_id=2 AND is_report=1 AND permission_type!=2 ` + condition + ` ORDER BY sort ASC `
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func GetChartPermissionById(chartPermissionId int) (item *ChartPermission, err error) {
|
|
func GetChartPermissionById(chartPermissionId int) (item *ChartPermission, err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `SELECT * FROM chart_permission WHERE chart_permission_id = ? `
|
|
sql := `SELECT * FROM chart_permission WHERE chart_permission_id = ? `
|
|
err = o.Raw(sql, chartPermissionId).QueryRow(&item)
|
|
err = o.Raw(sql, chartPermissionId).QueryRow(&item)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func GetChartPermissionActivity() (items []*ActivityChartPermission, err error) {
|
|
func GetChartPermissionActivity() (items []*ActivityChartPermission, err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `SELECT * FROM chart_permission WHERE chart_permission_id IN (19,20,21,22,23,31) ORDER BY sort ASC `
|
|
sql := `SELECT * FROM chart_permission WHERE chart_permission_id IN (19,20,21,22,23,31) ORDER BY sort ASC `
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
return
|
|
return
|
|
@@ -86,7 +86,7 @@ func GetUserCompanyPermission(companyId int) (items []*ActivityChartPermission,
|
|
AND b.chart_permission_name IN (` + chartPermissionName + `)
|
|
AND b.chart_permission_name IN (` + chartPermissionName + `)
|
|
GROUP BY b.chart_permission_name
|
|
GROUP BY b.chart_permission_name
|
|
ORDER BY b.sort ASC `
|
|
ORDER BY b.sort ASC `
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -106,45 +106,39 @@ func GetUserCompanyPermissionSandO(companyId int) (items []*ActivityChartPermiss
|
|
AND b.chart_permission_name != '专家'
|
|
AND b.chart_permission_name != '专家'
|
|
GROUP BY b.chart_permission_name
|
|
GROUP BY b.chart_permission_name
|
|
ORDER BY b.sort ASC `
|
|
ORDER BY b.sort ASC `
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
_, err = o.Raw(sql, companyId).QueryRows(&items)
|
|
_, err = o.Raw(sql, companyId).QueryRows(&items)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// 获取策略下面的所有分类
|
|
// 获取策略下面的所有分类
|
|
func GetCompanyReportPermissionAll() (items []*CompanyReportPermission, err error) {
|
|
func GetCompanyReportPermissionAll() (items []*CompanyReportPermission, err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `SELECT * FROM company_report_permission WHERE chart_permission_id IN (19,20,21,22) AND status IN ('正式','试用','永续') AND created_time <= '2021-12-28 15:05:43'`
|
|
sql := `SELECT * FROM company_report_permission WHERE chart_permission_id IN (19,20,21,22) AND status IN ('正式','试用','永续') AND created_time <= '2021-12-28 15:05:43'`
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-func AddChartPersion(item *CompanyReportPermission) (newId int64, err error) {
|
|
|
|
- o := orm.NewOrm()
|
|
|
|
- newId, err = o.Insert(item)
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// 获取海通国际开通的默认权限
|
|
// 获取海通国际开通的默认权限
|
|
func GetCompanyPermissionIdWithHtgj() (chartpermissionids string, err error) {
|
|
func GetCompanyPermissionIdWithHtgj() (chartpermissionids string, err error) {
|
|
sql := ` SELECT GROUP_CONCAT(DISTINCT chart_permission_id ORDER BY b.sort ASC SEPARATOR ',') AS chartpermissionids
|
|
sql := ` SELECT GROUP_CONCAT(DISTINCT chart_permission_id ORDER BY b.sort ASC SEPARATOR ',') AS chartpermissionids
|
|
FROM chart_permission as b
|
|
FROM chart_permission as b
|
|
WHERE chart_permission_name IN ('医药','消费','科技','智造','买方研选')`
|
|
WHERE chart_permission_name IN ('医药','消费','科技','智造','买方研选')`
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
err = o.Raw(sql).QueryRow(&chartpermissionids)
|
|
err = o.Raw(sql).QueryRow(&chartpermissionids)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// GetChartPermissionById 主键获取权限
|
|
// GetChartPermissionById 主键获取权限
|
|
func GetChartPermissionByRemark(remark string) (item *ChartPermission, err error) {
|
|
func GetChartPermissionByRemark(remark string) (item *ChartPermission, err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `SELECT * FROM chart_permission WHERE remark = ? LIMIT 1`
|
|
sql := `SELECT * FROM chart_permission WHERE remark = ? LIMIT 1`
|
|
err = o.Raw(sql, remark).QueryRow(&item)
|
|
err = o.Raw(sql, remark).QueryRow(&item)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func GetChartPermissionIdByName(condition string, pars []interface{}) (chartpermissionids string, err error) {
|
|
func GetChartPermissionIdByName(condition string, pars []interface{}) (chartpermissionids string, err error) {
|
|
- o := orm.NewOrm()
|
|
|
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
sql := `SELECT GROUP_CONCAT(DISTINCT chart_permission_id SEPARATOR ',') AS chartpermissionids FROM chart_permission WHERE product_id=2 ` + condition
|
|
sql := `SELECT GROUP_CONCAT(DISTINCT chart_permission_id SEPARATOR ',') AS chartpermissionids FROM chart_permission WHERE product_id=2 ` + condition
|
|
err = o.Raw(sql, pars).QueryRow(&chartpermissionids)
|
|
err = o.Raw(sql, pars).QueryRow(&chartpermissionids)
|
|
return
|
|
return
|