run.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package model
  2. import (
  3. "time"
  4. "ulink-admin/pkg/base"
  5. )
  6. type Run struct {
  7. Id int64 `excel:"name=主键id " xorm:"pk autoincr notnull comment('主键id')" json:"id" ` //主键id
  8. ServiceNo string `excel:"name=服务资格证号 " xorm:"varchar(255) comment('服务资格证号')" json:"serviceNo" ` //服务资格证号
  9. Card string `excel:"name=卡号 " xorm:"varchar(255) comment('卡号')" json:"card" binding:"required"` //卡号
  10. Driver string `excel:"name=驾驶员姓名 " xorm:"varchar(64) comment('驾驶员姓名')" json:"driver" binding:"required"` //驾驶员姓名
  11. IdCard string `excel:"name=身份证号 " xorm:"varchar(255) comment('身份证号')" json:"idCard" binding:"required"` //身份证号
  12. CompanyId int64 `excel:"name=现属公司 " xorm:"bigint(20) notnull default(0) comment('现属公司')" json:"companyId" binding:"required"` //现属公司
  13. CarNo string `excel:"name=车牌号 " xorm:"varchar(255) comment('车牌号')" json:"carNo" binding:"required"` //车牌号
  14. Address string `excel:"name=违章地点 " xorm:"varchar(255) comment('违章地点')" json:"address" ` //违章地点
  15. ViolationDate string `excel:"name=违章日期 " xorm:"varchar(255) comment('违章日期')" json:"violationDate" ` //违章日期
  16. Content string `excel:"name=违章内容 " xorm:"text comment('违章内容')" json:"content" ` //违章内容
  17. Score int `excel:"name=加减分 " xorm:"int(10) notnull default(0) comment('加减分')" json:"score" binding:"required"` //加减分
  18. Company string `excel:"name=执法单位 " xorm:"varchar(255) comment('执法单位')" json:"company" ` //执法单位
  19. HandlerDate string `excel:"name=处理时间 " xorm:"varchar(255) comment('处理时间')" json:"handlerDate" ` //处理时间
  20. Remark string `excel:"name=备注 " xorm:"text comment('备注')" json:"remark" ` //备注
  21. CreateTime time.Time `excel:"name=创建时间 " xorm:"datetime comment('创建时间')" json:"createTime" ` //创建时间
  22. CreateBy string `excel:"name=创建人 " xorm:"varchar(255) comment('创建人')" json:"createBy" ` //创建人
  23. UpdateTime time.Time `excel:"name=更新时间 " xorm:"datetime comment('更新时间')" json:"updateTime" ` //更新时间
  24. UpdateBy string `excel:"name=更新人 " xorm:"varchar(255) comment('更新人')" json:"updateBy" ` //更新人
  25. }
  26. func (this Run) TableName() string {
  27. return "run"
  28. }
  29. func (this *Run) Key() int64 {
  30. return this.Id
  31. }
  32. func (this *Run) Model() interface{} {
  33. return this
  34. }
  35. func (this *Run) BeforeUpdate() {
  36. user := base.GetCurUser()
  37. if user != nil {
  38. this.UpdateBy = user.Name
  39. }
  40. if user.ComponyId > 0 {
  41. this.CompanyId = user.ComponyId
  42. }
  43. }
  44. func (this *Run) BeforeInsert() {
  45. user := base.GetCurUser()
  46. if user != nil {
  47. this.CreateBy = user.Name
  48. this.UpdateBy = user.Name
  49. }
  50. if user.ComponyId > 0 {
  51. this.CompanyId = user.ComponyId
  52. }
  53. }