fix
wangpengfei
2023-08-21 da5dfc05723d56fd92e9eca31c8e84bb33177dc5
fix
2个文件已修改
30 ■■■■ 已修改文件
conf/config.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/contract.go 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
conf/config.go
@@ -132,8 +132,9 @@
        Conf.GrpcServiceAddr.Admin = AdminGrpc
    }
    if len(DBName) > 0 {
        Conf.GrpcServiceAddr.Aps = "http://" + DBName + ":9091"
    if len(DBUser) > 0 {
        Conf.GrpcServiceAddr.Aps = "http://" + DBUser + ":9091"
        //Conf.GrpcServiceAddr.Aps = DBUser + DBUser +
    }
    ShowConfig()
model/contract.go
@@ -7,17 +7,18 @@
type (
    Contract struct {
        Id          int         `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
        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"`
        Member      User        `json:"member" gorm:"foreignKey:MemberId"`
        Number      string      `json:"number" gorm:"column:number;type:varchar(255);comment:合同编号"`
        QuotationId int         `json:"quotationId" gorm:"column:quotation_id;type:int;comment:报价单id"`
        Quotation   Quotation   `json:"quotation" gorm:"foreignKey:QuotationId;references:Id"`
        StatusId    int         `json:"statusId" gorm:"column:status_id;type:int;comment:合同状态"`
        File        string      `json:"file" gorm:"column:file;type:varchar(255);comment:合同文件"`
        CreatedAt   *CustomTime `json:"created_at" gorm:"column:created_at;type:datetime;comment:创建时间"`
        Id                    int                   `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
        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"`
        Member                User                  `json:"member" gorm:"foreignKey:MemberId"`
        Number                string                `json:"number" gorm:"column:number;type:varchar(255);comment:合同编号"`
        QuotationId           int                   `json:"quotationId" gorm:"column:quotation_id;type:int;comment:报价单id"`
        Quotation             Quotation             `json:"quotation" gorm:"foreignKey:QuotationId;references:Id"`
        StatusId              int                   `json:"statusId" gorm:"column:status_id;type:int;comment:合同状态"`
        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:创建时间"`
        gormModel
    }
@@ -113,7 +114,7 @@
        db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize)
    }
    err := db.Preload("Client").Preload("Member").Preload("Quotation").Order("id desc").Find(&records).Error
    err := db.Preload("ServiceContractStatus").Preload("Client").Preload("Member").Preload("Quotation").Order("id desc").Find(&records).Error
    return records, total, err
}