折雨的天空
ruoyi-plus框架下,在后台对字典做转换
2022-8-25 我好笨


前端字典转换和excel转换的代码挺多的。



只有后台做字典转换的比较少。







因为将字典 value 转换成字典 label 是使用 DictUtils 类的 getDictLabel 方法。public static String getDictLabel(String dictType, String dictValue) 方法的定义只能接受 String 类型的字典 value 。

如果重载(overload)该方法,也可以。比如:public static String getDictLabel(String dictType, int dictValue)



试了一下,可行。







实际使用:



e.setDeviceKind(dict.selectDictLabel("device_kind",e.getDeviceKind()));



参考地址:https://blog.csdn.net/sayyy/article/details/109257463

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容