BindFieldList支持_转驼峰
This commit is contained in:
parent
850329960b
commit
7c191f8d8f
|
@ -128,7 +128,7 @@ public class FieldListBinder<T> extends FieldBinder<T> {
|
||||||
List entityList = valueEntityListMap.get(annoObjectId);
|
List entityList = valueEntityListMap.get(annoObjectId);
|
||||||
if(entityList != null){
|
if(entityList != null){
|
||||||
for(int i = 0; i< annoObjectSetterPropNameList.size(); i++){
|
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);
|
BeanUtils.setProperty(annoObject, annoObjectSetterPropNameList.get(i), valObjList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class TestFieldBinder {
|
||||||
// 验证直接关联和通过中间表间接关联的绑定
|
// 验证直接关联和通过中间表间接关联的绑定
|
||||||
Assert.assertNotNull(vo.getDeptName());
|
Assert.assertNotNull(vo.getDeptName());
|
||||||
Assert.assertNotNull(vo.getOrgName());
|
Assert.assertNotNull(vo.getOrgName());
|
||||||
Assert.assertNotNull(vo.getOrgTelphone());
|
Assert.assertNotNull(vo.getOrgParentId());
|
||||||
// 验证枚举值已绑定
|
// 验证枚举值已绑定
|
||||||
Assert.assertNotNull(vo.getGenderLabel());
|
Assert.assertNotNull(vo.getGenderLabel());
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,8 @@ public class TestFieldListBinder {
|
||||||
for(EntityListComplexBinderVO vo : voList){
|
for(EntityListComplexBinderVO vo : voList){
|
||||||
// 验证通过中间表间接关联的绑定
|
// 验证通过中间表间接关联的绑定
|
||||||
Assert.assertTrue(V.notEmpty(vo.getRoleCodes()));
|
Assert.assertTrue(V.notEmpty(vo.getRoleCodes()));
|
||||||
|
Assert.assertTrue(V.notEmpty(vo.getRoleCreateDates()));
|
||||||
|
|
||||||
System.out.println(JSON.stringify(vo.getRoleCodes()));
|
System.out.println(JSON.stringify(vo.getRoleCodes()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
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")
|
@BindFieldList(entity = Role.class, field = "code", condition="this.id=user_role.user_id AND user_role.role_id=id")
|
||||||
private List<String> roleCodes;
|
private List<String> roleCodes;
|
||||||
|
|
||||||
|
// 支持通过中间表的多-多Entity的单个属性集
|
||||||
|
@BindFieldList(entity = Role.class, field = "createTime", condition="this.id=user_role.user_id AND user_role.role_id=id")
|
||||||
|
private List<Date> roleCreateDates;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class EntityListSimpleBinderVO extends Department {
|
||||||
private List<DepartmentVO> children;
|
private List<DepartmentVO> children;
|
||||||
|
|
||||||
// 1-n 关联,取单个属性
|
// 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<Long> childrenIds;
|
private List<Long> childrenIds;
|
||||||
|
|
||||||
// 1-n 关联,取单个属性
|
// 1-n 关联,取单个属性
|
||||||
|
|
|
@ -44,8 +44,8 @@ public class FieldBinderVO extends User{
|
||||||
// 支持级联字段关联,相同条件的entity+condition将合并为一条SQL查询
|
// 支持级联字段关联,相同条件的entity+condition将合并为一条SQL查询
|
||||||
@BindField(entity = Organization.class, field="name", condition="this.department_id=department.id AND department.org_id=id")
|
@BindField(entity = Organization.class, field="name", condition="this.department_id=department.id AND department.org_id=id")
|
||||||
private String orgName;
|
private String orgName;
|
||||||
@BindField(entity = Organization.class, field="telphone", condition="this.department_id=department.id AND department.org_id=id")
|
@BindField(entity = Organization.class, field="parentId", condition="this.department_id=department.id AND department.org_id=id")
|
||||||
private String orgTelphone;
|
private Long orgParentId;
|
||||||
|
|
||||||
// 绑定数据字典枚举
|
// 绑定数据字典枚举
|
||||||
@BindDict(type="GENDER", field = "gender")
|
@BindDict(type="GENDER", field = "gender")
|
||||||
|
|
Loading…
Reference in New Issue