123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625 |
- package roadshow
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- "hongze/hongze_mobile_admin/models/tables/admin"
- "time"
- )
- type AddActivityReq struct {
- ActivityType string `description:"活动类型"`
- RoadshowType string `description:"路演形式"`
- RoadshowPlatform string `description:"路演平台"`
- CompanyId int `description:"客户id"`
- CompanyName string `description:"客户名称"`
- Province string `description:"省"`
- ProvinceCode string `description:"省编码"`
- City string `description:"市"`
- CityCode string `description:"市编码"`
- District string `description:"区"`
- Theme string `description:"会议主题"`
- CooperationName string `description:"合作方名称"`
- ActivityCategory string `description:"活动类别"`
- ResearcherList []*CalendarResearcher
- EnglishCompany int `description:"是否为英文客户"`
- }
- type CalendarResearcher struct {
- ResearcherId int `description:"研究员id"`
- ResearcherName string `description:"研究员名称"`
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- StartTime string `description:"开始时间"`
- EndTime string `description:"结束时间"`
- StartWeek string `description:"开始日期对应周"`
- EndWeek string `description:"结束日期对应周"`
- }
- type RsCalendar struct {
- RsCalendarId int `orm:"column(rs_calendar_id);pk"`
- SysUserId int `description:"创建人id"`
- SysUserRealName string `description:"创建人名称"`
- ActivityType string `description:"活动类型"`
- RoadshowType string `description:"路演形式"`
- RoadshowPlatform string `description:"路演平台"`
- CompanyId int `description:"客户id"`
- CompanyName string `description:"客户名称"`
- Province string `description:"省"`
- ProvinceCode string `description:"省编码"`
- City string `description:"市"`
- CityCode string `description:"市编码"`
- District string `description:"区"`
- Theme string `description:"会议主题"`
- CooperationName string `description:"合作方名称"`
- Title string `description:"展示在日历的标题"`
- Source int8 `description:"来源,0:自系统,1:上海方的"`
- CreateTime time.Time
- ModifyTime time.Time
- ActivityCategory string `description:"活动类别"`
- IsSynced int `description:"是否与上海同步 0:未同步 1:已同步"`
- UnionCode string `description:"公开会议联合编码"`
- EnglishCompany int `description:"是否为英文客户: 0-否; 1-是"`
- SellerId int `description:"销售id"`
- ShareSellerId int `description:"共享销售员id"`
- }
- type RsCalendarResearcher struct {
- RsCalendarResearcherId int `orm:"column(rs_calendar_researcher_id);pk"`
- RsCalendarId int `description:"日历活动id"`
- ResearcherId int `description:"研究员id"`
- ResearcherName string `description:"研究员名称"`
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- StartTime string `description:"开始时间"`
- EndTime string `description:"结束时间"`
- StartWeek string `description:"开始日期对应周"`
- EndWeek string `description:"结束日期对应周"`
- CreateTime time.Time
- ModifyTime time.Time
- Status int `description:"状态:1:待接受,2:已接受,3:已拒绝,4:已删除,5:已撤回,6:已结束"`
- RefuseReason string `description:"拒绝理由"`
- RefuseTime time.Time `description:"拒绝时间"`
- DeleteReason string `description:"删除理由"`
- DeleteTime time.Time `description:"删除时间"`
- ApproveTime time.Time `description:"接受时间"`
- IsSynced int `description:"是否与上海同步 0:未同步 1:已同步"`
- ResearcherSort int `description:"研究员新增排序"`
- }
- func GetRsCalendarById(rsCalendarId int) (item *RsCalendar, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_calendar WHERE rs_calendar_id=? `
- err = o.Raw(sql, rsCalendarId).QueryRow(&item)
- return
- }
- func GetRsCalendarResearcherById(rsCalendarResearcherId int) (item *RsCalendarResearcher, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_calendar_researcher WHERE rs_calendar_researcher_id=? `
- err = o.Raw(sql, rsCalendarResearcherId).QueryRow(&item)
- return
- }
- func GetRsCalendarResearcherListById(rsCalendarId int) (item []*RsCalendarResearcher, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_calendar_researcher WHERE rs_calendar_id=? `
- _, err = o.Raw(sql, rsCalendarId).QueryRows(&item)
- return
- }
- func GetRsCalendarResearcherListByCalendarResearcherId(rsCalendarResearcherId int) (item []*RsCalendarResearcher, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_calendar_researcher WHERE rs_calendar_researcher_id=? `
- _, err = o.Raw(sql, rsCalendarResearcherId).QueryRows(&item)
- return
- }
- type Researcher struct {
- AdminId int `description:"研究员id"`
- RealName string `description:"研究员名称"`
- GroupId int `description:"分组id"`
- GroupName string `description:"分组名称"`
- RoleTypeCode string `description:"角色编码"`
- }
- type ResearcherGroup struct {
- GroupId int `description:"分组id"`
- GroupName string `description:"分组名称"`
- AdminId int `description:"研究员id"`
- RealName string `description:"研究员名称"`
- RoleTypeCode string `description:"角色编码"`
- ResearcherList []*ResearcherGroup
- }
- type CalendarListView struct {
- RsCalendarId int `orm:"column(rs_calendar_id);pk"`
- SysUserId int `description:"创建人id"`
- SysUserRealName string `description:"创建人名称"`
- ActivityType string `description:"活动类型"`
- RoadshowType string `description:"路演形式"`
- RoadshowPlatform string `description:"路演平台"`
- CompanyId int `description:"客户id"`
- CompanyName string `description:"客户名称"`
- CompanyStatus string `description:"客户状态"`
- RsCalendarResearcherId int `description:"活动研究员id"`
- ResearcherId string `description:"研究员id"`
- ResearcherName string `description:"研究员名称"`
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- StartTime string `description:"开始时间"`
- EndTime string `description:"结束时间"`
- StartWeek string `description:"开始日期对应周"`
- EndWeek string `description:"结束日期对应周"`
- CreateTime time.Time
- ModifyTime time.Time
- Status int `description:"状态:1:待接受,2:已接受,3:已拒绝,4:已删除,5:已撤回"`
- RefuseReason string `description:"拒绝理由"`
- RefuseTime time.Time `description:"拒绝时间"`
- DeleteReason string `description:"删除原因"`
- Province string `description:"省"`
- ProvinceCode string `description:"省编码"`
- City string `description:"市"`
- CityCode string `description:"市编码"`
- District string `description:"区"`
- Theme string `description:"会议主题"`
- CooperationName string `description:"合作方名称"`
- ActivityCategory string `description:"活动类别"`
- Source int `description:"来源,0:自系统,1:上海方的"`
- Title string `description:"活动标题"`
- EnglishCompany int `description:"是否为英文客户: 0-否; 1-是"`
- EnglishCountry string `description:"英文客户-国家"`
- EnglishViewTotal int `description:"英文客户-累计点击量"`
- }
- type CalendarListResp struct {
- Paging *paging.PagingItem
- List []*CalendarListView
- }
- func GetCalendarListCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT COUNT(1) AS count FROM rs_calendar AS a
- INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id=b.rs_calendar_id
- WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
- func GetCalendarList(condition string, pars []interface{}, status int, pageLimit ...int) (list []*CalendarListView, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_calendar AS a
- INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id=b.rs_calendar_id
- `
- if condition != "" {
- sql += condition
- }
- if status == 1 {
- sql += ` ORDER BY b.create_time ASC LIMIT ?,? `
- } else {
- //sql += ` ORDER BY b.create_time DESC LIMIT ?,? `
- sql += ` ORDER BY b.start_date DESC , b.start_time DESC LIMIT ?,? ` // 已处理申请,按照活动开始时间倒序(包括ficc的)
- }
- _, err = o.Raw(sql, pars, pageLimit).QueryRows(&list)
- return
- }
- type AcceptReq struct {
- RsCalendarId int `description:"日历活动id"`
- RsCalendarResearcherId int `description:"活动研究员id"`
- }
- type DeleteReq struct {
- RsCalendarId int `description:"日历活动id"`
- RsCalendarResearcherId int `description:"活动研究员id"`
- DeleteReason string `description:"删除原因"`
- }
- type RefuseReq struct {
- RsCalendarId int `description:"日历活动id"`
- RsCalendarResearcherId int `description:"活动研究员id"`
- RefuseReason string `description:"拒绝原因"`
- }
- // 更新
- func UpdateCalendarResearcher(where, updateParams map[string]interface{}) error {
- o := orm.NewOrm()
- ptrStructOrTableName := "rs_calendar_researcher"
- qs := o.QueryTable(ptrStructOrTableName)
- for expr, exprV := range where {
- qs = qs.Filter(expr, exprV)
- }
- _, err := qs.Update(updateParams)
- return err
- }
- // 更新
- func UpdateCalendarResearcherFromSH(item *RsCalendarResearcher) error {
- o := orm.NewOrm()
- _, err := o.Update(item, "")
- return err
- }
- type AddMattersReq struct {
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- StartTime string `description:"开始时间"`
- EndTime string `description:"结束时间"`
- StartWeek string `description:"开始日期周"`
- EndWeek string `description:"结束日期周"`
- MatterContent string `description:"事项内容"`
- }
- type RsMatters struct {
- RsMattersId int `orm:"column(rs_matters_id);pk"`
- SysUserId int `description:"添加事项人id"`
- SysUserRealName string `description:"创建人姓名"`
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- StartTime string `description:"开始时间"`
- EndTime string `description:"结束时间"`
- StartWeek string `description:"开始日期周"`
- EndWeek string `description:"结束日期周"`
- MatterContent string `description:"事项内容"`
- Status int8 `description:"状态:1:进行中,6:已结束"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- IsSynced int `description:"是否与上海同步 0:未同步 1:已同步"`
- EditReason string `description:"修改原因"`
- IsSeller int `description:"是否为销售事项: 0-否; 1-是"`
- }
- type UpdateMattersReq struct {
- RsMattersId int `orm:"column(rs_matters_id);pk"`
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- StartTime string `description:"开始时间"`
- EndTime string `description:"结束时间"`
- StartWeek string `description:"开始日期周"`
- EndWeek string `description:"结束日期周"`
- MatterContent string `description:"事项内容"`
- EditReason string `description:"修改原因"`
- }
- type CalendarDetailResp struct {
- RsCalendarItem *RsCalendar
- RsCalendarResearcherItem *RsCalendarResearcher
- CompanyDetail *CompanyDetailView
- }
- type MattersListResp struct {
- Paging *paging.PagingItem
- List []*RsMattersView
- }
- type RsMattersView struct {
- RsMattersId int `orm:"column(rs_matters_id);pk"`
- SysUserId int `description:"添加事项人id"`
- SysUserRealName string `description:"创建人姓名"`
- StartDate string `description:"开始日期"`
- EndDate string `description:"结束日期"`
- StartTime string `description:"开始时间"`
- EndTime string `description:"结束时间"`
- StartWeek string `description:"开始日期周"`
- EndWeek string `description:"结束日期周"`
- MatterContent string `description:"事项内容"`
- Status int8 `description:"状态:1:进行中,6:已结束"`
- CreateTime string `description:"创建时间"`
- ModifyTime string `description:"修改时间"`
- IsSynced int `description:"是否与上海同步 0:未同步 1:已同步"`
- EditReason string `description:"修改原因"`
- ButtonAuth RsMatterButton `description:"按钮权限"`
- }
- // RsMatterButton 事项按钮权限
- type RsMatterButton struct {
- EditDisabled bool `description:"禁用编辑"`
- RemoveDisabled bool `description:"禁用删除"`
- }
- func GetMattersListCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT COUNT(1) AS count FROM rs_matters AS a
- WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
- func GetMattersList(condition string, pars []interface{}, pageLimit ...int) (list []*RsMattersView, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_matters AS a
- WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- sql += ` ORDER BY a.create_time DESC LIMIT ?,? `
- _, err = o.Raw(sql, pars, pageLimit).QueryRows(&list)
- return
- }
- type DeleteMattersReq struct {
- RsMattersId int `description:"事项id"`
- }
- // 删除事项
- func DeleteRsMatters(rsMattersId int) (err error) {
- o := orm.NewOrm()
- sql := ` DELETE FROM rs_matters WHERE rs_matters_id=? `
- _, err = o.Raw(sql, rsMattersId).Exec()
- return err
- }
- func CheckMattersCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT COUNT(1) AS count FROM rs_matters AS a
- WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
- func GetResearcherFromAdmin(condition string, pars []interface{}) (lists []*admin.Admin, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM admin WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- _, err = o.Raw(sql, pars).QueryRows(&lists)
- return
- }
- // 更新活动信息
- func UpdateRsCalendar(where, updateParams map[string]interface{}) error {
- o := orm.NewOrm()
- ptrStructOrTableName := "rs_calendar"
- qs := o.QueryTable(ptrStructOrTableName)
- for expr, exprV := range where {
- qs = qs.Filter(expr, exprV)
- }
- _, err := qs.Update(updateParams)
- return err
- }
- // 更新
- func UpdateRsMatters(where, updateParams map[string]interface{}) error {
- o := orm.NewOrm()
- ptrStructOrTableName := "rs_matters"
- qs := o.QueryTable(ptrStructOrTableName)
- for expr, exprV := range where {
- qs = qs.Filter(expr, exprV)
- }
- _, err := qs.Update(updateParams)
- return err
- }
- type EditActivityReq struct {
- EditType int `description:"修改方式: 1:修改,2:修改重提"`
- RsCalendarId int `description:"路演活动id"`
- RsCalendarResearcherId int `description:"活动研究员id"`
- ActivityType string `description:"活动类型"`
- RoadshowType string `description:"路演形式"`
- RoadshowPlatform string `description:"路演平台"`
- CompanyId int `description:"客户id"`
- CompanyName string `description:"客户名称"`
- Province string `description:"省"`
- ProvinceCode string `description:"省编码"`
- City string `description:"市"`
- CityCode string `description:"市编码"`
- District string `description:"区"`
- Theme string `description:"会议主题"`
- CooperationName string `description:"合作方名称"`
- ActivityCategory string `description:"活动类别"`
- ResearcherList []*CalendarResearcher
- EnglishCompany int `description:"是否为英文客户"`
- }
- // GetRsCalendarResearcherListByRsCalendarId 根据路演id获取路演研究员列表
- func GetRsCalendarResearcherListByRsCalendarId(rsCalendarId int) (items []*RsCalendarResearcher, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_calendar_researcher WHERE rs_calendar_id=? `
- _, err = o.Raw(sql, rsCalendarId).QueryRows(&items)
- return
- }
- func CheckCalendarResearcherCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT COUNT(1) AS count FROM rs_calendar_researcher AS a
- WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
- func GetMattersById(rsMatters int) (item *RsMatters, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_matters
- WHERE rs_matters_id=? `
- err = o.Raw(sql, rsMatters).QueryRow(&item)
- return
- }
- // 添加RsCalendarResearcher
- func AddRsMatters(item *RsMatters) (id int64, err error) {
- o := orm.NewOrm()
- id, err = o.Insert(item)
- return
- }
- // 添加RsCalendar
- func AddRsCalendar(item *RsCalendar) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- // 添加RsCalendarResearcher
- func AddRsCalendarResearcher(item *RsCalendarResearcher) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- func GetRsCalendarResearcherByRsCalendarIdAndResearcherId(rsCalendarId, researcherId int) (item *RsCalendarResearcher, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_calendar_researcher WHERE rs_calendar_id=? AND researcher_id=? `
- err = o.Raw(sql, rsCalendarId, researcherId).QueryRow(&item)
- return
- }
- func GetRsCalendarResearcherByCalendarId(rsCalendarId int) (item []*RsCalendarResearcher, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM rs_calendar_researcher WHERE rs_calendar_id=? `
- _, err = o.Raw(sql, rsCalendarId).QueryRows(&item)
- return
- }
- // 删除
- func DeleteRsCalendarResearcher(rsCalendarId int) (err error) {
- o := orm.NewOrm()
- sql := ` DELETE FROM rs_calendar_researcher WHERE rs_calendar_id=? `
- _, err = o.Raw(sql, rsCalendarId).Exec()
- return err
- }
- func GetResearcherGroup() (list []*ResearcherGroup, err error) {
- o := orm.NewOrm()
- sql := ` SELECT group_id,group_name FROM admin AS a
- WHERE a.role_type_code IN('researcher','ficc_researcher','ficc_admin')
- AND a.enabled=1
- AND a.group_id>0
- AND a.group_name<>'无'
- GROUP BY a.group_id
- ORDER BY a.group_id ASC `
- _, err = o.Raw(sql).QueryRows(&list)
- return
- }
- func GetResearcher() (list []*Researcher, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * FROM admin AS a
- WHERE a.role_type_code IN('researcher','rai_researcher','ficc_researcher','ficc_admin')
- AND a.enabled=1 AND a.real_name<>'于菲' `
- _, err = o.Raw(sql).QueryRows(&list)
- return
- }
- // 删除
- func DeleteCalendar(rsCalendarId, rsCalendarResearcherId int) (err error) {
- o := orm.NewOrm()
- sql := ` DELETE FROM rs_calendar_researcher WHERE rs_calendar_id=? `
- _, err = o.Raw(sql, rsCalendarId).Exec()
- if err != nil {
- return err
- }
- //var count int
- //sql = ` SELECT COUNT(1) AS count FROM rs_calendar_researcher WHERE rs_calendar_id=? `
- //err = o.Raw(sql, rsCalendarId).QueryRow(&count)
- //if err != nil && err.Error() != utils.ErrNoRow() {
- // return err
- //}
- //if count <= 0 {
- // sql := ` DELETE FROM rs_calendar WHERE rs_calendar_id=? `
- // _, err = o.Raw(sql, rsCalendarId).Exec()
- // if err != nil {
- // return err
- // }
- //}
- sql = ` DELETE FROM rs_calendar WHERE rs_calendar_id=? `
- _, err = o.Raw(sql, rsCalendarId).Exec()
- if err != nil {
- return err
- }
- return err
- }
- type ActivityTypeList struct {
- ActivityTypeId int `description:"活动类型ID"`
- ActivityTypeName string `description:"活动类型名称"`
- Pid int `description:"父级id,默认是:0"`
- Sort int `description:"排序字段"`
- FrontIsShow int8 `description:"是否在前台展示,0:不展示,1:展示"`
- CreateTime time.Time `description:"创建时间"`
- ChildList []*ActivityTypeList `description:"下级活动类型列表"`
- }
- // GetActivityTypeListByActivityTypePId 根据上级id获取活动分类列表
- func GetActivityTypeListByActivityTypePId(pid int) (list []*ActivityTypeList, err error) {
- o := orm.NewOrm()
- sql := `select * from yb_activity_type where pid=? order by sort asc ,activity_type_id asc`
- _, err = o.Raw(sql, pid).QueryRows(&list)
- return
- }
- type CalendarPanelDetailResp struct {
- CalendarList []*CalendarListView
- RsMattersList []*RsMatters
- }
- func GetCalendarDetailList(condition string, pars []interface{}) (list []*CalendarListView, err error) {
- o := orm.NewOrm()
- sql := `SELECT a.*,b.*,c.status AS company_status FROM rs_calendar AS a
- INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id=b.rs_calendar_id
- LEFT JOIN company_product AS c ON a.company_id=c.company_id AND c.product_id=1
- WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- sql += ` ORDER BY a.create_time DESC `
- _, err = o.Raw(sql, pars).QueryRows(&list)
- return
- }
- func GetRsMattersList(startDate, endDate string, researcherId int) (list []*RsMatters, err error) {
- o := orm.NewOrm()
- //sql := `SELECT * FROM rs_matters AS a WHERE a.start_date>=? AND a.end_date<=? AND sys_user_id=? `
- //sql := `SELECT * FROM rs_matters AS a WHERE a.end_date>=? AND sys_user_id=? `
- sql := `SELECT * FROM rs_matters AS a WHERE sys_user_id=? `
- sql += ` ORDER BY a.create_time DESC `
- _, err = o.Raw(sql, researcherId).QueryRows(&list)
- return
- }
- func GetCalendarTypeList(condition string, pars []interface{}, startSize, pageSize int) (list []*CalendarListView, err error) {
- o := orm.NewOrm()
- sql := ` SELECT a.rs_calendar_id,a.activity_type,a.roadshow_type,a.activity_category,a.roadshow_platform,b.create_time,
- b.modify_time,GROUP_CONCAT(b.researcher_id ORDER BY researcher_sort ASC) AS researcher_id,GROUP_CONCAT(b.researcher_name ORDER BY researcher_sort ASC) AS researcher_name,
- b.rs_calendar_researcher_id,b.start_date,
- b.end_date,b.start_time,b.end_time,b.start_week,b.end_week,b.status,b.refuse_reason,b.refuse_time,
- b.delete_reason,a.sys_user_real_name,a.city,a.province,a.company_name,a.company_id,
- a.cooperation_name,a.theme,a.activity_category
- FROM rs_calendar AS a
- INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id=b.rs_calendar_id
- WHERE 1=1
- `
- if condition != "" {
- sql += condition
- }
- sql += ` GROUP BY a.rs_calendar_id
- ORDER BY b.create_time DESC LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
- return
- }
- func GetCalendarTypeListCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT COUNT(1) AS count FROM(SELECT COUNT(1) AS count
- FROM rs_calendar AS a
- INNER JOIN rs_calendar_researcher AS b ON a.rs_calendar_id=b.rs_calendar_id
- WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- sql += ` GROUP BY a.rs_calendar_id ) AS t `
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
|