|
@ -107,14 +107,17 @@ func (impl *ProductFamilyDAOImplement) SelectOne(productFamilyId string) (*model |
|
|
////查询车型配置零件
|
|
|
////查询车型配置零件
|
|
|
//var product []model.Product
|
|
|
//var product []model.Product
|
|
|
//err = impl.session.Table(meta.Product.TableName).In("ProductId", productId).Find(&product)
|
|
|
//err = impl.session.Table(meta.Product.TableName).In("ProductId", productId).Find(&product)
|
|
|
condition := fmt.Sprintf("%s = %s and %s = %s", |
|
|
|
|
|
|
|
|
condition := fmt.Sprintf("%s = %s and %s = %s and %s = %s", |
|
|
meta.ProductFamilyRelate_PlantNr.ColumnName, |
|
|
meta.ProductFamilyRelate_PlantNr.ColumnName, |
|
|
meta.Product_PlantNr.ColumnName, |
|
|
meta.Product_PlantNr.ColumnName, |
|
|
meta.ProductFamilyRelate_ProductId.ColumnName, |
|
|
meta.ProductFamilyRelate_ProductId.ColumnName, |
|
|
meta.Product_ProductId.ColumnName) |
|
|
|
|
|
|
|
|
meta.Product_ProductId.ColumnName, |
|
|
|
|
|
meta.ProductFamilyRelate_ProjectId.ColumnName, |
|
|
|
|
|
meta.Product_ProjectId.ColumnName, |
|
|
|
|
|
) |
|
|
li := make([]model.ProductFamilyRelateAndProduct, 0, 4) |
|
|
li := make([]model.ProductFamilyRelateAndProduct, 0, 4) |
|
|
session := impl.session.Table(meta.ProductFamilyRelate.TableName).Join("LEFT", meta.Product.TableName, condition) |
|
|
session := impl.session.Table(meta.ProductFamilyRelate.TableName).Join("LEFT", meta.Product.TableName, condition) |
|
|
err = session.Where(fmt.Sprintf("%s = ?", meta.ProductFamilyRelate_ProductFamilyId.ColumnName), productFamilyId).OrderBy(meta.ProductFamilyRelate_Pos.ColumnName).Find(&li) |
|
|
|
|
|
|
|
|
err = session.Where(fmt.Sprintf("%s = ? and %s = ?", meta.ProductFamilyRelate_ProductFamilyId.ColumnName, meta.ProductFamilyRelate_ProjectId.ColumnName), productFamilyId, data.ProjectId).OrderBy(meta.ProductFamilyRelate_Pos.ColumnName).Find(&li) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
return nil, err |
|
|
} |
|
|
} |
|
|