All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.silentgo.orm.generate.TableDaoGenerate Maven / Gradle / Ivy

There is a newer version: 0.3.2
Show newest version
package com.silentgo.orm.generate;

import com.silentgo.orm.base.BaseDao;
import com.silentgo.utils.StringKit;

/**
 * Project : parent
 * Package : com.silentgo.orm.generate
 *
 * @author teddyzhu
 *         

* Created by teddyzhu on 16/9/28. */ public class TableDaoGenerate { public String run(TableMeta tableMeta, String packageName, String modelPackage) { StringBuilder builder = new StringBuilder(); builder.append(format(ClassConst._package, packageName)); builder.append(format(ClassConst._importOne, BaseDao.class.getName())); if (!packageName.equals(modelPackage)) { builder.append(format(ClassConst._importOne, modelPackage + "." + StringKit.firstToUpper(tableMeta.getName()))); } builder.append(format(ClassConst._importOne, "com.silentgo.core.ioc.annotation.Service")); builder.append(format(ClassConst._annotaion, "Service")); builder.append(format(ClassConst._interfaceclassbody_extend_t, StringKit.firstToUpper(tableMeta.getName()) + "Dao", BaseDao.class.getSimpleName(), StringKit.firstToUpper(tableMeta.getName()), "")); return builder.toString(); } private String format(String string, Object... objects) { string = string.replace("$s", "%s"); return String.format(string, objects); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy