|
@@ -25,6 +25,16 @@ type CygxArticleDepartmentRep struct {
|
|
|
List []*IndustrialManagementIdName
|
|
|
}
|
|
|
|
|
|
+type CygxArticleDepartmentRepPc struct {
|
|
|
+ DepartmentId int `description:"作者ID"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ NickName string `description:"昵称"`
|
|
|
+ ImgUrl string `description:"头像链接"`
|
|
|
+ FollowNum int `description:"是否关注 1是 ,0 否"`
|
|
|
+ IsMyFollow bool `description:"是否关注"`
|
|
|
+ List []*IndustrialManagementIdNamePc
|
|
|
+}
|
|
|
+
|
|
|
type CygxArticleDepartmentId struct {
|
|
|
DepartmentId int `description:"作者ID"`
|
|
|
}
|
|
@@ -36,6 +46,13 @@ type CygxArticleDepartmentList struct {
|
|
|
List []*CygxArticleDepartmentRep
|
|
|
}
|
|
|
|
|
|
+type CygxArticleDepartmentListPc struct {
|
|
|
+ HaveResearch bool `description:"是否有研选权限"`
|
|
|
+ Paging *paging.PagingItem `description:"分页数据"`
|
|
|
+ ListnNew []*IndustrialManagementIdInt
|
|
|
+ List []*CygxArticleDepartmentRepPc
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
func GetArticleDepartmentDateil(nickName, remarks string) (item *CygxArticleDepartmentRep, err error) {
|
|
|
o := orm.NewOrm()
|
|
@@ -90,6 +107,27 @@ func GetCygxArticleDepartmentList(startSize, pageSize int, condition string, uid
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+func GetCygxArticleDepartmentListPc(startSize, pageSize int, condition string, uid int) (items []*CygxArticleDepartmentRepPc, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT d.*,
|
|
|
+ ( SELECT COUNT( 1 ) FROM cygx_article AS a INNER JOIN cygx_article_history_record as h ON h.article_id = a.article_id WHERE a.department_id = d.department_id AND a.publish_status = 1 ) AS art_num,
|
|
|
+ ( SELECT COUNT( 1 ) FROM cygx_article_department_follow AS f WHERE f.department_id = d.department_id AND f.user_id = ? AND f.type = 1 ) AS follow_num
|
|
|
+ FROM
|
|
|
+ cygx_article_department AS d
|
|
|
+ INNER JOIN cygx_article AS a ON a.department_id = d.department_id
|
|
|
+ INNER JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
|
|
|
+ INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = mg.industrial_management_id WHERE 1= 1 `
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ sql += ` GROUP BY
|
|
|
+ d.department_id
|
|
|
+ ORDER BY art_num DESC LIMIT ?,?`
|
|
|
+ _, err = o.Raw(sql, uid, startSize, pageSize).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
func GetIndustrialSubjectByDepartment(departmentId int) (items []*IndustrialManagementIdInt, err error) {
|
|
|
o := orm.NewOrm()
|
|
@@ -223,3 +261,39 @@ WHERE
|
|
|
err = o.Raw(sql, articleId).QueryRow(&Industrial)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+type IndustrialManagementIdNamePc struct {
|
|
|
+ Title string `description:"标题"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
+ DepartmentId int `description:"作者ID"`
|
|
|
+ ArticleId int `description:"文章id"`
|
|
|
+ IndustryName string `description:"产业名称"`
|
|
|
+ SubjectName string `description:"标的名称"`
|
|
|
+ IsReport string `description:"1观点,0纪要"`
|
|
|
+ Pv int `description:"Pv"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func GetArticleByDepartmentIdPc(departmentId int) (items []*IndustrialManagementIdNamePc, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ m.industry_name,
|
|
|
+ (SELECT count(1) FROM cygx_article_history_record_newpv as h WHERE h.article_id = art.article_id ) as pv,
|
|
|
+ GROUP_CONCAT( DISTINCT s.subject_name SEPARATOR '/' ) AS subject_name,
|
|
|
+ art.*
|
|
|
+ FROM
|
|
|
+ cygx_article AS art
|
|
|
+ LEFT JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = art.article_id
|
|
|
+ LEFT JOIN cygx_industrial_management AS m ON m.industrial_management_id = mg.industrial_management_id
|
|
|
+ LEFT JOIN cygx_industrial_article_group_subject AS sg ON sg.article_id = art.article_id
|
|
|
+ LEFT JOIN cygx_industrial_subject AS s ON s.industrial_subject_id = sg.industrial_subject_id
|
|
|
+ WHERE
|
|
|
+ department_id = ?
|
|
|
+ AND publish_status = 1
|
|
|
+ GROUP BY
|
|
|
+ art.article_id
|
|
|
+ ORDER BY
|
|
|
+ publish_date DESC`
|
|
|
+ _, err = o.Raw(sql, departmentId).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|