liujiandao
2023-10-17 d4bf53dd19a45ef09a367babcf7a2ac04ae1d08f
model/contract.go
@@ -8,6 +8,7 @@
type (
   Contract struct {
      Id                    int                   `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
      ContractName          string                `json:"contractName" gorm:"column:contract_name;type:varchar(255);comment:合同名称"`
      ClientId              int                   `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
      Client                Client                `json:"client" gorm:"foreignKey:ClientId"`
      MemberId              int                   `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
@@ -19,6 +20,7 @@
      ServiceContractStatus ServiceContractStatus `json:"serviceContractStatus" gorm:"foreignKey:StatusId;references:Id"`
      File                  string                `json:"file" gorm:"column:file;type:varchar(255);comment:合同文件"`
      CreatedAt             *CustomTime           `json:"created_at" gorm:"column:created_at;type:datetime;comment:创建时间"`
      CodeStandID           string                `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:编码id"`
      gormModel
   }
@@ -70,6 +72,9 @@
               db = db.Where(key+"= ?", v)
            }
         case int:
            if key == "member_id" {
               db = db.Where(key+"= ?", v)
            }
         }
      }
   }
@@ -141,3 +146,7 @@
   slf.Orm = slf.Orm.Where("id in (?)", ids)
   return slf
}
func (slf *ContractSearch) UpdateByMap(data map[string]interface{}) error {
   var db = slf.build()
   return db.Updates(data).Error
}