文件名称:javascript:void(0);
文件大小:1KB
文件格式:JAVA
更新时间:2017-01-12 03:38:42
简单jsp操作
package serv;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.RowMapper;
import entity.Material;
public class MaterialService extends BaseService {
/**
* 把一条材料信息加入到数据库中
*/
public void addMr(String mtime,String mzno,String mpeople,String mname,String mquantity,double mmoney,String mno){
try {
String sql = "insert into Material(mtime,mzno,mpeople,mname,mquantity,mmoney,mno) VALUES(?,?,?,?,?,?,?)";
jt.update(sql,mtime,mzno,mpeople,mname,mquantity,mmoney,mno);
} catch (DataAccessException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
/**
* 根据mno查询材料
*/
public Material getmaterialBymno (String mno)throws DataAccessException{
Material material = null;
try {
String sql = "select * from material where mno= ?";
material = jt.queryForObject(sql,new MaterialRowMapper(), mno);
} catch (DataAccessException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
return material;
}
/**
*删除材料 ->1
* @param sno
* @throws DataAccessException
*/
public void deleteMaterial(String mno) throws DataAccessException{
String sql = "delete from Material where mno=? ";
jt.update(sql,mno);
}
/**
* 获取所有材料信息
*/
public ArrayList