/* (non-Javadoc) * @see com.jlj.service.imp.ICommandService#getTotalCount(int, java.lang.String) */ public int getTotalCount(int con, String convalue, User user) { String queryString = "select count(*) from Command mo where 1=1 "; Object[] p = null; if (con != 0 && convalue != null && !convalue.equals("")) { // 命令名称 if (con == 1) { queryString += "and mo.name like ? "; } p = new Object[] {'%' + convalue + '%'}; } switch (user.getLimits()) { case 0: // 系统管理员 queryString += " order by mo.project.id desc "; break; case 1: // 高级管理员 queryString += "and mo.project.id=" + user.getProject().getId(); break; case 2: // 普通管理员 queryString += "and mo.project.id=" + user.getProject().getId(); break; default: break; } return commandDao.getUniqueResult(queryString, p); }
/* (non-Javadoc) * @see com.jlj.service.imp.ICommandService#queryList(int, java.lang.String, int, int) */ public List<Command> queryList(int con, String convalue, User user, int page, int size) { String queryString = "from Command mo where 1=1 "; Object[] p = null; if (con != 0 && convalue != null && !convalue.equals("")) { // 线路名称 if (con == 1) { queryString += "and mo.name like ? "; } p = new Object[] {'%' + convalue + '%'}; } switch (user.getLimits()) { case 0: // 系统管理员 queryString += " order by mo.project.id desc "; break; case 1: // 高级管理员 queryString += "and mo.project.id=" + user.getProject().getId(); break; case 2: // 普通管理员 queryString += "and mo.project.id=" + user.getProject().getId(); break; default: break; } return commandDao.pageList(queryString, p, page, size); }
/* (non-Javadoc) * @see com.jlj.service.imp.ICommandService#loadById(int) */ public Command loadById(int id) { return commandDao.loadById(id); }
/* (non-Javadoc) * @see com.jlj.service.imp.ICommandService#getCommands() */ public List<Command> getCommands() { return commandDao.getCommands(); }
/* (non-Javadoc) * @see com.jlj.service.imp.ICommandService#update(com.jlj.model.Command) */ public void update(Command command) { commandDao.update(command); }
/* (non-Javadoc) * @see com.jlj.service.imp.ICommandService#deleteById(int) */ public void deleteById(int id) { commandDao.deleteById(id); }
/* (non-Javadoc) * @see com.jlj.service.imp.ICommandService#delete(com.jlj.model.Command) */ public void delete(Command command) { commandDao.delete(command); }
/* (non-Javadoc) * @see com.jlj.service.imp.ICommandService#add(com.jlj.model.Command) */ public void add(Command command) throws Exception { commandDao.save(command); }