System:字典数据列表过滤已关闭的数据

This commit is contained in:
owen 2023-09-23 23:42:20 +08:00
parent 052328c5fa
commit bf0e7d2c77
2 changed files with 8 additions and 3 deletions

View File

@ -49,7 +49,7 @@ public class DictDataServiceImpl implements DictDataService {
@Override
public List<DictDataDO> getDictDataList() {
List<DictDataDO> list = dictDataMapper.selectList();
List<DictDataDO> list = dictDataMapper.selectList(DictDataDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
list.sort(COMPARATOR_TYPE_AND_SORT);
return list;
}

View File

@ -43,10 +43,15 @@ public class DictDataServiceImplTest extends BaseDbUnitTest {
@Test
public void testGetDictDataList() {
// mock 数据
DictDataDO dictDataDO01 = randomDictDataDO().setDictType("yunai").setSort(2);
DictDataDO dictDataDO01 = randomDictDataDO().setDictType("yunai").setSort(2)
.setStatus(CommonStatusEnum.ENABLE.getStatus());
dictDataMapper.insert(dictDataDO01);
DictDataDO dictDataDO02 = randomDictDataDO().setDictType("yunai").setSort(1);
DictDataDO dictDataDO02 = randomDictDataDO().setDictType("yunai").setSort(1)
.setStatus(CommonStatusEnum.ENABLE.getStatus());
dictDataMapper.insert(dictDataDO02);
DictDataDO dictDataDO03 = randomDictDataDO().setDictType("yunai").setSort(3)
.setStatus(CommonStatusEnum.DISABLE.getStatus());
dictDataMapper.insert(dictDataDO03);
// 准备参数
// 调用