Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #150 from hardingadonis/vuong-fix-149
Browse files Browse the repository at this point in the history
Fix bug #149
  • Loading branch information
hardingadonis authored Mar 7, 2024
2 parents d016d0a + f1723b3 commit ccbf8b2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public String statisticBySold(Integer duration) {
try {
Connection conn = Singleton.dbContext.getConnection();

PreparedStatement smt = conn.prepareStatement("SELECT COUNT(*), DATE_FORMAT(SUBSTR(`created_at`, 1, 10), 'Tháng %m năm %Y') FROM `order` WHERE `created_at` BETWEEN DATE_SUB(CURDATE(), INTERVAL ? MONTH) AND CURDATE() GROUP BY SUBSTR(`created_at`, 1, 7)");
PreparedStatement smt = conn.prepareStatement("SELECT COUNT(*), DATE_FORMAT(SUBSTR(`created_at`, 1, 10), 'Tháng %m năm %Y') FROM `order` WHERE SUBSTR(`created_at`, 1, 10) BETWEEN DATE_SUB(CURDATE(), INTERVAL ? MONTH) AND CURDATE() GROUP BY SUBSTR(`created_at`, 1, 7)");
smt.setInt(1, duration);

ResultSet rs = smt.executeQuery();
Expand Down Expand Up @@ -135,7 +135,7 @@ public String statisticByStatus(Integer duration) {
try {
Connection conn = Singleton.dbContext.getConnection();

PreparedStatement smt = conn.prepareStatement("SELECT COUNT(*), CASE WHEN `status` = 'PENDING' THEN 'Đang xử lý' WHEN `status` = 'SHIPPING' THEN 'Đang giao hàng' WHEN `status` = 'DONE' THEN 'Đã hoàn thành' WHEN `status` = 'CANCELLED' THEN 'Đã hủy' END FROM `order` WHERE `created_at` BETWEEN DATE_SUB(CURDATE(), INTERVAL ? MONTH) AND CURDATE() GROUP BY `status`");
PreparedStatement smt = conn.prepareStatement("SELECT COUNT(*), CASE WHEN `status` = 'PENDING' THEN 'Đang xử lý' WHEN `status` = 'SHIPPING' THEN 'Đang giao hàng' WHEN `status` = 'DONE' THEN 'Đã hoàn thành' WHEN `status` = 'CANCELLED' THEN 'Đã hủy' END FROM `order` WHERE SUBSTR(`created_at`, 1, 10) BETWEEN DATE_SUB(CURDATE(), INTERVAL ? MONTH) AND CURDATE() GROUP BY `status`");
smt.setInt(1, duration);

ResultSet rs = smt.executeQuery();
Expand Down

0 comments on commit ccbf8b2

Please sign in to comment.