mirror of https://gitee.com/makejava/EasyCode.git
feat: 一套代码兼容多种平台
This commit is contained in:
parent
47132da355
commit
be02d792b5
|
@ -14,7 +14,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'com.sjhy'
|
group 'com.sjhy'
|
||||||
version '1.2.5-java.RELEASE'
|
version '1.2.5.RELEASE'
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
|
@ -95,12 +95,11 @@ public class TableInfoSettingsDTO {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DbTable dbTable = tableInfo.getObj();
|
DbTable dbTable = tableInfo.getObj();
|
||||||
PsiClass psiClass = tableInfo.getPsiClassObj();
|
|
||||||
String key;
|
String key;
|
||||||
if (dbTable != null) {
|
if (dbTable != null) {
|
||||||
key = generateKey(dbTable);
|
key = generateKey(dbTable);
|
||||||
} else if (psiClass != null) {
|
} else if (tableInfo.getPsiClassObj() != null) {
|
||||||
key = generateKey(psiClass);
|
key = generateKey((PsiClass) tableInfo.getPsiClassObj());
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.sjhy.plugin.entity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.intellij.database.psi.DbTable;
|
import com.intellij.database.psi.DbTable;
|
||||||
import com.intellij.psi.PsiClass;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -24,9 +23,11 @@ public class TableInfo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 原始对象(从实体生成)
|
* 原始对象(从实体生成)
|
||||||
|
*
|
||||||
|
* Note: 实际类型是com.intellij.psi.PsiClass,为了避免velocity反射出现ClassNotFound,写为Object类型
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private PsiClass psiClassObj;
|
private Object psiClassObj;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表名(首字母大写)
|
* 表名(首字母大写)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.intellij.openapi.module.Module;
|
||||||
import com.intellij.openapi.module.ModuleManager;
|
import com.intellij.openapi.module.ModuleManager;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.ui.Messages;
|
import com.intellij.openapi.ui.Messages;
|
||||||
|
import com.intellij.psi.PsiClass;
|
||||||
import com.intellij.util.ReflectionUtil;
|
import com.intellij.util.ReflectionUtil;
|
||||||
import com.sjhy.plugin.dict.GlobalDict;
|
import com.sjhy.plugin.dict.GlobalDict;
|
||||||
import com.sjhy.plugin.dto.GenerateOptions;
|
import com.sjhy.plugin.dto.GenerateOptions;
|
||||||
|
@ -80,7 +81,8 @@ public class CodeGenerateServiceImpl implements CodeGenerateService {
|
||||||
if (selectedTableInfo.getObj() != null) {
|
if (selectedTableInfo.getObj() != null) {
|
||||||
Messages.showInfoMessage(selectedTableInfo.getObj().getName() + "表配置信息不正确,请尝试重新配置", GlobalDict.TITLE_INFO);
|
Messages.showInfoMessage(selectedTableInfo.getObj().getName() + "表配置信息不正确,请尝试重新配置", GlobalDict.TITLE_INFO);
|
||||||
} else if (selectedTableInfo.getPsiClassObj() != null) {
|
} else if (selectedTableInfo.getPsiClassObj() != null) {
|
||||||
Messages.showInfoMessage(selectedTableInfo.getPsiClassObj().getName() + "类配置信息不正确,请尝试重新配置", GlobalDict.TITLE_INFO);
|
PsiClass psiClassObj = (PsiClass) selectedTableInfo.getPsiClassObj();
|
||||||
|
Messages.showInfoMessage(psiClassObj.getName() + "类配置信息不正确,请尝试重新配置", GlobalDict.TITLE_INFO);
|
||||||
} else {
|
} else {
|
||||||
Messages.showInfoMessage("配置信息不正确,请尝试重新配置", GlobalDict.TITLE_INFO);
|
Messages.showInfoMessage("配置信息不正确,请尝试重新配置", GlobalDict.TITLE_INFO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<idea-plugin>
|
||||||
|
|
||||||
|
<actions>
|
||||||
|
<!-- 实体类生成代码 -->
|
||||||
|
<action id="com.sjhy.plugin.actions.EasyCodeEntityAction"
|
||||||
|
class="com.sjhy.plugin.actions.EasyCodeEntityAction" text="EasyCode...">
|
||||||
|
<add-to-group group-id="GenerateGroup" anchor="last"/>
|
||||||
|
<add-to-group group-id="ProjectViewPopupMenu" anchor="last"/>
|
||||||
|
</action>
|
||||||
|
</actions>
|
||||||
|
|
||||||
|
</idea-plugin>
|
|
@ -234,8 +234,7 @@
|
||||||
<depends>com.intellij.modules.lang</depends>
|
<depends>com.intellij.modules.lang</depends>
|
||||||
<!--必须依赖Database Tool插件-->
|
<!--必须依赖Database Tool插件-->
|
||||||
<depends>com.intellij.database</depends>
|
<depends>com.intellij.database</depends>
|
||||||
<!--必须依赖Java环境-->
|
<depends optional="true" config-file="easycode-java.xml">com.intellij.modules.java</depends>
|
||||||
<depends>com.intellij.modules.java</depends>
|
|
||||||
|
|
||||||
<application-components>
|
<application-components>
|
||||||
<!--<component>-->
|
<!--<component>-->
|
||||||
|
@ -262,12 +261,6 @@
|
||||||
<!--生成代码菜单-->
|
<!--生成代码菜单-->
|
||||||
<add-to-group group-id="DatabaseViewPopupMenu" anchor="first"/>
|
<add-to-group group-id="DatabaseViewPopupMenu" anchor="first"/>
|
||||||
</group>
|
</group>
|
||||||
<!-- 实体类生成代码 -->
|
|
||||||
<action id="com.sjhy.plugin.actions.EasyCodeEntityAction"
|
|
||||||
class="com.sjhy.plugin.actions.EasyCodeEntityAction" text="EasyCode...">
|
|
||||||
<add-to-group group-id="GenerateGroup" anchor="last"/>
|
|
||||||
<add-to-group group-id="ProjectViewPopupMenu" anchor="last"/>
|
|
||||||
</action>
|
|
||||||
</actions>
|
</actions>
|
||||||
|
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
|
Loading…
Reference in New Issue