use of org.sagacity.sqltoy.demo.vo.StaffInfoVO in project sagacity-sqltoy by chenrenfei.
the class MapperUtilsTest method testPOTOVO.
@Test
public void testPOTOVO() {
StaffInfo staffInfo = new StaffInfo();
staffInfo.setStaffId("S2007");
staffInfo.setStaffCode("S2007");
staffInfo.setPost("MASTER");
staffInfo.setStaffName("测试员工9");
staffInfo.setSexType("M");
staffInfo.setEmail("test3@aliyun.com");
staffInfo.setEntryDate(LocalDate.now());
staffInfo.setStatus(1);
staffInfo.setOrganId("100007");
// staffInfoVO.setPhoto(FileUtil.readAsBytes("classpath:/mock/staff_photo.jpg"));
staffInfo.setCountry("86");
SqlToyContext context = new SqlToyContext();
try {
context.initialize();
StaffInfoVO staffInfoVO = MapperUtils.map(context, staffInfo, StaffInfoVO.class);
System.err.println(JSON.toJSONString(staffInfoVO));
StaffInfo staffInfo1 = MapperUtils.map(context, staffInfoVO, StaffInfo.class);
System.err.println(JSON.toJSONString(staffInfo1));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of org.sagacity.sqltoy.demo.vo.StaffInfoVO in project sagacity-sqltoy by chenrenfei.
the class BeanUtilTest method testMultLevelReflect.
// 测试多级反射
@Test
public void testMultLevelReflect() {
StaffInfoVO staff = new StaffInfoVO();
staff.setEmail("zhongxuchen@gmail.com");
staff.setStaffId("S001");
DataRange dataRange = new DataRange();
dataRange.setBeginDate(DateUtil.getDate("2020-10-01"));
dataRange.setEndDate(LocalDate.now());
staff.setDataRange(dataRange);
HashMap params = new HashMap();
params.put("companyId", "C0001");
params.put("companyName", "xxx企业集团");
staff.setParams(params);
Object[] result = BeanUtil.reflectBeanToAry(staff, new String[] { "staffId", "email", "dataRange.beginDate", "dataRange.enddate", "params.companyId", "params.companyName" }, null, null);
for (Object tmp : result) {
System.err.println(tmp);
}
}
use of org.sagacity.sqltoy.demo.vo.StaffInfoVO in project sagacity-sqltoy by chenrenfei.
the class BeanUtilTest method testMultLevelMapReflect.
@Test
public void testMultLevelMapReflect() {
StaffInfoVO staff = new StaffInfoVO();
staff.setEmail("zhongxuchen@gmail.com");
staff.setStaffId("S001");
DataRange dataRange = new DataRange();
dataRange.setBeginDate(DateUtil.getDate("2020-10-01"));
dataRange.setEndDate(LocalDate.now());
staff.setDataRange(dataRange);
HashMap params = new HashMap();
params.put("companyId", "C0001");
params.put("companyName", "xxx企业集团");
staff.setParams(params);
Map map = new IgnoreKeyCaseMap();
map.put("staff", staff);
Object[] result = BeanUtil.reflectBeanToAry(map, new String[] { "staff.staffid", "staff.email", "staff.dataRange.beginDate", "staff.dataRange.enddate", "staff.params.companyId", "staff.params.companyName" }, null, null);
for (Object tmp : result) {
System.err.println(tmp);
}
}
Aggregations