Search in sources :

Example 1 with StaffInfoVO

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

the class ShardingTest method testUpdateAll.

@Test
public void testUpdateAll() throws Exception {
    List<StaffInfoVO> staffInfoVOs = new ArrayList<StaffInfoVO>();
    for (int i = 0; i < 100; i++) {
        StaffInfoVO staffVO = new StaffInfoVO();
        staffVO.setStaffId(Integer.toString(i + 1));
        staffInfoVOs.add(staffVO);
    }
    staffInfoVOs = sqlToyCRUDService.loadAll(staffInfoVOs);
    for (StaffInfoVO staff : staffInfoVOs) {
        staff.setStaffName(staff.getStaffName() + "XX");
    }
    System.err.println(staffInfoVOs.get(0).getStaffId());
    sqlToyCRUDService.delete(staffInfoVOs.get(0));
}
Also used : ArrayList(java.util.ArrayList) StaffInfoVO(sqltoy.showcase.system.vo.StaffInfoVO) Test(org.junit.Test)

Example 2 with StaffInfoVO

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

the class ShardingTest method testAddStaff.

@Test
public void testAddStaff() throws Exception {
    List<StaffInfoVO> staffVOs = new ArrayList<StaffInfoVO>();
    String[] postType = { "1", "2", "3", "4" };
    String[] sexType = { "F", "M", "X" };
    String staffNames = "赵钱孙李周吴郑王冯陈楮卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳酆鲍史唐费廉岑薛雷贺倪汤滕殷罗毕郝邬安常乐于时傅皮卞齐康伍余元卜顾孟平黄";
    String names = "俞倩倪倰偀偲妆佳亿仪寒宜女奴妶好妃姗姝姹姿婵姑姜姣嫂嫦嫱姬娇娟嫣婕婧娴婉姐姞姯姲姳娘娜妹妍妙妹娆娉娥媚媱嫔婷玟环珆珊珠玲珴瑛琼瑶瑾瑞珍琦玫琪琳环琬瑗琰薇珂芬芳芯花茜荭荷莲莉莹菊芝萍燕苹荣草蕊芮蓝莎菀菁苑芸芊茗荔菲蓉英蓓蕾";
    int end = 100;
    for (int i = 0; i < end; i++) {
        StaffInfoVO staffVO = new StaffInfoVO();
        staffVO.setStaffId(Integer.toString(i + 1));
        staffVO.setStaffCode("S" + StringUtil.addLeftZero2Len(Integer.toString(i + 1), 4));
        int index = CommonUtils.getRandomNum(1, staffNames.length() - 1);
        int nameIndex = CommonUtils.getRandomNum(1, names.length() - 1);
        staffVO.setStaffName(staffNames.substring(index - 1, index) + names.substring(nameIndex - 1, nameIndex) + i);
        staffVO.setBirthday(DateUtil.getNowTime());
        staffVO.setOperator("admin");
        staffVO.setOperateDate(DateUtil.getNowTime());
        staffVO.setOrganId(Integer.toString(CommonUtils.getRandomNum(2, 10)));
        staffVO.setPost(postType[CommonUtils.getRandomNum(postType.length)]);
        // 按照千人比例取性别(千分之五为不确定性别)
        staffVO.setSexType(sexType[CommonUtils.getProbabilityIndex(new int[] { 493, 498, 5 })]);
        staffVO.setStatus("1");
        staffVOs.add(staffVO);
        if (((i + 1) % 100) == 0 || i == end - 1) {
            sqlToyCRUDService.saveOrUpdateAll(staffVOs);
            staffVOs.clear();
        }
    }
}
Also used : ArrayList(java.util.ArrayList) StaffInfoVO(sqltoy.showcase.system.vo.StaffInfoVO) Test(org.junit.Test)

Example 3 with StaffInfoVO

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

the class ShardingTest method testLoadAll.

@Test
public void testLoadAll() throws Exception {
    List<StaffInfoVO> staffInfoVOs = new ArrayList<StaffInfoVO>();
    for (int i = 0; i < 100; i++) {
        StaffInfoVO staffVO = new StaffInfoVO();
        staffVO.setStaffId(Integer.toString(i + 1));
        staffInfoVOs.add(staffVO);
    }
    staffInfoVOs = sqlToyCRUDService.loadAll(staffInfoVOs);
    for (StaffInfoVO staff : staffInfoVOs) System.err.println(staff.getStaffName());
}
Also used : ArrayList(java.util.ArrayList) StaffInfoVO(sqltoy.showcase.system.vo.StaffInfoVO) Test(org.junit.Test)

Example 4 with StaffInfoVO

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

the class SeniorQueryServiceTest method testFindTop.

/**
 * 取top记录数
 *
 * @throws Exception
 */
@Test
public void testFindTop() throws Exception {
    StaffInfoVO staffInfoVO = new StaffInfoVO();
    staffInfoVO.setStaffName("康");
    staffInfoVO.setStatus("-1");
    List<StaffInfoVO> staffInfoVOs = seniorQueryService.findTopStaff(10, staffInfoVO);
    for (StaffInfoVO staff : staffInfoVOs) {
        System.out.println("staffId=" + staff.getStaffId() + ",staffName=" + staff.getStaffName() + ";organName=" + staff.getOrganName());
    }
}
Also used : StaffInfoVO(sqltoy.showcase.system.vo.StaffInfoVO) Test(org.junit.Test)

Example 5 with StaffInfoVO

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

the class ShardingTest method testDeleteAll.

@Test
public void testDeleteAll() throws Exception {
    List<StaffInfoVO> staffInfoVOs = new ArrayList<StaffInfoVO>();
    for (int i = 0; i < 100; i++) {
        StaffInfoVO staffVO = new StaffInfoVO();
        staffVO.setStaffId(Integer.toString(i + 1));
        staffInfoVOs.add(staffVO);
    }
    sqlToyCRUDService.deleteAll(staffInfoVOs);
}
Also used : ArrayList(java.util.ArrayList) StaffInfoVO(sqltoy.showcase.system.vo.StaffInfoVO) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)9 StaffInfoVO (sqltoy.showcase.system.vo.StaffInfoVO)9 ArrayList (java.util.ArrayList)6 PaginationModel (org.sagacity.sqltoy.model.PaginationModel)2