allrepairqueryAction.java
上传用户:flow_meter
上传日期:2022-03-21
资源大小:40k
文件大小:3k
源码类别:

MySQL数据库

开发平台:

SQL

  1. package sql_lab;
  2. import java.sql.ResultSet;
  3. import java.sql.SQLException;
  4. import org.eclipse.jface.action.Action;
  5. import org.eclipse.swt.widgets.Text;
  6. public class allrepairqueryAction extends Action {
  7. public allrepairqueryAction(){
  8. super();
  9. this.setText("查看所有维修单信息(&N)");
  10. this.setToolTipText("查看所有维修单信息");
  11. }
  12. public void run(){
  13. if(MainWindow.log==false){
  14. Text content=MainWindow.getApp().getContent();
  15. content.append("请您先登陆n");
  16. return ;
  17. }
  18. String str="select "+
  19. sqlManager.tb_repair+"."+sqlManager.row_repair_id+","+ //维修单号
  20. sqlManager.tb_repair+"."+sqlManager.row_repair_time+","+//维修时间
  21. sqlManager.tb_repair+"."+sqlManager.row_repair_information+","+//维修记录
  22. sqlManager.tb_customer+"."+sqlManager.row_customer_name+","+//客户姓名
  23. sqlManager.tb_produce+"."+sqlManager.row_produce_name+","+//维修商品名称
  24. sqlManager.tb_repair_shop+"."+sqlManager.row_repair_shop_name+","+//维修店铺
  25. sqlManager.tb_repair_shop+"."+sqlManager.row_repair_shop_keeper+","+//维修人
  26. sqlManager.tb_repair_shop+"."+sqlManager.row_repair_shop_call+" " +//维修店联系电话
  27. "from "+sqlManager.tb_produce+","+sqlManager.tb_customer+","+sqlManager.tb_repair_shop+","+sqlManager.tb_repair+" "+
  28. "where "+
  29. sqlManager.tb_repair+"."+sqlManager.row_repair_repair_shop_id+"="+sqlManager.tb_repair_shop+"."+sqlManager.row_repair_shop_id+" and "+
  30. sqlManager.tb_repair+"."+sqlManager.row_repair_customer_id+"="+sqlManager.tb_customer+"."+sqlManager.row_customer_id+" and "+
  31. sqlManager.tb_repair+"."+sqlManager.row_repair_produce_id+"="+sqlManager.tb_produce+"."+sqlManager.row_produce_id+
  32. "";
  33. sqlManager sql=sqlManager.getSqlManager();
  34. ResultSet set=sql.executeQuery(str);
  35. Text content=MainWindow.getApp().getContent();
  36. boolean flag=false;
  37. String s="***********************************维修单信息查询结果**********************************n";
  38. try{
  39. while(set.next()){
  40. flag=true;
  41. content.append(s);
  42. content.append("维修单号:"+set.getInt(1)+"n");
  43. content.append("维修时间:"+set.getString(2)+"n");
  44. content.append("维修记录:"+set.getString(3)+"n");
  45. content.append("客户姓名:"+set.getString(4)+"n");
  46. content.append("维修商品名称:"+set.getString(5)+"n");
  47. content.append("维修店铺: "+set.getString(6)+"n");
  48. content.append("维修人: "+set.getString(7)+"n");
  49. content.append("维修店联系电话: "+set.getString(8)+"n");
  50. }
  51. }
  52. catch(SQLException e){
  53. e.printStackTrace();
  54. }
  55. content.append(s);
  56. if(flag==false)content.append("查询结果为空n");
  57. }
  58. }