|
@@ -19,15 +19,16 @@ type IndustrialManagementCount struct {
|
|
|
}
|
|
|
|
|
|
//获取产业置顶数量分类列表
|
|
|
-func GetIndustrialManagemenCountTop(ChartPermissionId, uid int) (items []*IndustrialManagementCount, err error) {
|
|
|
+func GetIndustrialManagemenCountTop(ChartPermissionId, uid int, condition string) (items []*IndustrialManagementCount, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
|
man_g.industrial_management_id
|
|
|
FROM
|
|
|
cygx_industrial_article_group_management AS man_g
|
|
|
+ INNER JOIN cygx_industrial_management as man ON man.industrial_management_id = man_g.industrial_management_id
|
|
|
WHERE
|
|
|
man_g.industrial_management_id IN ( SELECT industrial_management_id FROM cygx_industrial_management WHERE chart_permission_id = ? )
|
|
|
- AND man_g.industrial_management_id IN ( SELECT industrial_management_id FROM cygx_industry_top WHERE user_id = ? )
|
|
|
+ AND man_g.industrial_management_id IN ( SELECT industrial_management_id FROM cygx_industry_top WHERE user_id = ? ) ` + condition + `
|
|
|
GROUP BY
|
|
|
man_g.industrial_management_id`
|
|
|
_, err = o.Raw(sql, ChartPermissionId, uid).QueryRows(&items)
|
|
@@ -35,15 +36,16 @@ func GetIndustrialManagemenCountTop(ChartPermissionId, uid int) (items []*Indust
|
|
|
}
|
|
|
|
|
|
//获取产业不置顶数量
|
|
|
-func GetIndustrialManagemenCountNoTop(ChartPermissionId, uid int) (items []*IndustrialManagementCount, err error) {
|
|
|
+func GetIndustrialManagemenCountNoTop(ChartPermissionId, uid int, condition string) (items []*IndustrialManagementCount, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
|
man_g.industrial_management_id
|
|
|
FROM
|
|
|
cygx_industrial_article_group_management AS man_g
|
|
|
+ INNER JOIN cygx_industrial_management as man ON man.industrial_management_id = man_g.industrial_management_id
|
|
|
WHERE
|
|
|
man_g.industrial_management_id IN ( SELECT industrial_management_id FROM cygx_industrial_management WHERE chart_permission_id = ? )
|
|
|
- AND man_g.industrial_management_id NOT IN ( SELECT industrial_management_id FROM cygx_industry_top WHERE user_id = ? )
|
|
|
+ AND man_g.industrial_management_id NOT IN ( SELECT industrial_management_id FROM cygx_industry_top WHERE user_id = ? ) ` + condition + `
|
|
|
GROUP BY
|
|
|
man_g.industrial_management_id`
|
|
|
_, err = o.Raw(sql, ChartPermissionId, uid).QueryRows(&items)
|
|
@@ -51,7 +53,7 @@ func GetIndustrialManagemenCountNoTop(ChartPermissionId, uid int) (items []*Indu
|
|
|
}
|
|
|
|
|
|
//产业列表 不置顶
|
|
|
-func GetIndustrialManagementAll(ChartPermissionId, uid int, orderSrt string, startSize, pageSize int) (items []*IndustrialManagement, err error) {
|
|
|
+func GetIndustrialManagementAll(ChartPermissionId, uid int, condition, orderSrt string, startSize, pageSize int) (items []*IndustrialManagement, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
|
man.*,
|
|
@@ -67,7 +69,7 @@ func GetIndustrialManagementAll(ChartPermissionId, uid int, orderSrt string, sta
|
|
|
AND man.industrial_management_id NOT IN ( SELECT industrial_management_id FROM cygx_industry_top WHERE user_id = ` + strconv.Itoa(uid) + ` )
|
|
|
AND re.report_type = 2
|
|
|
AND art.is_report = 1
|
|
|
- AND art.is_class = 1
|
|
|
+ AND art.is_class = 1 ` + condition + `
|
|
|
GROUP BY
|
|
|
man.industry_name
|
|
|
ORDER BY ` + orderSrt + ` LIMIT ?,?`
|
|
@@ -79,7 +81,7 @@ func GetIndustrialManagementAll(ChartPermissionId, uid int, orderSrt string, sta
|
|
|
}
|
|
|
|
|
|
//产业列表 -置顶
|
|
|
-func GetIndustrialManagementTopAll(ChartPermissionId, uid, startSize, pageSize int) (items []*IndustrialManagement, err error) {
|
|
|
+func GetIndustrialManagementTopAll(ChartPermissionId, uid int, condition string, startSize, pageSize int) (items []*IndustrialManagement, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
|
man.*
|
|
@@ -94,7 +96,7 @@ func GetIndustrialManagementTopAll(ChartPermissionId, uid, startSize, pageSize i
|
|
|
AND top.user_id = ` + strconv.Itoa(uid) + `
|
|
|
AND re.report_type = 2
|
|
|
AND art.is_report = 1
|
|
|
- AND art.is_class = 1
|
|
|
+ AND art.is_class = 1 ` + condition + `
|
|
|
GROUP BY
|
|
|
man.industry_name
|
|
|
ORDER BY
|
|
@@ -197,3 +199,36 @@ func UpdateIndustrialIsDeepLabel(idStr string) (err error) {
|
|
|
_, err = o.Raw(msql).Exec()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+type IndustrialManagementIdInt struct {
|
|
|
+ IndustrialManagementId int `description:"产业Id"`
|
|
|
+ IndustryName string `description:"产业名称"`
|
|
|
+}
|
|
|
+
|
|
|
+//获取归类产业报告数量大于10的
|
|
|
+func GetIndustrialManagementIds() (items []*IndustrialManagementIdInt, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ //sql := `SELECT a.industrial_management_id FROM
|
|
|
+ // cygx_industrial_management AS a
|
|
|
+ // INNER JOIN cygx_industrial_subject as b ON b.industrial_management_id=a.industrial_management_id
|
|
|
+ // WHERE b.industrial_subject_id > 0
|
|
|
+ // GROUP BY a.industrial_management_id `
|
|
|
+
|
|
|
+ sql := `SELECT industrial_management_id,industry_name FROM cygx_industrial_management `
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func GetcygxIndustrialSubject(industrialManagementId int) (items []*IndustrialSubject, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT subject_name FROM cygx_industrial_subject WHERE industrial_management_id = ?`
|
|
|
+ _, err = o.Raw(sql, industrialManagementId).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func UpdateIndustrialManagementSubjectNames(nameStr string, industrialManagementId int) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `UPDATE cygx_industrial_management SET subject_names = ? WHERE industrial_management_id = ?`
|
|
|
+ _, err = o.Raw(sql, nameStr, industrialManagementId).Exec()
|
|
|
+ return
|
|
|
+}
|