提交 808e8af8 编写于 作者: zhouweidong's avatar zhouweidong

同步预置代码表

上级 f70b4f0e
...@@ -100,7 +100,11 @@ public class DictCatalog extends EntityMP implements Serializable { ...@@ -100,7 +100,11 @@ public class DictCatalog extends EntityMP implements Serializable {
@JsonProperty("updatedate") @JsonProperty("updatedate")
private Timestamp updatedate; private Timestamp updatedate;
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
@JsonProperty("items")
private List<DictOption> options;
/** /**
* 设置 [代码] * 设置 [代码]
......
...@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.sql.Wrapper; import java.sql.Wrapper;
...@@ -136,4 +137,22 @@ public class DictCoreService ...@@ -136,4 +137,22 @@ public class DictCoreService
return trees; return trees;
} }
/**
* 同步预置代码表
* @param catalogs
*/
public void syncRuntimeDict(List<DictCatalog> catalogs){
List<DictOption> options=new ArrayList<>();
for(DictCatalog catalog : catalogs){
if(!ObjectUtils.isEmpty(catalog.getOptions()))
options.addAll(catalog.getOptions());
}
if(catalogs.size()>0){
dictCatalogService.saveBatch(catalogs);
}
if(options.size()>0){
optionService.saveBatch(options);
}
}
} }
...@@ -120,5 +120,11 @@ public class DictCoreResource { ...@@ -120,5 +120,11 @@ public class DictCoreResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@RequestMapping(method = RequestMethod.POST, value = "/dictionarys/catalogs/sync")
public ResponseEntity<Boolean> syncRuntimeDict(@RequestBody List<DictCatalog> catalogs){
dictCoreService.syncRuntimeDict(catalogs);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
} }
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册