mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-11-02 21:44:50 +08:00
添加酒店信息的基本操作
This commit is contained in:
16
src/main/java/cn/mafangui/hotel/service/HotelService.java
Normal file
16
src/main/java/cn/mafangui/hotel/service/HotelService.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package cn.mafangui.hotel.service;
|
||||
|
||||
import cn.mafangui.hotel.entity.Hotel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HotelService {
|
||||
|
||||
int addHotel(Hotel hotel);
|
||||
int deleteHotel(int hotelId);
|
||||
int updateHotel(Hotel hotel);
|
||||
Hotel selectHotelByName(String hotelName);
|
||||
Hotel selectHotelById(int hotelId);
|
||||
List<Hotel> findAllHotel();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.mafangui.hotel.service.impl;
|
||||
|
||||
import cn.mafangui.hotel.entity.Hotel;
|
||||
import cn.mafangui.hotel.mapper.HotelMapper;
|
||||
import cn.mafangui.hotel.service.HotelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class HotelServiceImpl implements HotelService {
|
||||
@Autowired
|
||||
private HotelMapper hotelMapper;
|
||||
|
||||
@Override
|
||||
public int addHotel(Hotel hotel) {
|
||||
return hotelMapper.insertSelective(hotel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteHotel(int hotelId) {
|
||||
return hotelMapper.deleteByPrimaryKey(hotelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateHotel(Hotel hotel) {
|
||||
return hotelMapper.updateByPrimaryKeySelective(hotel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hotel selectHotelByName(String hotelName) {
|
||||
return hotelMapper.selectByName(hotelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hotel selectHotelById(int hotelId) {
|
||||
return hotelMapper.selectByPrimaryKey(hotelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Hotel> findAllHotel() {
|
||||
return hotelMapper.selectAll();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user