예제 #1
0
 public void save() throws Exception {
   UserRoleEntity entity = new UserRoleEntity();
   entity.setUserId(Integer.valueOf(1));
   entity.setRoleId(Integer.valueOf(1));
   this.service.save(entity);
   System.out.println("������ѯ" + entity.toString());
   entity = this.service.queryForObject(entity);
   System.out.println("������ѯ" + entity.toString());
 }
예제 #2
0
 @Test
 public void queryForList() throws Exception {
   UserRoleEntity entity = new UserRoleEntity();
   entity.setRoleId(Integer.valueOf(2));
   List<UserRoleEntity> list = this.service.queryForList(entity);
   for (UserRoleEntity entity1 : list) System.out.println("���º��ѯ��" + entity1.toString());
   System.out.println("--" + list.size());
 }
예제 #3
0
 public void delete() throws Exception {
   UserRoleEntity entity = new UserRoleEntity();
   entity.setUserRoleId(Integer.valueOf(6));
   this.service.delete(entity);
   entity = this.service.queryForObject(entity);
   if (entity != null) System.out.println("ɾ����ѯ��" + entity.toString());
   else System.out.println("ɾ����ѯ�� ������");
 }
예제 #4
0
 public void queryForPage() throws Exception {
   Integer pageSize = Integer.valueOf(10);
   Integer pageNum = Integer.valueOf(1);
   Integer userId = null;
   Integer roleId = Integer.valueOf(1);
   Integer userRoleId = null;
   Map<String, Object> map = new HashMap<String, Object>();
   map.put("userId", userId);
   map.put("roleId", roleId);
   map.put("userRoleId", userRoleId);
   map.put("startIndex", Integer.valueOf(pageSize.intValue() * (pageNum.intValue() - 1)));
   map.put("pageSize", pageSize);
   List<UserRoleEntity> list = this.service.queryForPage(map);
   Long count = this.service.count(map);
   for (UserRoleEntity entity : list) System.out.println("���º��ѯ��" + entity.toString());
   System.out.println(count + "--" + list.size());
 }