| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.example.springboot.entity.Queue; |
| | | import com.example.springboot.entity.north_frame_buffer1_frames; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.service.North_Glass_Buffer1Service.north_glass_buffer1Comparator; |
| | | |
| | | @Component |
| | | public class JdbcConnections { |
| | |
| | | |
| | | } |
| | | |
| | | // 根据铝框id查询铝框信息 |
| | | public north_frame_buffer1_frames SelectFrameBarcode(String frameBarcode) throws SQLException { |
| | | try { |
| | | Connection conn = getConn(); |
| | | north_frame_buffer1_frames frame=new north_frame_buffer1_frames(); |
| | | String sql1 = "select * from north_glass_buffer1_frames where Barcode=? limit 1"; |
| | | ps = conn.prepareStatement(sql1); |
| | | ps.setString(1, frameBarcode); |
| | | ResultSet rs = ps.executeQuery(); |
| | | while (rs.next()) { |
| | | frame.setId(rs.getInt("id")); |
| | | frame.setlistnumber(rs.getString("listnumber")); |
| | | frame.setordernumber(rs.getString("ordernumber")); |
| | | frame.setboxnumber(rs.getString("boxnumber")); |
| | | frame.setbarcode(rs.getString("barcode")); |
| | | frame.setframelength(rs.getDouble("framelength")); |
| | | frame.setframeheight(rs.getDouble("frameheight")); |
| | | frame.setframelengthmm(rs.getDouble("framelength_mm")); |
| | | frame.setframeheightmm(rs.getDouble("frameheight_mm")); |
| | | frame.setflip(rs.getInt("flip")); |
| | | } |
| | | conn.close(); |
| | | return frame; |
| | | } catch (Exception e) { |
| | | // TODO: handle exception |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1. 加载驱动 |
| | | * 2. 获取连接 conn |
| | |
| | | public static Connection getConn() throws SQLException { |
| | | try { |
| | | Connection conn = null; |
| | | // conn = |
| | | // DriverManager.getConnection("jdbc:mysql://localhost:3306/canadames?serverTimezone=GMT%2B8&characterEncoding=utf-8", |
| | | // "root", "beibo.123/"); |
| | | conn = DriverManager.getConnection( |
| | | "jdbc:mysql://192.168.102.9:3306/production?serverTimezone=GMT%2B8&characterEncoding=utf-8&useSSL=false", |
| | | "northglass", "n0rthgla55"); |
| | | conn = |
| | | DriverManager.getConnection("jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8&characterEncoding=utf-8", |
| | | "root", "beibo.123/"); |
| | | // conn = DriverManager.getConnection( |
| | | // "jdbc:mysql://192.168.102.9:3306/production?serverTimezone=GMT%2B8&characterEncoding=utf-8&useSSL=false", |
| | | // "northglass", "n0rthgla55"); |
| | | return conn; |
| | | } catch (Exception e) { |
| | | // TODO: handle exception |