Search in sources :

Example 1 with DictTypeVO

use of sqltoy.showcase.sagacity.vo.DictTypeVO in project sagacity-sqltoy by chenrenfei.

the class SqlToyCRUDServiceTest method testDelete.

// 单个对象删除
@Test
public void testDelete() {
    DictTypeVO dictTypeVO = new DictTypeVO();
    dictTypeVO.setDictTypeCode("POST_TYPE1");
    sqlToyCRUDService.delete(dictTypeVO);
}
Also used : DictTypeVO(sqltoy.showcase.sagacity.vo.DictTypeVO) Test(org.junit.Test)

Example 2 with DictTypeVO

use of sqltoy.showcase.sagacity.vo.DictTypeVO in project sagacity-sqltoy by chenrenfei.

the class SqlToyCRUDServiceTest method testSaveCascade.

@Test
public void testSaveCascade() {
    DictTypeVO dictTypeVO = new DictTypeVO();
    dictTypeVO.setDictTypeCode("POST_TYPE");
    dictTypeVO.setDictTypeName("岗位类别");
    dictTypeVO.setOperateDate(DateUtil.getNowTime());
    dictTypeVO.setOperator("admin");
    dictTypeVO.setDataSize(5);
    dictTypeVO.setDataType(1);
    dictTypeVO.setStatus("1");
    List dictDetailVOs = new ArrayList();
    DictDetailVO detailVO = new DictDetailVO();
    detailVO.setDictKey("1");
    detailVO.setDictName("staff");
    detailVO.setStatus("1");
    detailVO.setShowIndex(1);
    detailVO.setUpdateBy("0001");
    detailVO.setUpdateTime(DateUtil.getTimestamp(null));
    dictDetailVOs.add(detailVO);
    DictDetailVO detailVO1 = new DictDetailVO();
    detailVO1.setDictKey("2");
    detailVO1.setDictName("master");
    detailVO1.setStatus("1");
    detailVO1.setShowIndex(2);
    detailVO1.setUpdateTime(DateUtil.getTimestamp(null));
    detailVO1.setUpdateBy("0001");
    dictDetailVOs.add(detailVO1);
    dictTypeVO.setDictDetailVOs(dictDetailVOs);
    // 先删除
    sqlToyCRUDService.delete(dictTypeVO);
    sqlToyCRUDService.save(dictTypeVO);
}
Also used : DictTypeVO(sqltoy.showcase.sagacity.vo.DictTypeVO) DictDetailVO(sqltoy.showcase.sagacity.vo.DictDetailVO) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 3 with DictTypeVO

use of sqltoy.showcase.sagacity.vo.DictTypeVO in project sagacity-sqltoy by chenrenfei.

the class SqlToyCRUDServiceTest method testLoadAllCascade.

/**
 * 测试通过主表的主键级联查询加载字表明细记录(子表是通过一次查询,不是根据每个主键做一次子表查询,因此效率非常高)
 *
 * @throws Exception
 */
@Test
public void testLoadAllCascade() throws Exception {
    List entities = new ArrayList();
    entities.add(new DictTypeVO("POST_TYPE"));
    entities.add(new DictTypeVO("POST_TYPE1"));
    List<DictTypeVO> result = sqlToyLazyDao.loadAllCascade(entities);
    System.err.println(result.get(0).getDictDetailVOs().size());
}
Also used : DictTypeVO(sqltoy.showcase.sagacity.vo.DictTypeVO) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 4 with DictTypeVO

use of sqltoy.showcase.sagacity.vo.DictTypeVO in project sagacity-sqltoy by chenrenfei.

the class SqlToyCRUDServiceTest method testLoad.

@Test
public void testLoad() {
    DictTypeVO dictTypeVO = new DictTypeVO();
    dictTypeVO.setDictTypeCode("POST_TYPE");
    DictTypeVO entity = (DictTypeVO) sqlToyCRUDService.load(dictTypeVO);
    Assert.assertEquals("验证岗位字段", entity.getDictTypeName(), "岗位类别");
}
Also used : DictTypeVO(sqltoy.showcase.sagacity.vo.DictTypeVO) Test(org.junit.Test)

Example 5 with DictTypeVO

use of sqltoy.showcase.sagacity.vo.DictTypeVO in project sagacity-sqltoy by chenrenfei.

the class SqlToyCRUDServiceTest method testUpdate.

@Test
public void testUpdate() {
    DictTypeVO dictTypeVO = new DictTypeVO();
    dictTypeVO.setDictTypeCode("POST_TYPE");
    dictTypeVO.setDictTypeName("岗位类别3");
    dictTypeVO.setOperateDate(DateUtil.getNowTime());
    dictTypeVO.setOperator("admin");
    dictTypeVO.setDataType(0);
    dictTypeVO.setStatus("1");
    sqlToyCRUDService.update(dictTypeVO, null);
}
Also used : DictTypeVO(sqltoy.showcase.sagacity.vo.DictTypeVO) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 DictTypeVO (sqltoy.showcase.sagacity.vo.DictTypeVO)7 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ReflectPropertyHandler (org.sagacity.sqltoy.callback.ReflectPropertyHandler)1 DictDetailVO (sqltoy.showcase.sagacity.vo.DictDetailVO)1