|
@@ -157,10 +157,15 @@ public class HotelCouponImplDao implements HotelCouponDao {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public int updateExpire() {
|
|
public int updateExpire() {
|
|
|
- //查询
|
|
|
|
|
|
|
+// //查询
|
|
|
|
|
+// String sql = "SELECT `id` from `hotel_coupon` WHERE 1=1 and (DATE_FORMAT(`effective_end_date`, '%Y-%m-%d') < CURDATE() AND `effective_lose_day` IS NULL and `status` = 1)" +
|
|
|
|
|
+// " OR" +
|
|
|
|
|
+// " (DATE_FORMAT(DATE_ADD(`effective_end_date`, INTERVAL `effective_lose_day` + `effective_day` DAY),'%Y-%m-%d') < CURDATE() and `status` = 1)";
|
|
|
|
|
+
|
|
|
|
|
+ //查询 当effective_lose_day或者effective_day为null时都找不到,所以不会将有效时间段的id找出来
|
|
|
String sql = "SELECT `id` from `hotel_coupon` WHERE 1=1 and (DATE_FORMAT(`effective_end_date`, '%Y-%m-%d') < CURDATE() AND `effective_lose_day` IS NULL and `status` = 1)" +
|
|
String sql = "SELECT `id` from `hotel_coupon` WHERE 1=1 and (DATE_FORMAT(`effective_end_date`, '%Y-%m-%d') < CURDATE() AND `effective_lose_day` IS NULL and `status` = 1)" +
|
|
|
" OR" +
|
|
" OR" +
|
|
|
- " (DATE_FORMAT(DATE_ADD(`effective_end_date`, INTERVAL `effective_lose_day` + `effective_day` DAY),'%Y-%m-%d') < CURDATE() and `status` = 1)";
|
|
|
|
|
|
|
+ " (DATE_FORMAT(DATE_ADD(`grant_end_date`, INTERVAL `effective_lose_day` + `effective_day` DAY),'%Y-%m-%d') < CURDATE() and `status` = 1)";
|
|
|
int num = 0;
|
|
int num = 0;
|
|
|
try {
|
|
try {
|
|
|
List<String> ids = namedParameterJdbcTemplate.queryForList(sql, EmptySqlParameterSource.INSTANCE, String.class);
|
|
List<String> ids = namedParameterJdbcTemplate.queryForList(sql, EmptySqlParameterSource.INSTANCE, String.class);
|