博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
代码生成工具初步实现
阅读量:6179 次
发布时间:2019-06-21

本文共 5265 字,大约阅读时间需要 17 分钟。

<?xml version="1.0" encoding="utf-8" ?>

<project name="init" basedir=".">
 <target name="init" depends="initParameter">
  <copy file="template\${OldEntityName}." tofile="src\${newEntityName}.java" />
  <copy file="template\${OldEntityName}Dao.java" tofile="src\${newEntityName}Dao.java" />
  <copy file="template\${OldEntityName}DaoImpl.java" tofile="src\${newEntityName}DaoImpl.java" />
  <copy file="template\${OldEntityName}Service.java" tofile="src\${newEntityName}Service.java" />
  <copy file="template\${OldEntityName}ServiceImpl.java" tofile="src\${newEntityName}ServiceImpl.java" />
  <copy file="template\${OldEntityName}Action.java" tofile="src\${newEntityName}Action.java" />
  <copy file="template\${OldEntityName}Test.java" tofile="src\${newEntityName}ServiceTest.java" />

  <copy file="template\${oldentityname}.js" tofile="src\${newentityname}.js" />

  <copy file="template\${oldentityname}inc.txt" tofile="src\${newentityname}.inc" />

  <copy file="template\struts-${oldentityname}.xml" tofile="src\struts-${newentityname}.xml" />

  <copy file="template\${oldentityname}list.jsp" tofile="src\${newentityname}list.jsp" />

  <copy file="template\${oldentityname}save.jsp" tofile="src\${newentityname}save.jsp" />
  <copy file="template\${oldentityname}find.jsp" tofile="src\${newentityname}find.jsp" />
  <copy file="template\${oldentityname}update.jsp" tofile="src\${newentityname}update.jsp" />

  <replaceregexp match="${oldentityname}" replace="${newentityname}" byline="true">

   <fileset dir="src" includes="**/*.*" />
  </replaceregexp>

  <replaceregexp match="${OldEntityName}" replace="${NewEntityName}" byline="true">

   <fileset dir="src" includes="**/*.*" />
  </replaceregexp>

  <replaceregexp match="${oldmodulename}" replace="${newmodulename}" byline="true">

   <fileset dir="src" includes="**/*.*" />
  </replaceregexp>

  <replaceregexp match="${OldModuleName}" replace="${NewModuleName}" byline="true">

   <fileset dir="src" includes="**/*.*" />
  </replaceregexp>

 </target>

 <target name="copyNewFileToProject">

  <copy file="src\${NewEntityName}.java" tofile="${projectBasePath}\src\com\huike\hidp\system\${newmodulename}\vo\${NewEntityName}.java" />
  <copy file="src\${NewEntityName}Dao.java" tofile="${projectBasePath}\src\com\huike\hidp\system\${newmodulename}\dao\${NewEntityName}Dao.java" />
  <copy file="src\${NewEntityName}DaoImpl.java" tofile="${projectBasePath}\src\com\huike\hidp\system\${newmodulename}\dao\impl\${NewEntityName}Service.java" />
  <copy file="src\${NewEntityName}Service.java" tofile="${projectBasePath}\src\com\huike\hidp\system\${newmodulename}\service\${NewEntityName}Service.java" />
  <copy file="src\${NewEntityName}ServiceImpl.java" tofile="${projectBasePath}\src\com\huike\hidp\system\${newmodulename}\service\impl\${NewEntityName}Service.java" />
  <copy file="src\${NewEntityName}Action.java" tofile="${projectBasePath}\src\com\huike\hidp\system\${newmodulename}\action\${NewEntityName}Service.java" />
  <copy file="src\${NewEntityName}ServiceTest.java" tofile="${projectBasePath}\testsrc\com\huike\hidp\system\${newmodulename}\service\${NewEntityName}ServiceTest.java" />

 </target>

 <target name="initParameter">

  <property name="oldmodulename" value="informationmanager" />
  <property name="OldEntityName" value="Note" />

  <property name="oldModuleName" value="informationmanager" />

  <property name="oldEntityName2" value="note" />

  <property name="NewModuleName" value="Informationmanager" />

  <property name="newModuleName" value="informationmanager" />
  <property name="NewEntityName" value="Note" />
  <property name="newEntityName2" value="note" />
  <property name="projectBasePath" value="F:\Working\workspace\phmis" />
  <delete dir="WebRoot" />
  <delete dir="src" />
 </target>

 <target name="createTemplate">

  <property name="projectBasePath" value="F:\Working\workspace\phmis" />

  <property name="oldmodulename" value="informationmanager" />
  <property name="OldModuleName" value="Informationmanager" />
  <property name="NewModulename" value="Informationmanager" />
  <property name="OldEntityName" value="Note" />
  <property name="NewEntityName" value="Note" />

  <property name="ModuleClassName" value="InformationManager"/>

  

  <copy tofile="template\${NewEntityName}.java" file="${projectBasePath}\src\com\huike\hidp\system\${oldmodulename}\vo\${OldEntityName}.java" />

  <copy tofile="template\${NewModuleName}Dao.java" file="${projectBasePath}\src\com\huike\hidp\system\${oldmodulename}\dao\${OldModuleName}Dao.java" />
  <copy tofile="template\${NewModuleName}DaoImpl.java" file="${projectBasePath}\src\com\huike\hidp\system\${oldmodulename}\dao\impl\${OldModuleName}DaoImpl.java" />
  <copy tofile="template\${NewModuleName}Service.java" file="${projectBasePath}\src\com\huike\hidp\system\${oldmodulename}\service\${OldModuleName}Service.java" />
  <copy tofile="template\${NewModuleName}ServiceImpl.java" file="${projectBasePath}\src\com\huike\hidp\system\${oldmodulename}\service\impl\${OldModuleName}ServiceImpl.java" />
  <copy tofile="template\${NewModuleName}Action.java" file="${projectBasePath}\src\com\huike\hidp\system\${oldmodulename}\action\${OldModuleName}Service.java" />
  <copy tofile="template\${NewModuleName}ServiceTest.java" file="${projectBasePath}\testsrc\com\huike\hidp\system\${oldmodulename}\service\${ModuleClassName}ServiceTest.java" />
 </target>
</project>

转载地址:http://qnkda.baihongyu.com/

你可能感兴趣的文章
20 万网络节点背后的数据创新应用
查看>>
理论 | 朴素贝叶斯模型算法研究与实例分析
查看>>
docker安装gitlab只需要3分钟
查看>>
Android菜鸟学习js笔记 一
查看>>
Java基础之SPI机制
查看>>
使用js控制滚动条的位置
查看>>
【Tornado源码阅读笔记】tornado.web.Application
查看>>
lsyncd搭建测试
查看>>
移动web开发之像素和DPR
查看>>
nginx+tomcat+redis实现session共享
查看>>
UWP VirtualizedVariableSizedGridView 支持可虚拟化可变大小Item的View(二)
查看>>
rsync 介绍
查看>>
做一个合格的Team Leader -- 基本概念
查看>>
leetcode 190 Reverse Bits
查看>>
阿里巴巴发布AliOS品牌 重投汽车及IoT领域
查看>>
OPENCV图像处理(二):模糊
查看>>
glassfish4系统启动脚本
查看>>
VMware 虚拟化编程(13) — VMware 虚拟机的备份方案设计
查看>>
独家 | 一文读懂推荐系统知识体系-下(评估、实战、学习资料)
查看>>
UIEvent&amp;nbsp;UIResponder&amp;nbsp;UI_04
查看>>