基于javaweb+JSP+Servlet电影票售票管理系统
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException();
}
}
@Override
public List getUserOrders(String userId) {
String sql = String.format("select * from %s where %s=? order by %s desc", TABLE_NAEM, COLUME_USER_ID, COLUME_CREATE_TIME);
try {
return getQueryRunner().query(sql, new BeanListHandler<>(Order.class), userId);
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException();
}
}
@Override
public int update(String id, double amount) {
return update(String.format("update %s set %s=? where %s=?", TABLE_NAEM, COLUME_AMOUNT, COLUME_ID), new Object[]{amount, id});
}
@Override
public Map queryRealtimeSales() {
if (includeSelf)
dir.delete();
}
public static void deleteAllFiles(File dir) {
File[] files = dir.listFiles();
if (files != null) {
for (File f : files) {
if (f.isDirectory()) {
deleteAllFiles(f);
} else {
f.delete();
}
}
}
}
in = inStream.getChannel();
out = outStream.getChannel();
in.transferTo(0, in.size(), out);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
IOUtils.close(in, out, inStream, outStream);
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
private static void copyDir(File sourceDir, File targetDir) {
//目标目录新建源文件夹
if (!targetDir.exists()) {
public static long getStartOfDay(long date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date(date));
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
}
}
@Override
public boolean isSeatSold(String planId, String seat) {
String sql = String.format("select * from %s where %s=? and %s like ?", TABLE_NAEM, COLUME_PLAN_ID, COLUME_SEAT);
try {
List list = getQueryRunner().query(sql, new BeanListHandler<>(Order.class), planId, "%|" + seat + "|%");
return list != null && !list.isEmpty();
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException();
}
}
@Override
public List queryAll() {
String sql = String.format("select * from %s order by %s desc", TABLE_NAEM, COLUME_CREATE_TIME);
try {
return getQueryRunner().query(sql, new BeanListHandler<>(Order.class));
*/
public class OrderDaoImpl extends BaseDao implements OrderDao {
@Override
public int delete(String[] columnNames, Object... values) {
return update("delete from " + TABLE_NAEM + generateConditionString(columnNames), values);
}
@Override
public Order query(String[] columnNames, Object... values) {
return query(Order.class, columnNames, values);
}
@Override
public User add(Order order) {
String sql = "insert into " + TABLE_NAEM + " values(null,?,?,?,?,?,?)";
return insert(User.class, sql, new Object[]{order.user_id, order.plan_id, order.movie_name, order.seat, order.amount, order.create_time});
}
@Override
public boolean isSeatSold(String planId, String seat) {
String sql = String.format("select * from %s where %s=? and %s like ?", TABLE_NAEM, COLUME_PLAN_ID, COLUME_SEAT);
try {


