ermcpBrandModel.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**
  2. * @Author: zou.yingbin
  3. * @Create : 2021/3/15 10:27
  4. * @Modify : 2021/3/15 10:27
  5. */
  6. package models
  7. import (
  8. "mtp2_if/db"
  9. "mtp2_if/utils"
  10. )
  11. // ErmcpGoodsBrand 品牌
  12. type ErmcpGoodsBrand struct {
  13. BRANDID int32 `json:"brandid" xorm:"'BRANDID'"` // BrandID(SEQ_SPOTGOODSBRAND)
  14. BRANDNAME string `json:"brandname" xorm:"'BRANDNAME'"` // 品牌名称
  15. WRSTANDARDID int64 `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 现货商品ID
  16. DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 现货品种ID
  17. AREAUSERID int64 `json:"areauserid" xorm:"'AREAUSERID'"` // 所属机构
  18. ISVALID int32 `json:"isvalid" xorm:"'ISVALID'"` // 是否有效 - 0:无效 1:有效
  19. CREATORSRC int32 `json:"creatorsrc" xorm:"'CREATORSRC'"` // 创建人来源 - 1:管理端 2:终端
  20. CREATORID int64 `json:"creatorid" xorm:"'CREATORID'"` // 创建人
  21. CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
  22. UPDATORSRC int32 `json:"updatorsrc" xorm:"'UPDATORSRC'"` // 更新人来源 - 1:管理端 2:终端
  23. UPDATORID int64 `json:"updatorid" xorm:"'UPDATORID'"` // 更新人
  24. UPDATETIME string `json:"updatetime" xorm:"'UPDATETIME'"` // 更新时间
  25. }
  26. func (r *ErmcpGoodsBrand) buildSql() string {
  27. var sqlId utils.SQLVal = "SELECT t.BRANDID," +
  28. " t.BRANDNAME," +
  29. " t.WRSTANDARDID," +
  30. " t.DELIVERYGOODSID," +
  31. " t.AREAUSERID," +
  32. " t.ISVALID," +
  33. " t.CREATORSRC," +
  34. " t.CREATORID," +
  35. " to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
  36. " t.UPDATORSRC," +
  37. " t.UPDATORID," +
  38. " to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME" +
  39. " FROM SPOTGOODSBRAND t" +
  40. " WHERE 1 = 1"
  41. sqlId.And("t.AREAUSERID", r.AREAUSERID)
  42. return sqlId.String()
  43. }
  44. // GetDataEx 获取品牌数据
  45. func (r *ErmcpGoodsBrand) GetDataEx() (interface{}, error) {
  46. sData := make([]ErmcpGoodsBrand, 0)
  47. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  48. return sData, err
  49. }
  50. // ErmcpGoodsModel 商品型号
  51. type ErmcpGoodsModel struct {
  52. MODELID int32 `json:"modelid" xorm:"'MODELID'"` // ModelID(SEQ_SPOTGOODSMODEL)
  53. MODELNAME string `json:"modelname" xorm:"'MODELNAME'"` // 型号名称
  54. WRSTANDARDID int64 `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 现货商品ID
  55. DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 现货品种ID
  56. AREAUSERID int64 `json:"areauserid" xorm:"'AREAUSERID'"` // 所属机构
  57. ISVALID int32 `json:"isvalid" xorm:"'ISVALID'"` // 是否有效 - 0:无效 1:有效
  58. CREATORSRC int32 `json:"creatorsrc" xorm:"'CREATORSRC'"` // 创建人来源 - 1:管理端 2:终端
  59. CREATORID int64 `json:"creatorid" xorm:"'CREATORID'"` // 创建人
  60. CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
  61. UPDATORSRC int32 `json:"updatorsrc" xorm:"'UPDATORSRC'"` // 更新人来源 - 1:管理端 2:终端
  62. UPDATORID int64 `json:"updatorid" xorm:"'UPDATORID'"` // 更新人
  63. UPDATETIME string `json:"updatetime" xorm:"'UPDATETIME'"` // 更新时间
  64. }
  65. func (r *ErmcpGoodsModel) buildSql() string {
  66. var sqlId utils.SQLVal = "SELECT t.MODELID," +
  67. " t.MODELNAME," +
  68. " t.WRSTANDARDID," +
  69. " t.DELIVERYGOODSID," +
  70. " t.AREAUSERID," +
  71. " t.ISVALID," +
  72. " t.CREATORSRC," +
  73. " t.CREATORID," +
  74. " to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
  75. " t.UPDATORSRC," +
  76. " t.UPDATORID," +
  77. " to_char(t.UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME" +
  78. " FROM SPOTGOODSMODEL t" +
  79. " WHERE 1 = 1"
  80. sqlId.And("t.AREAUSERID", r.AREAUSERID)
  81. return sqlId.String()
  82. }
  83. // GetDataEx 商品型号
  84. func (r *ErmcpGoodsModel) GetDataEx() (interface{}, error) {
  85. sData := make([]ErmcpGoodsModel, 0)
  86. err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
  87. return sData, err
  88. }