添加酒店信息的基本操作

This commit is contained in:
freeebird
2018-10-24 18:48:21 +08:00
parent 79971cc62c
commit c7cac3cbe1
9 changed files with 213 additions and 155 deletions

View 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();
}

View File

@@ -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();
}
}