/**
* 创建Dao接口
* @param c实体类
* @param commonPackage 基础包:如com.jeff.tianti.info
* @param author 作者
* @param desc 描述
* @throws IOException
*/
public static void createDaoInterface(Class c,String commonPackage,String author) throws IOException{
String cName = c.getName();
String daoPath = "";
if(author == null || author.equals("")){
author = "Administrator";
}
if(commonPackage != null && !commonPackage.equals("")){
daoPath = commonPackage.replace(".", "/");
String fileName = System.getProperty("user.dir") + "/src/main/java/" + daoPath+"/dao"
+ "/" + getLastChar(cName) + "Dao.java";
File f = new File(fileName);
FileWriter fw = new FileWriter(f);
fw.write("package "+commonPackage+".dao"+";"+RT_2+"import "+commonPackage+".entity"+"."+getLastChar(cName)+";"+RT_1+"import com.jeff.tianti.common.dao.CommonDao;"+RT_2
+"/**"+RT_1+BLANK_1+"*"+BLANK_1+ANNOTATION_AUTHOR_PARAMTER+ author +RT_1
+BLANK_1+"*"+BLANK_1+ANNOTATION_DESC +getLastChar(cName)+"Dao接口"+BLANK_1+RT_1
+BLANK_1+"*"+BLANK_1+ANNOTATION_DATE +getDate()+RT_1+BLANK_1+"*/"+RT_1
+"public interface " +getLastChar(cName) +"Dao extends "+getLastChar(cName)+"DaoCustom,CommonDao<"+getLastChar(cName)+",String>{"+RT_2+"}");
fw.flush();
fw.close();
showInfo(fileName);
}else{
System.out.println("创建Dao接口失败,原因是commonPackage为空!");
}
}
GenCodeUtil.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:tianti
作者:
评论列表
文章目录