package com.brframework.generate.template; import com.brframework.generate.BaseUtil; import com.brframework.generate.Constant; import com.brframework.generate.base.JavaFile; import java.util.LinkedList; import java.util.List; import java.util.Map; /** * @Author: ljr * @Date: 2019/8/15 10:37 * @Description: */ public class ServiceInterfaceFile extends JavaFile { public ServiceInterfaceFile(String route, String packageDir, String entity, String function, Map notes) { fileDir = route + "/" + Constant.PACKAGE_SERVICE + "/" + function; packageDir = BaseUtil.toPackage(packageDir); String className = BaseUtil.getClassWithoutSuffix(entity); fileName = BaseUtil.getClassWithModule(entity, Constant.MODULE_SERVICE) + Constant.SUFFIX_CLASS_TYPE; filePackageName = packageDir + "." + Constant.PACKAGE_SERVICE + "." + function; type = Constant.INTERFACE_TYPE; name = BaseUtil.getClassWithModule(entity, Constant.MODULE_SERVICE ); String extendsService = "EntityService"; List imports = getImports(packageDir, function, entity, extendsService); List classAnnotations = getClassAnnotations(); List extendss = getExtendss(extendsService, className); List implementss = getImplementss(); List fields = getFields(); List methods = getMethods(); super.init(imports, notes, classAnnotations, extendss, implementss, fields, methods); } public List getImports(String mainPackage, String function, String entity, String extendsService){ List imports = new LinkedList<>(); imports.add(BaseUtil.getImportName(mainPackage, function, entity, Constant.PACKAGE_ENTITY).toString()); imports.add("com.brframework.commondb.core." + extendsService); return imports; } public List getClassAnnotations(){ List classAnnotations = new LinkedList<>(); return classAnnotations; } public List getExtendss(String extendsService, String className){ List extendss = new LinkedList<>(); extendss.add(extendsService + "<" + className +", Long, " + "Object>"); return extendss; } public List getImplementss(){ List implementss = new LinkedList<>(); return implementss; } public List getFields(){ List fields = new LinkedList<>(); return fields; } public List getMethods(){ List methods = new LinkedList<>(); //methods,lombok不需要方法 return methods; } }