字典集能力
在实体类属性上使用@DicSet(name=”xxx”, desc=”xxx”)可以自动在返回前端的结果中转换字典值。
例如数据库中字段sex值为male,前端获得结果中会自动转换成:
字典服务相关方法见DicsetController类:
项目中添加新的字典集步骤如下:
编写字典集SQL并插入数据库,例如:
1
2
3
INSERT INTO "UTILITY_DICSET"("ID","CODE","NAME","PARENT_ID","GROUP_CODE","STATUS","SORT","CREATE_USER","CREATE_TIME","UPDATE_USER","UPDATE_TIME") VALUES('uiType0','uiType','UI类型','0','uiType','active',0,null,null,null,null);
INSERT INTO "UTILITY_DICSET"("ID","CODE","NAME","PARENT_ID","GROUP_CODE","STATUS","SORT","CREATE_USER","CREATE_TIME","UPDATE_USER","UPDATE_TIME") VALUES('uiType1','menu','菜单','uiType0','uiType','active',1,null,null,null,null);
INSERT INTO "UTILITY_DICSET"("ID","CODE","NAME","PARENT_ID","GROUP_CODE","STATUS","SORT","CREATE_USER","CREATE_TIME","UPDATE_USER","UPDATE_TIME") VALUES('uiType2','button','按钮','uiType0','uiType','active',2,null,null,null,null);
核心字段为:GROUP_CODE(字典分组编码),NAME(字典项名称),CODE(字典项编码),和PARENT_ID(父字典项ID)。
在线清除项目中的字典集缓存,例如:
浏览器上运行Get方法:http://ip:port/services/utility/dicset/clearAlLCache
本文由作者按照
CC BY 4.0
进行授权