model.go 639 B

1234567891011121314151617181920212223
  1. package yb_community_question_process
  2. import (
  3. "hongze/hongze_yb/global"
  4. )
  5. func (item *YbCommunityQuestionProcess) Create() (err error) {
  6. err = global.DEFAULT_MYSQL.Create(item).Error
  7. return
  8. }
  9. func (item *YbCommunityQuestionProcess) Update(updateCols []string) (err error) {
  10. err = global.DEFAULT_MYSQL.Model(item).Select(updateCols).Updates(*item).Error
  11. return
  12. }
  13. func GetListByQuestionId(questionId int) (items []*YbCommunityQuestionProcess, err error) {
  14. err = global.DEFAULT_MYSQL.Model(YbCommunityQuestionProcess{}).
  15. Where("community_question_id = ?", questionId).
  16. Order("create_time DESC").
  17. Scan(&items).Error
  18. return
  19. }