⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 staffdao.java

📁 WAP PUSH后台源码,WAP PUSH后台源码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        sql += " OR ID = " + ids[i];      }    }    return sql;  }  protected static String getFindByPKSQL(int id) {    String sql = "";    if (Database.dbType == DBType.ORACLE) {      sql = "SELECT * FROM WAP_STAFF WHERE ID = " + id;    } else if (Database.dbType == DBType.SQLSERVER) {      sql = "SELECT * FROM WAP_STAFF WHERE ID = " + id;    } else if (Database.dbType == DBType.MYSQL) {      sql = "SELECT * FROM WAP_STAFF WHERE ID = " + id;    }    return sql;  }  protected static boolean isValidData(StaffModel model) {    return true;  }  private static Connection getDBConnection() throws SysException {    return Database.getConnection();  }  private static void closeConnection(Connection dbConnection) throws SysException {    try {      if (dbConnection != null && !dbConnection.isClosed()) {        dbConnection.close();        dbConnection = null;      }    } catch (SQLException se) {      //throw new SysException("SQL Exception while closing DB connection : \n" + se);    }  }  private static void closeResultSet(ResultSet result) throws SysException {    try {      if (result != null) {        result.close();      }    } catch (SQLException se) {      //throw new SysException("SQL Exception while closing Result Set : \n" + se);    }  }  private static void closeStatement(Statement stmt) throws SysException {    try {      if (stmt != null) {        stmt.close();      }    } catch (SQLException se) {      //throw new SysException("SQL Exception while closing Statement : \n" + se);    }  }  public static void main(String[] args) throws Exception{    String action = "";    if (args.length == 1) {      action = args[0];    }    if (action == null || "".equals(action)) {    } else if ("insert".equalsIgnoreCase(action)) {      StaffModel model=new StaffModel();      model.setId(StaffBean.getSequenceNextValue());      model.setUserMdn("abc");      model.setUserName("abc");      model.setSex(1);      model.setTel("abc");      model.setFax("abc");      model.setJob("abc");      model.setAddress("abc");      model.setPost("abc");      model.setRemark("abc");      model.setGroupId(1);      model.setDepartmentId(1);      model.setOrderId(1);      model.setPicture("abc");      model.setEmail("abc");      StaffModel staffModel = StaffBean.insert(model);    }else if ("update".equalsIgnoreCase(action)){      StaffModel staffModel = StaffBean.findByPK(1);      int id = staffModel.getId();      String userMdn = staffModel.getUserMdn();      String userName = staffModel.getUserName();      int sex = staffModel.getSex();      String tel = staffModel.getTel();      String fax = staffModel.getFax();      String job = staffModel.getJob();      String address = staffModel.getAddress();      String post = staffModel.getPost();      String remark = staffModel.getRemark();      int groupId = staffModel.getGroupId();      int departmentId = staffModel.getDepartmentId();      int orderId = staffModel.getOrderId();      String picture = staffModel.getPicture();      String email = staffModel.getEmail();      staffModel.setUserMdn(userMdn);      staffModel.setUserName(userName);      staffModel.setSex(sex);      staffModel.setTel(tel);      staffModel.setFax(fax);      staffModel.setJob(job);      staffModel.setAddress(address);      staffModel.setPost(post);      staffModel.setRemark(remark);      staffModel.setGroupId(groupId);      staffModel.setDepartmentId(departmentId);      staffModel.setOrderId(orderId);      staffModel.setPicture(picture);      staffModel.setEmail(email);      update(staffModel);    }else if ("delete".equalsIgnoreCase(action)){      int[] ids = new int[3];      ids[0] = 1;      ids[1] = 2;      ids[2] = 3;      StaffBean.delete(ids);    }else if ("findByPK".equalsIgnoreCase(action)){      StaffModel staffModel = StaffBean.findByPK(1);      int id = staffModel.getId();      String userMdn = staffModel.getUserMdn();      String userName = staffModel.getUserName();      int sex = staffModel.getSex();      String tel = staffModel.getTel();      String fax = staffModel.getFax();      String job = staffModel.getJob();      String address = staffModel.getAddress();      String post = staffModel.getPost();      String remark = staffModel.getRemark();      int groupId = staffModel.getGroupId();      int departmentId = staffModel.getDepartmentId();      int orderId = staffModel.getOrderId();      String picture = staffModel.getPicture();      String email = staffModel.getEmail();      System.out.println("id = " + id);      System.out.println("userMdn = " + userMdn);      System.out.println("userName = " + userName);      System.out.println("sex = " + sex);      System.out.println("tel = " + tel);      System.out.println("fax = " + fax);      System.out.println("job = " + job);      System.out.println("address = " + address);      System.out.println("post = " + post);      System.out.println("remark = " + remark);      System.out.println("groupId = " + groupId);      System.out.println("departmentId = " + departmentId);      System.out.println("orderId = " + orderId);      System.out.println("picture = " + picture);      System.out.println("email = " + email);    }else if ("queryBySql".equalsIgnoreCase(action)){      Collection coll = StaffBean.queryBySql("SELECT * FROM WAP_STAFF");    }else if ("getRowCountBySql".equalsIgnoreCase(action)){      int rowCount = StaffBean.getRowCountBySql("SELECT COUNT(*) FROM WAP_STAFF");      System.out.println("rowCount = " + rowCount);    }else if ("queryAll".equalsIgnoreCase(action)){      Collection coll = StaffBean.queryAll();      Iterator it = coll.iterator();      while ( it.hasNext() ) {        Hashtable element = (Hashtable)it.next();        String id = (String)element.get("id");        String userMdn = (String)element.get("userMdn");        String userName = (String)element.get("userName");        String sex = (String)element.get("sex");        String tel = (String)element.get("tel");        String fax = (String)element.get("fax");        String job = (String)element.get("job");        String address = (String)element.get("address");        String post = (String)element.get("post");        String remark = (String)element.get("remark");        String groupId = (String)element.get("groupId");        String departmentId = (String)element.get("departmentId");        String orderId = (String)element.get("orderId");        String picture = (String)element.get("picture");        String email = (String)element.get("email");        System.out.print("id = " + id + ",\t");        System.out.print("userMdn = " + userMdn + ",\t");        System.out.print("userName = " + userName + ",\t");        System.out.print("sex = " + sex + ",\t");        System.out.print("tel = " + tel + ",\t");        System.out.print("fax = " + fax + ",\t");        System.out.print("job = " + job + ",\t");        System.out.print("address = " + address + ",\t");        System.out.print("post = " + post + ",\t");        System.out.print("remark = " + remark + ",\t");        System.out.print("groupId = " + groupId + ",\t");        System.out.print("departmentId = " + departmentId + ",\t");        System.out.print("orderId = " + orderId + ",\t");        System.out.print("picture = " + picture + ",\t");        System.out.print("email = " + email + "\n");      }    }else if ("getRowCountOfAll".equalsIgnoreCase(action)){      int rowCount = StaffBean.getRowCountOfAll();      System.out.println("rowCount = " + rowCount);    }else if ("getSequenceNextValue".equalsIgnoreCase(action)){      int sequenceValue = StaffBean.getSequenceNextValue();      System.out.println("sequenceValue = " + sequenceValue);    }  }}/*int id = (model==null?0:model.getId());String userMdn = (model==null?"":model.getUserMdn());String userName = (model==null?"":model.getUserName());int sex = (model==null?0:model.getSex());String tel = (model==null?"":model.getTel());String fax = (model==null?"":model.getFax());String job = (model==null?"":model.getJob());String address = (model==null?"":model.getAddress());String post = (model==null?"":model.getPost());String remark = (model==null?"":model.getRemark());int groupId = (model==null?0:model.getGroupId());int departmentId = (model==null?0:model.getDepartmentId());int orderId = (model==null?0:model.getOrderId());String picture = (model==null?"":model.getPicture());String email = (model==null?"":model.getEmail());int id = PageUtil.parseIntField(request.getParameter("id"), "id", false, 0, );String userMdn = PageUtil.parseStringField(request.getParameter("userMdn"), "userMdn", false, 19);String userName = PageUtil.parseStringField(request.getParameter("userName"), "userName", false, 19);int sex = PageUtil.parseIntField(request.getParameter("sex"), "sex", false, 0, 19);String tel = PageUtil.parseStringField(request.getParameter("tel"), "tel", false, 19);String fax = PageUtil.parseStringField(request.getParameter("fax"), "fax", false, 19);String job = PageUtil.parseStringField(request.getParameter("job"), "job", false, 99);String address = PageUtil.parseStringField(request.getParameter("address"), "address", false, 254);String post = PageUtil.parseStringField(request.getParameter("post"), "post", false, 5);String remark = PageUtil.parseStringField(request.getParameter("remark"), "remark", false, 254);int groupId = PageUtil.parseIntField(request.getParameter("groupId"), "groupId", false, 0, 254);int departmentId = PageUtil.parseIntField(request.getParameter("departmentId"), "departmentId", false, 0, 254);int orderId = PageUtil.parseIntField(request.getParameter("orderId"), "orderId", false, 0, 254);String picture = PageUtil.parseStringField(request.getParameter("picture"), "picture", false, 199);String email = PageUtil.parseStringField(request.getParameter("email"), "email", false, 199);int id = PageUtil.parseIntField(request.getParameter("id"), "id", false, 0, 2147483647);String userMdn = PageUtil.parseStringField(request.getParameter("userMdn"), "userMdn", false, 20);String userName = PageUtil.parseStringField(request.getParameter("userName"), "userName", false, 20);int sex = PageUtil.parseIntField(request.getParameter("sex"), "sex", true, 0, 2147483647);String tel = PageUtil.parseStringField(request.getParameter("tel"), "tel", true, 20);String fax = PageUtil.parseStringField(request.getParameter("fax"), "fax", true, 20);String job = PageUtil.parseStringField(request.getParameter("job"), "job", true, 100);String address = PageUtil.parseStringField(request.getParameter("address"), "address", true, 255);String post = PageUtil.parseStringField(request.getParameter("post"), "post", true, 6);String remark = PageUtil.parseStringField(request.getParameter("remark"), "remark", true, 255);int groupId = PageUtil.parseIntField(request.getParameter("groupId"), "groupId", true, 0, 2147483647);int departmentId = PageUtil.parseIntField(request.getParameter("departmentId"), "departmentId", true, 0, 2147483647);int orderId = PageUtil.parseIntField(request.getParameter("orderId"), "orderId", true, 0, 2147483647);String picture = PageUtil.parseStringField(request.getParameter("picture"), "picture", true, 200);String email = PageUtil.parseStringField(request.getParameter("email"), "email", true, 200);String id = (model==null?"0":""+model.getId());String userMdn = (model==null?"":""+model.getUserMdn());String userName = (model==null?"":""+model.getUserName());String sex = (model==null?"0":""+model.getSex());String tel = (model==null?"":""+model.getTel());String fax = (model==null?"":""+model.getFax());String job = (model==null?"":""+model.getJob());String address = (model==null?"":""+model.getAddress());String post = (model==null?"":""+model.getPost());String remark = (model==null?"":""+model.getRemark());String groupId = (model==null?"0":""+model.getGroupId());String departmentId = (model==null?"0":""+model.getDepartmentId());String orderId = (model==null?"0":""+model.getOrderId());String picture = (model==null?"":""+model.getPicture());String email = (model==null?"":""+model.getEmail());Collection coll = StaffBean.queryAll((pageNum-1) * pageRow + 1, pageNum * pageRow);Iterator it = coll.iterator();while ( it.hasNext() ) {    Hashtable element = (Hashtable)it.next();    StaffModel staffModel = StaffBean.toModel(element);    int id = staffModel.getId();    String userMdn = staffModel.getUserMdn();    String userName = staffModel.getUserName();    int sex = staffModel.getSex();    String tel = staffModel.getTel();    String fax = staffModel.getFax();    String job = staffModel.getJob();    String address = staffModel.getAddress();    String post = staffModel.getPost();    String remark = staffModel.getRemark();    int groupId = staffModel.getGroupId();    int departmentId = staffModel.getDepartmentId();    int orderId = staffModel.getOrderId();    String picture = staffModel.getPicture();    String email = staffModel.getEmail();        excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE,    currRow, currCol++), id+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), userMdn+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), userName+"");        excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE,    currRow, currCol++), sex+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), tel+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), fax+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), job+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), address+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), post+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), remark+"");        excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE,    currRow, currCol++), groupId+"");        excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE,    currRow, currCol++), departmentId+"");        excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE,    currRow, currCol++), orderId+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), picture+"");        excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), email+"");*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -