bug 25 应用中心页面,停用的标签依然能展示

This commit is contained in:
Liuyang 2025-01-11 16:59:41 +08:00
parent 5a6d95d47c
commit 05105809d7
3 changed files with 44 additions and 14 deletions

View File

@ -83,7 +83,7 @@ public class LabelController {
@Operation(summary = "获得标签管理列表所有")
// @PreAuthorize("@ss.hasPermission('llm:label:query')")
public CommonResult<List<LabelRespVO>> getLabelList() {
List<LabelDO> list = labelService.getLabelList();
List<LabelDO> list = labelService.getEnableLabelList();
return success(BeanUtils.toBean(list, LabelRespVO.class));
}
@ -101,4 +101,4 @@ public class LabelController {
BeanUtils.toBean(list, LabelRespVO.class));
}
}
}

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.llm.service.label;
import cn.iocoder.yudao.module.llm.controller.admin.label.vo.*;
import cn.iocoder.yudao.module.llm.dal.dataobject.label.LabelDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.llm.controller.admin.label.vo.LabelPageReqVO;
import cn.iocoder.yudao.module.llm.controller.admin.label.vo.LabelSaveReqVO;
import cn.iocoder.yudao.module.llm.dal.dataobject.label.LabelDO;
import javax.validation.Valid;
import java.util.List;
@ -22,21 +22,21 @@ public interface LabelService {
* @param createReqVO 创建信息
* @return 编号
*/
Long createLabel(@Valid LabelSaveReqVO createReqVO);
Long createLabel (@Valid LabelSaveReqVO createReqVO);
/**
* 更新标签管理
*
* @param updateReqVO 更新信息
*/
void updateLabel(@Valid LabelSaveReqVO updateReqVO);
void updateLabel (@Valid LabelSaveReqVO updateReqVO);
/**
* 删除标签管理
*
* @param id 编号
*/
void deleteLabel(Long id);
void deleteLabel (Long id);
/**
* 获得标签管理
@ -44,7 +44,7 @@ public interface LabelService {
* @param id 编号
* @return 标签管理
*/
LabelDO getLabel(Long id);
LabelDO getLabel (Long id);
/**
* 获得标签管理分页
@ -52,8 +52,19 @@ public interface LabelService {
* @param pageReqVO 分页查询
* @return 标签管理分页
*/
PageResult<LabelDO> getLabelPage(LabelPageReqVO pageReqVO);
// 获取所有标签
List<LabelDO> getLabelList();
PageResult<LabelDO> getLabelPage (LabelPageReqVO pageReqVO);
}
/**
* 获取所有标签
*
* @return 标签列表
*/
List<LabelDO> getLabelList ();
/**
* 获取所有已开启的标签
*
* @return 标签列表
*/
List<LabelDO> getEnableLabelList ();
}

View File

@ -1,10 +1,13 @@
package cn.iocoder.yudao.module.llm.service.label;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.module.llm.controller.admin.label.vo.*;
import cn.iocoder.yudao.module.llm.dal.dataobject.label.LabelDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -77,4 +80,20 @@ public class LabelServiceImpl implements LabelService {
return labelMapper.selectList();
}
}
/**
* 获取所有已开启的标签
*
* @return 标签列表
*/
@Override
public List<LabelDO> getEnableLabelList () {
List<LabelDO> labels = labelMapper.selectList();
if (CollectionUtils.isEmpty(labels)){
return Collections.emptyList();
}
// status 0: 启用1: 停用
return labels.stream().filter(labelDO -> labelDO.getStatus() == 0).collect(Collectors.toList());
}
}