Esempio n. 1
0
 public void addZone(Integer uid, List<Integer> zones) {
   // 给用户加权限
   Admin admin = dao.findOne(uid);
   if (admin != null) {
     admin.getFunctions().clear();
     for (Integer fid : zones) {
       admin.getZones().add(zoneDao.findOne(fid));
     }
     dao.save(admin);
   }
 }
Esempio n. 2
0
 public void addFunction(Integer uid, List<Integer> functions) {
   // 给用户加权限
   Admin admin = dao.findOne(uid);
   if (admin != null) {
     admin.getFunctions().clear();
     for (Integer fid : functions) {
       admin.getFunctions().add(functionDao.findOne(fid));
     }
     dao.save(admin);
   }
 }
Esempio n. 3
0
 public Admin createAdmin(String name, String password) {
   Admin admin = new Admin();
   admin.setName(name);
   admin.setPassword(password);
   admin.setStatus(1);
   dao.save(admin);
   return admin;
 }
Esempio n. 4
0
 public Admin getById(Integer id) {
   Admin admin = dao.findOne(id);
   List<Function> functions = admin.getFunctions();
   for (Function function : functions) {
     // System.out.println(function.getName());
   }
   List<Zone> zones = admin.getZones();
   for (Zone zone : zones) {}
   return admin;
 }
Esempio n. 5
0
 public Admin getByName(String name) {
   Admin admin = dao.findByName(name);
   List<Function> functions = admin.getFunctions();
   for (Function function : functions) {
     // System.out.println(function.getName());
   }
   List<Zone> zones = admin.getZones();
   for (Zone zone : zones) {}
   return admin;
 }
Esempio n. 6
0
  public List<Admin> getAllAdmins(int page, int size) {
    List<Admin> admins = dao.getAll(new PageRequest(page, size));
    for (Admin admin : admins) {
      List<Function> functions = admin.getFunctions();
      for (Function function : functions) {}

      List<Zone> zones = admin.getZones();
      for (Zone zone : zones) {}
    }
    return admins;
  }
Esempio n. 7
0
 public void delete(Integer id) {
   Admin admin = dao.findOne(id);
   admin.setStatus(-1);
   dao.save(admin);
 }
Esempio n. 8
0
 public int getAllCount() {
   return dao.getCount();
 }
Esempio n. 9
0
 public void updateAdmin(Admin admin) {
   dao.save(admin);
 }