处理 GORM 0 的bug
This commit is contained in:
@@ -375,6 +375,8 @@ type ProductData struct {
|
||||
FrequencyUse string // 使用频率(例:1天3次)
|
||||
AvailableDays float64 // 可用天数(3)
|
||||
ProductRemarks string // 商品备注
|
||||
PharmacyName string // 所属药房
|
||||
PharmacyCode string // 所属药房编码
|
||||
CreatedAt string // 创建时间
|
||||
}
|
||||
|
||||
@@ -1974,11 +1976,22 @@ func (r *ExportService) Product(d []*model.Product) (string, error) {
|
||||
{Value: "使用频率(例:1天3次)", CellType: "string", NumberFmt: "", ColWidth: 18},
|
||||
{Value: "可用天数(3)", CellType: "float64", NumberFmt: "0.0000", ColWidth: 18},
|
||||
{Value: "商品备注", CellType: "string", NumberFmt: "", ColWidth: 40},
|
||||
{Value: "所属药房", CellType: "string", NumberFmt: "", ColWidth: 30},
|
||||
{Value: "所属药房编码", CellType: "string", NumberFmt: "", ColWidth: 30},
|
||||
{Value: "创建时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
|
||||
}
|
||||
|
||||
var dataSlice []interface{}
|
||||
for _, v := range d {
|
||||
pharmacyName := ""
|
||||
pharmacyCode := v.PharmacyCode
|
||||
if v.Pharmacy != nil {
|
||||
pharmacyName = v.Pharmacy.PharmacyName
|
||||
if pharmacyCode == "" {
|
||||
pharmacyCode = v.Pharmacy.PharmacyCode
|
||||
}
|
||||
}
|
||||
|
||||
data := ProductData{
|
||||
ProductName: v.ProductName,
|
||||
CommonName: v.CommonName,
|
||||
@@ -2000,6 +2013,8 @@ func (r *ExportService) Product(d []*model.Product) (string, error) {
|
||||
FrequencyUse: v.FrequencyUse,
|
||||
AvailableDays: v.AvailableDays,
|
||||
ProductRemarks: v.ProductRemarks,
|
||||
PharmacyName: pharmacyName,
|
||||
PharmacyCode: pharmacyCode,
|
||||
}
|
||||
|
||||
if v.ProductPlatformAmount != nil {
|
||||
|
||||
Reference in New Issue
Block a user