|
@@ -14,9 +14,12 @@ import com.boman.common.redis.service.RedisService;
|
|
|
import com.boman.domain.GenTable;
|
|
|
import com.boman.domain.GenTableColumn;
|
|
|
import com.boman.domain.constant.*;
|
|
|
+import com.boman.domain.dto.RoleMenuDto;
|
|
|
import com.boman.domain.exception.NoSuchFunctionException;
|
|
|
import com.boman.gen.api.RemoteGenTableColumnService;
|
|
|
import com.boman.gen.api.RemoteGenTableService;
|
|
|
+import com.boman.system.api.RemoteMenuService;
|
|
|
+import com.boman.system.api.domain.SysMenu;
|
|
|
import com.boman.web.core.domain.ActionType;
|
|
|
import com.boman.web.core.domain.FormDataDto;
|
|
|
import com.boman.web.core.domain.RowResult;
|
|
@@ -82,6 +85,8 @@ public class TableServiceCmdService {
|
|
|
private RemoteGenTableService remoteGenTableService;
|
|
|
@Resource
|
|
|
private RemoteGenTableColumnService remoteGenTableColumnService;
|
|
|
+ @Resource
|
|
|
+ private RemoteMenuService remoteMenuService;
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
|
|
|
|
|
@@ -380,12 +385,7 @@ public class TableServiceCmdService {
|
|
|
if (GenTableColumn.IS_QUERY.equalsIgnoreCase(column.getIsQuery())) {
|
|
|
String dictType = column.getDictType();
|
|
|
if (ObjectUtils.isNotEmpty(dictType)) {
|
|
|
- try {
|
|
|
- column.setSysDictData(listSysDictDataByType(dictType));
|
|
|
- } catch (Exception e) {
|
|
|
- System.out.println("sq_dictType = " + dictType);
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ column.setSysDictData(listSysDictDataByType(dictType));
|
|
|
}
|
|
|
|
|
|
queryList.add(column);
|
|
@@ -394,13 +394,33 @@ public class TableServiceCmdService {
|
|
|
|
|
|
jsonObject.put(FormDataConstant.QUERY_LIST, queryList);
|
|
|
// genTable.getMenuRole() 暂时数据库没有数据,
|
|
|
- jsonObject.put(FormDataConstant.BUTTON_LIST, Strings.nullToEmpty(genTable.getMenuRole()));
|
|
|
-
|
|
|
+ List<String> btns = buildBtnList();
|
|
|
+ jsonObject.put(FormDataConstant.BUTTON_LIST, Strings.nullToEmpty(CollectionUtils.listToString(btns)));
|
|
|
jsonObject.put(ViewTypeConst.VIEW_TYPE, Strings.nullToEmpty(genTable.getTplCategory()));
|
|
|
jsonObject.put(RULES, packRequireColumn(columns));
|
|
|
return AjaxResult.success(jsonObject);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 功能描述: 查找当前登陆人对应的btn
|
|
|
+ *
|
|
|
+ * @return java.util.List<java.lang.String>
|
|
|
+ */
|
|
|
+ private List<String> buildBtnList() {
|
|
|
+ List<SysMenu> menus = remoteMenuService.listBtnByUserId(SecurityUtils.getUserId());
|
|
|
+ if (isEmpty(menus)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> permses = map(menus, SysMenu::getPerms);
|
|
|
+ ArrayList<String> btns = Lists.newArrayListWithCapacity(permses.size());
|
|
|
+ for (String perms : permses) {
|
|
|
+ btns.add(RoleMenuDto.getBtnFromPerms(perms));
|
|
|
+ }
|
|
|
+
|
|
|
+ return btns;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 功能描述: 获取表单查询字段
|
|
|
* 注意: 都是从redis中拿的,如果数据库和redis不一致,则需刷新一下redis
|