From eaa5216743b873e7c8ac37ad952776401a951f82 Mon Sep 17 00:00:00 2001
From: 6c <420680616@qq.com>
Date: 星期六, 11 十月 2025 11:46:02 +0800
Subject: [PATCH] 移动端加载mvc
---
src/main/java/com/product/mobile/core/service/NavBarManagerService.java | 404 +++++++++++++++++++++++++++++++++++----------------------
1 files changed, 245 insertions(+), 159 deletions(-)
diff --git a/src/main/java/com/product/mobile/core/service/NavBarManagerService.java b/src/main/java/com/product/mobile/core/service/NavBarManagerService.java
index 11cc2f0..52af531 100644
--- a/src/main/java/com/product/mobile/core/service/NavBarManagerService.java
+++ b/src/main/java/com/product/mobile/core/service/NavBarManagerService.java
@@ -31,171 +31,257 @@
@Service
public class NavBarManagerService extends AbstractBaseService implements INavBarManagerService {
- @Autowired
- QueryFilterService queryFilterService;
+ @Autowired
+ QueryFilterService queryFilterService;
- /**
- * 閰嶇疆鍒楄〃
- *
- * @param fse
- * @return
- * @throws BaseException
- */
- @Override
- public DataTableEntity listConfig(FieldSetEntity fse) throws BaseException {
- String queryFilter = queryFilterService.getQueryFilter(fse);
- StringBuilder sql = new StringBuilder();
- sql.append(" SELECT module_category,count(function_uuid) function_count ")
- .append(" from product_sys_app_nav_bar a ")
- .append(" group by module_category,module_sequence order by module_sequence");
- if (!StringUtils.isEmpty(queryFilter)) {
- sql.insert(0, " SELECT * FROM (");
- sql.append(") a WHERE ").append(queryFilter);
- }
- return getBaseDao().listTable(sql.toString(),
- new Object[]{}, fse.getInteger(MobileCoreConst.PAGESIZE), fse.getInteger(MobileCoreConst.CPAGE));
- }
+ /**
+ * 閰嶇疆鍒楄〃
+ *
+ * @param fse
+ * @return
+ * @throws BaseException
+ */
+ @Override
+ public DataTableEntity listConfig(FieldSetEntity fse) throws BaseException {
+ String queryFilter = queryFilterService.getQueryFilter(fse);
+ StringBuilder sql = new StringBuilder();
+ sql.append(" SELECT module_category,count(function_uuid) function_count ")
+ .append(" from product_sys_app_nav_bar a ")
+ .append(" group by module_category,module_sequence order by module_sequence");
+ if (!StringUtils.isEmpty(queryFilter)) {
+ sql.insert(0, " SELECT * FROM (");
+ sql.append(") a WHERE ").append(queryFilter);
+ }
+ return getBaseDao().listTable(sql.toString(),
+ new Object[]{}, fse.getInteger(MobileCoreConst.PAGESIZE), fse.getInteger(MobileCoreConst.CPAGE));
+ }
- /**
- * 閰嶇疆璇︽儏
- *
- * @param fse
- * @return
- * @throws BaseException
- */
- @Override
- public FieldSetEntity findConfig(FieldSetEntity fse) throws BaseException {
- String module_category = fse.getString(MobileCoreConst.MODULE_CATEGORY);
- if (!StringUtils.isEmpty(module_category)) {
- DataTableEntity dt = getBaseDao().listTable(MobileCoreConst.TABLE_NAV_BAR, "module_category=?", new Object[]{module_category});
- if (!DataTableEntity.isEmpty(dt)) {
- fse = new FieldSetEntity();
- fse.setTableName(MobileCoreConst.TABLE_NAV_BAR);
- fse.setValue(MobileCoreConst.MODULE_CATEGORY, module_category);
- fse.setValue(MobileCoreConst.MODULE_SEQUENCE, dt.getString(0, MobileCoreConst.MODULE_SEQUENCE));
- fse.addSubDataTable(dt);
- return fse;
- }
- }
- throw new BaseException(MobileCoreCode.FIND_NAV_BAR_CONFIG_FAIL);
- }
+ /**
+ * 閰嶇疆璇︽儏
+ *
+ * @param fse
+ * @return
+ * @throws BaseException
+ */
+ @Override
+ public FieldSetEntity findConfig(FieldSetEntity fse) throws BaseException {
+ String module_category = fse.getString(MobileCoreConst.MODULE_CATEGORY);
+ if (!StringUtils.isEmpty(module_category)) {
+ DataTableEntity dt = getBaseDao().listTable(MobileCoreConst.TABLE_NAV_BAR, "module_category=?", new Object[]{module_category});
+ if (!DataTableEntity.isEmpty(dt)) {
+ fse = new FieldSetEntity();
+ fse.setTableName(MobileCoreConst.TABLE_NAV_BAR);
+ fse.setValue(MobileCoreConst.MODULE_CATEGORY, module_category);
+ fse.setValue(MobileCoreConst.MODULE_SEQUENCE, dt.getString(0, MobileCoreConst.MODULE_SEQUENCE));
+ fse.addSubDataTable(dt);
+ return fse;
+ }
+ }
+ throw new BaseException(MobileCoreCode.FIND_NAV_BAR_CONFIG_FAIL);
+ }
- /**
- * 淇濆瓨閰嶇疆
- *
- * @param fse
- * @return
- * @throws BaseException
- */
- @Override
- public void saveConfig(FieldSetEntity fse) throws BaseException {
- DataTableEntity subDataTable = fse.getSubDataTable(MobileCoreConst.TABLE_NAV_BAR);
- if (DataTableEntity.isEmpty(subDataTable)) {
- throw new BaseException(MobileCoreCode.SAVE_NAV_BAR_CONFIG_FAIL);
- }
- BaseUtil.createCreatorAndCreationTime(fse);
- for (int i = 0; i < subDataTable.getRows(); i++) {
- subDataTable.setFieldValue(i, MobileCoreConst.MODULE_CATEGORY, fse.getString(MobileCoreConst.MODULE_CATEGORY));
- subDataTable.setFieldValue(i, MobileCoreConst.MODULE_SEQUENCE, fse.getString(MobileCoreConst.MODULE_SEQUENCE));
- subDataTable.setFieldValue(i, MobileCoreConst.UPDATED_BY, fse.getString(MobileCoreConst.UPDATED_BY));
- subDataTable.setFieldValue(i, MobileCoreConst.CREATED_BY, fse.getString(MobileCoreConst.CREATED_BY));
- subDataTable.setFieldValue(i, MobileCoreConst.UPDATED_UTC_DATETIME, fse.getString(MobileCoreConst.UPDATED_UTC_DATETIME));
- subDataTable.setFieldValue(i, MobileCoreConst.CREATED_UTC_DATETIME, fse.getString(MobileCoreConst.CREATED_UTC_DATETIME));
- }
- getBaseDao().update(subDataTable);
- }
+ /**
+ * 淇濆瓨閰嶇疆
+ *
+ * @param fse
+ * @return
+ * @throws BaseException
+ */
+ @Override
+ public void saveConfig(FieldSetEntity fse) throws BaseException {
+ DataTableEntity subDataTable = fse.getSubDataTable(MobileCoreConst.TABLE_NAV_BAR);
+ if (DataTableEntity.isEmpty(subDataTable)) {
+ throw new BaseException(MobileCoreCode.SAVE_NAV_BAR_CONFIG_FAIL);
+ }
+ BaseUtil.createCreatorAndCreationTime(fse);
+ for (int i = 0; i < subDataTable.getRows(); i++) {
+ subDataTable.setFieldValue(i, MobileCoreConst.MODULE_CATEGORY, fse.getString(MobileCoreConst.MODULE_CATEGORY));
+ subDataTable.setFieldValue(i, MobileCoreConst.MODULE_SEQUENCE, fse.getString(MobileCoreConst.MODULE_SEQUENCE));
+ subDataTable.setFieldValue(i, MobileCoreConst.UPDATED_BY, fse.getString(MobileCoreConst.UPDATED_BY));
+ subDataTable.setFieldValue(i, MobileCoreConst.CREATED_BY, fse.getString(MobileCoreConst.CREATED_BY));
+ subDataTable.setFieldValue(i, MobileCoreConst.UPDATED_UTC_DATETIME, fse.getString(MobileCoreConst.UPDATED_UTC_DATETIME));
+ subDataTable.setFieldValue(i, MobileCoreConst.CREATED_UTC_DATETIME, fse.getString(MobileCoreConst.CREATED_UTC_DATETIME));
+ }
+ getBaseDao().update(subDataTable);
+ }
- /**
- * 鍒犻櫎閰嶇疆
- *
- * @param fse
- * @throws BaseException
- */
- @Override
- public void delConfig(FieldSetEntity fse) throws BaseException {
- getBaseDao().delete(fse.getTableName(), "module_category = ?", new Object[]{fse.getString(MobileCoreConst.MODULE_CATEGORY)});
- }
+ /**
+ * 鍒犻櫎閰嶇疆
+ *
+ * @param fse
+ * @throws BaseException
+ */
+ @Override
+ public void delConfig(FieldSetEntity fse) throws BaseException {
+ getBaseDao().delete(fse.getTableName(), "module_category = ?", new Object[]{fse.getString(MobileCoreConst.MODULE_CATEGORY)});
+ }
- @Autowired
- FileManagerService fileManagerService;
+ @Autowired
+ FileManagerService fileManagerService;
- /**
- * 绉诲姩绔幏鍙栧鑸爮锛堝睍绀鸿烦杞級
- *
- * @return
- * @throws BaseException
- */
- @Override
- public List<Object> getNarBarTree() throws BaseException {
- SystemUser currentUser = SpringMVCContextHolder.getCurrentUser();
- if (currentUser == null) {
- return null;
- }
- StringBuilder sql = new StringBuilder();
- sql.append(" SELECT ");
- sql.append(" a.function_uuid, ");
- sql.append(" a.nav_bar_img, ");
- sql.append(" a.nav_bar_name, ");
- sql.append(" a.module_category, ");
- sql.append(" b.route_name, ");
- sql.append(" concat( '/', b.uuid ) path, ");
- sql.append(" a.uuid, ");
- sql.append(" a.sequence,a.module_sequence ");
- sql.append(" FROM ");
- sql.append(" product_sys_app_nav_bar a ");
- sql.append(" JOIN product_sys_functions c ON a.function_uuid = c.uuid ");
- sql.append(" AND c.status_uuid = 1 ");
- sql.append(" and c.function_type_uuid=1 ");
- sql.append(" AND concat( ',', c.client_type_uuid, ',' ) LIKE '%,App,%' ");
- sql.append(" JOIN product_sys_function_buttons b ON a.function_uuid = b.function_uuid ");
- sql.append(" AND b.button_type = 1 ");
- sql.append(" AND b.is_main = 1 ");
- sql.append(" AND b.client_type_uuid = 'App' ");
- sql.append(" JOIN product_sys_function_permission permission ON concat( ',', permission.button_uuid, ',' ) LIKE concat( ',%', b.uuid, '%,' ) ");
- sql.append(" JOIN product_sys_role role on role.uuid=permission.role_uuid and role.is_used=1 ");
- //浣跨敤瑙掕壊鍋氬姛鑳芥潈闄愰檺鍒�
-// sql.append(" and ").append(BaseUtil.buildQuestionMarkFilter("role.uuid", currentUser.getRoles().split(","), true));
+ /**
+ * 绉诲姩绔幏鍙栧鑸爮锛堝睍绀鸿烦杞級
+ *
+ * @return
+ * @throws BaseException
+ */
+ @Override
+ public List<Object> getNarBarTree() throws BaseException {
+ SystemUser currentUser = SpringMVCContextHolder.getCurrentUser();
+ if (currentUser == null) {
+ return null;
+ }
+ StringBuilder sql = new StringBuilder();
+ sql.append(" SELECT ");
+ sql.append(" a.function_uuid, ");
+ sql.append(" a.nav_bar_img, ");
+ sql.append(" a.nav_bar_name, ");
+ sql.append(" a.module_category, ");
+ sql.append(" b.route_name, ");
+ sql.append(" concat( '/', b.uuid ) path, ");
+ sql.append(" a.uuid, ");
+ sql.append(" a.sequence,a.module_sequence ");
+ sql.append(" FROM ");
+ sql.append(" product_sys_app_nav_bar a ");
+ sql.append(" JOIN product_sys_functions c ON a.function_uuid = c.uuid ");
+ sql.append(" AND c.status_uuid = 1 ");
+ sql.append(" and c.function_type_uuid=1 ");
+ sql.append(" AND concat( ',', c.client_type_uuid, ',' ) LIKE '%,App,%' ");
+ sql.append(" JOIN product_sys_function_buttons b ON a.function_uuid = b.function_uuid ");
+ sql.append(" AND b.button_type = 1 ");
+ sql.append(" AND b.is_main = 1 ");
+ sql.append(" AND b.client_type_uuid = 'App' ");
+ sql.append(" JOIN product_sys_function_permission permission ON concat( ',', permission.button_uuid, ',' ) LIKE concat( ',%', b.uuid, '%,' ) ");
+ sql.append(" JOIN product_sys_role role on role.uuid=permission.role_uuid and role.is_used=1 ");
+ //浣跨敤瑙掕壊鍋氬姛鑳芥潈闄愰檺鍒�
+ sql.append(" and ").append(BaseUtil.buildQuestionMarkFilter("role.uuid", currentUser.getRoles().split(","), true));
+ sql.append(" GROUP BY a.function_uuid, ");
+ sql.append(" a.nav_bar_img, ");
+ sql.append(" a.nav_bar_name, ");
+ sql.append(" a.module_category, ");
+ sql.append(" a.uuid ,");
+ sql.append(" concat( '/', b.uuid ) ,");
+ sql.append(" a.sequence, ");
+ sql.append(" b.route_name,a.module_sequence ");
+ sql.append(" order by a.module_sequence,a.sequence");
+ DataTableEntity dt = getBaseDao().listTable(sql.toString(), new Object[]{});
+ if (!DataTableEntity.isEmpty(dt)) {
+ Map<String, List<NavBarEntity>> map = new LinkedHashMap<>();
+ for (int i = 0; i < dt.getRows(); i++) {
+ String module_name = dt .getString(i, MobileCoreConst.MODULE_CATEGORY);
+ List<NavBarEntity> navBarEntities = map.get(module_name);
+ if (navBarEntities == null) {
+ navBarEntities = new ArrayList<>();
+ map.put(module_name, navBarEntities);
+ }
+ String file_uuid = dt.getString(i, MobileCoreConst.NAV_BAR_IMG);
+ try {
+ String bytes = null;
+ byte[] fileContent = fileManagerService.getFileContent(file_uuid);
+ if (fileContent != null && fileContent.length > 0) {
+ bytes = Base64.encodeBase64String(fileContent);
+ }
+ dt.setFieldValue(i, MobileCoreConst.NAV_BAR_IMG, bytes);
+ } catch (Exception e) {
+ dt.setFieldValue(i, MobileCoreConst.NAV_BAR_IMG, null);
+ }
+ navBarEntities.add(new NavBarEntity(dt.getFieldSetEntity(i)));
+
+ }
+ List<Object> list = new ArrayList<>();
+ map.forEach((k, v) -> {
+ Map<String, Object> m = new HashMap<>();
+ m.put("name", k);
+ m.put("functions", v);
+ list.add(m);
+ });
+ return list;
+ }
+ return null;
+ }
+ /**
+ * 璁惧绠$悊
+ * 绉诲姩绔幏鍙栧鑸爮锛堝睍绀鸿烦杞級
+ *
+ * @return
+ * @throws BaseException
+ */
+ @Override
+ public List<Object> getDeviceNarBarTree() throws BaseException {
+ SystemUser currentUser = SpringMVCContextHolder.getCurrentUser();
+ if (currentUser == null) {
+ return null;
+ }
+ StringBuilder sql = new StringBuilder();
+ sql.append(" SELECT ");
+ sql.append(" a.function_uuid, ");
+ sql.append(" a.nav_bar_img, ");
+ sql.append(" a.nav_bar_name, ");
+ sql.append(" a.module_category, ");
+ sql.append(" b.route_name, ");
+ sql.append(" concat( '/', b.uuid ) path, ");
+ sql.append(" a.uuid, ");
+ sql.append(" a.sequence,a.module_sequence ");
+ sql.append(" FROM ");
+ sql.append(" product_sys_app_nav_bar a ");
+ sql.append(" JOIN product_sys_functions c ON a.function_uuid = c.uuid ");
+ sql.append(" AND c.status_uuid = 1 ");
+ sql.append(" and c.function_type_uuid=1 ");
+ sql.append(" AND concat( ',', c.client_type_uuid, ',' ) LIKE '%,App,%' ");
+ sql.append(" JOIN product_sys_function_buttons b ON a.function_uuid = b.function_uuid ");
+ sql.append(" AND b.button_type = 1 ");
+ sql.append(" AND b.is_main = 1 ");
+ sql.append(" AND b.client_type_uuid = 'App' ");
+ sql.append(" JOIN product_sys_function_permission permission ON concat( ',', permission.button_uuid, ',' ) LIKE concat( ',%', b.uuid, '%,' ) ");
+ sql.append(" JOIN product_sys_role role on role.uuid=permission.role_uuid and role.is_used=1 ");
+ //浣跨敤瑙掕壊鍋氬姛鑳芥潈闄愰檺鍒�
+ sql.append(" and ").append(BaseUtil.buildQuestionMarkFilter("role.uuid", currentUser.getRoles().split(","), true));
+ //娣诲姞璁惧绠$悊妯″潡杩囨护鏉′欢
+ //sql.append(" and a.module_category='璁惧绠$悊' ");
+
sql.append(" GROUP BY a.function_uuid, ");
- sql.append(" a.nav_bar_img, ");
- sql.append(" a.nav_bar_name, ");
- sql.append(" a.module_category, ");
- sql.append(" a.uuid ,");
- sql.append(" b.uuid ,");
- sql.append(" a.sequence, ");
- sql.append(" b.route_name,a.module_sequence ");
- sql.append(" order by a.module_sequence,a.sequence");
- DataTableEntity dt = getBaseDao().listTable(sql.toString(), new Object[]{});
- if (!DataTableEntity.isEmpty(dt)) {
- Map<String, List<NavBarEntity>> map = new LinkedHashMap<>();
- for (int i = 0; i < dt.getRows(); i++) {
- String module_name = dt.getString(i, MobileCoreConst.MODULE_CATEGORY);
- List<NavBarEntity> navBarEntities = map.get(module_name);
- if (navBarEntities == null) {
- navBarEntities = new ArrayList<>();
- map.put(module_name, navBarEntities);
- }
- String file_uuid = dt.getString(i, MobileCoreConst.NAV_BAR_IMG);
- try {
- byte[] fileContent = fileManagerService.getFileContent(file_uuid);
- String bytes = Base64.encodeBase64String(fileContent);
- dt.setFieldValue(i, MobileCoreConst.NAV_BAR_IMG, bytes);
- } catch (Exception e) {
- dt.setFieldValue(i, MobileCoreConst.NAV_BAR_IMG, null);
- }
- navBarEntities.add(new NavBarEntity(dt.getFieldSetEntity(i)));
+ sql.append(" a.nav_bar_img, ");
+ sql.append(" a.nav_bar_name, ");
+ sql.append(" a.module_category, ");
+ sql.append(" a.uuid ,");
+ sql.append(" concat( '/', b.uuid ) ,");
+ sql.append(" a.sequence, ");
+ sql.append(" b.route_name,a.module_sequence ");
+ sql.append(" order by a.module_sequence,a.sequence");
+ DataTableEntity dt = getBaseDao().listTable(sql.toString(), new Object[]{});
+ if (!DataTableEntity.isEmpty(dt)) {
+ Map<String, List<NavBarEntity>> map = new LinkedHashMap<>();
+ for (int i = 0; i < dt.getRows(); i++) {
+ String module_name = dt .getString(i, MobileCoreConst.MODULE_CATEGORY);
+ List<NavBarEntity> navBarEntities = map.get(module_name);
+ if (navBarEntities == null) {
+ navBarEntities = new ArrayList<>();
+ map.put(module_name, navBarEntities);
+ }
+ String file_uuid = dt.getString(i, MobileCoreConst.NAV_BAR_IMG);
+ try {
+ String bytes = null;
+ byte[] fileContent = fileManagerService.getFileContent(file_uuid);
+ if (fileContent != null && fileContent.length > 0) {
+ bytes = Base64.encodeBase64String(fileContent);
+ }
+ dt.setFieldValue(i, MobileCoreConst.NAV_BAR_IMG, bytes);
+ } catch (Exception e) {
+ dt.setFieldValue(i, MobileCoreConst.NAV_BAR_IMG, null);
+ }
+ navBarEntities.add(new NavBarEntity(dt.getFieldSetEntity(i)));
- }
- List<Object> list = new ArrayList<>();
- map.forEach((k, v) -> {
- Map<String, Object> m = new HashMap<>();
- m.put("name", k);
- m.put("functions", v);
- list.add(m);
- });
- return list;
- }
- return null;
- }
-
-
+ }
+ List<Object> list = new ArrayList<>();
+ map.forEach((k, v) -> {
+ Map<String, Object> m = new HashMap<>();
+ m.put("name", k);
+ m.put("functions", v);
+ list.add(m);
+ });
+ return list;
+ }
+ return null;
+ }
+
}
--
Gitblit v1.9.2