src/com/tjzhic/dao/impl/CurrstageDaoImpl.java

(开头部分) 1KB

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

package com.tjzhic.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.tjzhic.dao.CurrstageDao;
import com.tjzhic.db.ConnectionFactory;
import com.tjzhic.entity.Currstage;

public class CurrstageDaoImpl implements CurrstageDao{

  @Override
  public int set(String adminname,String currstage) {
    int rows = 0;
    Connection con = ConnectionFactory.getConnection();
    PreparedStatement pre = null;
    try {
        String sql = "insert into currstage(adminname,settime,stagename) values(?,NOW(),?)";
        pre = con.prepareStatement(sql);
        pre.setString(1, adminname);
        pre.setString(2, currstage);
        rows = pre.executeUpdate();
    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        try{
            if (pre!=null)
                pre.close();
            if (con != null)
                con.close();
        }catch (SQLException e) {
            e.printStackTrace();
        }
    }
    return rows;
  }

  @Override
  public Currstage findCurrent() {
    Currstage currstage = null;
    Connection con = ConnectionFactory.getConnection();
    PreparedStatement pre = null;
    ResultSet rs = null;
    try{
      pre = con.prepareStatement("select adminname,settime,stagename from currstage order by configid desc limit 1");
      rs = pre.executeQuery();
      while(rs.next()){
        currstage=new Currstage();
        currstage.setAdminname(rs.getString(1));
        currstage.setSettime(rs.getString(2));
        currstage.setStagename(rs.getString(3));
      }
  }catch (Exception e){
      e.printStackTrace();
  }finally{
      try {
          if (rs != null)
              rs.close();
后面还有 12 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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