Commit 5c4cb6c1 by xxlv

Fix tpl

parent b001e2b3
......@@ -2,8 +2,15 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1abc04e8-e167-42cd-98ea-074bbb2150ed" name="Default" comment="">
<change afterPath="$PROJECT_DIR$/README.md" afterDir="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" />
<change beforePath="$PROJECT_DIR$/template/${PLACE}.java" beforeDir="false" afterPath="$PROJECT_DIR$/template/${PLACE}.java" afterDir="false" />
<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}BizImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/template/${PLACE}BizImpl.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$/template/${PLACE}Mapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/template/${PLACE}Mapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/template/${PLACE}ReqDto.java" beforeDir="false" afterPath="$PROJECT_DIR$/template/${PLACE}ReqDto.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/template/${PLACE}RespDto.java" beforeDir="false" afterPath="$PROJECT_DIR$/template/${PLACE}RespDto.java" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
......@@ -17,11 +24,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="gen.py" pinned="false" current-in-tab="false">
<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="329" column="36" selection-start-line="329" selection-start-column="36" selection-end-line="329" selection-end-column="36" />
<state relative-caret-position="270">
<caret line="284" column="11" selection-start-line="284" selection-start-column="11" selection-end-line="284" selection-end-column="11" />
<folding>
<element signature="e#42#51#0" expanded="true" />
</folding>
......@@ -29,15 +36,6 @@
</provider>
</entry>
</file>
<file leaf-file-name="README.md" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="435">
<caret line="29" lean-forward="true" selection-start-line="29" selection-end-line="29" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
......@@ -46,8 +44,8 @@
<find>{}/dat</find>
<find>clean_tmp</find>
<find>gen_po</find>
<find>config_mybatis</find>
<find>compile_table</find>
<find>config_mybatis</find>
</findStrings>
<replaceStrings>
<replace>${PLACE}</replace>
......@@ -60,14 +58,19 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<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$/tmp/generatorConfig.xml" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/gen.py" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/template/${PLACE}.java" />
<option value="$PROJECT_DIR$/template/${PLACE}Biz.java" />
<option value="$PROJECT_DIR$/template/${PLACE}BizImpl.java" />
<option value="$PROJECT_DIR$/template/${PLACE}Facade.java" />
<option value="$PROJECT_DIR$/template/${PLACE}FacadeImpl.java" />
<option value="$PROJECT_DIR$/template/${PLACE}Mapper.java" />
<option value="$PROJECT_DIR$/template/${PLACE}ReqDto.java" />
<option value="$PROJECT_DIR$/template/${PLACE}RespDto.java" />
<option value="$PROJECT_DIR$/gen.py" />
</list>
</option>
</component>
......@@ -101,6 +104,11 @@
<item name="quick_tpl" type="b2602c69:ProjectViewProjectNode" />
<item name="quick_tpl" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="quick_tpl" type="b2602c69:ProjectViewProjectNode" />
<item name="quick_tpl" type="462c0819:PsiDirectoryNode" />
<item name="template" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
......@@ -221,7 +229,7 @@
<window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="bottom" id="Python Console" order="9" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Terminal" order="7" visible="true" weight="0.329718" />
<window_info active="true" anchor="bottom" id="Terminal" order="7" visible="true" weight="0.329718" />
<window_info content_ui="combo" id="Project" order="0" weight="0.25235197" />
<window_info anchor="bottom" id="Docker" order="9" show_stripe_button="false" />
<window_info anchor="right" id="Database" order="3" />
......@@ -252,23 +260,24 @@
<window_info id="Designer" order="2" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="bottom" id="Python Console" order="12" />
<window_info id="Image Layers" order="3" />
<window_info anchor="bottom" id="Run" 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="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="Terminal" order="8" visible="true" weight="0.329718" />
<window_info anchor="bottom" id="Docker" order="13" show_stripe_button="false" />
<window_info anchor="right" id="Capture Analysis" order="4" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.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="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 active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24958494" />
<window_info anchor="bottom" id="Find" order="1" weight="0.329718" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25235197" />
<window_info anchor="right" id="SciView" order="9" />
<window_info anchor="right" id="Database" order="6" />
<window_info anchor="bottom" id="Message" order="0" />
......@@ -277,7 +286,6 @@
<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" weight="0.329718" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
</layout-to-restore>
</component>
......@@ -302,20 +310,6 @@
</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">
......@@ -463,24 +457,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}FacadeImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="8" selection-start-column="8" selection-end-column="8" />
</state>
</provider>
</entry>
<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" />
<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" />
<entry file="file://$PROJECT_DIR$/tmp/SystemlogFacade.java" />
<entry file="file://$PROJECT_DIR$/tmp/SystemlogBiz.java" />
......@@ -489,23 +466,6 @@
<entry file="file://$PROJECT_DIR$/tmp/SystemlogMapper.xml" />
<entry file="file://$PROJECT_DIR$/tmp/SystemlogRespDto.java" />
<entry file="file://$PROJECT_DIR$/tmp/DemoBiz.java" />
<entry file="file://$PROJECT_DIR$/template/${PLACE}ReqDto.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="9" lean-forward="true" selection-start-line="8" selection-start-column="9" selection-end-line="8" selection-end-column="9" />
</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}Mapper.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/ydl-login-intf/src/main/java/com/ydl/login/intf/po/DoctorModify.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
......@@ -541,34 +501,90 @@
</state>
</provider>
</entry>
<entry file="file:///usr/lib/python2.7/re.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="137" column="4" selection-start-line="137" selection-start-column="4" selection-end-line="137" selection-end-column="4" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="435">
<caret line="29" lean-forward="true" selection-start-line="29" selection-end-line="29" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="47" selection-start-column="47" selection-end-column="47" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}Biz.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" column="45" selection-start-line="3" selection-start-column="45" selection-end-line="3" selection-end-column="45" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}BizImpl.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="21" selection-start-column="21" selection-end-column="21" />
<caret column="46" selection-start-column="46" selection-end-column="46" />
</state>
</provider>
</entry>
<entry file="file:///usr/lib/python2.7/re.py">
<entry file="file://$PROJECT_DIR$/template/${PLACE}Facade.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="137" column="4" selection-start-line="137" selection-start-column="4" selection-end-line="137" selection-end-column="4" />
<state relative-caret-position="75">
<caret line="5" column="80" lean-forward="true" selection-start-line="5" selection-start-column="80" selection-end-line="5" selection-end-column="80" />
</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="461">
<caret line="329" column="36" selection-start-line="329" selection-start-column="36" selection-end-line="329" selection-end-column="36" />
<folding>
<element signature="e#42#51#0" expanded="true" />
</folding>
<state relative-caret-position="135">
<caret line="9" column="33" lean-forward="true" selection-start-line="9" selection-start-column="33" selection-end-line="9" selection-end-column="33" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<entry file="file://$PROJECT_DIR$/template/${PLACE}Mapper.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="435">
<caret line="29" lean-forward="true" selection-start-line="29" selection-end-line="29" />
<state relative-caret-position="75">
<caret line="5" column="62" lean-forward="true" selection-start-line="5" selection-start-column="62" selection-end-line="5" selection-end-column="62" />
</state>
</provider>
</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$/template/${PLACE}ReqDto.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" lean-forward="true" selection-start-line="7" selection-end-line="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/template/${PLACE}RespDto.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="46" selection-start-column="46" selection-end-column="46" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gen.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="284" column="11" selection-start-line="284" selection-start-column="11" selection-end-line="284" selection-end-column="11" />
<folding>
<element signature="e#42#51#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
......
......@@ -5,6 +5,7 @@ import os
import shutil
import argparse
import xml.etree.ElementTree as ET
import re
DIR = "./template"
TMP = "./tmp"
......@@ -189,7 +190,7 @@ def gen_po(res_name, project_target_path):
print("Mybatis 路径有误")
exit(-1)
tables_name = res_name
tables_name = get_table_name(res_name)
local_mybatis_config = config_mybatis(res_name, tables_name, mybatis_config_path)
......@@ -279,6 +280,25 @@ def clean_tmp():
print("清空目录 {}".format(TMP))
def get_res_name(res_name):
# TODO
# 转化为驼峰
pass
def get_table_name(res_name):
table_name = ""
res_name = res_name[0:1].lower() + res_name[1:]
for i in range(0, len(res_name)):
t = res_name[i]
if (t.isupper()):
t = "".join(["_", t.lower()])
table_name = "".join([table_name, t])
return table_name
def gen(res_name, look_path):
"""
核心逻辑
......@@ -288,8 +308,7 @@ def gen(res_name, look_path):
:return:
"""
clean_tmp()
res_name = res_name[0].upper() + res_name[1:]
res_name = get_res_name(res_name)
print("----------------------------------")
print("你的资源名称为 {}".format(res_name))
print("----------------------------------")
......@@ -308,7 +327,6 @@ def gen(res_name, look_path):
compile_table['${PLACE}'] = "{}{}".format(res_name[0].upper(), res_name[1:])
compile_table['${PLACE_VAR}'] = "{}{}".format(res_name[0].lower(), res_name[1:])
import re
intf = PROJECT_TARGET_PATH["intf_po_path"]
p = re.compile("[\s\S]*\/(.+)\-intf\/[\s\S]*")
......@@ -344,6 +362,10 @@ def gen(res_name, look_path):
PROJECT_TARGET_PATH)
safe_cpfile(compiled_file, PROJECT_TARGET_PATH, res_name)
print("---------------------------------------------")
print("你已经成功的生成了代码")
print("---------------------------------------------")
if __name__ == "__main__":
print("-------------------------")
......@@ -354,7 +376,6 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Auto create Resource for ydl java project")
parser.add_argument('--verbose', '-v', action='store_true', help='debug mode')
parser.add_argument("resource_name")
parser.add_argument("package")
parser.add_argument("project_path")
args = parser.parse_args()
......
package com.ydl.user.intf.po;
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL1}.intf.po;
public class ${PLACE} {
......
package com.ydl.user.service.biz;
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.biz;
import com.ydl.common.service.IService;
import com.ydl.user.intf.po.${PLACE};
import com.${PACKAGE_LEVEL1}.common.service.IService;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.po.${PLACE};
public interface ${PLACE}Biz extends IService<${PLACE}> {
......
package com.ydl.user.service.biz.impl;
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.biz.impl;
import com.ydl.user.intf.po.${PLACE};
import com.ydl.user.service.biz.${PLACE}Biz;
import com.ydl.user.service.dao.${PLACE}Mapper;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.po.${PLACE};
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.biz.${PLACE}Biz;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.dao.${PLACE}Mapper;
import org.springframework.stereotype.Service;
import com.ydl.common.service.impl.BaseService;
......
package com.ydl.user.intf.facade;
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.facade;
import com.ydl.common.dto.BaseDtoResponse;
import com.ydl.user.intf.dto.request.{PLACE}ReqDto;
import com.ydl.user.intf.dto.response.{PLACE}RespDto;
import com.${PACKAGE_LEVEL1}.common.dto.BaseDtoResponse;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.dto.request.{PLACE}ReqDto;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.dto.response.{PLACE}RespDto;
public interface ${PLACE}Facade {
BaseDtoResponse<${PLACE}RespDto> create${PLACE}(${PLACE}ReqDto ${PLACE_VAR}ReqDto);
......
package com.ydl.user.service.facade;
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.facade;
import com.ydl.common.dto.BaseDtoResponse;
import com.ydl.common.helper.ResponseFormatterHelper;
import com.ydl.common.utils.ModelMapperUtil;
import com.ydl.user.intf.facade.${PLACE}Facade;
import com.ydl.user.service.biz.${PLACE}Biz;
import com.${PACKAGE_LEVEL1}.common.dto.BaseDtoResponse;
import com.${PACKAGE_LEVEL1}.common.helper.ResponseFormatterHelper;
import com.${PACKAGE_LEVEL1}.common.utils.ModelMapperUtil;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.facade.${PLACE}Facade;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.biz.${PLACE}Biz;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......
package com.ydl.user.service.dao;
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.dao;
import com.ydl.common.service.BaseMapper;
import com.ydl.user.intf.po.${PLACE};
import com.${PACKAGE_LEVEL1}.common.service.BaseMapper;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.po.${PLACE};
public interface ${PLACE}Mapper extends BaseMapper<${PLACE}> {
}
package com.ydl.user.intf.dto.request;
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.dto.request;
import java.io.Serializable;
......
package com.ydl.user.intf.dto.response;
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.dto.response;
public class ${PLACE}RespDto {
......
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