1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxArticleDepartment struct {
- DepartmentId int `orm:"column(department_id);pk;主键ID"`
- CreateTime time.Time `description:"创建时间"`
- NickName string `description:"昵称"`
- Remark string `description:"备注"`
- Remarks string `description:"备注辅助字段"`
- Content string `description:"初始内容"`
- }
- type DepartmentResp struct {
- DepartmentId int `description:"作者ID"`
- CreateTime string `description:"创建时间"`
- NickName string `description:"昵称"`
- ImgUrl string `description:"头像链接"`
- IsFollow bool `description:"是否关注"`
- }
- type CygxArticleDepartmentId struct {
- DepartmentId int `description:"作者ID"`
- }
- func GetArticleDepartmentDateilById(departmentId int) (item *DepartmentResp, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_article_department WHERE department_id = ? `
- err = o.Raw(sql, departmentId).QueryRow(&item)
- return
- }
- //数量
- func GetArticleDepartmentCount(condition string) (count int, err error) {
- o := orm.NewOrm()
- sql := ` SELECT COUNT(*) count
- FROM
- ( SELECT COUNT(1) 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 ) AS num `
- err = o.Raw(sql).QueryRow(&count)
- return
- }
- type IndustrialSubjectList struct {
- SubjectName string `description:"标的名称"`
- }
|