Java Code Examples for com.jfinal.kit.StrKit#toCamelCase()

The following examples show how to use com.jfinal.kit.StrKit#toCamelCase() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonUtils.java    From my_curd with Apache License 2.0 6 votes vote down vote up
/**
 * 把model转为map,驼峰命名
 *
 * @param model
 * @return
 */
public static Map<String, Object> modelToCamelCaseMap(Model model) {
    if (null == model) {
        return null;
    }
    String[] keys = model._getAttrNames();
    Map<String, Object> map = new HashMap<>();
    for (String key : keys) {
        Object value = model.get(key);
        key = StrKit.toCamelCase(key.toLowerCase());
        if (null != value) {
            map.put(key, value);
        }
    }
    return map;
}
 
Example 2
Source File: JsonUtils.java    From my_curd with Apache License 2.0 6 votes vote down vote up
/**
 * Record转为Map,驼峰命名
 *
 * @param record
 * @return
 */
public static Map<String, Object> recordToCamelCaseMap(Record record) {
    if (null == record) {
        return null;
    }
    String[] keys = record.getColumnNames();
    Map<String, Object> map = new HashMap<>();
    for (String key : keys) {
        Object value = record.get(key);
        key = StrKit.toCamelCase(key.toLowerCase());
        if (null != value) {
            map.put(key, value);
        }
    }
    return map;
}
 
Example 3
Source File: _JFCodeGenerator.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
public void htmlList(String className, TableMeta tablemeta) {
    String packages = toPackages();
    String classNameSmall = toClassNameSmall(className);
    String basePathUrl = basePath.replace('.', '/');

    Map<String, String> columnMap = new HashMap<>();

    for (ColumnMeta columnMeta :tablemeta.columnMetas
         ) {

        String desc = StringUtils.substringBetween(columnMeta.remarks, "[", "]");
        columnMap.put(columnMeta.attrName, desc);
    }

    String primaryKey = StrKit.toCamelCase(tablemeta.primaryKey);

    jfEngine.render("/html/index.vue",
            Kv.by("tablemeta", tablemeta)
                    .set("package", packages)
                    .set("className", className)
                    .set("columnMap", columnMap)
                    .set("primaryKey", primaryKey)
                    .set("classNameSmall", classNameSmall)
                    .set("basePath", basePathUrl)
            ,
            new StringBuilder()
                    .append(viewFolder)
                    .append("/")
                    .append(classNameSmall)
                    .append("List.html")
    );
}
 
Example 4
Source File: JbootJson.java    From jboot with Apache License 2.0 5 votes vote down vote up
protected void fillMapToMap(Map<String, Object> fillMap, Map<String, Object> toMap) {
    if (fillMap != null && !fillMap.isEmpty()) {
        for (Map.Entry<String, Object> entry : fillMap.entrySet()) {
            String fieldName = entry.getKey();
            if (isCamelCaseJsonStyleEnable) {
                fieldName = StrKit.toCamelCase(fieldName, camelCaseToLowerCaseAnyway);
            }
            toMap.put(fieldName, entry.getValue());
        }
    }
}
 
Example 5
Source File: OAController.java    From my_curd with Apache License 2.0 5 votes vote down vote up
/**
 * 流程实例表单申请详情
 */
public void processInstanceFormDetail() {
    String businessForm = getPara("businessForm");
    String businessKey = getPara("businessKey");
    if (StringUtils.isEmpty(businessForm)) {
        renderText("businessForm 缺失");
        return;
    }
    if (StringUtils.isEmpty(businessKey)) {
        renderText("businessKey 缺失");
        return;
    }
    String redirecturl = "/" + StrKit.toCamelCase(businessForm) + "/detail?id=" + businessKey;
    redirect(redirecturl);
}
 
Example 6
Source File: MyProcessController.java    From my_curd with Apache License 2.0 5 votes vote down vote up
/**
 * 新建流程弹窗 重定向 业务表 新增表单
 */
public void newProcessStep2() {
    String businessFormInfoId = getPara("businessFormInfoId");
    String formKey = getPara("formKey");
    if (StringUtils.isEmpty(businessFormInfoId) || StringUtils.isEmpty(formKey)) {
        renderFail("businessFormInfoId 或 formKey 参数缺失");
        return;
    }
    formKey = StrKit.toCamelCase(formKey);
    redirect("/" + formKey + "/newModel?businessFormInfoId=" + businessFormInfoId);
}
 
Example 7
Source File: MyProcessController.java    From my_curd with Apache License 2.0 5 votes vote down vote up
/**
 * 重定向 到 业务表单数据删除
 */
public void deleteProcess() {
    String formKey = getPara("formKey");        // 业务表名
    String businessKey = getPara("businessKey"); // 业务表主键
    if (StringUtils.isEmpty(formKey) || StringUtils.isEmpty(businessKey)) {
        renderFail("businessKey 或 businessForm 参数缺失");
        return;
    }
    formKey = StrKit.toCamelCase(formKey);
    redirect("/" + formKey + "/deleteAction?id=" + businessKey);
}
 
Example 8
Source File: MyTaskController.java    From my_curd with Apache License 2.0 5 votes vote down vote up
/**
 * 跳转到任务办理界面
 */
@Before(IdRequired.class)
public void goCompleteForm() {
    String taskId = getPara("id");
    Task task = ActivitiKit.getTaskService().createTaskQuery()
            .taskId(taskId).singleResult();

    set("taskName", task.getName());
    if (StringUtils.notEmpty(task.getDescription())) {
        set("taskDescription", task.getDescription());
    }
    set("taskId", task.getId());
    String processInstanceId = task.getProcessInstanceId();
    set("processInstanceId", processInstanceId);

    ProcessInstance processInstance = ActivitiKit.getRuntimeService().createProcessInstanceQuery()
            .processInstanceId(processInstanceId)
            .includeProcessVariables()
            .singleResult();

    String businessForm = (String) processInstance.getProcessVariables().get("businessForm");
    String initiator = (String) processInstance.getProcessVariables().get("initiator");
    String renderedTaskForm = (String) ActivitiKit.getFormService().getRenderedTaskForm(taskId);

    setAttr("initiator", initiator);  // 发起人
    setAttr("processInstanceName", processInstance.getName()); // 流程实例名
    setAttr("businessKey", processInstance.getBusinessKey()); // 业务表 id
    setAttr("businessForm", businessForm);  // 业务表名
    setAttr("renderedTaskForm", renderedTaskForm); // 任务表单

    // 如果是调整表单, 显示调整操作
    String taskDefinitionKey = task.getTaskDefinitionKey();
    setAttr("taskDefinitionKey", taskDefinitionKey);
    if ("adjustForm".equals(taskDefinitionKey)) {
        String adjustFormUrl = StrKit.toCamelCase(businessForm) + "/newModel?id=" + getAttr("businessKey");
        setAttr("adjustFormUrl", adjustFormUrl);
    }

    render("oa/myTask_complete.ftl");
}
 
Example 9
Source File: _JFCodeGenerator.java    From sdb-mall with Apache License 2.0 4 votes vote down vote up
public void vue(String className, TableMeta tablemeta) {
    boolean includeFlag = false;
    for (String includeClass:includedVueClass
            ) {
        if (includeClass.equalsIgnoreCase(className)) {
            includeFlag = true;
            break;
        }
    }

    if (!includeFlag) {
        return;
    }

    String packages = toPackages();
    String classNameSmall = toClassNameSmall(className);
    String basePathUrl = basePath.replace('.', '/');

    Map<String, String> columnMap = new HashMap<>();

    for (ColumnMeta columnMeta :tablemeta.columnMetas
         ) {

        String desc = StringUtils.substringBetween(columnMeta.remarks, "[", "]");
        columnMap.put(columnMeta.attrName, desc);
    }

    String primaryKey = StrKit.toCamelCase(tablemeta.primaryKey);

    jfEngine.render("/html/index.html",
            Kv.by("tablemeta", tablemeta)
                    .set("package", packages)
                    .set("className", className)
                    .set("columnMap", columnMap)
                    .set("primaryKey", primaryKey)
                    .set("classNameSmall", classNameSmall)
                    .set("basePath", basePathUrl)
            ,
            new StringBuilder()
                    .append(viewFolder)
                    .append("/")
                    .append(classNameSmall)
                    .append(".vue")
    );
}
 
Example 10
Source File: _JFCodeGenerator.java    From sdb-mall with Apache License 2.0 4 votes vote down vote up
public void vueAddUpdate(String className, TableMeta tablemeta) {
    boolean includeFlag = false;
    for (String includeClass:includedVueClass
            ) {
        if (includeClass.equalsIgnoreCase(className)) {
            includeFlag = true;
            break;
        }
    }

    if (!includeFlag) {
        return;
    }

    String packages = toPackages();
    String classNameSmall = toClassNameSmall(className);
    String basePathUrl = basePath.replace('.', '/');

    Map<String, String> columnMap = new HashMap<>();

    for (ColumnMeta columnMeta :tablemeta.columnMetas
         ) {

        String desc = StringUtils.substringBetween(columnMeta.remarks, "[", "]");
        columnMap.put(columnMeta.attrName, desc);
    }

    String primaryKey = StrKit.toCamelCase(tablemeta.primaryKey);

    jfEngine.render("/html/add-or-update.html",
            Kv.by("tablemeta", tablemeta)
                    .set("package", packages)
                    .set("className", className)
                    .set("columnMap", columnMap)
                    .set("primaryKey", primaryKey)
                    .set("classNameSmall", classNameSmall)
                    .set("basePath", basePathUrl)
            ,
            new StringBuilder()
                    .append(viewFolder)
                    .append("/")
                    .append(classNameSmall)
                    .append("-add-or-update")
                    .append(".vue")
    );
}