exam-master/src/org/mmxbb/exam/util/Selector.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package org.mmxbb.exam.util;


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import org.apache.struts.util.LabelValueBean;

public class Selector {
  private Connection conn = null;
  DBConn dbconn = null;

  private static final String SELECT_OPTIONS =
      "select b_id as id,b_value as name from ex_baseinfo where b_type = (select b_id from ex_baseinfo where b_value = ?) and b_id <> b_type";

  public Selector() {
    try {
      dbconn = new DBConn();
      conn = dbconn.getConnection();
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }

  public ArrayList getOptions(String lable) {
    ArrayList options = null;
    PreparedStatement pstmt = null;
    Statement stmt = null;
    ResultSet rs = null;
    options = new ArrayList();
    options.add(new LabelValueBean("-----请选择----", "%"));

    if (lable.equals("organization_id")) {
      try {
        stmt = conn.createStatement();
        rs = stmt.executeQuery(
            "SELECT organization_id AS id, org_name AS name FROM b_organization");
      } catch (SQLException ex2) {
        ex2.printStackTrace();
      }
    } else if (lable.equals("post_index")) {
      try {
        stmt = conn.createStatement();
        rs = stmt.executeQuery(
            "SELECT post_index AS id, post_name AS name FROM B_POST_TYPE");
      } catch (SQLException ex2) {
        ex2.printStackTrace();
      }
    } else if (lable.equals("education_index")) {
      try {
        stmt = conn.createStatement();
        rs = stmt.executeQuery(
            "SELECT education_index AS id, education_name AS name FROM b_education_type");
      } catch (SQLException ex2) {
        ex2.printStackTrace();
      }
后面还有 28 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。