diff --git a/diboot-core/src/main/java/com/diboot/core/binding/binder/FieldListBinder.java b/diboot-core/src/main/java/com/diboot/core/binding/binder/FieldListBinder.java index 1bec6ef..a4a6352 100644 --- a/diboot-core/src/main/java/com/diboot/core/binding/binder/FieldListBinder.java +++ b/diboot-core/src/main/java/com/diboot/core/binding/binder/FieldListBinder.java @@ -128,7 +128,7 @@ public class FieldListBinder extends FieldBinder { List entityList = valueEntityListMap.get(annoObjectId); if(entityList != null){ for(int i = 0; i< annoObjectSetterPropNameList.size(); i++){ - List valObjList = BeanUtils.collectToList(entityList, referencedGetterColumnNameList.get(i)); + List valObjList = BeanUtils.collectToList(entityList, S.toLowerCaseCamel(referencedGetterColumnNameList.get(i))); BeanUtils.setProperty(annoObject, annoObjectSetterPropNameList.get(i), valObjList); } } diff --git a/diboot-core/src/test/java/diboot/core/test/binder/TestFieldBinder.java b/diboot-core/src/test/java/diboot/core/test/binder/TestFieldBinder.java index c00c5f2..06b5051 100644 --- a/diboot-core/src/test/java/diboot/core/test/binder/TestFieldBinder.java +++ b/diboot-core/src/test/java/diboot/core/test/binder/TestFieldBinder.java @@ -66,7 +66,7 @@ public class TestFieldBinder { // 验证直接关联和通过中间表间接关联的绑定 Assert.assertNotNull(vo.getDeptName()); Assert.assertNotNull(vo.getOrgName()); - Assert.assertNotNull(vo.getOrgTelphone()); + Assert.assertNotNull(vo.getOrgParentId()); // 验证枚举值已绑定 Assert.assertNotNull(vo.getGenderLabel()); diff --git a/diboot-core/src/test/java/diboot/core/test/binder/TestFieldListBinder.java b/diboot-core/src/test/java/diboot/core/test/binder/TestFieldListBinder.java index d5b06dc..10a04b6 100644 --- a/diboot-core/src/test/java/diboot/core/test/binder/TestFieldListBinder.java +++ b/diboot-core/src/test/java/diboot/core/test/binder/TestFieldListBinder.java @@ -92,6 +92,8 @@ public class TestFieldListBinder { for(EntityListComplexBinderVO vo : voList){ // 验证通过中间表间接关联的绑定 Assert.assertTrue(V.notEmpty(vo.getRoleCodes())); + Assert.assertTrue(V.notEmpty(vo.getRoleCreateDates())); + System.out.println(JSON.stringify(vo.getRoleCodes())); } } diff --git a/diboot-core/src/test/java/diboot/core/test/binder/vo/EntityListComplexBinderVO.java b/diboot-core/src/test/java/diboot/core/test/binder/vo/EntityListComplexBinderVO.java index 8f2ce71..ecdea54 100644 --- a/diboot-core/src/test/java/diboot/core/test/binder/vo/EntityListComplexBinderVO.java +++ b/diboot-core/src/test/java/diboot/core/test/binder/vo/EntityListComplexBinderVO.java @@ -23,6 +23,7 @@ import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; +import java.util.Date; import java.util.List; /** @@ -47,4 +48,9 @@ public class EntityListComplexBinderVO extends User { @BindFieldList(entity = Role.class, field = "code", condition="this.id=user_role.user_id AND user_role.role_id=id") private List roleCodes; + // 支持通过中间表的多-多Entity的单个属性集 + @BindFieldList(entity = Role.class, field = "createTime", condition="this.id=user_role.user_id AND user_role.role_id=id") + private List roleCreateDates; + + } diff --git a/diboot-core/src/test/java/diboot/core/test/binder/vo/EntityListSimpleBinderVO.java b/diboot-core/src/test/java/diboot/core/test/binder/vo/EntityListSimpleBinderVO.java index 3e01f03..1ff2796 100644 --- a/diboot-core/src/test/java/diboot/core/test/binder/vo/EntityListSimpleBinderVO.java +++ b/diboot-core/src/test/java/diboot/core/test/binder/vo/EntityListSimpleBinderVO.java @@ -40,7 +40,7 @@ public class EntityListSimpleBinderVO extends Department { private List children; // 1-n 关联,取单个属性 - @BindFieldList(entity = Department.class, field = "id", condition = "this.id=parent_id") + @BindFieldList(entity = Department.class, field = "parentId", condition = "this.id=parent_id") private List childrenIds; // 1-n 关联,取单个属性 diff --git a/diboot-core/src/test/java/diboot/core/test/binder/vo/FieldBinderVO.java b/diboot-core/src/test/java/diboot/core/test/binder/vo/FieldBinderVO.java index 49e3025..d7a1934 100644 --- a/diboot-core/src/test/java/diboot/core/test/binder/vo/FieldBinderVO.java +++ b/diboot-core/src/test/java/diboot/core/test/binder/vo/FieldBinderVO.java @@ -44,8 +44,8 @@ public class FieldBinderVO extends User{ // 支持级联字段关联,相同条件的entity+condition将合并为一条SQL查询 @BindField(entity = Organization.class, field="name", condition="this.department_id=department.id AND department.org_id=id") private String orgName; - @BindField(entity = Organization.class, field="telphone", condition="this.department_id=department.id AND department.org_id=id") - private String orgTelphone; + @BindField(entity = Organization.class, field="parentId", condition="this.department_id=department.id AND department.org_id=id") + private Long orgParentId; // 绑定数据字典枚举 @BindDict(type="GENDER", field = "gender")