|
@@ -307,6 +307,31 @@ public class HotelCouponImplDao implements HotelCouponDao {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ public List<HotelCoupon> advertisingCouponPage(String sqlx, Integer page, Integer rows) {
|
|
|
|
|
+ SqlUtil.filterKeyword(sqlx);
|
|
|
|
|
+ int start = (page - 1) * rows;// 每页的起始下标
|
|
|
|
|
+ String sql = "select " +
|
|
|
|
|
+ "id,hotelIds,name,type,rebate_price,deduction_price,max_deduction,grant_number,limit_number,grant_start_date,grant_end_date," +
|
|
|
|
|
+ "meet_price,effective_start_date,effective_end_date,effective_type,effective_day,effective_lose_day,create_id,create_date,modify_date,status,remainder_number,reversed_number" +
|
|
|
|
|
+ " from hotel_coupon where status = 1 and DATE_FORMAT( grant_end_date, '%Y-%m-%d' ) >= CURDATE( )" + sqlx + " ORDER BY create_date DESC limit :start , :rows ";
|
|
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
|
|
+ sps.addValue("start", start);
|
|
|
|
|
+ sps.addValue("rows", rows);
|
|
|
|
|
+ List<HotelCoupon> list = namedParameterJdbcTemplate.query(sql, sps,
|
|
|
|
|
+ new BeanPropertyRowMapper<>(HotelCoupon.class));
|
|
|
|
|
+ if (list != null && list.size() > 0) return list;
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int advertisingCouponPageTotal(String sqlx) {
|
|
|
|
|
+ SqlUtil.filterKeyword(sqlx);
|
|
|
|
|
+ String sql = "SELECT count(*) FROM `hotel_coupon` where status = 1 and DATE_FORMAT( grant_end_date, '%Y-%m-%d' ) >= CURDATE( ) " + sqlx;
|
|
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
|
|
+ return namedParameterJdbcTemplate.queryForInt(sql, sps);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
public int updateRemainderNumber(String complaintId, String modifyDate) {
|
|
public int updateRemainderNumber(String complaintId, String modifyDate) {
|
|
|
String sql = "UPDATE `hotel_coupon` SET remainder_number=remainder_number-1 ,modify_date=:modifyDate WHERE id=:complaintId ";
|
|
String sql = "UPDATE `hotel_coupon` SET remainder_number=remainder_number-1 ,modify_date=:modifyDate WHERE id=:complaintId ";
|
|
|
MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
MapSqlParameterSource sps = new MapSqlParameterSource();
|