Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

liao-sea 10 месяцев назад
Родитель
Сommit
3612c28fb8

+ 1 - 0
src/main/java/com/hz/employmentsite/mapper/cquery/LabelCQuery.java

@@ -12,6 +12,7 @@ public interface LabelCQuery {
     List<LabelVo> getUserLabelList(@Param("jobUserID") String jobUserID);
 
     List<LabelVo> getCompanyLabelList(@Param("companyID") String companyID);
+    List<LabelVo> getCompanyLabelListInCompanyIDs(@Param("companyIDList") String companyIDList);
 
     List<LabelVo> getPostLabelList(@Param("postID") String postID);
 }

+ 2 - 0
src/main/java/com/hz/employmentsite/mapper/cquery/PostCQuery.java

@@ -27,4 +27,6 @@ public interface PostCQuery {
      * @return 岗位信息
      */
     List<PostVo> selectCompanyMapPostList(@Param("companyID") String companyID);
+
+    List<PostVo> selectPostInCompanyIDs(@Param("companyIDList") String companyIDList);
 }

+ 44 - 1
src/main/java/com/hz/employmentsite/services/impl/companyService/CompanyServiceImpl.java

@@ -6,6 +6,7 @@ import com.hz.employmentsite.filter.exception.BaseException;
 import com.hz.employmentsite.mapper.*;
 import com.hz.employmentsite.mapper.cquery.CompanyCQuery;
 import com.hz.employmentsite.mapper.cquery.LabelCQuery;
+import com.hz.employmentsite.mapper.cquery.PostCQuery;
 import com.hz.employmentsite.model.*;
 import com.hz.employmentsite.services.service.companyService.CompanyService;
 import com.hz.employmentsite.services.service.companyService.FirmService;
@@ -13,8 +14,10 @@ import com.hz.employmentsite.services.service.companyService.IndustryService;
 import com.hz.employmentsite.services.service.system.DictionaryService;
 import com.hz.employmentsite.util.RegexUtils;
 import com.hz.employmentsite.util.StringUtils;
+import com.hz.employmentsite.vo.baseSettings.LabelVo;
 import com.hz.employmentsite.vo.companyService.AppCompanyPostVo;
 import com.hz.employmentsite.vo.companyService.CompanyVo;
+import com.hz.employmentsite.vo.companyService.PostVo;
 import com.hz.employmentsite.vo.dataMap.CompanyPostMapVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -69,6 +72,9 @@ public class CompanyServiceImpl implements CompanyService {
     @Autowired
     private LabelCQuery labelCQuery;
 
+    @Autowired
+    private PostCQuery postCQuery;
+
     @Override
     public PageInfo<CompanyVo> getList(Integer pageIndex, Integer pageSize,
                                        List<String> companyIDList, String companyName,
@@ -627,7 +633,44 @@ public class CompanyServiceImpl implements CompanyService {
                                                      Double latitude, Double longitude) {
         PageHelper.startPage(pageIndex, pageSize);
         List<CompanyPostMapVo> dataMapList = companyCQuery.getDataMapList(companyName, maxDistance, companyModel, recordStatus, regionCode, siteID, latitude, longitude);
-        PageInfo<CompanyPostMapVo> result = new PageInfo(dataMapList);
+        PageInfo<CompanyPostMapVo> result = new PageInfo<>(dataMapList);
+
+        // 获取所有的企业ID
+        List<String> companyIDs = result.getList().stream()
+                .filter(Objects::nonNull)
+                .map(CompanyPostMapVo::getCompanyID)
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
+
+        if (!companyIDs.isEmpty()) {
+            // 查询岗位并映射到企业
+            List<PostVo> postList = postCQuery.selectPostInCompanyIDs(stringUtils.ListToInSql(companyIDs));
+            Map<String, List<PostVo>> postMap = (postList != null) ?
+                    postList.stream()
+                            .filter(Objects::nonNull)
+                            .collect(Collectors.groupingBy(PostVo::getCompanyID))
+                    : new HashMap<>();
+            // 填充岗位数据
+            result.getList().forEach(company -> {
+                if (company != null && company.getCompanyID() != null) {
+                    company.setPostList(postMap.getOrDefault(company.getCompanyID(), new ArrayList<>()));
+                }
+            });
+
+            // 查询标签并映射到企业
+            List<LabelVo> companyLabelList = labelCQuery.getCompanyLabelListInCompanyIDs(stringUtils.ListToInSql(companyIDs));
+            Map<String, List<LabelVo>> labelMap = (companyLabelList != null) ?
+                    companyLabelList.stream()
+                            .filter(Objects::nonNull)
+                            .collect(Collectors.groupingBy(LabelVo::getCompanyID))
+                    : new HashMap<>();
+            // 填充标签数据
+            result.getList().forEach(company -> {
+                if (company != null && company.getCompanyID() != null) {
+                    company.setCompanyLabelList(labelMap.getOrDefault(company.getCompanyID(), new ArrayList<>()));
+                }
+            });
+        }
         return result;
     }
 

+ 19 - 0
src/main/java/com/hz/employmentsite/vo/baseSettings/LabelVo.java

@@ -6,4 +6,23 @@ public class LabelVo extends PcLabel {
     public String labelTypeName;//标签类型 1-基础标签 2-自定义标签
     public String bigTypeName;//大类型 1-企业 2-人员
     public String modifyUserName;
+
+    public String postID;
+    public String companyID;
+
+    public String getPostID() {
+        return postID;
+    }
+
+    public void setPostID(String postID) {
+        this.postID = postID;
+    }
+
+    public String getCompanyID() {
+        return companyID;
+    }
+
+    public void setCompanyID(String companyID) {
+        this.companyID = companyID;
+    }
 }

+ 5 - 2
src/main/java/com/hz/employmentsite/vo/dataMap/CompanyPostMapVo.java

@@ -1,8 +1,11 @@
 package com.hz.employmentsite.vo.dataMap;
 
+import com.hz.employmentsite.vo.baseSettings.LabelVo;
+import com.hz.employmentsite.vo.companyService.PostVo;
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 @Data
 public class CompanyPostMapVo {
@@ -46,9 +49,9 @@ public class CompanyPostMapVo {
 
     private Double distance;
 
-    private String companyLabelList;
+    private List<LabelVo> companyLabelList;
 
     private String postLabelList;
 
-    private String postList;
+    private List<PostVo> postList;
 }

+ 3 - 50
src/main/resources/mapping/cquery/CompanyCQuery.xml

@@ -30,7 +30,7 @@
         left join pc_site_institution inSites on site.SiteID = inSites.SiteID
         left join pc_institution institution on inSites.institutionID = institution.InstitutionID
         left join sys_user modifyUser on company.ModifyUserID = modifyUser.UserID
-        left join (select CompanyID, count(1) as postCount from pc_post group by CompanyID) postCountData on postCountData.CompanyID = company.CompanyID    
+        left join (select CompanyID, count(1) as postCount from pc_post group by CompanyID) postCountData on postCountData.CompanyID = company.CompanyID
         where 1=1
         <if test="companyIDList!='' and companyIDList!=null">
             and company.companyID in (${companyIDList})
@@ -107,38 +107,7 @@
         RADIANS( company.Longitude ) - RADIANS( #{longitude} )) + SIN(
         RADIANS( #{latitude} )) * SIN(
         RADIANS( company.Latitude ))
-        )) AS distance,
-        (
-        SELECT
-        JSON_ARRAYAGG( JSON_OBJECT( 'labelID', labelTemp.LabelID, 'labelName', labelTemp.LabelName ) )
-        FROM
-        (
-        SELECT
-        label.LabelID,
-        label.LabelName
-        FROM
-        pc_label label
-        LEFT JOIN pc_label_company label_company ON label.LabelID = label_company.LabelID
-        WHERE
-        label_company.CompanyID = company.CompanyID
-        ) AS labelTemp
-        ) AS companyLabelList,
-        (
-        SELECT
-        JSON_ARRAYAGG( JSON_OBJECT( 'postID', postTemp.PostID, 'professionName', postTemp.ProfessionName ) )
-        FROM
-        (
-        SELECT
-        post.PostID,
-        profession.ProfessionName
-        FROM
-        pc_post post
-        LEFT JOIN pc_profession profession ON post.ProfessionID = profession.ProfessionID
-        WHERE
-        post.CompanyID = company.CompanyID
-        limit 4
-        ) AS postTemp
-        ) AS postList
+        )) AS distance
         FROM
         pc_company company
         LEFT JOIN sys_dictionary_item cmodel ON company.CompanyModel = cmodel.`Value`
@@ -198,23 +167,7 @@
         RADIANS( company.Longitude ) - RADIANS( #{longitude} )) + SIN(
         RADIANS( #{latitude} )) * SIN(
         RADIANS( company.Latitude ))
-        )) AS distance,
-        (
-        SELECT
-        JSON_ARRAYAGG(
-        JSON_OBJECT( 'labelID', labelTemp.LabelID, 'labelName', labelTemp.LabelName ))
-        FROM
-        (
-        SELECT
-        label.LabelID,
-        label.LabelName
-        FROM
-        pc_label label
-        LEFT JOIN pc_label_post label_post ON label.LabelID = label_post.LabelID
-        WHERE
-        label_post.PostID = post.PostID
-        ) AS labelTemp
-        ) AS postLabelList
+        )) AS distance
         FROM
         pc_post post
         LEFT JOIN pc_profession prof ON post.ProfessionID = prof.ProfessionID

+ 8 - 3
src/main/resources/mapping/cquery/JobUserCQuery.xml

@@ -12,9 +12,7 @@
         sys_occ_level.Name as occupationalLevelName,sys_blood_type.Name as bloodTypeName,sys_marital_status.Name as
         MaritalStatusName, sys_nation.Name as nationName, modifyUser.Name as modifyUserName,
         area_region.name as RegionName,area_street.name as StreetName,
-        (select count(*) from pc_recommend recommend where jobuser.JobUserID = recommend.JobuserID and isRead = 1)as
-        RecommendedCount
-        ,(select count(*) from pc_jobhunt hunt where jobuser.jobuserID = hunt.jobUserID )as jobHuntCount
+        recommendCountData.RecommendedCount,jobhuntCountData.jobHuntCount
         from pc_jobuser jobuser
         left join pc_site site on site.SiteID = jobuser.SiteID
         left join sys_dictionary_item culture on jobuser.CultureRank = culture.value and
@@ -48,6 +46,13 @@
         left join pc_site_institution inSites on site.SiteID = inSites.SiteID
         left join pc_institution institution on inSites.institutionID = institution.InstitutionID
         left join sys_user modifyUser on jobuser.ModifyUserID = modifyUser.UserID
+        left join (SELECT job_user.JobUserID, count( 1 ) AS RecommendedCount
+                   FROM pc_recommend_mgt mgt
+                   LEFT JOIN pc_jobhunt hunt ON mgt.JobHuntID = hunt.JobHuntID
+                   LEFT JOIN pc_jobuser job_user ON job_user.JobUserID = job_user.JobuserID
+                   GROUP BY job_user.JobUserID
+        ) recommendCountData on recommendCountData.JobUserID = jobuser.JobUserID
+        left join (select JobUserID, count(1) as jobHuntCount from pc_jobhunt jobhunt group by JobUserID) jobhuntCountData on jobhuntCountData.JobUserID = jobuser.JobUserID
         where 1=1
         <if test="jobUserIDList != '' and jobUserIDList != null">
             and jobuser.jobuserID in (${jobUserIDList})

+ 7 - 0
src/main/resources/mapping/cquery/LabelCQuery.xml

@@ -38,6 +38,13 @@
         where CompanyID = #{companyID}
         order by b.SortNo
     </select>
+    <select id="getCompanyLabelListInCompanyIDs" resultType="com.hz.employmentsite.vo.baseSettings.LabelVo">
+        select b.LabelID,b.LabelName,b.LabelType,b.BigType,b.SortNo,a.companyID
+        from pc_label b
+                 left join pc_label_company a on b.LabelID = a.LabelID
+        where a.CompanyID in (${companyIDList})
+        order by a.companyID, b.SortNo
+    </select>
     <select id="getPostLabelList" resultType="com.hz.employmentsite.vo.baseSettings.LabelVo">
         select b.LabelID,b.LabelName,b.LabelType,b.BigType,b.SortNo
         from pc_label b

+ 12 - 0
src/main/resources/mapping/cquery/PostCQuery.xml

@@ -114,4 +114,16 @@
                  LEFT JOIN pc_profession prof ON post.ProfessionID = prof.ProfessionID
         WHERE post.CompanyID = #{companyID}
     </select>
+
+    <select id="selectPostInCompanyIDs" resultType="com.hz.employmentsite.vo.companyService.PostVo">
+        SELECT
+            post.PostID,
+            post.CompanyID,
+            profession.ProfessionName
+        FROM
+            pc_post post
+            LEFT JOIN pc_profession profession ON post.ProfessionID = profession.ProfessionID
+        WHERE
+            post.CompanyID in (${companyIDList})
+    </select>
 </mapper>

+ 5 - 5
vue/src/views/dataMap/companyDataMap.vue

@@ -98,7 +98,8 @@
                       style="width: 25px;flex: 0 0 auto">
                 更多
               </span>
-                <span v-if="company.postList.length == 0" style="width: 25px;flex: 0 0 auto">暂无</span>
+                <span v-if="!company.postList || company.postList.length == 0"
+                      style="width: 25px;flex: 0 0 auto">暂无</span>
               </div>
               <!-- 标签 -->
               <div class="company-label-box" v-if="company.companyLabelList && company.companyLabelList.length > 0"
@@ -395,6 +396,7 @@ const getRegionList = async function () {
 // 查询事件
 function onSearch() {
   searchLoading.value = true;
+  companyList.value = [];
   // 按企业名称查询
   if (searchType.value == 'company') {
     getDataMapList(companySearchParam).then((result: any) => {
@@ -430,9 +432,7 @@ function findFuncThen(result: any) {
   companyList.value = result.list;
   // 处理标签和岗位JSON数据
   companyList.value.forEach((item: any) => {
-    item.companyLabelList = JSON.parse(item.companyLabelList || '[]')
     item.postLabelList = JSON.parse(item.postLabelList || '[]')
-    item.postList = JSON.parse(item.postList || '[]')
     item.labelExpanded = true;
   });
   companyTotal.value = result.total;
@@ -927,7 +927,7 @@ export default {
       background-color: white;
       padding: 18px;
       width: 100%;
-      max-height: 156px;
+      max-height: 165px;
       overflow-y: auto;
       border-radius: 10px;
 
@@ -979,7 +979,7 @@ export default {
     }
 
     .list-box {
-      height: calc(100% - 190px);
+      height: calc(100% - 240px);
 
       .list-post-box {
         padding: 8px;