Browse Source

修改结构

wangxingcheng 2 years ago
parent
commit
9330d0b909
1 changed files with 7 additions and 2 deletions
  1. 7 2
      opms_parent/app/service/base/base_product.go

+ 7 - 2
opms_parent/app/service/base/base_product.go

@@ -40,7 +40,6 @@ func (s *productService) GetList(req *model.ProductSearchReq) (total int, produc
 	total, err = Dao.Count()
 	if err != nil {
 		g.Log().Error(err)
-		err = myerrors.New("获取总行数失败", err)
 		return
 	}
 	if req.PageNum == 0 {
@@ -56,7 +55,7 @@ func (s *productService) GetEntityById(id int64) (product *model.BaseProduct, er
 	product, err = s.Dao.FindOne(id)
 	if err != nil {
 		g.Log().Error(err)
-		return nil, err
+		return
 	}
 	return
 }
@@ -65,10 +64,15 @@ func (s *productService) GetEntityById(id int64) (product *model.BaseProduct, er
 func (s *productService) Create(req *model.AddProductReq) (lastInsertId int64, err error) {
 	product := new(model.BaseProduct)
 	if err = gconv.Struct(req, product); err != nil {
+		g.Log().Error(err)
 		return
 	}
 	service.SetCreatedInfo(product, s.GetCxtUserId(), s.GetCxtUserName())
 	lastInsertId, err = s.Dao.InsertAndGetId(product)
+	if err != nil {
+		g.Log().Error(err)
+		return
+	}
 	return
 }
 
@@ -76,6 +80,7 @@ func (s *productService) Create(req *model.AddProductReq) (lastInsertId int64, e
 func (s *productService) UpdateById(req *model.UpdateProductReq) (err error) {
 	product, err := s.Dao.FindOne(req.Id)
 	if err != nil {
+		g.Log().Error(err)
 		return err
 	}
 	if product == nil {