ermcpWarehouseInfo.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * @Author: zou.yingbin
  3. * @Create : 2021/3/9 16:21
  4. * @Modify : 2021/3/9 16:21
  5. */
  6. package models
  7. import (
  8. "mtp2_if/db"
  9. "mtp2_if/utils"
  10. )
  11. // ErmcpWareHouseInfo 仓库信息结构
  12. type ErmcpWareHouseInfo struct {
  13. AUTOID int64 `json:"autoid" xorm:"'AUTOID'"` // 自增ID(仓库ID)
  14. WAREHOUSECODE string `json:"warehousecode" xorm:"'WAREHOUSECODE'"` // 仓库代码
  15. WAREHOUSENAME string `json:"warehousename" xorm:"'WAREHOUSENAME'"` // 仓库名称
  16. WAREHOUSETYPE int32 `json:"warehousetype" xorm:"'WAREHOUSETYPE'"` // 仓库类型 - 1 厂库 2 自有库 3 合作库
  17. AREAUSERID int64 `json:"areauserid" xorm:"'AREAUSERID'"` // 所属机构
  18. WAREHOUSESTATUS int32 `json:"warehousestatus" xorm:"'WAREHOUSESTATUS'"` // 仓库状态 - 1:正常 2:注销 3:待审核 4:审核拒绝
  19. COUNTRYID int32 `json:"countryid" xorm:"'COUNTRYID'"` // 国家
  20. PROVINCEID int32 `json:"provinceid" xorm:"'PROVINCEID'"` // 省
  21. CITYID int32 `json:"cityid" xorm:"'CITYID'"` // 市
  22. DISTRICTID int32 `json:"districtid" xorm:"'DISTRICTID'"` // 区
  23. ADDRESS string `json:"address" xorm:"'ADDRESS'"` // 详细地址
  24. REMARK string `json:"remark" xorm:"'REMARK'"` // 审核备注
  25. CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
  26. HASVIDEO int32 `json:"hasvideo" xorm:"'HASVIDEO'"` // 是否有视频 - 0:无 1:有
  27. VIDEOURL string `json:"videourl" xorm:"'VIDEOURL'"` // 视频地址
  28. CONTACTNAME string `json:"contactname" xorm:"'CONTACTNAME'"` // 联系人
  29. CONTACTNUM string `json:"contactnum" xorm:"'CONTACTNUM'"` // 联系电话
  30. }
  31. func (r *ErmcpWareHouseInfo) buildSql() string {
  32. var sqlId utils.SQLVal = "SELECT t.AUTOID," +
  33. " t.WAREHOUSECODE," +
  34. " t.WAREHOUSENAME," +
  35. " t.WAREHOUSETYPE," +
  36. " t.AREAUSERID," +
  37. " t.WAREHOUSESTATUS," +
  38. " t.COUNTRYID," +
  39. " t.PROVINCEID," +
  40. " t.CITYID," +
  41. " t.DISTRICTID," +
  42. " t.ADDRESS," +
  43. " t.REMARK," +
  44. " to_char(t.CREATETIME,'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
  45. " t.HASVIDEO," +
  46. " t.VIDEOURL," +
  47. " t.CONTACTNAME," +
  48. " t.CONTACTNUM" +
  49. " FROM WAREHOUSEINFO t" +
  50. " WHERE 1 = 1"
  51. if r.AREAUSERID > 0 {
  52. sqlId.And("t.AREAUSERID", r.AREAUSERID)
  53. }
  54. return sqlId.String()
  55. }
  56. // GetDataEx 获取仓库信息
  57. func (r *ErmcpWareHouseInfo) GetDataEx() (interface{}, error) {
  58. sData := make([]ErmcpWareHouseInfo, 0)
  59. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  60. return sData, err
  61. }