⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editfightutil.java

📁 主要是航空预订系统
💻 JAVA
字号:
/**
 * 
 */
package com.air.backend.util;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.air.exceptions.AirException;
import com.air.form.FightForm;
import com.air.persistence.DataSrcUtil;
import com.air.persistence.IsqlDataSource;

/**
 * @author jelly_yang
 *
 */
public class EditFightUtil {
	
	private static Log log = LogFactory.getLog(EditFightUtil.class);
	private EditFightUtil() {
		// TODO Auto-generated constructor stub
	}

	public static class EditFightUtilHolder{
		static EditFightUtil editFightUtil = new EditFightUtil();
	}
	
	public static EditFightUtil getInstance(){
		return EditFightUtilHolder.editFightUtil;
	}
	
	public boolean editFight(FightForm fightForm)throws AirException{
		int result = 0 ;
		String sSql = "update fights set fight_name='"+fightForm.getFightName()+"',fight_no='"+fightForm.getFightNo()+
		              "',leave_city='"+fightForm.getLeaveCity()+"',arrive_city='"+fightForm.getArriveCity()+
		              "',leave_time='"+fightForm.getLeaveTime()+"',arrive_time='"+fightForm.getArriveTime()+
		              "',price="+Double.parseDouble(fightForm.getPrice())+",fuel_rate="+Double.parseDouble(fightForm.getFuelRate())+
		              ",build_rate="+Double.parseDouble(fightForm.getBuildRate())+",leave_date='"+fightForm.getLeaveDate()+
		              "',special_num="+Integer.parseInt(fightForm.getSpecialNum())+",economic_num="+Integer.parseInt(fightForm.getEconomicNum())+
		              ",business_num="+Integer.parseInt(fightForm.getBusinessNum())+",head_num="+Integer.parseInt(fightForm.getHeadNum())+
		              " where fid="+fightForm.getFightId();
		IsqlDataSource src = DataSrcUtil.getInstance().getDataSource();
		Connection conn = null;
		log.debug("editFight() -- sSql["+ sSql+ "]");
		try
		{
			conn = src.getConnection();
			Statement stmt = conn.createStatement();
			result = src.executeUpdate(stmt, sSql);
		}
		catch(SQLException se)
		{
			log.error("editFight() caught SQLException: " + se);
		}
		catch(Exception ex)
		{
			log.error("editFight() caught Exception: " + ex);
		}
		finally
		{
			src.closeConn(conn);
		}
		if(result==0){
			return false;
		}
		return true;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -