1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| public class OrderDaoImpl extends BaseDao implements OrderDao {
@Override public int saveOrder(Order order) { String sql = "insert into t_order(`order_id`,`create_time`,`price`,`status`,`user_id`) values(?,?,?,?,?)";
return update(sql, order.getOrderId(), order.getCreateTime(), order.getPrice(), order.getStatus(), order.getUserId()); }
@Override public List<Order> queryOrders() { String sql = "select `order_id` orderId,`create_time` createTime,`price`,`status`,`user_id` userId from t_order"; return queryForList(Order.class, sql); }
@Override public List<Order> queryOrdersByUserId(Integer id) { String sql = "select `order_id` orderId,`create_time` createTime,`price`,`status`,`user_id` userId from t_order where user_id=?"; return queryForList(Order.class, sql, id); }
@Override public int updateOrder(Order order) { String sql = "update t_order set `create_time`=?,`price`=?,`status`=? where order_id=?"; return update(sql, order.getCreateTime(), order.getPrice(), order.getStatus(), order.getOrderId()); } }
|