瀏覽代碼

修正:缓存代码生成的bug,按Map缓存的也注册为List了

master
郑根木 2 年之前
父節點
當前提交
479a1e2839
共有 4 個檔案被更改,包括 139 行新增537 行删除
  1. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java
  2. +11
    -11
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/area/AreaCache.java
  3. +2
    -2
      smtweb-framework/bpm/src/main/resources/static/template/java_cache.ftl
  4. +125
    -524
      smtweb-framework/core/src/main/resources/demo.json

+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/CodeBuildHandler.java 查看文件

@@ -164,6 +164,7 @@ public class CodeBuildHandler extends AbstractHandler {
fn.put("nameUF", CodeGenUtil.toUpperHump(name));
fn.put("title", cache.getTitle());
fn.put("fields", cache.getFields());
fn.put("type", cache.getType());
}

CodeGenerator.getInstance().generateCache(model, codePath + "/" + beanName + "Cache.java");


+ 11
- 11
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/area/AreaCache.java 查看文件

@@ -10,33 +10,33 @@ import java.util.List;
import java.util.Set;

/**
* Created by 1 at 2022-06-17 07:58:14
* Created by 1 at 2022-07-26 18:31:03
* 实体【[行政区划](SYS_AREA)】的缓存类
*/
@SwCache(ident = "SYS_AREA", title = "行政区划")
public class AreaCache extends AbstractEntityCache<Area> {
//缓存key:按父ID
public final static String mk_pr = "pr";
//缓存key:按编码
public final static String mk_code = "code";
//缓存key:按父ID
public final static String mk_pr = "pr";

public static AreaCache getInstance() {
return CacheManager.getIntance().getCache(AreaCache.class);
}

public AreaCache() {
//缓存key:按父ID
regList(mk_pr, "ar_parent_id");
//缓存key:按编码
regList(mk_code, "ar_code");
//缓存key:按编码 M
regMap(mk_code, "ar_code");
//缓存key:按父ID L
regList(mk_pr, "ar_parent_id");
}

//缓存key:按编码
public final Area getByCode(String key) {
return getByKey(mk_code, key);
}
//缓存key:按父ID
public final Set<Area> getByPr(String key) {
return getListByKey(mk_pr, key);
}
//缓存key:按编码
public final Set<Area> getByCode(String key) {
return getListByKey(mk_code, key);
}
}

+ 2
- 2
smtweb-framework/bpm/src/main/resources/static/template/java_cache.ftl 查看文件

@@ -28,9 +28,9 @@ public class ${beanName}Cache extends AbstractEntityCache<${beanName}> {
<#list caches as cache>
//缓存key:${cache.title}
<#if cache.type=="M">
regMap(mk_${cache.name}, "${cache.fields}");
regMap(mk_${cache.name}, "${cache.fields}");
<#else>
regList(mk_${cache.name}, "${cache.fields}");
regList(mk_${cache.name}, "${cache.fields}");
</#if>
</#list>
}


+ 125
- 524
smtweb-framework/core/src/main/resources/demo.json
文件差異過大導致無法顯示
查看文件


Loading…
取消
儲存