每日总结 4.20
今天进行了供货商页面的设计,对于数据的处理实现对应付金额的显示,对于登录显示用户名,明天进行补货,对于每个用户发送的信息进行补货。
package queren; import toolse.Tool; 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 java.util.List; public class Daos { public List<Things> search(){ List<Things> list = new ArrayList<>(); try { Connection conn =Tool.getConnection(); String sql="select * from car_send " ; PreparedStatement pstmt = conn.prepareStatement(sql); ResultSet rs = pstmt.executeQuery(); while(rs.next()){ Things lu = new Things(); lu.setMer_phone(rs.getString("mer_phone")); lu.setTime(rs.getString("time")); lu.setAddress(rs.getString("address")); lu.setUser_phone(rs.getString("user_phone")); lu.setName(rs.getString("name")); lu.setTotal(rs.getInt("total")); list.add(lu); } rs.close(); pstmt.close(); conn.close(); }catch(SQLException e) { System.out.println("发生错误"); e.printStackTrace(); } return list; } public List<Things> searches(String name ,String time,String phone,String mer ){ List<Things> list = new ArrayList<>(); try { Connection conn =Tool.getConnection(); Statement state = null; String sql="select * from car_send where mer_phone= ? and name like '%"+name+"%' and time like '%"+time+"%' and user_phone like '%"+phone+"%' " ; PreparedStatement pstmt = conn.prepareStatement(sql); pstmt.setString(1, mer); ResultSet rs = pstmt.executeQuery(); while(rs.next()){ Things lu = new Things(); lu.setMer_phone(rs.getString("mer_phone")); lu.setTime(rs.getString("time")); lu.setAddress(rs.getString("address")); lu.setUser_phone(rs.getString("user_phone")); lu.setName(rs.getString("name")); lu.setTotal(rs.getInt("total")); list.add(lu); } rs.close(); pstmt.close(); conn.close(); }catch(SQLException e) { System.out.println("发生错误"); e.printStackTrace(); } return list; } public int js(String name,String phone) { int price=0; try { Connection conn =Tool.getConnection(); String sql="select * from car_commodity where name = ? and user_phone = ?" ; PreparedStatement pstmt = conn.prepareStatement(sql); pstmt.setString(1, name); pstmt.setString(2,phone); ResultSet rs = pstmt.executeQuery(); while(rs.next()){ price=rs.getInt("price"); } rs.close(); pstmt.close(); conn.close(); }catch(SQLException e) { System.out.println("发生错误"); e.printStackTrace(); } return price; } }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通