mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-12 13:39:01 +08:00
♻️ Refactoring code. 优化代码生成
This commit is contained in:
1 parent
934f2ec361
commit
49966b1096
6 files changed
+20
-15
No files matched your search
+1
-1
@@ -44,7 +44,7 @@ import java.util.List;
|
||||
@Configuration
|
||||
@ConditionalOnBean(DataSource.class)
|
||||
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
|
||||
public class MybatisPlusConfig {
|
||||
public class MybatisPlusConfiguration {
|
||||
|
||||
/**
|
||||
* 创建租户维护处理器对象
|
||||
@@ -5,5 +5,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.pig4cloud.pigx.common.data.tenant.PigxTenantConfigProperties,\
|
||||
com.pig4cloud.pigx.common.data.tenant.TenantContextHolderFilter,\
|
||||
com.pig4cloud.pigx.common.data.tenant.PigxFeignTenantConfiguration,\
|
||||
com.pig4cloud.pigx.common.data.mybatis.MybatisPlusConfig,\
|
||||
com.pig4cloud.pigx.common.data.mybatis.MybatisPlusConfiguration,\
|
||||
com.pig4cloud.pigx.common.data.resolver.WebMvcConfig
|
||||
+14
-9
@@ -66,7 +66,7 @@ public class GenUtils {
|
||||
private final String MENU_SQL_VM = "menu.sql.vm";
|
||||
private final String AVUE_INDEX_VUE_VM = "avue/index.vue.vm";
|
||||
private final String ELE_INDEX_VUE_VM = "element/index.vue.vm";
|
||||
private final String ELE_ADD_UPDATE_VUE_VM = "element/add-or-update.vue.vm";
|
||||
private final String ELE_ADD_UPDATE_VUE_VM = "element/form.vue.vm";
|
||||
private final String AVUE_API_JS_VM = "avue/api.js.vm";
|
||||
private final String AVUE_CRUD_JS_VM = "avue/crud.js.vm";
|
||||
|
||||
@@ -89,7 +89,7 @@ public class GenUtils {
|
||||
|
||||
if (StyleTypeEnum.ELEMENT.getStyle().equals(config.getStyle())) {
|
||||
templates.add("template/element/index.vue.vm");
|
||||
templates.add("template/element/add-or-update.vue.vm");
|
||||
templates.add("template/element/form.vue.vm");
|
||||
} else {
|
||||
templates.add("template/avue/index.vue.vm");
|
||||
templates.add("template/avue/crud.js.vm");
|
||||
@@ -275,7 +275,9 @@ public class GenUtils {
|
||||
* 获取文件名
|
||||
*/
|
||||
private String getFileName(String template, String className, String packageName, String moduleName) {
|
||||
String packagePath = CommonConstants.BACK_END_PROJECT + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator;
|
||||
String packagePath = CommonConstants.BACK_END_PROJECT + File.separator + "src"
|
||||
+ File.separator + "main" + File.separator + "java" + File.separator;
|
||||
|
||||
if (StringUtils.isNotBlank(packageName)) {
|
||||
packagePath += packageName.replace(".", File.separator) + File.separator + moduleName + File.separator;
|
||||
}
|
||||
@@ -301,7 +303,8 @@ public class GenUtils {
|
||||
}
|
||||
|
||||
if (template.contains(MAPPER_XML_VM)) {
|
||||
return CommonConstants.BACK_END_PROJECT + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "mapper" + File.separator + className + "Mapper.xml";
|
||||
return CommonConstants.BACK_END_PROJECT + File.separator + "src" + File.separator + "main"
|
||||
+ File.separator + "resources" + File.separator + "mapper" + File.separator + className + "Mapper.xml";
|
||||
}
|
||||
|
||||
if (template.contains(MENU_SQL_VM)) {
|
||||
@@ -314,17 +317,19 @@ public class GenUtils {
|
||||
}
|
||||
|
||||
if (template.contains(AVUE_API_JS_VM)) {
|
||||
return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "api" + File.separator + className.toLowerCase() + ".js";
|
||||
return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "api"
|
||||
+ File.separator + className.toLowerCase() + ".js";
|
||||
}
|
||||
|
||||
if (template.contains(AVUE_CRUD_JS_VM)) {
|
||||
return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "const" +
|
||||
File.separator + "crud" + File.separator + className.toLowerCase() + ".js";
|
||||
return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "const"
|
||||
+ File.separator + "crud" + File.separator + className.toLowerCase() + ".js";
|
||||
}
|
||||
|
||||
if (template.contains(ELE_ADD_UPDATE_VUE_VM)) {
|
||||
return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "views" +
|
||||
File.separator + moduleName + File.separator + className.toLowerCase() + File.separator + moduleName + "-add-or-update.vue";
|
||||
return CommonConstants.FRONT_END_PROJECT + File.separator + "src" + File.separator + "views"
|
||||
+ File.separator + moduleName + File.separator + className.toLowerCase()
|
||||
+ File.separator + moduleName + "-form.vue.vm";
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<mapper namespace="com.pig4cloud.pigx.codegen.mapper.GeneratorMapper">
|
||||
<select id="queryList" resultType="map">
|
||||
select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables
|
||||
select table_name tableName, engine, table_comment tableComment, table_collation tableCollation, create_time createTime from information_schema.tables
|
||||
where table_schema = (select database())
|
||||
<if test="tableName != null and tableName.trim() != ''">
|
||||
and table_name like concat('%', #{tableName}, '%')
|
||||
|
||||
File renamed without changes.
@@ -45,14 +45,14 @@
|
||||
</el-pagination>
|
||||
</div>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<table-form v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></table-form>
|
||||
</basic-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {fetchList, delObj} from '@/api/${pathName}'
|
||||
import AddOrUpdate from './${pathName}-add-or-update'
|
||||
import TableForm from './${pathName}-form'
|
||||
import {mapGetters} from 'vuex'
|
||||
export default {
|
||||
data () {
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
TableForm
|
||||
},
|
||||
created () {
|
||||
this.getDataList()
|
||||
|
||||
Reference in new issue
Block a user