Commit c45e854f by xxlv

Fix code structure

parent 4d620a71
tmp
.idea
\ No newline at end of file
.idea
quick_generator.egg-info
build
dist
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
<excludeFolder url="file://$MODULE_DIR$/quick_generator.egg-info" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
......
......@@ -7,9 +7,9 @@ import argparse
import xml.etree.ElementTree as ET
import re
DIR = "./template"
TMP = "./tmp"
JAR_PATH = "./jar"
DIR = os.path.join(".","template")
TMP = os.path.join(".","tmp")
JAR_PATH = os.path.join(".","jar")
MYBATIS_GEN_JAVA_PATH = "{}/java".format(TMP)
PO = ""
......@@ -211,7 +211,6 @@ def gen_po(res_name, project_target_path):
po_path = "{}/{}".format(MYBATIS_GEN_JAVA_PATH, "/".join(local_mybatis_config["po_path"].split(".")))
print(po_path)
gen_po_cmd = """
java -jar {}/mybatis-generator-core-1.3.6.jar -configfile {} -overwrite
""".format(JAR_PATH, local_mybatis_config_path)
......@@ -408,6 +407,7 @@ def gen(res_name, look_path):
# 编译文件
compiled_file_list = []
print(DIR)
for root, dirs, files in os.walk(DIR, False):
for file in files:
if (file[0] == "$"):
......@@ -445,7 +445,7 @@ def gen(res_name, look_path):
print("---------------------------------------------")
if __name__ == "__main__":
def main():
print("-------------------------")
print("Start Building your Resource")
print("Draw by ghost ")
......@@ -459,3 +459,7 @@ if __name__ == "__main__":
project_path = args.project_path
resource_name = args.resource_name
gen(resource_name, project_path)
if __name__ == "__main__":
main()
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.po;
public class ${PLACE} {
}
\ No newline at end of file
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.biz;
import com.${PACKAGE_LEVEL1}.common.service.IService;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.po.${PLACE};
public interface ${PLACE}Biz extends IService<${PLACE}> {
/**
* Create ${PLACE} Resource
*
* @param ${PLACE_VAR}
* @return
*/
${PLACE} create${PLACE}(${PLACE} ${PLACE_VAR});
}
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.biz.impl;
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;
import javax.annotation.Resource;
@Service
public class ${PLACE}BizImpl extends BaseService<${PLACE}> implements ${PLACE}Biz {
@Resource
private ${PLACE}Mapper ${PLACE_VAR}Mapper;
@Override
public ${PLACE} create${PLACE}(${PLACE} ${PLACE_VAR}) {
return null;
}
}
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.facade;
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.${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.dto.request.${PLACE}ReqDto;
import com.ydl.user.intf.dto.response.${PLACE}RespDto;
import com.ydl.user.intf.facade.${PLACE}Facade;
import com.ydl.user.service.biz.${PLACE}Biz;
import com.ydl.user.intf.po.${PLACE};
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class ${PLACE}FacadeImpl implements ${PLACE}Facade {
@Resource
private ${PLACE}Biz ${PLACE_VAR}Biz;
@Override
public BaseDtoResponse<${PLACE}RespDto> create${PLACE}(${PLACE}ReqDto ${PLACE_VAR}ReqDto) {
${PLACE} ${PLACE_VAR}=ModelMapperUtil.strictMap(${PLACE_VAR}ReqDto,${PLACE}.class);
${PLACE} ${PLACE_VAR}Stored=${PLACE_VAR}Biz.create${PLACE}(${PLACE_VAR});
${PLACE}RespDto ${PLACE_VAR}RespDto=ModelMapperUtil.strictMap(${PLACE_VAR}Stored,${PLACE}RespDto.class);
return ResponseFormatterHelper.success(${PLACE_VAR}RespDto);
}
}
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.dao;
import com.${PACKAGE_LEVEL1}.common.service.BaseMapper;
import com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.po.${PLACE};
public interface ${PLACE}Mapper extends BaseMapper<${PLACE}> {
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.service.dao.${PLACE}Mapper" >
</mapper>
\ No newline at end of file
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.dto.request;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
public class ${PLACE}ReqDto implements Serializable {
${PO}
}
package com.${PACKAGE_LEVEL1}.${PACKAGE_LEVEL2}.intf.dto.response;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
public class ${PLACE}RespDto implements Serializable{
${PO}
}
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="quick_generator",
version="0.0.1",
author="ghost",
author_email="lvxiang119@gmail.com",
description="Quickly code generator",
long_description=long_description,
packages=setuptools.find_packages(),
entry_points={
'console_scripts': ['gen=quick_generator.gen:main'],
}
)
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