Browse Source

企业查询

master
赵鹏 1 month ago
parent
commit
2b8e00cb57
  1. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java
  2. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java
  3. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java
  4. 28
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java
  5. 3
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java

@ -144,9 +144,12 @@ public class EnterpriseController {
}
// 获取标签
List<TagLibraryDO> tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId());
if (tagLibraryDOS != null) {
List<TagLibraryDO> tagLibraryDOS1 = tagLibraryService.listSetParentId(tagLibraryDOS);
enterprise.setTagObjList(tagLibraryDOS1);
enterprise.setTagList(tagLibraryDOS.stream()
.map(TagLibraryDO::getTagName)
.collect(Collectors.toList()));

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java

@ -111,6 +111,9 @@ public class EnterpriseRespVO {
@Schema(description = "企业标签", example = "26433")
private List<String> tagList;
@Schema(description = "企业标签", example = "26433")
private List<TagLibraryDO> tagObjList;
@Schema(description = "邀请人")
@ExcelProperty("邀请人")
private String inviterName;

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java

@ -62,4 +62,6 @@ public interface TagLibraryService {
//根据企业id标签查标签
List<TagLibraryDO> listByEnterpriseId(Long enterpriseId);
List<TagLibraryDO> listSetParentId(List<TagLibraryDO> tagLibraryDOS);
}

28
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java

@ -1,17 +1,16 @@
package cn.iocoder.yudao.module.system.service.taglibrary;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO;
import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO;
import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper;
import cn.iocoder.yudao.module.system.dal.mysql.tasktag.TaskTagMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper;
@ -20,6 +19,7 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -142,6 +142,30 @@ public class TagLibraryServiceImpl implements TagLibraryService {
return null;
}
@Override
public List<TagLibraryDO> listSetParentId(List<TagLibraryDO> tagLibraryDOS) {
List<TagLibraryDO> tagLibraryDOSAll = tagLibraryMapper.selectList();
Map<Integer, TagLibraryDO> integerTagLibraryDOMap = CollectionUtils.convertMap(tagLibraryDOSAll, TagLibraryDO::getId);
for (TagLibraryDO tagLibraryDO : tagLibraryDOS) {
TagLibraryDO topTag = findTopTag(integerTagLibraryDOMap, tagLibraryDO);
if (topTag != null) {
tagLibraryDO.setTagCode(topTag.getTagCode());
}
}
return tagLibraryDOS;
}
public TagLibraryDO findTopTag(Map<Integer, TagLibraryDO> integerTagLibraryDOMap,TagLibraryDO tagLibraryDOBot) {
if(tagLibraryDOBot.getParentId() == 0)
return tagLibraryDOBot;
TagLibraryDO tagLibraryDO = integerTagLibraryDOMap.get(tagLibraryDOBot.getParentId());
return findTopTag(integerTagLibraryDOMap,tagLibraryDO);
}
// 递归构建树
private List<TagLibraryDO> buildTree(List<TagLibraryDO> tags, Integer parentId) {
List<TagLibraryDO> tree = new ArrayList<>();

3
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml

@ -27,6 +27,9 @@
<if test="params.departmentId != null and params.departmentId != ''">
and department_id = #{params.departmentId}
</if>
<if test="params.enterprisesName != null and params.enterprisesName != ''">
and enterprises_name like '%${params.enterprisesName}%'
</if>
<if test="params.tagList != null and params.tagList != ''">
and tl.id in
<foreach collection="params.tagList" item="item" open="(" separator="," close=")">

Loading…
Cancel
Save