mirror of
https://github.com/getrebuild/rebuild.git
synced 2025-10-06 13:40:00 +08:00
hotfix:be
This commit is contained in:
parent
f64d397c31
commit
b0d02d7c08
4 changed files with 41 additions and 3 deletions
|
@ -777,6 +777,10 @@ public class FormsBuilder extends FormsManager {
|
|||
inFormFields.contains(field) ? new Object[] { mixValue } : value);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// v3.9 其他类型,需要限制字段类型???
|
||||
initialValReady.put(field, value);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
@ -109,7 +109,6 @@ public class TableBuilder {
|
|||
continue;
|
||||
}
|
||||
|
||||
System.out.println(last.prev + " <> " + current.prev);
|
||||
if (last.content.equals(current.content) && Objects.equals(last.prev, current.prev)) {
|
||||
last.rowspan++;
|
||||
current.rowspan = 0;
|
||||
|
|
|
@ -150,7 +150,6 @@ public class TableChart extends ChartData {
|
|||
StringUtils.join(dimSqlItems, ", "),
|
||||
StringUtils.join(numSqlItems, ", "),
|
||||
getSourceEntity().getName(), getFilterSql(nums.length > 0 ? nums[0] : null));
|
||||
System.out.println(sql);
|
||||
|
||||
return appendSqlSort(sql);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import cn.devezhao.commons.web.ServletUtils;
|
|||
import cn.devezhao.persist4j.Entity;
|
||||
import cn.devezhao.persist4j.Field;
|
||||
import cn.devezhao.persist4j.Record;
|
||||
import cn.devezhao.persist4j.dialect.FieldType;
|
||||
import cn.devezhao.persist4j.engine.ID;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONAware;
|
||||
|
@ -20,9 +21,12 @@ import com.rebuild.api.RespBody;
|
|||
import com.rebuild.core.Application;
|
||||
import com.rebuild.core.metadata.EntityHelper;
|
||||
import com.rebuild.core.metadata.MetadataHelper;
|
||||
import com.rebuild.core.metadata.MetadataSorter;
|
||||
import com.rebuild.core.metadata.easymeta.DisplayType;
|
||||
import com.rebuild.core.service.DataSpecificationException;
|
||||
import com.rebuild.core.service.query.AdvFilterParser;
|
||||
import com.rebuild.core.service.query.ParseHelper;
|
||||
import com.rebuild.core.service.query.QueryHelper;
|
||||
import com.rebuild.utils.JSONUtils;
|
||||
import com.rebuild.web.BaseController;
|
||||
import com.rebuild.web.IdParam;
|
||||
|
@ -34,14 +38,17 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 非业务实体操作(如系统实体)
|
||||
*
|
||||
* @author devezhao
|
||||
* @since 2020/11/6
|
||||
* @see com.rebuild.core.Application#getService(int)
|
||||
* @see Application#getService(int)
|
||||
* @see GeneralOperatingController
|
||||
*/
|
||||
@Slf4j
|
||||
|
@ -81,6 +88,35 @@ public class CommonOperatingController extends BaseController {
|
|||
return RespBody.ok(record);
|
||||
}
|
||||
|
||||
@RequestMapping("common-find")
|
||||
public RespBody find(HttpServletRequest request) {
|
||||
String k = getParameterNotNull(request, "k");
|
||||
Object id = getParameterNotNull(request, "id");
|
||||
|
||||
String[] ef = k.split("\\.");
|
||||
Entity findEntity = MetadataHelper.getEntity(ef[0]);
|
||||
Field findField = findEntity.getField(ef[1]);
|
||||
String sql = String.format("select %s from %s where %s = ?",
|
||||
findEntity.getPrimaryField().getName(), findEntity.getName(), findField.getName());
|
||||
// 引用字段查名称
|
||||
if (findField.getType() == FieldType.REFERENCE) {
|
||||
if (ID.isId(id)) {
|
||||
id = ID.valueOf(id.toString());
|
||||
} else {
|
||||
Set<Field> queryFields = new HashSet<>();
|
||||
queryFields.add(findField.getReferenceEntity().getNameField());
|
||||
queryFields.addAll(Arrays.asList(MetadataSorter.sortFields(findField.getReferenceEntity(), DisplayType.SERIES)));
|
||||
id = QueryHelper.queryIdValue(queryFields.toArray(new Field[0]), id.toString(), false);
|
||||
}
|
||||
}
|
||||
|
||||
Object[] found = id == null ? null
|
||||
: Application.createQueryNoFilter(sql).setParameter(1, id).unique();
|
||||
|
||||
if (found != null) return RespBody.ok(JSONUtils.toJSONObject("id", found[0]));
|
||||
return RespBody.ok(JSONUtils.toJSONObject("entity", findEntity.getName()));
|
||||
}
|
||||
|
||||
@RequestMapping("common-list")
|
||||
public RespBody list(HttpServletRequest request) {
|
||||
JSONObject queryBody = (JSONObject) ServletUtils.getRequestJson(request);
|
||||
|
|
Loading…
Add table
Reference in a new issue