分类管理增删改查完成
This commit is contained in:
@@ -43,7 +43,7 @@ public class FieldBuilder {
|
||||
FieldType fieldType, SearchType searchType, AddType addType, EditType editType,
|
||||
String searchPlaceholder, String addPlaceholder, String editPlaceholder,
|
||||
FieldRuleListBuilder fieldRuleListBuilder, String mockDataPattern) {
|
||||
JSONObject jsonObject = new JSONObject(2);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
||||
/* 实际字段 */
|
||||
// 用于筛选、增删改
|
||||
|
@@ -19,7 +19,7 @@ public class FieldMapperBuilder {
|
||||
// if (mapper == null || mapper.size() == 0) {
|
||||
// return this;
|
||||
// }
|
||||
// JSONObject jsonObject = new JSONObject(2);
|
||||
// JSONObject jsonObject = new JSONObject(3);
|
||||
// jsonObject.put("key", prop);
|
||||
// jsonObject.put("value", label);
|
||||
// jsonObject.put("mapper", mapper);
|
||||
@@ -28,7 +28,7 @@ public class FieldMapperBuilder {
|
||||
// }
|
||||
|
||||
public FieldMapperBuilder add(String prop, String label, HashMap mapper) {
|
||||
JSONObject jsonObject = new JSONObject(2);
|
||||
JSONObject jsonObject = new JSONObject(3);
|
||||
jsonObject.put("key", prop);
|
||||
jsonObject.put("value", label);
|
||||
jsonObject.put("mapper", mapper);
|
||||
|
@@ -8,6 +8,7 @@ import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
// 数据库关系映射
|
||||
@@ -38,4 +39,23 @@ public class GoodCategoryVO implements Serializable {
|
||||
List<GoodCategoryVO> goodCategoryVOList = goodCategoryList.stream().map(GoodCategoryVO::convertFrom).collect(Collectors.toList());
|
||||
return goodCategoryVOList;
|
||||
}
|
||||
|
||||
public static GoodCategory convertTo(GoodCategoryVO goodCategoryVO) {
|
||||
if (goodCategoryVO == null) {
|
||||
return null;
|
||||
}
|
||||
GoodCategory goodCategory = new GoodCategory();
|
||||
BeanUtils.copyProperties(goodCategoryVO, goodCategory);
|
||||
try {
|
||||
if (!Objects.isNull(goodCategoryVO.getId())) {
|
||||
Long goodCategoryId = Long.valueOf(goodCategoryVO.getId());
|
||||
goodCategory.setId(goodCategoryId);
|
||||
} else {
|
||||
goodCategory.setId(null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
goodCategory.setId(null);
|
||||
}
|
||||
return goodCategory;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user