完成酒店信息接口编写

This commit is contained in:
freeebird
2018-11-15 21:10:47 +08:00
parent c8124bbc70
commit f7ea1c33eb
7 changed files with 197 additions and 22 deletions

View File

@@ -6,11 +6,11 @@ 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();
int insert(Hotel hotel);
int delete(int hotelId);
int update(Hotel hotel);
Hotel selectByName(String hotelName);
Hotel selectById(int hotelId);
List<Hotel> selectAll();
}

View File

@@ -0,0 +1,46 @@
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 insert(Hotel hotel) {
return hotelMapper.insertSelective(hotel);
}
@Override
public int delete(int hotelId) {
return hotelMapper.deleteByPrimaryKey(hotelId);
}
@Override
public int update(Hotel hotel) {
return hotelMapper.updateByPrimaryKeySelective(hotel);
}
@Override
public Hotel selectByName(String hotelName) {
return hotelMapper.selectByName(hotelName);
}
@Override
public Hotel selectById(int hotelId) {
return hotelMapper.selectByPrimaryKey(hotelId);
}
@Override
public List<Hotel> selectAll() {
return hotelMapper.selectAll();
}
}