From 424153a8c803dee00fc041f804cd13d57e6518d4 Mon Sep 17 00:00:00 2001 From: zhangxin Date: Tue, 19 Jul 2022 11:18:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=81=9A=E6=B4=BE=E7=94=9F=E5=92=8C?= =?UTF-8?q?=E6=80=BB=E6=88=90=E7=9A=84=E5=85=B3=E8=81=94=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=97=B6=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AEid=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/me/implments/ProductFamily.dao.impl.go | 9 ++++++--- dao/me/implments/ProductFamilyRelate.dao.impl.go | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dao/me/implments/ProductFamily.dao.impl.go b/dao/me/implments/ProductFamily.dao.impl.go index 2f3625a..813d59e 100644 --- a/dao/me/implments/ProductFamily.dao.impl.go +++ b/dao/me/implments/ProductFamily.dao.impl.go @@ -107,14 +107,17 @@ func (impl *ProductFamilyDAOImplement) SelectOne(productFamilyId string) (*model ////查询车型配置零件 //var product []model.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.Product_PlantNr.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) 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 { return nil, err } diff --git a/dao/me/implments/ProductFamilyRelate.dao.impl.go b/dao/me/implments/ProductFamilyRelate.dao.impl.go index f780045..0431f1a 100644 --- a/dao/me/implments/ProductFamilyRelate.dao.impl.go +++ b/dao/me/implments/ProductFamilyRelate.dao.impl.go @@ -340,15 +340,19 @@ func (impl *ProductFamilyRelateDAOImplement) SelectProductByFamilyIdForCreateSer meta.ProductFamilyRelate_ProjectId.ColumnName, meta.ProductFamilyRelate_ProductFamilyId.ColumnName, meta.Product_CreateWorkOrderToggle.ColumnName) - condition := fmt.Sprintf("%s = %s and %s = %s", + condition := fmt.Sprintf("%s = %s and %s = %s and %s = %s", meta.ProductFamilyRelate_PlantNr.ColumnName, meta.Product_PlantNr.ColumnName, meta.ProductFamilyRelate_ProductId.ColumnName, - meta.Product_ProductId.ColumnName) + meta.Product_ProductId.ColumnName, + meta.ProductFamilyRelate_ProjectId.ColumnName, + meta.Product_ProjectId.ColumnName, + ) err := impl.session.Table(impl.meta.TableName).Join("LEFT", meta.Product.TableName, condition).Where(where, parameters...).OrderBy(meta.ProductFamilyRelate_Pos.SortColumnName).Find(&result) return result, err } + /****************************************************************************** * * @Reference LAPP_ACURA_MOM_BACKEND/dao/jit/ProductFamilyRelateDAO.GetMaxPos