songjiaqing 5 سال پیش
والد
کامیت
9ca37311f1
1فایلهای تغییر یافته به همراه6 افزوده شده و 3 حذف شده
  1. 6 3
      whepi-web/src/main/java/com/bofeng/service/ShShopService.java

+ 6 - 3
whepi-web/src/main/java/com/bofeng/service/ShShopService.java

@@ -23,7 +23,7 @@ public class ShShopService {
     //我的商店新增
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
     public int addShShop(Long userId, Integer shopType, String shopName, String adddr,
-                         DateTime startDate, DateTime endDate, String linkman, String phone) {
+                         DateTime startDate, DateTime endDate, String linkman, String phone) throws Exception {
 
         DateTime dateTime = new DateTime();
         var shShopDb = shShopMapper.selectById(userId);
@@ -45,7 +45,10 @@ public class ShShopService {
             /* qzTak.setUserUpdate(userId);*/
             shop.setTimeUpdate(dateTime);
             return shShopMapper.insert(shop);
-        }/* else {
+        } else {
+            throw new Exception("您已有一个商店,请勿重复添加");
+        }
+        /* else {
             shShopDb.setUserId(userId);
             shShopDb.setShopType(shopType);
             shShopDb.setShopName(shopName);
@@ -63,7 +66,7 @@ public class ShShopService {
             return shShopMapper.updateById(shShopDb);
         }*/
 
-        return 0;
+
     }
 
     public List<ShShop> queryMyShShop(Long userId) throws Exception {