增加获取字典的接口
This commit is contained in:
@ -36,4 +36,11 @@ public class SysDataController {
|
|||||||
|
|
||||||
return Result.ok(sysDataService.listDictDataByDicType(dicType));
|
return Result.ok(sysDataService.listDictDataByDicType(dicType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "根据字典key查询字典数据")
|
||||||
|
@GetMapping("/getDictDataByDicTypeAndValue")
|
||||||
|
public Result<SysDictDataDTO> getDictDataByDicTypeAndValue(@RequestParam(name = "dicType") String dicType, @RequestParam(name = "dicValue") String dicValue){
|
||||||
|
|
||||||
|
return Result.ok(sysDataService.listDictDataByDicType(dicType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,4 +12,12 @@ public interface SysDataService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SysDictDataDTO> listDictDataByDicType(String dicType);
|
List<SysDictDataDTO> listDictDataByDicType(String dicType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典值查询字典数据
|
||||||
|
* @param dicType
|
||||||
|
* @param dicValue
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SysDictDataDTO getDictDataByDicTypeAndValue(String dicType, String dicValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,4 +27,11 @@ public class SysDataServiceImpl implements SysDataService {
|
|||||||
|
|
||||||
return SysDictDataConvert.INSTANCE.posToDtos(sysDictDataPOList);
|
return SysDictDataConvert.INSTANCE.posToDtos(sysDictDataPOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysDictDataDTO getDictDataByDicTypeAndValue(String dicType, String dicValue) {
|
||||||
|
LambdaQueryWrapper<SysDictDataPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(SysDictDataPO::getDictType, dicType).eq(SysDictDataPO::getDictValue, dicValue).last(" limit 1");
|
||||||
|
return SysDictDataConvert.INSTANCE.poToDTO(sysDictDataRepo.getOne(wrapper));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user