fix
Helius
2022-08-31 cdfb23e312706438a4673acf19f19c37402ae98a
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ColumnServiceImpl.java
@@ -175,8 +175,10 @@
                adminSeeColumnInfoVo.setUrl(companyEntity.getWebAddress() + columnEntity.getPath() + "/" + columnEntity.getTargetUrl() + ".html");
            } else if (columnEntity.getTargetType() == 2) {
                ColumnEntity column = this.baseMapper.selectByCodeAndCompanyId(columnEntity.getTargetUrl(), LoginUserUtil.getCompanyId());
                adminSeeColumnInfoVo.setTargetName(column.getColumnName());
                adminSeeColumnInfoVo.setUrl(companyEntity.getWebAddress() + column.getPath());
                if (column != null) {
                    adminSeeColumnInfoVo.setTargetName(column.getColumnName());
                    adminSeeColumnInfoVo.setUrl(companyEntity.getWebAddress() + column.getPath());
                }
            }
        } else {
            adminSeeColumnInfoVo.setUrl(companyEntity.getWebAddress() + columnEntity.getPath());
@@ -197,9 +199,11 @@
        String columnCode = adminUpdateColumnDto.getColumnCode();
        ColumnEntity updateEntity = ColumnConversion.INSTANCE.updateDtoToEntity(adminUpdateColumnDto);
        ColumnEntity hasExist = this.baseMapper.selectByCodeAndCompanyId(columnCode, companyId);
        if(ObjectUtil.isNotEmpty(hasExist)){
            return Result.fail("栏目编码不能重复");
        if (!columnEntity.getColumnCode().equals(columnCode)) {
            ColumnEntity hasExist = this.baseMapper.selectByCodeAndCompanyId(columnCode, companyId);
            if (ObjectUtil.isNotEmpty(hasExist)) {
                return Result.fail("栏目编码不能重复");
            }
        }
        Long parentId = adminUpdateColumnDto.getParentId();
@@ -213,10 +217,12 @@
        }
        // 若编码进行了修改且该栏目为父栏目,则需要同步修改子栏目的path。
        if (!columnEntity.getColumnCode().equals(columnCode) && "-1".equals(columnEntity.getColumnCode())) {
            updateEntity.setBeforeColumnCode(columnCode);
        if (!columnEntity.getColumnCode().equals(columnCode)) {
            if ("-1".equals(columnEntity.getBeforeColumnCode())) {
                updateEntity.setBeforeColumnCode(columnEntity.getColumnCode());
            }
            if (adminUpdateColumnDto.getParentId() == 0L) {
            if (updateEntity.getParentId() == 0L) {
                List<ColumnEntity> childColumn = this.baseMapper.selectColumnByParentId(columnEntity.getId(), companyId, 2);
                if (CollUtil.isNotEmpty(childColumn)) {
                    for (ColumnEntity child : childColumn) {
@@ -228,7 +234,7 @@
        }
        // 栏目修改时,需判断父级ID及栏目编码的修改。若栏目父级ID修改了,则需记录原父级ID,在发布时,需连同原父级栏目同时编译
        if (!parentId.equals(columnEntity.getParentId()) && columnEntity.getBeforeParentId() == -1) {
        if (!columnEntity.getParentId().equals(updateEntity.getParentId()) && columnEntity.getBeforeParentId() == -1) {
            updateEntity.setBeforeParentId(columnEntity.getParentId());
        }
@@ -247,6 +253,7 @@
                QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>();
                objectQueryWrapper.eq("parent_id",id);
                objectQueryWrapper.eq("company_id",companyId);
                objectQueryWrapper.orderByAsc("order_num");
                List<ColumnEntity> columnEntities = this.baseMapper.selectList(objectQueryWrapper);
                List<AdminColumnVo> adminColumnVoChilds = new ArrayList<>();
                if(CollUtil.isNotEmpty(columnEntities)){