diff --git a/.gitignore b/.gitignore index c53e733..320970e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,9 @@ out/ .idea *.iml *.zip +*.DS_Store build/ .gradle .sandbox -gradle.properties \ No newline at end of file +gradle.properties diff --git a/LICENSE b/LICENSE index 906b0c9..d1400dc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright © 2019 CodeGen +Copyright © 2020 CodeGen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in diff --git a/README.md b/README.md index 582737a..24eaa4e 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,6 @@ https://www.jetbrains.com/help/idea/meet-intellij-idea.html * [IceMimosa](https://github.com/IceMimosa) ## License -Copyright © 2019 [MIT License](https://github.com/hykes/CodeGen/blob/master/LICENSE) +Copyright © 2020 [MIT License](https://github.com/hykes/CodeGen/blob/master/LICENSE) diff --git a/build.gradle b/build.gradle index 989b829..c232ec3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,26 +1,28 @@ buildscript { repositories { - mavenLocal() - mavenCentral() + maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url "https://plugins.gradle.org/m2/" } } dependencies { - classpath "gradle.plugin.org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.4.3" + classpath "gradle.plugin.org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.4.21" } } plugins { - id 'org.jetbrains.intellij' version '0.4.3' + id 'java' + id 'org.jetbrains.intellij' version '0.4.21' } group 'me.hehaiyang.codegen' -version '1.3.0' +version '1.3.2' + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 apply plugin: 'idea' -apply plugin: 'org.jetbrains.intellij' +apply plugin: "org.jetbrains.intellij" apply plugin: 'java' -sourceCompatibility = 1.8 -targetCompatibility = 1.8 repositories { mavenLocal() @@ -34,8 +36,8 @@ dependencies { } intellij { -// version '2017.3.1' localPath ideaSDKlocalPath pluginName 'CodeGen' sandboxDirectory = project.rootDir.canonicalPath + "/.sandbox" + plugins = ['java'] } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b1cd79a..0a16f31 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun May 05 15:28:40 CST 2019 +#Sun Jul 26 21:46:05 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip diff --git a/src/main/java/com/github/hykes/codegen/configurable/ui/TemplatesUI.java b/src/main/java/com/github/hykes/codegen/configurable/ui/TemplatesUI.java index 5fdcb93..f202a5c 100644 --- a/src/main/java/com/github/hykes/codegen/configurable/ui/TemplatesUI.java +++ b/src/main/java/com/github/hykes/codegen/configurable/ui/TemplatesUI.java @@ -412,9 +412,9 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, if (obj instanceof CodeRoot) { CodeRoot node = (CodeRoot) obj; DefaultTreeCellRenderer tempCellRenderer = new DefaultTreeCellRenderer(); - tempCellRenderer.setOpenIcon(AllIcons.Nodes.JavaModuleRoot); - tempCellRenderer.setClosedIcon(AllIcons.Nodes.JavaModuleRoot); - tempCellRenderer.setLeafIcon(AllIcons.Nodes.JavaModuleRoot); + tempCellRenderer.setOpenIcon(AllIcons.Nodes.JavaModule); + tempCellRenderer.setClosedIcon(AllIcons.Nodes.JavaModule); + tempCellRenderer.setLeafIcon(AllIcons.Nodes.JavaModule); return tempCellRenderer.getTreeCellRendererComponent(tree, node.getName(), selected, expanded, false, row, hasFocus); } else if (obj instanceof CodeGroup) { diff --git a/src/main/java/com/github/hykes/codegen/configurable/ui/action/TemplateAddAction.java b/src/main/java/com/github/hykes/codegen/configurable/ui/action/TemplateAddAction.java index cc32bf9..b5f18fd 100644 --- a/src/main/java/com/github/hykes/codegen/configurable/ui/action/TemplateAddAction.java +++ b/src/main/java/com/github/hykes/codegen/configurable/ui/action/TemplateAddAction.java @@ -94,7 +94,7 @@ private List getMultipleActions(DefaultMutableTreeNode selectedNode) { class CodeRootAddAction extends AnAction { public CodeRootAddAction() { - super("Code Root", null, AllIcons.Nodes.JavaModuleRoot); + super("Code Root", null, AllIcons.Nodes.JavaModule); } @Override diff --git a/src/main/java/com/github/hykes/codegen/gui/SelectPathDialog.java b/src/main/java/com/github/hykes/codegen/gui/SelectPathDialog.java index 286b25a..5dd0f3d 100644 --- a/src/main/java/com/github/hykes/codegen/gui/SelectPathDialog.java +++ b/src/main/java/com/github/hykes/codegen/gui/SelectPathDialog.java @@ -6,6 +6,7 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.project.Project; +import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.PackageChooser; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.JavaDirectoryService; @@ -63,9 +64,9 @@ public void actionPerformed(ActionEvent e) { descriptor.setShowFileSystemRoots(false); descriptor.setDescription("Select output path"); descriptor.setHideIgnored(true); - descriptor.setRoots(project.getBaseDir()); + descriptor.setRoots(ProjectRootManager.getInstance(project).getContentRoots()); descriptor.setForcedToUseIdeaFileChooser(true); - VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, project.getBaseDir()); + VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, project.getProjectFile()); if (Objects.nonNull(virtualFile)) { String output = virtualFile.getPath(); PsiDirectory psiDirectory = PsiDirectoryFactory.getInstance(project).createDirectory(virtualFile); diff --git a/src/main/java/com/github/hykes/codegen/utils/PsiUtil.java b/src/main/java/com/github/hykes/codegen/utils/PsiUtil.java index d7c9342..fbf21f4 100644 --- a/src/main/java/com/github/hykes/codegen/utils/PsiUtil.java +++ b/src/main/java/com/github/hykes/codegen/utils/PsiUtil.java @@ -11,6 +11,7 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.project.Project; +import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiClass; @@ -86,9 +87,9 @@ public static PsiDirectory createDirectory(Project project, String title, String descriptor.setShowFileSystemRoots(false); descriptor.setDescription(description); descriptor.setHideIgnored(true); - descriptor.setRoots(project.getBaseDir()); + descriptor.setRoots(ProjectRootManager.getInstance(project).getContentRoots()); descriptor.setForcedToUseIdeaFileChooser(true); - VirtualFile file = FileChooser.chooseFile(descriptor, project, project.getBaseDir()); + VirtualFile file = FileChooser.chooseFile(descriptor, project, project.getProjectFile()); if(Objects.isNull(file)){ Messages.showInfoMessage("Cancel " + title, "Error"); return null; diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 78feb8a..605147d 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ me.hehaiyang.codegen CodeGen - 1.3.1 + 1.3.2 hykes com.intellij.modules.lang --> com.intellij.database + com.intellij.modules.java diff --git a/src/main/resources/mapper/AppQuotationProductsMapper.xml b/src/main/resources/mapper/AppQuotationProductsMapper.xml new file mode 100644 index 0000000..db3cad7 --- /dev/null +++ b/src/main/resources/mapper/AppQuotationProductsMapper.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + app_quotation_products + + + + id, + + + + + `quotation_id`, `product_id`, created_at, updated_at + + + + #{quotationId}, #{productId}, now(), now() + + + + + AND `quotation_id` = #{quotationId} + AND `product_id` = #{productId} + AND = #{createdAt}]]> + AND + + + + + INSERT INTO + + () + VALUES + () + + + + INSERT INTO + + () + VALUES + + (#{i.quotationId}, #{i.productId}, now(), now()) + + + + + + + + + UPDATE + + + `quotation_id` = #{quotationId}, + `product_id` = #{productId}, + updated_at = now() + + WHERE id = #{id} + + + + DELETE FROM + + WHERE id = #{id} + + + + + + + + +