feat:增加根据字典编码查找选项接口
This commit is contained in:
@@ -25,12 +25,21 @@ public class DictItemController {
|
|||||||
@Resource
|
@Resource
|
||||||
private IDictItemService dictItemService;
|
private IDictItemService dictItemService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典编码获取所有选项
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据字典编码获取所有选项")
|
||||||
|
@GetMapping("/{dicCode}")
|
||||||
|
public ResponseMessage listByPageCode(String dicCode) {
|
||||||
|
return dictItemService.listByPageCode(dicCode);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页获取所有数据字典记录
|
* 分页获取所有数据字典记录
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "分页获取所有数据字典记录")
|
@ApiOperation(value = "分页获取所有数据字典记录")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ResponseMessage pageById(@Valid DictItemQueryVo dictItemQueryVo) {
|
public ResponseMessage pageByDicId(@Valid DictItemQueryVo dictItemQueryVo) {
|
||||||
return dictItemService.pageById(dictItemQueryVo);
|
return dictItemService.pageById(dictItemQueryVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,25 @@ public class DictItemServiceImpl extends ServiceImpl<DictItemDao, DictItemEntity
|
|||||||
}
|
}
|
||||||
return Result.error("新增失败");
|
return Result.error("新增失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage listByPageCode(String dicCode) {
|
||||||
|
LambdaQueryWrapper<DictEntity> dicWrapper = new LambdaQueryWrapper<>();
|
||||||
|
dicWrapper.eq(DictEntity::getDicCode, dicCode);
|
||||||
|
dicWrapper.eq(DictEntity::getDelFlag, 0);
|
||||||
|
DictEntity dictEntity = dictDao.selectOne(dicWrapper);
|
||||||
|
if (dictEntity == null) {
|
||||||
|
return Result.error("此字典编码不存在或已被删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<DictItemEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(DictItemEntity::getDelFlag, 0);
|
||||||
|
wrapper.eq(DictItemEntity::getTypeId, dictEntity.getId());
|
||||||
|
wrapper.orderByAsc(DictItemEntity::getItemOrder);
|
||||||
|
List<DictItemEntity> list = list(wrapper);
|
||||||
|
List<DictItemVo> dictItemVos = BeanCopyUtils.copyBeanList(list, DictItemVo.class);
|
||||||
|
return Result.success(dictItemVos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,4 +42,11 @@ public interface IDictItemService extends IService<DictItemEntity> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseMessage add(DictItemVo dictItemVo);
|
ResponseMessage add(DictItemVo dictItemVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典编码获取所有选项
|
||||||
|
* @param dicCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ResponseMessage listByPageCode(String dicCode);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user