Răsfoiți Sursa

Get site by code

wfansh 5 luni în urmă
părinte
comite
f7bc3efd1f

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/common/service/FeishuService.java

@@ -104,7 +104,7 @@ public class FeishuService {
             return;
         }
 
-        String siteName = adwebSiteService.getSiteNameByCode(siteCode);
+        String siteName = adwebSiteService.getSiteByCode(siteCode).getName();
 
         String template = dictItem.getItemValue();
         template = template.replace("{{siteName}}", siteName);

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/service/IAdwebSiteService.java

@@ -45,7 +45,7 @@ public interface IAdwebSiteService extends IService<AdwebSite> {
      */
     List<Integer> getAllSiteIdBySiteId(Integer siteId);
 
-    String getSiteNameByCode(String siteCode);
+    AdwebSite getSiteByCode(String siteCode);
 
     /**
      * 根据用户id查询所有未删除的站点

+ 4 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/service/impl/AdwebSiteServiceImpl.java

@@ -187,18 +187,18 @@ public class AdwebSiteServiceImpl extends ServiceImpl<AdwebSiteMapper, AdwebSite
     }
 
     @Override
-    public String getSiteNameByCode(String siteCode) {
+    public AdwebSite getSiteByCode(String siteCode) {
         try {
             List<AdwebSite> adwebSites = this.list(new LambdaQueryWrapper<AdwebSite>()
                     .eq(AdwebSite::getCode, siteCode)
                     .ne(AdwebSite::getStatus, 0));
             if (!adwebSites.isEmpty()) {
-                return adwebSites.get(0).getName();
+                return adwebSites.get(0);
             }
         } catch (Exception e) {
-            log.error("获取站点名称失败");
+            log.error("获取站点失败, code = " + siteCode, e);
         }
-        return "";
+        return null;
     }
     /**
      * 根据用户id查询所有未删除的站点