From e8268aa30019d0ce46fe8bd1b125cd548f572d98 Mon Sep 17 00:00:00 2001 From: chenshaohua <635616957@qq.com> Date: Wed, 27 May 2026 00:11:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BC=81=E4=B8=9A=E8=81=94?= =?UTF-8?q?=E7=B3=BB=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms/service/impl/CompanyServiceImpl.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/CompanyServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/CompanyServiceImpl.java index c79d06b..1efaad8 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/CompanyServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/CompanyServiceImpl.java @@ -61,8 +61,22 @@ public class CompanyServiceImpl extends ServiceImpl impl public Company selectCompanyByCompanyId(Long companyId) { Company company = companyMapper.selectById(companyId); - if(SiteSecurityUtils.isLogin()){ - Long l = companyCollectionMapper.selectCount(Wrappers.lambdaQuery().eq(CompanyCollection::getCompanyId, companyId).eq(CompanyCollection::getUserId, SiteSecurityUtils.getUserId())); + Long userId=null; + try { + LoginUser loginUser = SecurityUtils.getLoginUser(); + userId = loginUser.getUserId(); + }catch (Exception ignored){ + try { + LoginSiteUser siteUser = SiteSecurityUtils.getLoginSiteUser(); + userId = siteUser.getUserId(); + } catch (Exception ignored2) { + } + } + + if (userId == null) { + company.setIsCollection(0); + } else { + Long l = companyCollectionMapper.selectCount(Wrappers.lambdaQuery().eq(CompanyCollection::getCompanyId, companyId).eq(CompanyCollection::getUserId, userId)); company.setIsCollection(l>0?1:0); }