zhangqian
2024-07-30 9bb979dbfb2c4edc31018a83970567f8734c0b61
controllers/product_controller.go
@@ -1028,6 +1028,16 @@
      v.Sort = i + 1
   }
   //校验重复
   m := make(map[string]struct{})
   for _, v := range params {
      if _, ok := m[v.Name]; ok {
         util.ResponseFormat(c, code.RequestParamError, "单位重复:"+v.Name)
         return
      }
      m[v.Name] = struct{}{}
   }
   err := models.WithTransaction(func(tx *gorm.DB) error {
      err := models.NewUnitDictSearch().SetOrm(tx).Delete()
      if err != nil {
@@ -1041,7 +1051,7 @@
      return nil
   })
   if err != nil {
      util.ResponseFormat(c, code.RequestParamError, "删除失败")
      util.ResponseFormat(c, code.RequestParamError, "保存失败")
      return
   }