|
@@ -313,3 +313,45 @@ func UpdateSyncRsCalendarRelation(thirdUserCalendar UserCalendar, rsCalendar *Rs
|
|
|
_, err = o.Update(rsCalendarRelation, "SelfCalendarId", "UserId", "UserPhone", "UserName", "ProjectName", "ProjectId", "CustomerId", "CustomerName", "CustomerSocial", "ProjectType", "ProjectFormType", "Room", "StartTime", "EndTime", "Content", "FeedExpert", "Title", "ResearcherMobile", "ModifyTime")
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// RsCalendarResearcherRelationInfo
|
|
|
+type RsCalendarResearcherRelationInfo struct {
|
|
|
+ RsCalendarResearcherId int `orm:"column(rs_calendar_researcher_id);pk"`
|
|
|
+ CalendarType int8 `description:"日历类型;1:路演;2:事项"`
|
|
|
+ ThirdCalendarId int `description:"第三方路演id"`
|
|
|
+ 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:"研究员新增排序"`
|
|
|
+}
|
|
|
+
|
|
|
+// GetRsCalendarResearcherInfoIByResearcherIdAndDate 根据研究员和开始/结束日期获取上海的活动路演
|
|
|
+func GetRsCalendarResearcherInfoIByResearcherIdAndDate(researcherId int, startDate, endDate string) (items []*RsCalendarResearcherRelationInfo, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ // sql := `SELECT a.*,c.third_calendar_id,c.calendar_type FROM rs_calendar_researcher a join rs_calendar b on a.rs_calendar_id=b.rs_calendar_id
|
|
|
+ //join rs_calendar_relation c on a.rs_calendar_researcher_id=c.self_calendar_id
|
|
|
+ //WHERE b.source=1 and a.status=2 and c.calendar_type=1 and a.researcher_id=? and start_date>=? and end_date <= ? `
|
|
|
+
|
|
|
+ //杭州创建的路演活动,如果上海被删除了,那么也要同步删除杭州的(所以相对于上面的逻辑,下面移除了来源的where条件)
|
|
|
+ sql := `SELECT a.*,c.third_calendar_id,c.calendar_type FROM rs_calendar_researcher a
|
|
|
+join rs_calendar b on a.rs_calendar_id=b.rs_calendar_id
|
|
|
+join rs_calendar_relation c on a.rs_calendar_researcher_id=c.self_calendar_id
|
|
|
+WHERE a.status=2 and c.calendar_type=1 and a.researcher_id=? and start_date>=? and end_date <= ? `
|
|
|
+ _, err = o.Raw(sql, researcherId, startDate, endDate).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|