From 50c953709c1dc3d6119e11e7820291b8f6830645 Mon Sep 17 00:00:00 2001
From: 877617829 <877617829@qq.com>
Date: Sun, 16 Jul 2023 15:28:58 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=E6=96=B0?=
=?UTF-8?q?=E5=A2=9E=E7=A7=BB=E5=8A=A8=E7=AB=AF=E3=80=90=E5=8E=8B=E7=BC=A9?=
=?UTF-8?q?=E5=8C=85=E3=80=91=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=EF=BC=8C?=
=?UTF-8?q?mysql=E6=95=B0=E6=8D=AE=E5=BA=93gen=5Fbasic=E8=A1=A8=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0=EF=BC=8C=E4=BD=86Oracle=E6=9C=AA=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
snowy-admin-web/src/api/gen/genBasicApi.js | 4 +
snowy-admin-web/src/views/gen/basic.vue | 38 ++++-
snowy-admin-web/src/views/gen/preview.vue | 10 +-
.../xiaonuo/mobile/api/MobileModuleApi.java | 33 ++++
snowy-plugin/snowy-plugin-gen/pom.xml | 6 +
.../basic/controller/GenBasicController.java | 14 ++
.../gen/modular/basic/entity/GenBasic.java | 20 ++-
.../modular/basic/param/GenBasicAddParam.java | 21 ++-
.../basic/param/GenBasicEditParam.java | 35 ++--
.../GenBasicMobileModuleSelectorResult.java | 23 +++
.../basic/result/GenBasicPreviewResult.java | 4 +
.../basic/service/GenBasicService.java | 9 +
.../service/impl/GenBasicServiceImpl.java | 63 +++++++
.../src/main/resources/mobile/Api.js.btl | 42 +++++
.../src/main/resources/mobile/form.vue.btl | 119 +++++++++++++
.../src/main/resources/mobile/index.vue.btl | 157 ++++++++++++++++++
.../src/main/resources/mobile/more.vue.btl | 60 +++++++
.../src/main/resources/mobile/page.json.btl | 47 ++++++
.../src/main/resources/mobile/search.vue.btl | 123 ++++++++++++++
.../src/main/resources/sqlend/Mysql.sql.btl | 9 +
.../src/main/resources/sqlend/Oracle.sql.btl | 9 +
.../provider/MobileModuleApiProvider.java | 26 +++
.../resource/service/MobileModuleService.java | 9 +
.../service/impl/MobileModuleServiceImpl.java | 12 ++
.../src/main/resources/_sql/snowy_mysql.sql | 1 +
25 files changed, 861 insertions(+), 33 deletions(-)
create mode 100644 snowy-plugin-api/snowy-plugin-mobile-api/src/main/java/vip/xiaonuo/mobile/api/MobileModuleApi.java
create mode 100644 snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/result/GenBasicMobileModuleSelectorResult.java
create mode 100644 snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/Api.js.btl
create mode 100644 snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/form.vue.btl
create mode 100644 snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/index.vue.btl
create mode 100644 snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/more.vue.btl
create mode 100644 snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/page.json.btl
create mode 100644 snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/search.vue.btl
create mode 100644 snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/provider/MobileModuleApiProvider.java
diff --git a/snowy-admin-web/src/api/gen/genBasicApi.js b/snowy-admin-web/src/api/gen/genBasicApi.js
index 884b4965..f8a2a070 100644
--- a/snowy-admin-web/src/api/gen/genBasicApi.js
+++ b/snowy-admin-web/src/api/gen/genBasicApi.js
@@ -41,5 +41,9 @@ export default {
// 预览代码生成
basicPreviewGen(data) {
return request('previewGen', data, 'get')
+ },
+ // 获取所有移动端模块
+ basicMobileModuleSelector(data) {
+ return request('mobileModuleSelector', data, 'get')
}
}
diff --git a/snowy-admin-web/src/views/gen/basic.vue b/snowy-admin-web/src/views/gen/basic.vue
index 54ee3f98..5b077eda 100644
--- a/snowy-admin-web/src/views/gen/basic.vue
+++ b/snowy-admin-web/src/views/gen/basic.vue
@@ -36,7 +36,14 @@
-
+
+
+
+ 注:移动端代码生成目前只支持【压缩包】方式。
+
+ 生成方式:
+
+
@@ -72,6 +79,17 @@
>
+
+
+
+
+
+
@@ -172,6 +190,7 @@
// 表单数据
const formData = ref({})
// 定义
+ const mobileModuleList = ref([])
const tableList = ref([])
const tableColumns = ref([])
const menuTreeData = ref([])
@@ -266,6 +285,22 @@
}
}
})
+
+ // 获取移动端模块
+ submitLoading.value = true
+ genBasicApi
+ .basicMobileModuleSelector()
+ .then((data) => {
+ mobileModuleList.value = data.map((item) => {
+ return {
+ value: item['id'],
+ label: item['name']
+ }
+ })
+ })
+ .finally(() => {
+ submitLoading.value = false
+ })
}
// 默认要校验的
const formRules = {
@@ -277,6 +312,7 @@
generateType: [required('请选择生成方式')],
module: [required('请选择所属模块')],
menuPid: [required('请选择上级目录')],
+ mobileModule: [required('请选择移动端所属模块')],
functionName: [required('请输入功能名')],
busName: [required('请输入业务名')],
className: [required('请输入类名')],
diff --git a/snowy-admin-web/src/views/gen/preview.vue b/snowy-admin-web/src/views/gen/preview.vue
index e72dd8a5..6dd510b1 100644
--- a/snowy-admin-web/src/views/gen/preview.vue
+++ b/snowy-admin-web/src/views/gen/preview.vue
@@ -54,6 +54,11 @@
codeTypeTitle: '前端代码',
codeTypeList: data.genBasicCodeFrontendResultList
},
+ {
+ codeTypeKey: 'mobile',
+ codeTypeTitle: '移动端代码',
+ codeTypeList: data.genBasicCodeMobileResultList
+ },
{
codeTypeKey: 'backend',
codeTypeTitle: '后端代码',
@@ -85,9 +90,12 @@
onOpen
})
-
diff --git a/snowy-plugin-api/snowy-plugin-mobile-api/src/main/java/vip/xiaonuo/mobile/api/MobileModuleApi.java b/snowy-plugin-api/snowy-plugin-mobile-api/src/main/java/vip/xiaonuo/mobile/api/MobileModuleApi.java
new file mode 100644
index 00000000..47873fa9
--- /dev/null
+++ b/snowy-plugin-api/snowy-plugin-mobile-api/src/main/java/vip/xiaonuo/mobile/api/MobileModuleApi.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright [2022] [https://www.xiaonuo.vip]
+ *
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+ *
+ * 1.请不要删除和修改根目录下的LICENSE文件。
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package vip.xiaonuo.mobile.api;
+
+import cn.hutool.json.JSONObject;
+import java.util.List;
+
+/**
+ * 移动端菜单API
+ *
+ * @author xuyuxiang
+ * @date 2023/1/31 10:09
+ **/
+public interface MobileModuleApi {
+
+ /**
+ * 获取移动端模块选择器
+ *
+ * @author xuyuxiang
+ * @date 2023/7/15 22:01
+ **/
+ List mobileModuleSelector();
+}
diff --git a/snowy-plugin/snowy-plugin-gen/pom.xml b/snowy-plugin/snowy-plugin-gen/pom.xml
index 97669164..73393ceb 100644
--- a/snowy-plugin/snowy-plugin-gen/pom.xml
+++ b/snowy-plugin/snowy-plugin-gen/pom.xml
@@ -27,6 +27,12 @@
snowy-plugin-sys-api
+
+
+ vip.xiaonuo
+ snowy-plugin-mobile-api
+
+
com.ibeetl
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/controller/GenBasicController.java b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/controller/GenBasicController.java
index 03512e81..344c7131 100644
--- a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/controller/GenBasicController.java
+++ b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/controller/GenBasicController.java
@@ -28,6 +28,7 @@ import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.common.pojo.CommonValidList;
import vip.xiaonuo.gen.modular.basic.entity.GenBasic;
import vip.xiaonuo.gen.modular.basic.param.*;
+import vip.xiaonuo.gen.modular.basic.result.GenBasicMobileModuleSelectorResult;
import vip.xiaonuo.gen.modular.basic.result.GenBasicPreviewResult;
import vip.xiaonuo.gen.modular.basic.result.GenBasicTableColumnResult;
import vip.xiaonuo.gen.modular.basic.result.GenBasicTableResult;
@@ -193,5 +194,18 @@ public class GenBasicController {
public CommonResult previewGen(@Valid GenBasicIdParam genBasicIdParam) {
return CommonResult.data(genBasicService.previewGen(genBasicIdParam));
}
+
+ /**
+ * 获取所有移动端模块
+ *
+ * @author 每天一点
+ * @date 2023/7/15 22:36
+ */
+ @ApiOperationSupport(order = 11)
+ @ApiOperation("获取所有移动端模块")
+ @GetMapping("/gen/basic/mobileModuleSelector")
+ public CommonResult> mobileModuleSelector() {
+ return CommonResult.data(genBasicService.mobileModuleSelector());
+ }
}
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/entity/GenBasic.java b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/entity/GenBasic.java
index fcfaee1d..43d00650 100644
--- a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/entity/GenBasic.java
+++ b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/entity/GenBasic.java
@@ -65,35 +65,39 @@ public class GenBasic extends CommonEntity {
@ApiModelProperty(value = "上级目录", position = 9)
private String menuPid;
+ /** 移动端所属模块 */
+ @ApiModelProperty(value = "移动端所属模块", position = 10)
+ private String mobileModule;
+
/** 功能名 */
- @ApiModelProperty(value = "功能名", position = 10)
+ @ApiModelProperty(value = "功能名", position = 11)
private String functionName;
/** 业务名 */
- @ApiModelProperty(value = "业务名", position = 11)
+ @ApiModelProperty(value = "业务名", position = 12)
private String busName;
/** 类名 */
- @ApiModelProperty(value = "类名", position = 12)
+ @ApiModelProperty(value = "类名", position = 13)
private String className;
/** 表单布局 */
- @ApiModelProperty(value = "表单布局", position = 13)
+ @ApiModelProperty(value = "表单布局", position = 14)
private String formLayout;
/** 使用栅格 */
- @ApiModelProperty(value = "使用栅格", position = 14)
+ @ApiModelProperty(value = "使用栅格", position = 15)
private String gridWhether;
/** 排序 */
- @ApiModelProperty(value = "排序", position = 15)
+ @ApiModelProperty(value = "排序", position = 16)
private Integer sortCode;
/** 包名 */
- @ApiModelProperty(value = "包名", position = 16)
+ @ApiModelProperty(value = "包名", position = 17)
private String packageName;
/** 作者 */
- @ApiModelProperty(value = "作者", position = 17)
+ @ApiModelProperty(value = "作者", position = 18)
private String authorName;
}
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/param/GenBasicAddParam.java b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/param/GenBasicAddParam.java
index 2bd897a9..c6931559 100644
--- a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/param/GenBasicAddParam.java
+++ b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/param/GenBasicAddParam.java
@@ -68,41 +68,46 @@ public class GenBasicAddParam {
@NotNull(message = "menuPid不能为空")
private String menuPid;
+ /** 移动端所属模块 */
+ @ApiModelProperty(value = "移动端所属模块", required = true, position = 9)
+ @NotNull(message = "mobileModule不能为空")
+ private String mobileModule;
+
/** 功能名 */
- @ApiModelProperty(value = "功能名", required = true, position = 8)
+ @ApiModelProperty(value = "功能名", required = true, position = 10)
@NotNull(message = "functionName不能为空")
private String functionName;
/** 业务名 */
- @ApiModelProperty(value = "业务名", required = true, position = 10)
+ @ApiModelProperty(value = "业务名", required = true, position = 11)
@NotNull(message = "busName不能为空")
private String busName;
/** 类名 */
- @ApiModelProperty(value = "类名", required = true, position = 11)
+ @ApiModelProperty(value = "类名", required = true, position = 12)
@NotNull(message = "className不能为空")
private String className;
/** 表单布局 */
- @ApiModelProperty(value = "表单布局", required = true, position = 12)
+ @ApiModelProperty(value = "表单布局", required = true, position = 13)
@NotNull(message = "formLayout不能为空")
private String formLayout;
/** 使用栅格 */
- @ApiModelProperty(value = "使用栅格", required = true, position = 13)
+ @ApiModelProperty(value = "使用栅格", required = true, position = 14)
@NotNull(message = "gridWhether不能为空")
private String gridWhether;
/** 排序 */
- @ApiModelProperty(value = "排序", required = true, position = 14)
+ @ApiModelProperty(value = "排序", required = true, position = 15)
@NotNull(message = "sortCode不能为空")
private Integer sortCode;
/** 作者名 */
- @ApiModelProperty(value = "作者名", required = true, position = 15)
+ @ApiModelProperty(value = "作者名", required = true, position = 16)
private String authorName;
/** 包名 */
- @ApiModelProperty(value = "包名", required = true, position = 16)
+ @ApiModelProperty(value = "包名", required = true, position = 17)
private String packageName;
}
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/param/GenBasicEditParam.java b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/param/GenBasicEditParam.java
index 56919841..edde3ca2 100644
--- a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/param/GenBasicEditParam.java
+++ b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/param/GenBasicEditParam.java
@@ -29,17 +29,17 @@ import javax.validation.constraints.NotNull;
public class GenBasicEditParam {
/** id */
- @ApiModelProperty(value = "id", position = 1)
+ @ApiModelProperty(value = "id", required = true, position = 1)
@NotNull(message = "id不能为空")
private String id;
/** 主表名称 */
- @ApiModelProperty(value = "主表名称", position = 2)
+ @ApiModelProperty(value = "主表名称", required = true, position = 2)
@NotNull(message = "dbTable不能为空")
private String dbTable;
/** 主表主键 */
- @ApiModelProperty(value = "主表主键", position = 3)
+ @ApiModelProperty(value = "主表主键", required = true, position = 3)
@NotNull(message = "dbTableKey不能为空")
private String dbTableKey;
@@ -54,61 +54,66 @@ public class GenBasicEditParam {
private String moduleName;
/** 表前缀移除 */
- @ApiModelProperty(value = "表前缀移除", position = 6)
+ @ApiModelProperty(value = "表前缀移除", required = true, position = 6)
@NotNull(message = "tablePrefix不能为空")
private String tablePrefix;
/** 生成方式 */
- @ApiModelProperty(value = "生成方式", position = 7)
+ @ApiModelProperty(value = "生成方式", required = true, position = 7)
@NotNull(message = "generateType不能为空")
private String generateType;
/** 所属模块 */
- @ApiModelProperty(value = "所属模块", position = 8)
+ @ApiModelProperty(value = "所属模块", required = true, position = 8)
@NotNull(message = "module不能为空")
private String module;
/** 上级目录 */
- @ApiModelProperty(value = "上级目录", position = 9)
+ @ApiModelProperty(value = "上级目录", required = true, position = 9)
@NotNull(message = "menuPid不能为空")
private String menuPid;
+ /** 移动端所属模块 */
+ @ApiModelProperty(value = "移动端所属模块", required = true, position = 10)
+ @NotNull(message = "mobileModule不能为空")
+ private String mobileModule;
+
/** 功能名 */
- @ApiModelProperty(value = "功能名", position = 10)
+ @ApiModelProperty(value = "功能名", required = true, position = 11)
@NotNull(message = "functionName不能为空")
private String functionName;
/** 业务名 */
- @ApiModelProperty(value = "业务名", position = 11)
+ @ApiModelProperty(value = "业务名", required = true, position = 12)
@NotNull(message = "busName不能为空")
private String busName;
/** 类名 */
- @ApiModelProperty(value = "类名", position = 12)
+ @ApiModelProperty(value = "类名", required = true, position = 13)
@NotNull(message = "className不能为空")
private String className;
/** 表单布局 */
- @ApiModelProperty(value = "表单布局", position = 13)
+ @ApiModelProperty(value = "表单布局", required = true, position = 14)
@NotNull(message = "formLayout不能为空")
private String formLayout;
/** 使用栅格 */
- @ApiModelProperty(value = "使用栅格", position = 14)
+ @ApiModelProperty(value = "使用栅格", required = true, position = 15)
@NotNull(message = "gridWhether不能为空")
private String gridWhether;
/** 排序 */
- @ApiModelProperty(value = "排序", position = 15)
+ @ApiModelProperty(value = "排序", required = true, position = 16)
@NotNull(message = "sortCode不能为空")
private Integer sortCode;
/** 作者名 */
- @ApiModelProperty(value = "作者名", required = true, position = 16)
+ @ApiModelProperty(value = "作者名", required = true, position = 17)
@NotNull(message = "authorName不能为空")
private String authorName;
/** 包名 */
- @ApiModelProperty(value = "包名 */", position = 17)
+ @ApiModelProperty(value = "包名 */", required = true, position = 17)
private String packageName;
}
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/result/GenBasicMobileModuleSelectorResult.java b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/result/GenBasicMobileModuleSelectorResult.java
new file mode 100644
index 00000000..88421d94
--- /dev/null
+++ b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/result/GenBasicMobileModuleSelectorResult.java
@@ -0,0 +1,23 @@
+package vip.xiaonuo.gen.modular.basic.result;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 代码生成模块所需要用到的移动端模块选择的结果
+ *
+ * @author 每天一点
+ * @date 2023/7/15 22:28
+ **/
+@Getter
+@Setter
+public class GenBasicMobileModuleSelectorResult {
+ /** id */
+ @ApiModelProperty(value = "id", position = 1)
+ private String id;
+
+ /** 名称 */
+ @ApiModelProperty(value = "名称", position = 2)
+ private String name;
+}
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/result/GenBasicPreviewResult.java b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/result/GenBasicPreviewResult.java
index c5429fc2..5c1a061a 100644
--- a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/result/GenBasicPreviewResult.java
+++ b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/result/GenBasicPreviewResult.java
@@ -40,6 +40,10 @@ public class GenBasicPreviewResult {
@ApiModelProperty(value = "后端代码结果集", position = 3)
private List genBasicCodeBackendResultList;
+ /** 前端代码结果集 */
+ @ApiModelProperty(value = "移动端代码结果集", position = 4)
+ private List genBasicCodeMobileResultList;
+
@Getter
@Setter
public static class GenBasicCodeResult {
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/GenBasicService.java b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/GenBasicService.java
index 5ac4969a..937111c4 100644
--- a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/GenBasicService.java
+++ b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/GenBasicService.java
@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import vip.xiaonuo.gen.modular.basic.entity.GenBasic;
import vip.xiaonuo.gen.modular.basic.param.*;
+import vip.xiaonuo.gen.modular.basic.result.GenBasicMobileModuleSelectorResult;
import vip.xiaonuo.gen.modular.basic.result.GenBasicPreviewResult;
import vip.xiaonuo.gen.modular.basic.result.GenBasicTableColumnResult;
import vip.xiaonuo.gen.modular.basic.result.GenBasicTableResult;
@@ -119,4 +120,12 @@ public interface GenBasicService extends IService {
* @date 2022/10/28 17:08
**/
GenBasicPreviewResult previewGen(GenBasicIdParam genBasicIdParam);
+
+ /**
+ * 获取移动端模块
+ *
+ * @author 每天一点
+ * @date 2023/7/15 22:28
+ **/
+ List mobileModuleSelector();
}
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/impl/GenBasicServiceImpl.java b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/impl/GenBasicServiceImpl.java
index 3eb7bddc..4b3b7044 100644
--- a/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/impl/GenBasicServiceImpl.java
+++ b/snowy-plugin/snowy-plugin-gen/src/main/java/vip/xiaonuo/gen/modular/basic/service/impl/GenBasicServiceImpl.java
@@ -49,6 +49,7 @@ import vip.xiaonuo.gen.modular.basic.enums.GenEffectTypeEnum;
import vip.xiaonuo.gen.modular.basic.enums.GenYesNoEnum;
import vip.xiaonuo.gen.modular.basic.mapper.GenBasicMapper;
import vip.xiaonuo.gen.modular.basic.param.*;
+import vip.xiaonuo.gen.modular.basic.result.GenBasicMobileModuleSelectorResult;
import vip.xiaonuo.gen.modular.basic.result.GenBasicPreviewResult;
import vip.xiaonuo.gen.modular.basic.result.GenBasicTableColumnResult;
import vip.xiaonuo.gen.modular.basic.result.GenBasicTableResult;
@@ -56,6 +57,7 @@ import vip.xiaonuo.gen.modular.basic.service.GenBasicService;
import vip.xiaonuo.gen.modular.config.entity.GenConfig;
import vip.xiaonuo.gen.modular.config.param.GenConfigAddParam;
import vip.xiaonuo.gen.modular.config.service.GenConfigService;
+import vip.xiaonuo.mobile.api.MobileModuleApi;
import vip.xiaonuo.sys.api.SysButtonApi;
import vip.xiaonuo.sys.api.SysMenuApi;
import vip.xiaonuo.sys.api.SysRoleApi;
@@ -69,6 +71,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
/**
* 代码生成基础Service接口实现类
@@ -98,6 +101,15 @@ public class GenBasicServiceImpl extends ServiceImpl i
JSONUtil.createObj().set("name", "form.vue.btl").set("path", "views"),
JSONUtil.createObj().set("name", "index.vue.btl").set("path", "views"));
+ private static final List GEN_MOBILE_FILE_LIST = CollectionUtil.newArrayList(
+ JSONUtil.createObj().set("name", "page.json.btl"),
+ JSONUtil.createObj().set("name", "Api.js.btl").set("path", "api"),
+ JSONUtil.createObj().set("name", "search.vue.btl").set("path", "pages"),
+ JSONUtil.createObj().set("name", "form.vue.btl").set("path", "pages"),
+ JSONUtil.createObj().set("name", "more.vue.btl").set("path", "pages"),
+ JSONUtil.createObj().set("name", "index.vue.btl").set("path", "pages"));
+
+
private static final List GEN_BACKEND_FILE_LIST = CollectionUtil.newArrayList(
JSONUtil.createObj().set("name", "Controller.java.btl").set("path", "controller"),
JSONUtil.createObj().set("name", "Entity.java.btl").set("path", "entity"),
@@ -141,6 +153,9 @@ public class GenBasicServiceImpl extends ServiceImpl i
@Resource
private SysRoleApi sysRoleApi;
+ @Resource
+ private MobileModuleApi mobileModuleApi;
+
@Override
public Page page(GenBasicPageParam genBasicPageParam) {
QueryWrapper queryWrapper = new QueryWrapper<>();
@@ -443,6 +458,10 @@ public class GenBasicServiceImpl extends ServiceImpl i
genBasicPreviewResult.getGenBasicCodeBackendResultList().forEach(genBasicCodeResult ->
FileUtil.writeUtf8String(genBasicCodeResult.getCodeFileContent(), FileUtil.file(tempFolder + File.separator
+ "backend" + File.separator + genBasicCodeResult.getCodeFileWithPathName())));
+ // 生成移动端代码到临时目录
+ genBasicPreviewResult.getGenBasicCodeMobileResultList().forEach(genBasicCodeResult ->
+ FileUtil.writeUtf8String(genBasicCodeResult.getCodeFileContent(), FileUtil.file(tempFolder + File.separator
+ + "mobile" + File.separator + genBasicCodeResult.getCodeFileWithPathName())));
return tempFolder;
}
@@ -520,6 +539,37 @@ public class GenBasicServiceImpl extends ServiceImpl i
genBasicCodeBackendResultList.add(genBasicCodeBackendResult);
});
genBasicPreviewResult.setGenBasicCodeBackendResultList(genBasicCodeBackendResultList);
+
+ // 移动端基础路径
+ String genMobileBasicPath = "";
+ // 移动端
+ GroupTemplate groupTemplateMobile = new GroupTemplate(new ClasspathResourceLoader("mobile"), Configuration.defaultConfiguration());
+ List genBasicCodeMobileResultList = CollectionUtil.newArrayList();
+ GEN_MOBILE_FILE_LIST.forEach(fileJsonObject -> {
+ String fileTemplateName = fileJsonObject.getStr("name");
+ String fileTemplatePath = "";
+ if (!"page.json.btl".equals(fileTemplateName)){
+ fileTemplatePath = fileJsonObject.getStr("path") + File.separator + genBasic.getModuleName();
+ }
+ GenBasicPreviewResult.GenBasicCodeResult genBasicCodeMobileResult = new GenBasicPreviewResult.GenBasicCodeResult();
+ Template templateMobile = groupTemplateMobile.getTemplate(fileTemplateName);
+ templateMobile.binding(bindingJsonObject);
+ String resultName = StrUtil.removeSuffix(fileTemplateName, ".btl");
+ if(fileTemplateName.equalsIgnoreCase("Api.js.btl")) {
+ resultName = StrUtil.lowerFirst(genBasic.getClassName()) + resultName;
+ genBasicCodeMobileResult.setCodeFileName(resultName);
+ genBasicCodeMobileResult.setCodeFileWithPathName(genMobileBasicPath + fileTemplatePath + File.separator + resultName);
+ } else if("page.json.btl".equals(fileTemplateName)) {
+ genBasicCodeMobileResult.setCodeFileName(resultName);
+ genBasicCodeMobileResult.setCodeFileWithPathName(genMobileBasicPath + fileTemplatePath + File.separator + resultName);
+ } else {
+ genBasicCodeMobileResult.setCodeFileName(resultName);
+ genBasicCodeMobileResult.setCodeFileWithPathName(genMobileBasicPath + fileTemplatePath + File.separator + genBasic.getBusName() + File.separator + resultName);
+ }
+ genBasicCodeMobileResult.setCodeFileContent(templateMobile.render());
+ genBasicCodeMobileResultList.add(genBasicCodeMobileResult);
+ });
+ genBasicPreviewResult.setGenBasicCodeMobileResultList(genBasicCodeMobileResultList);
} catch (Exception e) {
log.error(">>> 代码生成异常:", e);
throw new CommonException("代码生成异常");
@@ -527,6 +577,17 @@ public class GenBasicServiceImpl extends ServiceImpl i
return genBasicPreviewResult;
}
+ /**
+ * 获取移动端模块
+ * @author 每天一点
+ * @date 2023/7/15 22:38
+ */
+ @Override
+ public List mobileModuleSelector() {
+ return mobileModuleApi.mobileModuleSelector().stream()
+ .map(jsonObject -> JSONUtil.toBean(jsonObject, GenBasicMobileModuleSelectorResult.class)).collect(Collectors.toList());
+ }
+
/**
* 根据代码生成基础获取构造的参数
*
@@ -575,6 +636,8 @@ public class GenBasicServiceImpl extends ServiceImpl i
bindingJsonObject.set("menuComponent", genBasic.getModuleName() + StrUtil.SLASH + genBasic.getBusName() + StrUtil.SLASH + "index");
// 模块ID
bindingJsonObject.set("moduleId", genBasic.getModule());
+ // 移动端模块ID
+ bindingJsonObject.set("mobileModuleId", genBasic.getMobileModule());
// 添加按钮ID
bindingJsonObject.set("addButtonId", IdWorker.getIdStr());
// 编辑按钮ID
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/Api.js.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/Api.js.btl
new file mode 100644
index 00000000..9f4058c4
--- /dev/null
+++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/Api.js.btl
@@ -0,0 +1,42 @@
+import request from '@/utils/request'
+
+// 获取${functionName}分页
+export function ${classNameFirstLower}Page(data) {
+ return request({
+ url: '/${moduleName}/${busName}/page',
+ method: 'get',
+ data: data
+ })
+}
+// 获取${functionName}列表
+export function ${classNameFirstLower}List(data) {
+ return request({
+ url: '/${moduleName}/${busName}/list',
+ method: 'get',
+ data: data
+ })
+}
+// 提交${functionName}表单 add为false时为编辑,默认为新增
+export function ${classNameFirstLower}SubmitForm(data, add = true) {
+ return request({
+ url: '/${moduleName}/${busName}/'+ (add ? 'add' : 'edit'),
+ method: 'post',
+ data: data
+ })
+}
+// 删除${functionName}
+export function ${classNameFirstLower}Delete(data) {
+ return request({
+ url: '/${moduleName}/${busName}/delete',
+ method: 'post',
+ data: data
+ })
+}
+// 获取${functionName}详情
+export function ${classNameFirstLower}Detail(data) {
+ return request({
+ url: '/${moduleName}/${busName}/detail',
+ method: 'get',
+ data: data
+ })
+}
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/form.vue.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/form.vue.btl
new file mode 100644
index 00000000..0ebff437
--- /dev/null
+++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/form.vue.btl
@@ -0,0 +1,119 @@
+
+
+
+ <% for(var i = 0; i < configList.~size; i++) { %>
+ <% if(!configList[i].needTableId && configList[i].whetherAddUpdate && configList[i].fieldNameCamelCase != 'tenantId') { %>
+ <% if(configList[i].effectType == 'input') { %>
+
+
+
+ <% } else if (configList[i].effectType == 'textarea') {%>
+
+
+
+ <% } else if (configList[i].effectType == 'select') {%>
+
+
+
+ <% } else if (configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') {%>
+
+
+
+ <% } else if (configList[i].effectType == 'datepicker' || configList[i].effectType == 'timepicker') {%>
+
+
+
+ <% } else if (configList[i].effectType == 'inputNumber') {%>
+
+
+
+ <% } else if (configList[i].effectType == 'slider') {%>
+
+ {formData.${configList[i].fieldNameCamelCase} = e.detail.value}">
+
+ <% } %>
+ <% } %>
+ <% } %>
+
+
+
+
+
+
+
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/index.vue.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/index.vue.btl
new file mode 100644
index 00000000..0f914e1a
--- /dev/null
+++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/index.vue.btl
@@ -0,0 +1,157 @@
+
+ <%
+ var searchCount = 0;
+ var row = 0;
+ %>
+ <% for(var i = 0; i < configList.~size; i++) { %>
+ <% if(!configList[i].needTableId && configList[i].needPage) { searchCount ++; }%>
+ <% } %>
+
+ <% if (searchCount > 0) { %>
+
+ <% for(var i = 0; i < configList.~size; i++) { %>
+ <% if(!configList[i].needTableId && configList[i].needPage) { row ++; %>
+ <% if(row <= 1) { %>
+
+
+
+
+
+
+
+ 高级\n搜索
+
+
+
+
+ <% } %>
+ <% } %>
+ <% } %>
+
+
+ <% } %>
+
+
+
+
+
+ <% for(var i = 0; i < configList.~size; i++) { %>
+ <% if(!configList[i].needTableId && configList[i].whetherTable && configList[i].fieldNameCamelCase != 'tenantId') { %>
+
+
+
+ ${configList[i].fieldRemark}
+
+
+ {{ item.${configList[i].fieldNameCamelCase} }}
+
+
+
+ <% } %>
+ <% } %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/more.vue.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/more.vue.btl
new file mode 100644
index 00000000..733cf19d
--- /dev/null
+++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/more.vue.btl
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/page.json.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/page.json.btl
new file mode 100644
index 00000000..647112cf
--- /dev/null
+++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/page.json.btl
@@ -0,0 +1,47 @@
+// 二选一 将代码复制到page.json文件中
+
+// 不使用分包
+{
+ "path": "pages/${moduleName}/${busName}/index",
+ "style": {
+ "navigationBarTitleText": "${functionName}管理",
+ "enablePullDownRefresh": true,
+ //#ifdef H5
+ "navigationStyle": "custom"
+ //#endif
+ }
+}, {
+ "path": "pages/${moduleName}/${busName}/form",
+ "style": {
+ "navigationBarTitleText": "${functionName}管理",
+ "enablePullDownRefresh": false,
+ //#ifdef H5
+ "navigationStyle": "custom"
+ //#endif
+ }
+},
+
+
+// 使用分包(微信小程序开发主包不能超过2m,所以建议使用分包)
+{
+ "root": "pages/${moduleName}/${busName}",
+ "pages": [{
+ "path": "index",
+ "style": {
+ "navigationBarTitleText": "${functionName}管理",
+ "enablePullDownRefresh": true,
+ //#ifdef H5
+ "navigationStyle": "custom"
+ //#endif
+ }
+ },{
+ "path": "form",
+ "style": {
+ "navigationBarTitleText": "${functionName}管理",
+ "enablePullDownRefresh": false,
+ //#ifdef H5
+ "navigationStyle": "custom"
+ //#endif
+ }
+ }]
+}
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/search.vue.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/search.vue.btl
new file mode 100644
index 00000000..23ff09bc
--- /dev/null
+++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/mobile/search.vue.btl
@@ -0,0 +1,123 @@
+
+ <%
+ var searchCount = 0;
+ var row = 0;
+ %>
+ <% for(var i = 0; i < configList.~size; i++) { %>
+ <% if(!configList[i].needTableId && configList[i].needPage) { searchCount ++; }%>
+ <% } %>
+
+
+ <% if (searchCount > 0) { %>
+
+ <% for(var i = 0; i < configList.~size; i++) { %>
+ <% if(!configList[i].needTableId && configList[i].needPage) { %>
+ <% if(configList[i].effectType == 'input' || configList[i].effectType == 'textarea') { %>
+
+
+
+ <% } else if (configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') {%>
+
+
+
+ <% } else if (configList[i].effectType == 'inputNumber' || configList[i].effectType == 'slider') {%>
+
+
+
+ <% } else if (configList[i].effectType == 'datepicker') {%>
+
+
+
+ <% } else {%>
+
+
+
+ <% } %>
+ <% } %>
+ <% } %>
+
+ <% } %>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/sqlend/Mysql.sql.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/sqlend/Mysql.sql.btl
index f1b69d69..03356ec9 100644
--- a/snowy-plugin/snowy-plugin-gen/src/main/resources/sqlend/Mysql.sql.btl
+++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/sqlend/Mysql.sql.btl
@@ -12,3 +12,12 @@ INSERT INTO `SYS_RESOURCE` VALUES ('${batchDeleteButtonId}', '${menuId}', '批
INSERT INTO `SYS_RESOURCE` VALUES ('${editButtonId}', '${menuId}', '编辑${functionName}', NULL, '${classNameFirstLower}Edit', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, 3, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
INSERT INTO `SYS_RESOURCE` VALUES ('${deleteButtonId}', '${menuId}', '删除${functionName}', NULL, '${classNameFirstLower}Delete', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, 4, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
+
+
+INSERT INTO `MOBILE_RESOURCE` VALUES ('${menuId}', '0', '${functionName}管理', NULL, 'MENU', '${mobileModuleId}', 'MENU', '/pages/${moduleName}/${busName}/index', 'apartment-outlined', '#1890ff', 'YES', 'ENABLE', 99, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
+
+INSERT INTO `MOBILE_RESOURCE` VALUES ('${addButtonId}', '${menuId}', '新增${functionName}', 'mobile${className}Add', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
+
+INSERT INTO `MOBILE_RESOURCE` VALUES ('${editButtonId}', '${menuId}', '编辑${functionName}', 'mobile${className}Edit', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
+
+INSERT INTO `MOBILE_RESOURCE` VALUES ('${deleteButtonId}', '${menuId}', '删除${functionName}', 'mobile${className}Delete', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
diff --git a/snowy-plugin/snowy-plugin-gen/src/main/resources/sqlend/Oracle.sql.btl b/snowy-plugin/snowy-plugin-gen/src/main/resources/sqlend/Oracle.sql.btl
index d588ab5f..d1f00458 100644
--- a/snowy-plugin/snowy-plugin-gen/src/main/resources/sqlend/Oracle.sql.btl
+++ b/snowy-plugin/snowy-plugin-gen/src/main/resources/sqlend/Oracle.sql.btl
@@ -12,3 +12,12 @@ INSERT INTO "SNOWY"."SYS_RESOURCE" VALUES ('${batchDeleteButtonId}', '${menuId}'
INSERT INTO "SNOWY"."SYS_RESOURCE" VALUES ('${editButtonId}', '${menuId}', '编辑${functionName}', NULL, '${classNameFirstLower}Edit', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, '3', NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
INSERT INTO "SNOWY"."SYS_RESOURCE" VALUES ('${deleteButtonId}', '${menuId}', '删除${functionName}', NULL, '${classNameFirstLower}Delete', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, '4', NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
+
+
+INSERT INTO "SNOWY"."MOBILE_RESOURCE" VALUES ('${menuId}', '0', '${functionName}管理', NULL, 'MENU', '${moduleId}', 'MENU', '/pages/${moduleName}/${busName}/index', 'apartment-outlined', '#1890ff', 'YES', 'ENABLE', 99, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
+
+INSERT INTO "SNOWY"."MOBILE_RESOURCE" VALUES ('${addButtonId}', '${menuId}', '新增${functionName}', 'mobile${className}Add', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
+
+INSERT INTO "SNOWY"."MOBILE_RESOURCE" VALUES ('${editButtonId}', '${menuId}', '编辑${functionName}', 'mobile${className}Edit', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 2, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
+
+INSERT INTO "SNOWY"."MOBILE_RESOURCE" VALUES ('${deleteButtonId}', '${menuId}', '删除${functionName}', 'mobile${className}Delete', 'BUTTON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3, NULL, 'NOT_DELETE', NULL, NULL, NULL, NULL);
diff --git a/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/provider/MobileModuleApiProvider.java b/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/provider/MobileModuleApiProvider.java
new file mode 100644
index 00000000..d28ac0f7
--- /dev/null
+++ b/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/provider/MobileModuleApiProvider.java
@@ -0,0 +1,26 @@
+package vip.xiaonuo.mobile.modular.resource.provider;
+
+import cn.hutool.json.JSONObject;
+import org.springframework.stereotype.Service;
+import vip.xiaonuo.mobile.api.MobileModuleApi;
+import vip.xiaonuo.mobile.modular.resource.service.MobileModuleService;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 移动端模块API接口提供者
+ *
+ * @author 每天一点
+ * @date 2023/7/15 22:38
+ */
+@Service
+public class MobileModuleApiProvider implements MobileModuleApi {
+ @Resource
+ private MobileModuleService mobileModuleService;
+
+ @Override
+ public List mobileModuleSelector() {
+ return mobileModuleService.mobileModuleSelector();
+ }
+}
diff --git a/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/service/MobileModuleService.java b/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/service/MobileModuleService.java
index e31c625f..0da15e38 100644
--- a/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/service/MobileModuleService.java
+++ b/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/service/MobileModuleService.java
@@ -12,6 +12,7 @@
*/
package vip.xiaonuo.mobile.modular.resource.service;
+import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import vip.xiaonuo.mobile.modular.resource.entity.MobileModule;
@@ -77,4 +78,12 @@ public interface MobileModuleService extends IService {
* @date 2022/4/24 21:18
*/
MobileModule queryEntity(String id);
+
+ /**
+ * 获取移动端模块选择器
+ *
+ * @author 每天一点
+ * @date 2023/7/15 21:52
+ */
+ List mobileModuleSelector();
}
diff --git a/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/service/impl/MobileModuleServiceImpl.java b/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/service/impl/MobileModuleServiceImpl.java
index 8a991f12..cf7aa5be 100644
--- a/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/service/impl/MobileModuleServiceImpl.java
+++ b/snowy-plugin/snowy-plugin-mobile/src/main/java/vip/xiaonuo/mobile/modular/resource/service/impl/MobileModuleServiceImpl.java
@@ -18,6 +18,8 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -136,4 +138,14 @@ public class MobileModuleServiceImpl extends ServiceImpl mobileModuleSelector() {
+ LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>();
+ lambdaQueryWrapper.select(MobileModule::getId, MobileModule::getTitle);
+ lambdaQueryWrapper.eq(MobileModule::getCategory, MobileResourceCategoryEnum.MODULE.getValue());
+ lambdaQueryWrapper.orderByAsc(MobileModule::getSortCode);
+ return this.list(lambdaQueryWrapper).stream().map(item -> JSONUtil.createObj().set("id", item.getId()).set("name", item.getTitle()))
+ .collect(Collectors.toList());
+ }
}
diff --git a/snowy-web-app/src/main/resources/_sql/snowy_mysql.sql b/snowy-web-app/src/main/resources/_sql/snowy_mysql.sql
index 9b28a247..d1f2c536 100644
--- a/snowy-web-app/src/main/resources/_sql/snowy_mysql.sql
+++ b/snowy-web-app/src/main/resources/_sql/snowy_mysql.sql
@@ -525,6 +525,7 @@ CREATE TABLE `GEN_BASIC` (
`GENERATE_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生成方式',
`MODULE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属模块',
`MENU_PID` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级目录',
+ `MOBILE_MODULE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '移动端所属模块',
`FUNCTION_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '功能名',
`BUS_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务名',
`CLASS_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类名',