|
|
@@ -1,14 +1,17 @@
|
|
|
package com.happy.service.impl;
|
|
|
|
|
|
import com.happy.Model.AdminManager;
|
|
|
+import com.happy.Model.Hotel;
|
|
|
import com.happy.Model.HotelCoupon;
|
|
|
import com.happy.Until.DateUtil;
|
|
|
import com.happy.dao.HotelCouponDao;
|
|
|
+import com.happy.dao.HotelDao;
|
|
|
import com.happy.dto.IPage;
|
|
|
import com.happy.service.HotelCoupomService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@Service("hotelCoupomService")
|
|
|
@@ -17,6 +20,9 @@ public class HotelCoupomImplService implements HotelCoupomService {
|
|
|
@Resource
|
|
|
private HotelCouponDao hotelCouponDao;
|
|
|
|
|
|
+ @Resource
|
|
|
+ public HotelDao hotelDao;
|
|
|
+
|
|
|
@Override
|
|
|
public int insert(HotelCoupon hotelCoupon) {
|
|
|
return hotelCouponDao.insert(hotelCoupon);
|
|
|
@@ -41,6 +47,19 @@ public class HotelCoupomImplService implements HotelCoupomService {
|
|
|
public IPage<HotelCoupon> queryPage(String sqlx, int page, int rows) {
|
|
|
IPage<HotelCoupon> iPage = new IPage();
|
|
|
List<HotelCoupon> hotelCouponList = hotelCouponDao.queryPage(sqlx,page,rows);
|
|
|
+ hotelCouponList.forEach(hotelCoupon -> {
|
|
|
+ String hotelIds = hotelCoupon.getHotelIds();
|
|
|
+ String sql = " and id in ( " + hotelIds + " )";
|
|
|
+ List<Hotel> hotels = hotelDao.queryList(sql);
|
|
|
+ if (hotels!=null){
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ hotels.forEach(hotel -> {
|
|
|
+ stringBuilder.append(hotel.getHname()).append(",");
|
|
|
+ });
|
|
|
+ String hotelNames = stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString();
|
|
|
+ hotelCoupon.setHotelNames(hotelNames);
|
|
|
+ }
|
|
|
+ });
|
|
|
int total = hotelCouponDao.queryTotal(sqlx);
|
|
|
iPage.setPageList(hotelCouponList);
|
|
|
iPage.setPage(page);
|