public boolean delete(Airport airport) { ActionContext ctx = ActionContext.getContext(); Integer aid = airport.getAid(); String hql = "from Airport as airport where aid='" + aid + "'"; List list = airportDao.findByHql(hql); if (list.isEmpty()) return false; else { Airport delairport = (Airport) list.get(0); airportDao.delete(delairport); return true; } }
public boolean updateAirportByManager(Airport airport) { ActionContext ctx = ActionContext.getContext(); session = (Map<String, Object>) ctx.getSession(); Integer aid = airport.getAid(); String hql = "from Airport as airport where aid='" + aid + "'"; List list = airportDao.findByHql(hql); if (list.isEmpty()) return false; else { airport = (Airport) list.get(0); session.put("airport", airport); return true; } }
public boolean find(Airport airport) { ActionContext ctx = ActionContext.getContext(); session = (Map<String, Object>) ctx.getSession(); String portname = airport.getPortname(); String hql = "from Airport as airport where portname='" + portname + "'"; List list = airportDao.findByHql(hql); if (list.isEmpty()) return false; else { airport = (Airport) list.get(0); session.put("airport", airport); return true; } }
public List list() { String hql = "from Airport"; List list = airportDao.findByHql(hql); return list; }
public boolean update(Airport airport) { if (airportDao.update(airport)) return true; else return false; }
public boolean add(Airport airport) { if (airportDao.save(airport)) return true; else return false; }
public boolean check(String portname) { String hql = "from Airport as airport where portname='" + portname + "'"; List list = airportDao.findByHql(hql); if (list.isEmpty()) return false; else return true; }