From 94c0dbc9821c59b1830acecd36e38233b013bcf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Wed, 26 Feb 2025 09:03:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E4=BC=81=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/common/pojo/PageParam.java | 2 - .../enterprise/EnterpriseController.java | 23 ++++++---- .../enterprise/vo/EnterprisePageReqVO.java | 14 +++++- .../admin/enterprise/vo/EnterpriseRespVO.java | 3 +- .../enterprise/vo/EnterpriseSaveReqVO.java | 7 +++ .../vo/EnterpriseQualificationRespVO.java | 5 +++ .../mysql/enterprise/EnterpriseMapper.java | 5 +++ .../enterprise/EnterpriseServiceImpl.java | 43 ++++++++++++++++++- 8 files changed, 86 insertions(+), 16 deletions(-) diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java index 97819f9..8951b2d 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java @@ -23,13 +23,11 @@ public class PageParam implements Serializable { public static final Integer PAGE_SIZE_NONE = -1; @Schema(description = "页码,从 1 开始", requiredMode = Schema.RequiredMode.REQUIRED,example = "1") - @NotNull(message = "页码不能为空") @Min(value = 1, message = "页码最小值为 1") private Integer pageNo = PAGE_NO; @Schema(description = "每页条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") @NotNull(message = "每页条数不能为空") - @Min(value = 1, message = "每页条数最小值为 1") @Max(value = 100, message = "每页条数最大值为 100") private Integer pageSize = PAGE_SIZE; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java index be956b4..4d4e645 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java @@ -1,8 +1,10 @@ package cn.iocoder.yudao.module.system.controller.admin.enterprise; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.infra.api.file.dto.InfraFileInfoDTO; +import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.EnterpriseQualificationRespVO; import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.TagLibraryPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.TagLibraryRespVO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; @@ -21,6 +23,7 @@ import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseServiceImpl; import cn.iocoder.yudao.module.system.service.enterprisetag.EnterpriseTagService; import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationService; +import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationServiceImpl; import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -140,9 +143,6 @@ public class EnterpriseController { enterprise.setFiles(list); } - //获取标签 -// final List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); -// enterprise.setTagList(tagLibraryDOS.stream().map(item->item.getTagName()).collect(Collectors.toList())); // 获取标签 List tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); @@ -167,7 +167,7 @@ public class EnterpriseController { //获取资质 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(EnterpriseQualificationDO::getEnterpriseId, enterprise.getId()); - final List enterpriseQualificationList = enterpriseQualificationMapper.selectList(queryWrapper); + List enterpriseQualificationList = enterpriseQualificationMapper.selectList(queryWrapper); if (enterpriseQualificationList != null && enterpriseQualificationList.size() > 0) { enterpriseQualificationList.forEach(item->{ @@ -182,18 +182,24 @@ public class EnterpriseController { } }); - } + List bean1 = BeanUtils.toBean(enterpriseQualificationList, EnterpriseQualificationRespVO.class); + Map> longListMap = CollectionUtils.convertMultiMap(bean1, EnterpriseQualificationRespVO::getId); + List collectQuali = longListMap.keySet().stream().map(x -> x.toString()).collect(Collectors.toList()); + Map> fileListMap = fileInfoService.getFileListMap(EnterpriseServiceImpl.DEFAULT_DICT_TYPE, EnterpriseQualificationServiceImpl.DEFAULT_DICT_DATA_QYZZ, collectQuali); - enterprise.setQualificationList(enterpriseQualificationList); - } + for (EnterpriseQualificationRespVO item : bean1) { + item.setFiles(fileListMap.get(item.getId().toString())); + } + enterprise.setQualificationList(bean1); + } + } return success(enterprise); } @GetMapping("/pcpage") @Operation(summary = "电脑端获得企业标签分页") - @PreAuthorize("@ss.hasPermission('system:tag-library:query')") public CommonResult> getTagLibraryPcPage(EnterprisePageReqVO pageReqVO) { PageResult pageResult = enterpriseService.getEnterprisePage(pageReqVO); pageResult.getList().forEach(item->{ @@ -208,7 +214,6 @@ public class EnterpriseController { @GetMapping("/page") @Operation(summary = "获得企业分页") - @PreAuthorize("@ss.hasPermission('system:enterprise:query')") public CommonResult> getEnterprisePage(EnterprisePageReqVO pageReqVO) { PageResult pageResult = enterpriseService.getEnterprisePage(pageReqVO); pageResult.getList().forEach(item->{ diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java index d48de4f..e37a2f3 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java @@ -78,8 +78,6 @@ public class EnterprisePageReqVO extends PageParam { @Schema(description = "修改人") private String updater; -// @Schema(description = "管理部门", example = "26433") -// private Long deptId; @Schema(description = "邀请人") private String inviterName; @@ -90,5 +88,17 @@ public class EnterprisePageReqVO extends PageParam { @Schema(description = "根据标签类型过滤") private List tagList; + @Schema(description = "根据标签类型过滤") + private String onlyEnterprisesName; + + + @Schema(description = "企业人员") + private Long enterpriseUserId; + + @Schema(description = "企业ids") + private List enterpriseIds; + + @Schema(description = "排除企业id") + private Long excludeEnterpriseId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java index 61ae3af..f0e8e7f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.system.controller.admin.enterprise.vo; import cn.iocoder.yudao.module.infra.api.file.dto.InfraFileInfoDTO; +import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.EnterpriseQualificationRespVO; import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO; import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; import io.swagger.v3.oas.annotations.media.Schema; @@ -105,7 +106,7 @@ public class EnterpriseRespVO { private List files; @Schema(description = "企业资质列表", example = "26433") - private List qualificationList; + private List qualificationList; @Schema(description = "企业标签", example = "26433") private List tagList; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java index abec0a9..f803cbd 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.system.controller.admin.enterprise.vo; +import cn.iocoder.yudao.module.system.controller.admin.enterpriseinspections.vo.EnterpriseInspectionsSaveReqVO; +import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.EnterpriseQualificationSaveReqVO; import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -81,5 +83,10 @@ public class EnterpriseSaveReqVO { @Schema(description = "审核信息", example = "26433") private String content; + @Schema(description = "标签id") + private List tagIds; + + @Schema(description = "企业资质") + private List qualis; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java index 7b1384f..76e9ff7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.system.controller.admin.qualification.vo; import cn.iocoder.yudao.module.infra.api.file.dto.InfraFileInfoDTO; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -62,4 +63,8 @@ public class EnterpriseQualificationRespVO { @Schema(description = "企业图片", example = "26433") private List files; + + //资质状态 + @TableField(exist = false) + private Integer status; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java index 551e673..727c02e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java @@ -38,6 +38,11 @@ public interface EnterpriseMapper extends BaseMapperX { .eqIfPresent(EnterpriseDO::getGpsLocation, reqVO.getGpsLocation()) .betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime()) .eqIfPresent(EnterpriseDO::getUpdater, reqVO.getUpdater()) + .eqIfPresent(EnterpriseDO::getEnterprisesName,reqVO.getOnlyEnterprisesName()) + .inIfPresent(EnterpriseDO::getId,reqVO.getEnterpriseIds()) + //不能于id + .neIfPresent(EnterpriseDO::getId,reqVO.getExcludeEnterpriseId()) + // .or(w->w.eq( EnterpriseDO::getCreator, getLoginUserId())) .orderByDesc(EnterpriseDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java index 757f156..c5680b1 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java @@ -1,5 +1,8 @@ package cn.iocoder.yudao.module.system.service.enterprise; +import cn.hutool.core.util.StrUtil; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.RoleNameAndSelectTypeVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; @@ -17,10 +20,12 @@ import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMappe import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper; import cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper; import cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper; +import cn.iocoder.yudao.module.system.dal.mysql.qualification.EnterpriseQualificationMapper; import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService; import cn.iocoder.yudao.module.system.service.permission.RoleService; +import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -61,6 +66,9 @@ public class EnterpriseServiceImpl implements EnterpriseService { private EnterpriseMapper enterpriseMapper; @Resource private FileInfoMapper fileInfoMapper; + + @Resource + private EnterpriseQualificationService enterpriseQualificationService; @Resource private EnterpriseAuditLogMapper enterpriseAuditLogMapper; @Resource @@ -87,8 +95,7 @@ public class EnterpriseServiceImpl implements EnterpriseService { //先查询是否存在 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(EnterpriseDO::getEnterprisesName, createReqVO.getEnterprisesName()); - final EnterpriseDO enterpriseDO = enterpriseMapper.selectOne(queryWrapper); - if (enterpriseDO != null) { + if (enterpriseMapper.exists(queryWrapper)) { throw exception(ENTERPRISE_EXISTS); } @@ -137,6 +144,27 @@ public class EnterpriseServiceImpl implements EnterpriseService { } } + if(!CollectionUtils.isAnyEmpty(createReqVO.getTagIds())){ + List enterpriseTagDOList = new ArrayList<>(); + for (Long tagId : createReqVO.getTagIds()) { + EnterpriseTagDO enterpriseTagDO = new EnterpriseTagDO(); + enterpriseTagDO.setEnterpriseId(enterprise.getId()); + enterpriseTagDO.setTagId(tagId); + enterpriseTagDOList.add(enterpriseTagDO); + } + enterpriseTagMapper.insertBatch(enterpriseTagDOList); + + } + + if(!CollectionUtils.isAnyEmpty(createReqVO.getQualis())) + { + //企业资质 + createReqVO.getQualis().forEach(enterpriseQualificationSaveReqVO -> { + enterpriseQualificationSaveReqVO.setEnterpriseId(enterprise.getId()); + enterpriseQualificationService.createEnterpriseQualification(enterpriseQualificationSaveReqVO); + }); + } + // 返回 return enterprise.getId(); } @@ -218,6 +246,17 @@ public class EnterpriseServiceImpl implements EnterpriseService { @Override public PageResult getEnterprisePage(EnterprisePageReqVO pageReqVO) { + + if(pageReqVO.getEnterpriseUserId()!=null){ + LambdaQueryWrapperX lambdaQueryWrapperX = new LambdaQueryWrapperX(); + lambdaQueryWrapperX.eqIfPresent(EnterprisesUserDO::getUserId, pageReqVO.getUserId()); + List enterprisesUserDOS = enterprisesUserMapper.selectList(lambdaQueryWrapperX); + if(!CollectionUtils.isAnyEmpty(enterprisesUserDOS)){ + pageReqVO.setEnterpriseIds(CollectionUtils.convertList(enterprisesUserDOS,EnterprisesUserDO::getEnterprisesId)); + + } + } + final PageResult enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO); return enterpriseDOPageResult; } From 2b8e00cb578da2495950e5e4bd8594034be935e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Wed, 26 Feb 2025 14:56:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enterprise/EnterpriseController.java | 3 ++ .../admin/enterprise/vo/EnterpriseRespVO.java | 3 ++ .../service/taglibrary/TagLibraryService.java | 2 ++ .../taglibrary/TagLibraryServiceImpl.java | 28 +++++++++++++++++-- .../mapper/enterprise/EnterpriseMapper.xml | 3 ++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java index 4d4e645..ca8f944 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java +++ b/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 tagLibraryDOS = tagLibraryService.listByEnterpriseId(enterprise.getId()); if (tagLibraryDOS != null) { + List tagLibraryDOS1 = tagLibraryService.listSetParentId(tagLibraryDOS); + enterprise.setTagObjList(tagLibraryDOS1); enterprise.setTagList(tagLibraryDOS.stream() .map(TagLibraryDO::getTagName) .collect(Collectors.toList())); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java index f0e8e7f..146fd3e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java +++ b/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 tagList; + @Schema(description = "企业标签", example = "26433") + private List tagObjList; + @Schema(description = "邀请人") @ExcelProperty("邀请人") private String inviterName; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java index 3fc2657..29aa413 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryService.java +++ b/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 listByEnterpriseId(Long enterpriseId); + + List listSetParentId(List tagLibraryDOS); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java index bd9f0b5..fcbfa94 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taglibrary/TagLibraryServiceImpl.java +++ b/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 listSetParentId(List tagLibraryDOS) { + List tagLibraryDOSAll = tagLibraryMapper.selectList(); + Map 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 integerTagLibraryDOMap,TagLibraryDO tagLibraryDOBot) { + if(tagLibraryDOBot.getParentId() == 0) + return tagLibraryDOBot; + TagLibraryDO tagLibraryDO = integerTagLibraryDOMap.get(tagLibraryDOBot.getParentId()); + + return findTopTag(integerTagLibraryDOMap,tagLibraryDO); + } + // 递归构建树 private List buildTree(List tags, Integer parentId) { List tree = new ArrayList<>(); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml index 433e850..0071d79 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprise/EnterpriseMapper.xml @@ -27,6 +27,9 @@ and department_id = #{params.departmentId} + + and enterprises_name like '%${params.enterprisesName}%' + and tl.id in