mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-11-02 21:44:50 +08:00
完成RoomService类编写,通过单元测试
This commit is contained in:
@@ -6,13 +6,11 @@ import java.util.List;
|
||||
|
||||
|
||||
public interface RoomService {
|
||||
int addRoom(Room room);
|
||||
int deleteRoom(int roomId);
|
||||
int deleteRoom(String roomNumber);
|
||||
int updateRoom(Room room);
|
||||
Room findById(int roomId);
|
||||
Room findByNumber(String roomNumber);
|
||||
List<Room> findByStatus(String status);
|
||||
List<Room> findByType(String typeName);
|
||||
List<Room> findAll();
|
||||
int insert(Room room);
|
||||
int delete(int roomId);
|
||||
int update(Room room);
|
||||
Room selectById(int roomId);
|
||||
List<Room> selectByStatus(int roomStatus);
|
||||
List<Room> selectByType(int typeId);
|
||||
List<Room> selectAll();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.mafangui.hotel.service.impl;
|
||||
|
||||
import cn.mafangui.hotel.entity.Room;
|
||||
import cn.mafangui.hotel.mapper.RoomMapper;
|
||||
import cn.mafangui.hotel.service.RoomService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class RoomServiceImpl implements RoomService {
|
||||
@Autowired
|
||||
private RoomMapper roomMapper;
|
||||
|
||||
@Override
|
||||
public int insert(Room room) {
|
||||
return roomMapper.insertSelective(room);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(int roomId) {
|
||||
return roomMapper.deleteByPrimaryKey(roomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Room room) {
|
||||
return roomMapper.updateByPrimaryKeySelective(room);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Room selectById(int roomId) {
|
||||
return roomMapper.selectByPrimaryKey(roomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Room> selectByStatus(int roomStatus) {
|
||||
return roomMapper.selectByStatus(roomStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Room> selectByType(int typeId) {
|
||||
return roomMapper.selectByType(typeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Room> selectAll() {
|
||||
return roomMapper.selectAll();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user