Example #1
0
  /* (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);
  }
Example #2
0
  /* (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);
  }