|
@@ -0,0 +1,62 @@
|
|
|
+package roadshow
|
|
|
+
|
|
|
+import (
|
|
|
+ "context"
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+type RsCalendarResearcherQuestion struct {
|
|
|
+ RsCalendarResearcherQuestionId int `orm:"column(rs_calendar_researcher_question_id);pk"`
|
|
|
+ RsCalendarResearcherId int `description:"路演研究员记录ID"`
|
|
|
+ QuestionContent string `description:"提问内容"`
|
|
|
+ ReplyContent string `description:"客户分类"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"更新时间"`
|
|
|
+}
|
|
|
+
|
|
|
+type RoadShowQuestionSaveReq struct {
|
|
|
+ RsCalendarId int `description:"路演ID"`
|
|
|
+ RsCalendarResearcherId int `description:"路演研究员记录ID"`
|
|
|
+ CompanyIndustry string `description:"客户行业"`
|
|
|
+ CompanyClassify string `description:"客户分类"`
|
|
|
+ QuestionList []*RsCalendarResearcherQuestionSaveReq `description:"问答列表"`
|
|
|
+}
|
|
|
+
|
|
|
+type RsCalendarResearcherQuestionSaveReq struct {
|
|
|
+ QuestionContent string `description:"提问内容"`
|
|
|
+ ReplyContent string `description:"客户分类"`
|
|
|
+}
|
|
|
+
|
|
|
+func RoadShowQuestionSave(req *RoadShowQuestionSaveReq) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ tx, err := o.BeginWithCtx(context.Background())
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ sql := ` UPDATE rs_calendar_researcher SET company_industry = ?,company_classify = ?,question_status=1 WHERE rs_calendar_researcher_id = ? `
|
|
|
+ _, err = tx.Raw(sql, req.CompanyIndustry, req.CompanyClassify, req.RsCalendarResearcherId).Exec()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ list := make([]*RsCalendarResearcherQuestion, 0)
|
|
|
+ for _, v := range req.QuestionList {
|
|
|
+ item := new(RsCalendarResearcherQuestion)
|
|
|
+ item.RsCalendarResearcherId = req.RsCalendarResearcherId
|
|
|
+ item.QuestionContent = v.QuestionContent
|
|
|
+ item.ReplyContent = v.ReplyContent
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ list = append(list, item)
|
|
|
+ }
|
|
|
+ _, err = tx.InsertMulti(len(list), &list)
|
|
|
+ return err
|
|
|
+}
|
|
|
+
|
|
|
+func GetRoadShowQuestionList(rsCalendarResearcherId int) (item []*RsCalendarResearcherQuestion, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT * FROM rs_calendar_researcher_question WHERE rs_calendar_researcher_id = ? ORDER BY create_time DESC `
|
|
|
+ _, err = o.Raw(sql, rsCalendarResearcherId).QueryRows(&item)
|
|
|
+ return
|
|
|
+}
|