business_apply_peer.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package business_trip
  2. import "time"
  3. import (
  4. "github.com/beego/beego/v2/client/orm"
  5. )
  6. type BusinessApplyPeer struct {
  7. BusinessApplyPeerId int `orm:"column(business_apply_peer_id);pk;auto" description:"ID"`
  8. BusinessApplyId int `description:"出差申请id"`
  9. ArriveDate string `description:"到达日期"`
  10. ReturnDate string `description:"返程日期"`
  11. Province string `description:"目的地省"`
  12. City string `description:"目的地市"`
  13. Status string `description:"状态:'待审批','已审批','已驳回','已撤回','已过期'"`
  14. PeerPeopleId int `description:"同行人id"`
  15. PeerPeopleName string `description:"同行人姓名"`
  16. CreateTime time.Time `description:"创建时间"`
  17. ModifyTime time.Time `description:"修改时间"`
  18. }
  19. // 添加出差申请随行人
  20. func AddBusinessApplyPeer(items []*BusinessApplyPeer) (err error) {
  21. o := orm.NewOrm()
  22. _, err = o.InsertMulti(len(items), items)
  23. if err != nil {
  24. return
  25. }
  26. return
  27. }
  28. // 删除
  29. func DeleteBusinessApplyPeer(businessApplyId int) (err error) {
  30. o := orm.NewOrm()
  31. sql := ` DELETE FROM business_apply_peer WHERE business_apply_id=? `
  32. _, err = o.Raw(sql, businessApplyId).Exec()
  33. if err != nil {
  34. return err
  35. }
  36. return err
  37. }