提交 a3783b8f 编写于 作者: sq3536's avatar sq3536

接口

上级 166278c9
......@@ -24,17 +24,29 @@ import java.util.Map;
@JsonIgnoreProperties(value = "handler")
public class EntityModel {
private String entityId;
public String getEntityId() {
return getEntity().getEntityId();
}
private String codeName;
public String getCodeName() {
return getEntity().getCodeName();
}
private String entityName;
public String getEntityName() {
return getEntity().getEntityName();
}
private String tableName;
public String getTableName() {
return getEntity().getTableName();
}
private String logicName;
public String getLogicName() {
return getEntity().getLogicName();
}
private String systemId;
public String getSystemId() {
return getEntity().getSystemId();
}
private MetaEntity entity;
......
......@@ -47,7 +47,7 @@ public class LiteCoreService {
@Transactional
public boolean syncSysModel(SysModel sysModel) {
// proxyService.asyncSysModel(sysModel);
//proxyService.asyncSysModel(sysModel);
return true;
}
......
......@@ -5,6 +5,8 @@ import cn.ibizlab.core.lite.extensions.domain.EntityModel;
import cn.ibizlab.core.lite.extensions.domain.FieldModel;
import cn.ibizlab.core.lite.extensions.domain.RelationshipModel;
import cn.ibizlab.core.lite.extensions.util.LiteStorage;
import cn.ibizlab.core.lite.filter.MetaEntitySearchContext;
import cn.ibizlab.core.lite.filter.MetaFieldSearchContext;
import cn.ibizlab.core.lite.service.*;
import cn.ibizlab.util.errors.BadRequestAlertException;
import com.alibaba.fastjson.JSON;
......@@ -68,6 +70,17 @@ public class LiteModelService {
@Lazy
private IDstComponentService dstComponentService;
public List<EntityModel> getEntityModel(String systemId)
{
List<EntityModel> list = new ArrayList<>();
metaEntityService.list(Wrappers.<MetaEntity>lambdaQuery().eq(MetaEntity::getSystemId,systemId).orderByAsc(MetaEntity::getEntityName)).forEach(entity -> {
EntityModel entityModel = new EntityModel();
entityModel.setEntity(entity);
list.add(entityModel);
});
return list;
}
@Cacheable( value="entitymodel",key = "'row:'+#p0+'.'+#p1")
public EntityModel getEntityModel(String systemId, String name)
{
......@@ -118,7 +131,11 @@ public class LiteModelService {
entityModel.setNesteds(nesteds);
List<FieldModel> fields = new ArrayList<>();
metaFieldService.selectByEntityId(entity.getEntityId()).forEach(item->
MetaFieldSearchContext searchContext = new MetaFieldSearchContext();
searchContext.setN_entityid_eq(entity.getEntityId());
searchContext.getSelectCond().orderByAsc("showorder");
searchContext.setSize(Integer.MAX_VALUE);
metaFieldService.searchDefault(searchContext).getContent().forEach(item->
{
FieldModel model = new FieldModel();
model.setField(item);
......
......@@ -40,6 +40,12 @@ public class LiteCoreResource {
@Lazy
LiteCoreService liteCoreService;
@RequestMapping(method = RequestMethod.GET, value = "/lite/{system}/entitys")
public ResponseEntity<List<EntityModel>> getEntityModel(@PathVariable("system") String system) {
return ResponseEntity.status(HttpStatus.OK).body(liteModelService.getEntityModel(system));
}
@RequestMapping(method = RequestMethod.GET, value = "/lite/{system}/entitys/{entity}")
public ResponseEntity<EntityModel> getEntityModel(@PathVariable("system") String system,@PathVariable("entity") String entity) {
return ResponseEntity.status(HttpStatus.OK).body(liteModelService.getEntityModel(system,entity));
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册