Browse Source

民宿信息Service

raojiaolong@163.com 2 years ago
parent
commit
0bce68d695

+ 4 - 4
mhotel/src/com/happy/service/HotelDictService.java

@@ -9,17 +9,17 @@ public interface HotelDictService {
 
     /**
      * 描述:新增
-     * @param house
+     * @param hotel
      * @return
      */
-    int insertHotelDict(HotelDict house);
+    int insertHotelDict(HotelDict hotel);
 
     /**
      * 描述:修改
-     * @param house
+     * @param hotel
      * @return
      */
-    int updateHotelDict(HotelDict house);
+    int updateHotelDict(HotelDict hotel);
 
     /**
      * 描述:删除

+ 53 - 0
mhotel/src/com/happy/service/HotelService.java

@@ -0,0 +1,53 @@
+package com.happy.service;
+
+import com.happy.Model.Hotel;
+import com.happy.dto.IPage;
+
+import java.util.List;
+
+public interface HotelService {
+
+    /**
+     * 描述:新增
+     * @param hotel
+     * @return
+     */
+    int insertHotel(Hotel hotel);
+
+    /**
+     * 描述:修改
+     * @param hotel
+     * @return
+     */
+    int updateHotel(Hotel hotel);
+
+    /**
+     * 描述:删除
+     * @param id
+     * @return
+     */
+    int delHotel(int id);
+
+    /**
+     * 描述:根据Id查询详细
+     * @param id
+     * @return
+     */
+    Hotel getById(int id);
+
+    /**
+     * 描述:分页查询
+     * @param sqlx
+     * @param page
+     * @param rows
+     * @return
+     */
+    IPage<Hotel> queryPage(String sqlx, int page, int rows);
+
+    /**
+     * 描述:查询列表
+     * @param sqlx
+     * @return
+     */
+    List<Hotel> queryList(String sqlx);
+}

+ 55 - 0
mhotel/src/com/happy/service/impl/HotelDictImplService.java

@@ -0,0 +1,55 @@
+package com.happy.service.impl;
+
+import com.happy.Model.HotelDict;
+import com.happy.dao.HotelDictDao;
+import com.happy.dto.IPage;
+import com.happy.service.HotelDictService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("HotelDictService")
+public class HotelDictImplService implements HotelDictService {
+
+    @Resource
+    public HotelDictDao hotelDictDao;
+
+    @Override
+    public int insertHotelDict(HotelDict hotelDict) {
+        return hotelDictDao.insertHotelDict(hotelDict);
+    }
+
+    @Override
+    public int updateHotelDict(HotelDict hotelDict) {
+        return hotelDictDao.updateHotelDict(hotelDict);
+    }
+
+    @Override
+    public int delHotelDict(int id) {
+        return hotelDictDao.delHotelDict(id);
+    }
+
+    @Override
+    public HotelDict getById(int id) {
+        return hotelDictDao.getById(id);
+    }
+
+    @Override
+    public IPage<HotelDict> queryPage(String sqlx, int page, int rows) {
+        IPage<HotelDict> iPage = new IPage();
+        List<HotelDict> hotelDictList = hotelDictDao.queryPage(sqlx,page,rows);
+        int total = hotelDictDao.queryTotal(sqlx);
+        iPage.setPageList(hotelDictList);
+        iPage.setPage(page);
+        iPage.setTotalPage( (int)Math.ceil((double)total/rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
+    @Override
+    public List<HotelDict> queryList(String sqlx) {
+        return hotelDictDao.queryList(sqlx);
+    }
+}

+ 55 - 0
mhotel/src/com/happy/service/impl/HotelImplService.java

@@ -0,0 +1,55 @@
+package com.happy.service.impl;
+
+import com.happy.Model.Hotel;
+import com.happy.dao.HotelDao;
+import com.happy.dto.IPage;
+import com.happy.service.HotelService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("HotelService")
+public class HotelImplService implements HotelService {
+
+    @Resource
+    public HotelDao hotelDao;
+
+    @Override
+    public int insertHotel(Hotel hotel) {
+        return hotelDao.insertHotel(hotel);
+    }
+
+    @Override
+    public int updateHotel(Hotel hotel) {
+        return hotelDao.updateHotel(hotel);
+    }
+
+    @Override
+    public int delHotel(int id) {
+        return hotelDao.delHotel(id);
+    }
+
+    @Override
+    public Hotel getById(int id) {
+        return hotelDao.getById(id);
+    }
+
+    @Override
+    public IPage<Hotel> queryPage(String sqlx, int page, int rows) {
+        IPage<Hotel> iPage = new IPage();
+        List<Hotel> hotelList = hotelDao.queryPage(sqlx,page,rows);
+        int total = hotelDao.queryTotal(sqlx);
+        iPage.setPageList(hotelList);
+        iPage.setPage(page);
+        iPage.setTotalPage( (int)Math.ceil((double)total/rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
+    @Override
+    public List<Hotel> queryList(String sqlx) {
+        return hotelDao.queryList(sqlx);
+    }
+}