|
|
@@ -261,7 +261,11 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
}
|
|
|
if (StrUtil.isNotBlank(field)) {
|
|
|
Order order = new Order();
|
|
|
- order.setDirection(StrUtil.equalsIgnoreCase(orderStr, "descend") ? Direction.DESC : Direction.ASC);
|
|
|
+ order.setDirection(Direction.ASC);
|
|
|
+ if (orderStr.equals("descend") || orderStr.equals("desc")) {
|
|
|
+ order.setDirection(Direction.DESC);
|
|
|
+ }
|
|
|
+// order.setDirection(StrUtil.equalsIgnoreCase(orderStr, "descend") ? Direction.DESC : Direction.ASC);
|
|
|
order.setField(field);
|
|
|
page.setOrder(order);
|
|
|
}
|
|
|
@@ -838,7 +842,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
TableConfig tableConfig = mainTable.get();
|
|
|
String tableName = tableConfig.getTableName();
|
|
|
|
|
|
- Optional<TableStructureConfig> mainConfig = formDesignConfig.getTableStructureConfigs().stream().filter(x->x.getTableName().equals(tableName)).findFirst();
|
|
|
+ Optional<TableStructureConfig> mainConfig = formDesignConfig.getTableStructureConfigs().stream().filter(x -> x.getTableName().equals(tableName)).findFirst();
|
|
|
|
|
|
if (!mainConfig.isPresent()) {
|
|
|
throw new MyException("主表不存在");
|
|
|
@@ -891,7 +895,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
}
|
|
|
|
|
|
//构建子表单数据
|
|
|
- wrapperChildEntity(datasource, tableConfigList, childMaps, formData, formDesignConfig,keyValue, autoCodeList);
|
|
|
+ wrapperChildEntity(datasource, tableConfigList, childMaps, formData, formDesignConfig, keyValue, autoCodeList);
|
|
|
|
|
|
|
|
|
//此时的formData 已经是剔除了子表单数据了
|
|
|
@@ -969,7 +973,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
Entity where = Entity.create(tableName).set(pk.getName(), keyValue2);
|
|
|
|
|
|
//构建子表单数据
|
|
|
- wrapperChildEntity(datasource, tableConfigList, childMaps, formData, formDesignConfig,keyValue2, null);
|
|
|
+ wrapperChildEntity(datasource, tableConfigList, childMaps, formData, formDesignConfig, keyValue2, null);
|
|
|
|
|
|
// 处理字段值
|
|
|
formData = handleFormDataForSave(formData, formDesignConfig, tableName, null);
|
|
|
@@ -1132,7 +1136,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
//构建子表单数据
|
|
|
//深拷贝一份表单数据 避免修改原表单数据
|
|
|
Map<String, Object> newFormData = ObjectUtil.cloneIfPossible(formData);
|
|
|
- Map<String, List<Map<String, Object>>> childFormData = wrapperChildEntity(datasource, tableConfigList, childMaps, newFormData, formDesignConfig,keyValue, null);
|
|
|
+ Map<String, List<Map<String, Object>>> childFormData = wrapperChildEntity(datasource, tableConfigList, childMaps, newFormData, formDesignConfig, keyValue, null);
|
|
|
|
|
|
// 处理字段值
|
|
|
newFormData = handleFormDataForSave(newFormData, formDesignConfig, tableName, null);
|
|
|
@@ -1147,9 +1151,9 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
Session session = Session.create(datasource);
|
|
|
session.beginTransaction();
|
|
|
|
|
|
- if (pk.getTypeName().equals("varchar")){ //常用主键为String类型,默认为Long类型
|
|
|
+ if (pk.getTypeName().equals("varchar")) { //常用主键为String类型,默认为Long类型
|
|
|
where = where.set(pk.getName(), keyValue.toString());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
where = where.set(pk.getName(), keyValue);
|
|
|
}
|
|
|
// 更新主表数据
|
|
|
@@ -1219,7 +1223,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
Long keyValue = MapUtil.get(formData, pk.getName(), Long.class);
|
|
|
|
|
|
//如果不为空就是更新
|
|
|
- if(ObjectUtil.isNotNull(keyValue)){
|
|
|
+ if (ObjectUtil.isNotNull(keyValue)) {
|
|
|
//where 拼接 id
|
|
|
Entity where = Entity.create(tableName).set(pk.getName(), keyValue);
|
|
|
|
|
|
@@ -1227,7 +1231,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
//构建子表单数据
|
|
|
//深拷贝一份表单数据 避免修改原表单数据
|
|
|
Map<String, Object> newFormData = ObjectUtil.cloneIfPossible(formData);
|
|
|
- Map<String, List<Map<String, Object>>> childFormData = wrapperChildEntity(datasource, tableConfigList, childMaps, newFormData, formDesignConfig,keyValue, null);
|
|
|
+ Map<String, List<Map<String, Object>>> childFormData = wrapperChildEntity(datasource, tableConfigList, childMaps, newFormData, formDesignConfig, keyValue, null);
|
|
|
|
|
|
// 处理字段值
|
|
|
Map<String, Object> toSaveFormData = handleFormDataForSave(newFormData, formDesignConfig, tableName, null);
|
|
|
@@ -1275,17 +1279,17 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
//深拷贝一份表单数据 避免修改原表单数据
|
|
|
Map<String, Object> newFormData = ObjectUtil.cloneIfPossible(formData);
|
|
|
|
|
|
- if(ObjectUtil.isNull(newFormData)){
|
|
|
+ if (ObjectUtil.isNull(newFormData)) {
|
|
|
newFormData = new HashMap<>();
|
|
|
}
|
|
|
// 自动编码code
|
|
|
List<String> autoCodeList = new ArrayList<>();
|
|
|
- Map<String, List<Map<String, Object>>> childFormData = wrapperChildEntity(datasource, tableConfigList, childMaps, newFormData, formDesignConfig,keyValue, autoCodeList);
|
|
|
+ Map<String, List<Map<String, Object>>> childFormData = wrapperChildEntity(datasource, tableConfigList, childMaps, newFormData, formDesignConfig, keyValue, autoCodeList);
|
|
|
|
|
|
// 处理字段值
|
|
|
Map<String, Object> toSaveFormData = handleFormDataForSave(newFormData, formDesignConfig, tableName, autoCodeList);
|
|
|
toSaveFormData.put(pk.getName(), keyValue);
|
|
|
- formData.put(pk.getName(),keyValue);
|
|
|
+ formData.put(pk.getName(), keyValue);
|
|
|
//此时的formData 已经是剔除了子表单数据了
|
|
|
where.putAll(toSaveFormData);
|
|
|
|
|
|
@@ -1369,8 +1373,8 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
//如果是日期类型 默认设置查询参数为两个
|
|
|
if (queryConfig.getIsDate()) {
|
|
|
//根据查询配置的字段名 从参数里面找到对应的值 如果是时间类型 需要查询start 和 end
|
|
|
- String startTime = MapUtil.get(params,queryConfig.getFieldName() + GlobalConstant.START_TIME_SUFFIX,String.class);
|
|
|
- String endTime = MapUtil.get(params,queryConfig.getFieldName() + GlobalConstant.END_TIME_SUFFIX,String.class);
|
|
|
+ String startTime = MapUtil.get(params, queryConfig.getFieldName() + GlobalConstant.START_TIME_SUFFIX, String.class);
|
|
|
+ String endTime = MapUtil.get(params, queryConfig.getFieldName() + GlobalConstant.END_TIME_SUFFIX, String.class);
|
|
|
|
|
|
//如果全都没有数据 则跳过
|
|
|
if (startTime == null && endTime == null) {
|
|
|
@@ -1405,7 +1409,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- Object value = MapUtil.get(params,queryConfig.getFieldName(),Object.class);
|
|
|
+ Object value = MapUtil.get(params, queryConfig.getFieldName(), Object.class);
|
|
|
//如果没有数据 则跳过
|
|
|
if (value == null || StrUtil.isEmpty(String.valueOf(value))) {
|
|
|
continue;
|
|
|
@@ -1450,8 +1454,8 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
|
|
|
if (TIME_CLASS_NAME.contains(className)) {
|
|
|
//根据查询配置的字段名 从参数里面找到对应的值 如果是时间类型 需要查询start 和 end
|
|
|
- String startTime = MapUtil.get(params,queryConfig.getFieldName() + GlobalConstant.START_TIME_SUFFIX,String.class);
|
|
|
- String endTime = MapUtil.get(params,queryConfig.getFieldName() + GlobalConstant.END_TIME_SUFFIX,String.class);
|
|
|
+ String startTime = MapUtil.get(params, queryConfig.getFieldName() + GlobalConstant.START_TIME_SUFFIX, String.class);
|
|
|
+ String endTime = MapUtil.get(params, queryConfig.getFieldName() + GlobalConstant.END_TIME_SUFFIX, String.class);
|
|
|
|
|
|
if (startTime != null) {
|
|
|
GreaterThanEquals geq = new GreaterThanEquals(); // ">="
|
|
|
@@ -1501,10 +1505,9 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
Expression dataAuthExpression = AuthorityUtil.getDataAuthExpressionByTableName(tableName, null);
|
|
|
|
|
|
if (ObjectUtil.isNotNull(dataAuthExpression)) {
|
|
|
- if(queryExpression == null){
|
|
|
+ if (queryExpression == null) {
|
|
|
queryExpression = dataAuthExpression;
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
queryExpression = new AndExpression(queryExpression, dataAuthExpression);
|
|
|
}
|
|
|
}
|
|
|
@@ -1520,7 +1523,6 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 根据配置信息获取不分页列表数据
|
|
|
*
|
|
|
@@ -1667,8 +1669,8 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
//如果是日期类型 默认设置查询参数为两个
|
|
|
if (queryConfig.getIsDate()) {
|
|
|
//根据查询配置的字段名 从参数里面找到对应的值 如果是时间类型 需要查询start 和 end
|
|
|
- String startTime = MapUtil.get(params, fieldName + GlobalConstant.START_TIME_SUFFIX,String.class);
|
|
|
- String endTime = MapUtil.get(params, fieldName + GlobalConstant.END_TIME_SUFFIX,String.class);
|
|
|
+ String startTime = MapUtil.get(params, fieldName + GlobalConstant.START_TIME_SUFFIX, String.class);
|
|
|
+ String endTime = MapUtil.get(params, fieldName + GlobalConstant.END_TIME_SUFFIX, String.class);
|
|
|
|
|
|
//如果全都没有数据 则跳过
|
|
|
if (startTime == null && endTime == null) {
|
|
|
@@ -1682,12 +1684,16 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
if (StrUtil.isNotEmpty(startTime)) startRightExp = new StringValue(startTime);
|
|
|
if (StrUtil.isNotEmpty(endTime)) endRightExp = new StringValue(endTime);
|
|
|
} else if (type == JdbcType.DATE || type == JdbcType.TIMESTAMP) {
|
|
|
- if (StrUtil.isNotEmpty(startTime)) startRightExp = new TimestampValue().withValue(Timestamp.valueOf(LocalDateTimeUtil.parseDateByLength(startTime)));
|
|
|
- if (StrUtil.isNotEmpty(endTime)) endRightExp = new TimestampValue().withValue(Timestamp.valueOf(LocalDateTimeUtil.parseDateByLength(endTime)));
|
|
|
+ if (StrUtil.isNotEmpty(startTime))
|
|
|
+ startRightExp = new TimestampValue().withValue(Timestamp.valueOf(LocalDateTimeUtil.parseDateByLength(startTime)));
|
|
|
+ if (StrUtil.isNotEmpty(endTime))
|
|
|
+ endRightExp = new TimestampValue().withValue(Timestamp.valueOf(LocalDateTimeUtil.parseDateByLength(endTime)));
|
|
|
} else if (StrUtil.equalsIgnoreCase(queryColumn.getTypeName(), OracleFieldsType.TIME.getType())) {
|
|
|
// oracle时间字段处理
|
|
|
- if (StrUtil.isNotEmpty(startTime)) startRightExp = new StringValue(StringPool.ZERO + StringPool.SPACE + startTime);
|
|
|
- if (StrUtil.isNotEmpty(endTime))endRightExp = new StringValue(StringPool.ZERO + StringPool.SPACE + endTime);
|
|
|
+ if (StrUtil.isNotEmpty(startTime))
|
|
|
+ startRightExp = new StringValue(StringPool.ZERO + StringPool.SPACE + startTime);
|
|
|
+ if (StrUtil.isNotEmpty(endTime))
|
|
|
+ endRightExp = new StringValue(StringPool.ZERO + StringPool.SPACE + endTime);
|
|
|
}
|
|
|
if (startTime != null) {
|
|
|
GreaterThanEquals geq = new GreaterThanEquals(); // ">="
|
|
|
@@ -1717,7 +1723,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- Object value = MapUtil.get(params, fieldName,Object.class);
|
|
|
+ Object value = MapUtil.get(params, fieldName, Object.class);
|
|
|
//如果没有数据 则跳过
|
|
|
if (value == null || StrUtil.isEmpty(String.valueOf(value))) {
|
|
|
continue;
|
|
|
@@ -1762,8 +1768,8 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
|
|
|
if (TIME_CLASS_NAME.contains(className)) {
|
|
|
//根据查询配置的字段名 从参数里面找到对应的值 如果是时间类型 需要查询start 和 end
|
|
|
- String startTime = MapUtil.get(params, fieldName + GlobalConstant.START_TIME_SUFFIX,String.class);
|
|
|
- String endTime = MapUtil.get(params, fieldName + GlobalConstant.END_TIME_SUFFIX,String.class);
|
|
|
+ String startTime = MapUtil.get(params, fieldName + GlobalConstant.START_TIME_SUFFIX, String.class);
|
|
|
+ String endTime = MapUtil.get(params, fieldName + GlobalConstant.END_TIME_SUFFIX, String.class);
|
|
|
|
|
|
if (startTime != null) {
|
|
|
GreaterThanEquals geq = new GreaterThanEquals(); // ">="
|
|
|
@@ -1813,10 +1819,9 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
Expression dataAuthExpression = AuthorityUtil.getDataAuthExpressionByTableName(tableName, null);
|
|
|
|
|
|
if (ObjectUtil.isNotNull(dataAuthExpression)) {
|
|
|
- if(queryExpression == null){
|
|
|
+ if (queryExpression == null) {
|
|
|
queryExpression = dataAuthExpression;
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
queryExpression = new AndExpression(queryExpression, dataAuthExpression);
|
|
|
}
|
|
|
}
|
|
|
@@ -2188,6 +2193,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
|
|
|
/**
|
|
|
* 处理保存的表单数据
|
|
|
+ *
|
|
|
* @param formData
|
|
|
* @param formDesignConfig
|
|
|
*/
|
|
|
@@ -2223,7 +2229,7 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
if (timeObj instanceof String) {
|
|
|
resultData.put(bindField, LocalDateTimeUtil.parseDbTime(String.valueOf(timeObj), dbType));
|
|
|
} else if (timeObj instanceof LocalTime) {
|
|
|
- resultData.put(bindField,timeObj);
|
|
|
+ resultData.put(bindField, timeObj);
|
|
|
} else {
|
|
|
resultData.put(bindField, null);
|
|
|
}
|
|
|
@@ -2231,46 +2237,46 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
Object start = MapUtils.getObject(formData, bindStartTimeField);
|
|
|
Object end = MapUtils.getObject(formData, bindEndTimeField);
|
|
|
if (ObjectUtil.isNotEmpty(start)) {
|
|
|
- if (start instanceof String){
|
|
|
+ if (start instanceof String) {
|
|
|
resultData.put(bindStartTimeField, LocalDateTimeUtil.parseDbTime(String.valueOf(start), dbType));
|
|
|
} else {
|
|
|
- resultData.put(bindStartTimeField,start);
|
|
|
+ resultData.put(bindStartTimeField, start);
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- resultData.put(bindStartTimeField,null);
|
|
|
+ } else {
|
|
|
+ resultData.put(bindStartTimeField, null);
|
|
|
}
|
|
|
if (ObjectUtil.isNotEmpty(end)) {
|
|
|
- if (end instanceof String){
|
|
|
+ if (end instanceof String) {
|
|
|
resultData.put(bindEndTimeField, LocalDateTimeUtil.parseDbTime(String.valueOf(end), dbType));
|
|
|
} else {
|
|
|
- resultData.put(bindEndTimeField,end);
|
|
|
+ resultData.put(bindEndTimeField, end);
|
|
|
}
|
|
|
- }else {
|
|
|
- resultData.put(bindEndTimeField,null);
|
|
|
+ } else {
|
|
|
+ resultData.put(bindEndTimeField, null);
|
|
|
}
|
|
|
} else if (StrUtil.equalsIgnoreCase(type, ComponentTypeConstant.DATE)) {
|
|
|
Object valueStr = MapUtils.getObject(formData, bindField);
|
|
|
if (ObjectUtil.isNotEmpty(valueStr)) {
|
|
|
resultData.put(bindField, valueStr instanceof LocalDateTime ? valueStr : DateTimeUtil.parseDate(LocalDateTimeUtil.parseDate(String.valueOf(valueStr), format).toString()));
|
|
|
- }else {
|
|
|
- resultData.put(bindField,null);
|
|
|
+ } else {
|
|
|
+ resultData.put(bindField, null);
|
|
|
}
|
|
|
} else if (StrUtil.equalsIgnoreCase(type, ComponentTypeConstant.DATE_RANGE)) {
|
|
|
Object start = MapUtils.getObject(formData, bindStartTimeField);
|
|
|
Object end = MapUtils.getObject(formData, bindEndTimeField);
|
|
|
if (ObjectUtil.isNotEmpty(start)) {
|
|
|
resultData.put(bindStartTimeField, start instanceof LocalDateTime ? start : DateTimeUtil.parseDate(LocalDateTimeUtil.parseDate(String.valueOf(start), format).toString()));
|
|
|
- }else {
|
|
|
- resultData.put(bindStartTimeField,null);
|
|
|
+ } else {
|
|
|
+ resultData.put(bindStartTimeField, null);
|
|
|
}
|
|
|
if (ObjectUtil.isNotEmpty(end)) {
|
|
|
resultData.put(bindEndTimeField, end instanceof LocalDateTime ? end : DateTimeUtil.parseDate(LocalDateTimeUtil.parseDate(String.valueOf(end), format).toString()));
|
|
|
- }else {
|
|
|
- resultData.put(bindEndTimeField,null);
|
|
|
+ } else {
|
|
|
+ resultData.put(bindEndTimeField, null);
|
|
|
}
|
|
|
} else if (StrUtil.equalsIgnoreCase(type, ComponentTypeConstant.AUTO_CODE)) {
|
|
|
- if (autoCodeList != null) autoCodeList.add(MapUtils.getString(options, ComponentTypeConstant.AUTO_CODE_RULE));
|
|
|
+ if (autoCodeList != null)
|
|
|
+ autoCodeList.add(MapUtils.getString(options, ComponentTypeConstant.AUTO_CODE_RULE));
|
|
|
}
|
|
|
}
|
|
|
return resultData;
|
|
|
@@ -2368,8 +2374,8 @@ public class FormExecuteServiceImpl implements IFormExecuteService {
|
|
|
myColumnInfos.add(myColumnInfo);
|
|
|
|
|
|
DeskColumnsVo myColumnInfo1 = new DeskColumnsVo();
|
|
|
- if (!column.getName().equals(pk.get().getName())){
|
|
|
- myColumnInfo1.setLabel(column.getComment()+ StringPool.UNDERSCORE + "接口");
|
|
|
+ if (!column.getName().equals(pk.get().getName())) {
|
|
|
+ myColumnInfo1.setLabel(column.getComment() + StringPool.UNDERSCORE + "接口");
|
|
|
myColumnInfo1.setProp(column.getName() + StringPool.UNDERSCORE + "api");
|
|
|
myColumnInfos.add(myColumnInfo1);
|
|
|
}
|