Browse Source

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

master
郑根木 2 years ago
parent
commit
479a1e2839
4 changed files with 139 additions and 537 deletions
  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 View File

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


CodeGenerator.getInstance().generateCache(model, codePath + "/" + beanName + "Cache.java"); 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 View File

@@ -10,33 +10,33 @@ import java.util.List;
import java.util.Set; 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)】的缓存类 * 实体【[行政区划](SYS_AREA)】的缓存类
*/ */
@SwCache(ident = "SYS_AREA", title = "行政区划") @SwCache(ident = "SYS_AREA", title = "行政区划")
public class AreaCache extends AbstractEntityCache<Area> { public class AreaCache extends AbstractEntityCache<Area> {
//缓存key:按父ID
public final static String mk_pr = "pr";
//缓存key:按编码 //缓存key:按编码
public final static String mk_code = "code"; public final static String mk_code = "code";
//缓存key:按父ID
public final static String mk_pr = "pr";


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


public AreaCache() { 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 //缓存key:按父ID
public final Set<Area> getByPr(String key) { public final Set<Area> getByPr(String key) {
return getListByKey(mk_pr, 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 View File

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


+ 125
- 524
smtweb-framework/core/src/main/resources/demo.json
File diff suppressed because it is too large
View File


Loading…
Cancel
Save