62,621
社区成员
发帖
与我相关
我的任务
分享public class X_FILE implements Serializable{
private int fileId;
private int typeId;
private int version;
private InputStream menuFile;
private String fileName;
private String createTime;
private String remark;
private String size;
public X_FILE(int fileId, int typeId, int version, InputStream menuFile,
String fileName, String remark) {
super();
this.fileId = fileId;
this.typeId = typeId;
this.version = version;
this.menuFile = menuFile;
this.fileName = fileName;
this.remark = remark;
}
public X_FILE(int fileId, int typeId, int version, InputStream menuFile,
String fileName, String createTime, String remark) {
super();
this.fileId = fileId;
this.typeId = typeId;
this.version = version;
this.menuFile = menuFile;
this.fileName = fileName;
this.createTime = createTime;
this.remark = remark;
}
public X_FILE(int typeId, int version, InputStream menuFile, String fileName,
String remark) {
super();
this.typeId = typeId;
this.version = version;
this.menuFile = menuFile;
this.fileName = fileName;
this.remark = remark;
}
public int getFileId() {
return fileId;
}
public void setFileId(int fileId) {
this.fileId = fileId;
}
public int getTypeId() {
return typeId;
}
public void setTypeId(int typeId) {
this.typeId = typeId;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
public InputStream getMenuFile() {
return menuFile;
}
public void setMenuFile(InputStream menuFile) {
this.menuFile = menuFile;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
}public void insetX_FILE(X_FILE x_file){
sql = "insert into X_FILE (TypeID,Version,MenuFile,FileName,Remark) values(?,?,?,?,?)";
try {
PreparedStatement pstmt=conn.prepareStatement(sql);
pstmt.setInt(1,x_file.getTypeId());
pstmt.setInt(2,x_file.getVersion());
try {
pstmt.setBinaryStream(3,x_file.getMenuFile(),x_file.getMenuFile().available());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
pstmt.setString(4,x_file.getFileName());
pstmt.setString(5,x_file.getRemark());
pstmt.execute();
log.debug("执行"+sql+"完成!");
} catch (SQLException e) {
// TODO Auto-generated catch block
log.debug("执行" + sql + "出现异常!");
e.printStackTrace();
} finally {
freeResouce();
}
}