package com.eversec.kit.creator.impl.page;

import com.eversec.common.Kv;

import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * 创建 service.js
 * @author: liangxianyou at 2018/8/6 16:34.
 */
public class JsServiceKit extends PageKit {
    @Override
    public File getFile(String clazz) {
        String fileDir = getFileDir(clazz);
        return new File(dirPath + pageModel +"/" + fileDir + "/"+ fileDir +"Service.js");
    }

    @Override
    public String createStr(String clazz, List<Map> fieldList, Map para) {
        String fileDir = getFileDir(clazz);

        Kv kv = createTplData(clazz);
        kv.set("remark", para.get("remark"));
        kv.set("fileDir", fileDir);

        return engine.getTemplate(tplPath + "front/ServiceTpl.js").renderToString(kv);
    }
}
