Commit 9bcbcb29 by xxlv

Fix typo

parent 932182e8
......@@ -2,10 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1abc04e8-e167-42cd-98ea-074bbb2150ed" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/template/${PLACE}Biz.java" beforeDir="false" afterPath="$PROJECT_DIR$/template/${PLACE}Biz.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/template/${PLACE}Facade.java" beforeDir="false" afterPath="$PROJECT_DIR$/template/${PLACE}Facade.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/template/${PLACE}FacadeImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/template/${PLACE}FacadeImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tmp/DemoFacadeImpl.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gen.py" beforeDir="false" afterPath="$PROJECT_DIR$/gen.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
......@@ -14,8 +12,33 @@
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CoverageDataManager">
<SUITE FILE_PATH="coverage/quick_tpl$gen.coverage" NAME="gen Coverage Results" MODIFIED="1528859310664" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
<component name="FileEditorManager">
<leaf />
<leaf>
<file leaf-file-name="gen.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/gen.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="461">
<caret line="176" lean-forward="true" selection-start-line="176" selection-end-line="176" />
<folding>
<element signature="e#42#51#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="generatorConfig.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tmp/generatorConfig.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" column="29" lean-forward="true" selection-start-line="17" selection-start-column="29" selection-end-line="17" selection-end-column="29" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
<findStrings>
......@@ -35,6 +58,8 @@
<option value="$PROJECT_DIR$/template/${PLACE}Facade.java" />
<option value="$PROJECT_DIR$/template/${PLACE}FacadeImpl.java" />
<option value="$PROJECT_DIR$/template/${PLACE}Biz.java" />
<option value="$PROJECT_DIR$/heml.py" />
<option value="$PROJECT_DIR$/gen.py" />
</list>
</option>
</component>
......@@ -53,14 +78,14 @@
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="AndroidView" />
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
......@@ -71,12 +96,20 @@
<path>
<item name="quick_tpl" type="b2602c69:ProjectViewProjectNode" />
<item name="quick_tpl" type="462c0819:PsiDirectoryNode" />
<item name="template" type="462c0819:PsiDirectoryNode" />
<item name="jar" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="quick_tpl" type="b2602c69:ProjectViewProjectNode" />
<item name="quick_tpl" type="462c0819:PsiDirectoryNode" />
<item name="tmp" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="AndroidView" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -97,6 +130,25 @@
</option>
</component>
<component name="RunManager">
<configuration name="gen" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="quick_tpl" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/gen.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
</configuration>
......@@ -138,6 +190,11 @@
<properties />
<listeners />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.gen" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
......@@ -158,61 +215,87 @@
</component>
<component name="ToolWindowManager">
<frame x="67" y="25" width="1853" height="1055" extended-state="6" />
<editor active="true" />
<layout>
<window_info anchor="right" id="Palette" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="FindBugs-IDEA" />
<window_info anchor="right" id="Palette&#9;" />
<window_info id="Image Layers" />
<window_info anchor="right" id="Capture Analysis" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="right" id="Maven Projects" />
<window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Version Control" />
<window_info anchor="bottom" id="Terminal" />
<window_info id="Capture Tool" />
<window_info id="Designer" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24958494" />
<window_info anchor="right" id="Database" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info id="UI Designer" />
<window_info anchor="right" id="Theme Preview" />
<window_info anchor="bottom" id="TODO" order="13" />
<window_info anchor="bottom" id="Event Log" order="20" side_tool="true" />
<window_info anchor="bottom" id="Database Changes" order="5" show_stripe_button="false" />
<window_info anchor="bottom" id="Run" order="0" weight="0.329718" />
<window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="bottom" id="Python Console" order="10" />
<window_info active="true" anchor="bottom" id="Terminal" order="6" visible="true" weight="0.329718" />
<window_info content_ui="combo" id="Project" order="0" weight="0.24958494" />
<window_info anchor="bottom" id="Docker" order="12" show_stripe_button="false" />
<window_info anchor="right" id="Database" order="11" />
<window_info anchor="right" id="SciView" order="8" />
<window_info id="Structure" order="2" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info id="Favorites" side_tool="true" />
<window_info id="Favorites" order="9" side_tool="true" />
<window_info anchor="bottom" id="FindBugs-IDEA" order="15" />
<window_info id="Designer" order="4" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="bottom" id="Python Console" order="21" />
<window_info anchor="bottom" id="Run" order="4" />
<window_info id="Image Layers" order="5" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="9" weight="0.25" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info id="Capture Tool" order="6" />
<window_info id="UI Designer" order="7" />
<window_info id="Favorites" order="8" side_tool="true" />
<window_info anchor="bottom" id="Terminal" order="16" />
<window_info anchor="bottom" id="Docker" order="22" show_stripe_button="false" />
<window_info anchor="right" id="Capture Analysis" order="4" />
<window_info anchor="bottom" id="Event Log" order="17" side_tool="true" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info content_ui="combo" id="Project" order="1" weight="0.25" />
<window_info anchor="bottom" id="Database Changes" order="18" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="19" />
<window_info anchor="right" id="Maven Projects" order="5" />
<window_info anchor="bottom" id="Inspection" order="11" weight="0.4" />
<window_info anchor="right" id="SciView" order="10" />
<window_info anchor="right" id="Database" order="6" />
<window_info anchor="bottom" id="Message" order="1" />
<window_info anchor="bottom" id="TODO" order="14" />
<window_info anchor="right" id="Palette&#9;" order="7" />
<window_info anchor="right" id="Theme Preview" order="9" />
<window_info id="Structure" order="3" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Find" order="2" />
<window_info anchor="bottom" id="Debug" order="7" weight="0.4" />
</layout>
<layout-to-restore>
<window_info anchor="bottom" id="FindBugs-IDEA" order="7" />
<window_info id="Designer" order="2" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="bottom" id="Python Console" order="9" />
<window_info anchor="bottom" id="Python Console" order="12" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info id="Image Layers" order="2" />
<window_info id="Image Layers" order="3" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info id="Capture Tool" order="2" />
<window_info id="UI Designer" order="2" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Terminal" order="7" />
<window_info anchor="bottom" id="Docker" order="9" show_stripe_button="false" />
<window_info anchor="right" id="Capture Analysis" order="3" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
<window_info id="Capture Tool" order="4" />
<window_info id="UI Designer" order="5" />
<window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Terminal" order="8" />
<window_info anchor="bottom" id="Docker" order="13" show_stripe_button="false" />
<window_info anchor="right" id="Capture Analysis" order="4" />
<window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="right" id="Maven Projects" order="3" />
<window_info anchor="bottom" id="Database Changes" order="10" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="11" />
<window_info anchor="right" id="Maven Projects" order="5" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info content_ui="combo" id="Project" order="0" weight="0.25" />
<window_info anchor="right" id="SciView" order="5" />
<window_info anchor="right" id="Database" order="3" />
<window_info anchor="right" id="SciView" order="9" />
<window_info anchor="right" id="Database" order="6" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="right" id="Palette&#9;" order="3" />
<window_info anchor="right" id="Theme Preview" order="3" />
<window_info anchor="right" id="Palette&#9;" order="7" />
<window_info anchor="right" id="Theme Preview" order="8" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
</layout>
</layout-to-restore>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
......@@ -221,90 +304,6 @@
<option name="myLimit" value="2678400000" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/template/${PLACE}Facade.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}FacadeImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" lean-forward="true" selection-start-line="8" selection-end-line="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="12" column="17" lean-forward="true" selection-start-line="12" selection-start-column="17" selection-end-line="12" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="12" column="17" lean-forward="true" selection-start-line="12" selection-start-column="17" selection-end-line="12" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}Facade.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="11" column="80" selection-start-line="11" selection-start-column="80" selection-end-line="11" selection-end-column="80" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="12" column="17" lean-forward="true" selection-start-line="12" selection-start-column="17" selection-end-line="12" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}Facade.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="12" column="17" lean-forward="true" selection-start-line="12" selection-start-column="17" selection-end-line="12" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}Facade.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}FacadeImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="21" column="5" selection-start-line="21" selection-start-column="5" selection-end-line="21" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="12" column="17" lean-forward="true" selection-start-line="12" selection-start-column="17" selection-end-line="12" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}Facade.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" selection-start-line="1" selection-end-line="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}FacadeImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
......@@ -550,10 +549,10 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen.py">
<entry file="file://$PROJECT_DIR$/template/${PLACE}FacadeImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="12" column="17" lean-forward="true" selection-start-line="12" selection-start-column="17" selection-end-line="12" selection-end-column="17" />
<state>
<caret column="8" selection-start-column="8" selection-end-column="8" />
</state>
</provider>
</entry>
......@@ -564,17 +563,64 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}FacadeImpl.java">
<entry file="file://$PROJECT_DIR$/template/${PLACE}Biz.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="22" lean-forward="true" selection-start-line="22" selection-end-line="22" />
<state relative-caret-position="210">
<caret line="14" column="51" lean-forward="true" selection-start-line="14" selection-start-column="51" selection-end-line="14" selection-end-column="51" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}Biz.java">
<entry file="file://$PROJECT_DIR$/template/${PLACE}BizImpl.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/heml.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}Mapper.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
<caret line="4" column="9" lean-forward="true" selection-start-line="4" selection-start-column="9" selection-end-line="4" selection-end-column="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tmp/SystemlogMapper.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/tmp/SystemlogFacade.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/tmp/SystemlogBiz.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/tmp/Systemlog.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/tmp/SystemlogFacadeImpl.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/tmp/SystemlogMapper.xml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/tmp/SystemlogRespDto.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/tmp/DemoBiz.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/tmp/generatorConfig.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" column="29" lean-forward="true" selection-start-line="17" selection-start-column="29" selection-end-line="17" selection-end-column="29" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="16" lean-forward="true" selection-start-line="16" selection-end-line="16" />
<state relative-caret-position="461">
<caret line="176" lean-forward="true" selection-start-line="176" selection-end-line="176" />
<folding>
<element signature="e#42#51#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
......
......@@ -4,16 +4,22 @@
import os
import shutil
import argparse
import xml.etree.ElementTree as ET
DIR = "./template"
TMP = "./tmp"
JAR_PATH = "./jar"
def parse_ydl_project(path):
# target_path
# target_pathtarget-path-intf
# target_path/target-pathr-service
# 如果满足当前的目录结构 就认为是YDL project
"""
target_path
target_pathtarget-path-intf
target_path/target-pathr-service
如果满足当前的目录结构 就认为是YDL project
:param path:
:return:
"""
name = os.path.realpath(path)
abs_path = name.split("/")[0:-1]
identity = name.split("/")[-1]
......@@ -22,9 +28,11 @@ def parse_ydl_project(path):
package2 = project_prefix.split("-")[1]
interface_path = "/".join(abs_path + [identity, project_prefix, "{}-intf".format(project_prefix)])
service_path = "/".join(abs_path + [identity, project_prefix, "{}-service".format(project_prefix)])
intf_facade_path = "{}/{}".format(interface_path, "src/main/java/com/{}/{}/intf/facade".format(package1, package2))
intf_req_dto_path = "{}/{}".format(interface_path,
"src/main/java/com/{}/{}/intf/dto/request".format(package1, package2))
intf_resp_dto_path = "{}/{}".format(interface_path,
......@@ -38,30 +46,23 @@ def parse_ydl_project(path):
service_biz_impl_path = "{}/{}".format(service_path,
"src/main/java/com/{}/{}/service/biz/impl".format(package1, package2))
service_dao_path = "{}/{}".format(service_path, "src/main/java/com/{}/{}/service/dao".format(package1, package2))
service_sql_xml_path = "{}/{}".format(service_path, "src/main/resources/sqlmap")
# print("Interface facade path is {}".format(intf_facade_path))
# print("Interface req dto path is {}".format(intf_req_dto_path))
# print("Interface resp dto path is {}".format(intf_resp_dto_path))
# print("Interface po path is {}".format(intf_po_path))
# print("Service facade impl path is {}".format(service_facade_impl_path))
# print("Service biz intf path is {}".format(service_intf_biz_path))
# print("Service biz impl path is {}".format(service_biz_impl_path))
# print("Service dao path is {}".format(service_dao_path))
# print("Service sql xml path is {}".format(service_sql_xml_path))
service_sql_mybatis_generator_config_path = "{}/{}".format(service_path,
"src/main/resources/mybatis/generatorConfig.xml")
d = dict()
d["intf_facade_path"] = intf_facade_path
d["intf_req_dto_path"] = intf_req_dto_path
d["intf_resp_dto_path"] = intf_resp_dto_path
d["intf_po_path"] = intf_po_path
d["service_intf_biz_path"] = service_intf_biz_path
d["service_facade_impl_path"] = service_facade_impl_path
d["service_biz_impl_path"] = service_biz_impl_path
d["service_sql_xml_path"] = service_sql_xml_path
d["service_dao_path"] = service_dao_path
d["mybatis_config_path"] = service_sql_mybatis_generator_config_path
for id, path in d.iteritems():
if (not os.path.exists(path)):
......@@ -83,7 +84,6 @@ def safe_cpfile(f, target_path_map, res_name):
print("开始copy 文件{}".format(f))
print("-------------------------------------")
identity = f.split("/")[-1]
categories_map = dict()
categories_map["{}Facade.java".format(res_name)] = "intf_facade_path"
......@@ -102,7 +102,6 @@ def safe_cpfile(f, target_path_map, res_name):
print("目标 {} 不存在".format(target_path))
exit(-1)
try:
shutil.move(f, target_path)
except Exception as e:
......@@ -110,13 +109,93 @@ def safe_cpfile(f, target_path_map, res_name):
print("无法移动 [{}] -_-".format(e.message))
exit(-1)
print("move 当前的文件{} 到 {}".format(f, target_path))
# 编译内容
def compile_content(compile_table, origin, tmp):
def is_po(res_name, identity):
print("检测po {} {}".format(res_name, identity.split("/")[-1]))
return "{}.java".format(res_name) == identity.split("/")[-1]
def config_mybatis(res_name, table_name, mybatis_config_path):
"""
重写mybatis generatorConfig
:param res_name:
:param table_name:
:param mybatis_config_path:
:return:
"""
print("-----------------------------------------------")
print("修改 {}".format(mybatis_config_path))
print("-----------------------------------------------")
head = """
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
"""
root = ET.parse(mybatis_config_path)
e = ET.Element("table", tableName=table_name, domainObjectName=res_name, enableCountByExample="false",
enableDeleteByExample="false", enableSelectByExample="false", enableUpdateByExample="false",
selectByExampleQueryId="false")
context = root.find("context")
context.append(e)
tmp_mybatis_path = os.path.join(TMP, "generatorConfig.xml")
root.write(tmp_mybatis_path,encoding="utf-8")
return tmp_mybatis_path
def gen_po(res_name, project_target_path):
"""
生成po 调用mybatis 的generator
:param res_name:
:param project_target_path:
:return:
"""
mybatis_config_path = project_target_path['mybatis_config_path']
if (not os.path.exists(mybatis_config_path)):
print("Mybatis 路径有误")
exit(-1)
tables_name = res_name
local_mybatis_config=config_mybatis(res_name, tables_name, mybatis_config_path)
gen_po_cmd = """
java -jar {}/mybatis-generator-core-1.3.6.jar -configfile {} -overwrite
""".format(JAR_PATH, local_mybatis_config)
print("----------------------------------------")
print(gen_po_cmd)
print("----------------------------------------")
# os.system(gen_po_cmd)
return "PO"
def rewrite_mybatis_config():
pass
# 编译内容
def compile_content(res_name, compile_table, origin, tmp, project_target_path):
"""
编译内容
:param res_name:
:param compile_table:
:param origin:
:param tmp:
:param project_target_path:
:return:
"""
if not os.path.isdir(tmp):
os.mkdir(tmp)
......@@ -129,9 +208,16 @@ def compile_content(compile_table, origin, tmp):
with open(identity, "w+") as f:
f.write(compile(body, compile_table))
# 检测如果当前的文件是PO的话,使用mybatis 生成po
if is_po(res_name, identity):
print("发现po {}".format(identity))
with open(identity, "w+") as f:
f.write(gen_po(res_name, project_target_path))
print("--------------------------------")
print("成功编译文件 {} [{}]".format(identity, len(body)))
print("--------------------------------")
return identity
......@@ -143,13 +229,31 @@ def compile(body, compile_table):
return body
# clean tmp dir
def clean_tmp():
"""
清空临时目录
:return:
"""
for root, dirs, files in os.walk(TMP, False):
for file in files:
os.remove(os.path.join(root, file))
print("清空目录 {}".format(TMP))
# gen
def gen(res_name, look_path):
"""
核心逻辑
:param res_name:
:param look_path:
:return:
"""
clean_tmp()
res_name = res_name[0].upper() + res_name[1:]
print("----------------------------------")
print("你的资源名称为 {}".format(res_name))
print("----------------------------------")
......@@ -165,7 +269,6 @@ def gen(res_name, look_path):
compile_table = dict()
compile_table['${PLACE}'] = "{}{}".format(res_name[0].upper(), res_name[1:])
compile_table['${PLACE_VAR}'] = "{}{}".format(res_name[0].lower(), res_name[1:])
print("--------------------------------------")
print("编译常量表")
print("--------------------------------------")
......@@ -174,21 +277,19 @@ def gen(res_name, look_path):
for root, dirs, files in os.walk(DIR, False):
for file in files:
if (file[0] == "$"):
compiled_file = compile_content(compile_table, os.path.join(root, file), TMP)
safe_cpfile(compiled_file, PROJECT_TARGET_PATH, res_name)
def clean_tmp():
for root, dirs, files in os.walk(TMP, False):
for file in files:
os.remove(os.path.join(root, file))
print("清空目录 {}".format(TMP))
compiled_file = compile_content(res_name, compile_table, os.path.join(root, file), TMP,
PROJECT_TARGET_PATH)
# safe_cpfile(compiled_file, PROJECT_TARGET_PATH, res_name)
if __name__ == "__main__":
print("-------------------------")
print("Start Building your Resource")
print("Draw by ghost ")
print("-------------------------")
parser = argparse.ArgumentParser(description="Auto create Resource for ydl java project")
parser.add_argument('--verbose', '-v', action='store_true', help='verbose mode')
parser.add_argument("resource_name")
parser.add_argument("project_path")
args = parser.parse_args()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment