|
|
@@ -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 {
|