完成RoomTypeService类编写,通过单元测试

This commit is contained in:
freeebird
2018-11-12 16:19:23 +08:00
parent dbee98a4f0
commit 01475b6215
7 changed files with 178 additions and 39 deletions

View File

@@ -1,20 +1,20 @@
package cn.mafangui.hotel.service;
import cn.mafangui.hotel.entity.RoomType;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public interface RoomTypeService {
int addRoomType(RoomType roomType);
int insert(RoomType roomType);
int delRoomType(RoomType roomType);
int delete(int typeId);
int delById(int typeId);
int update(RoomType roomType);
int updateRoomType(RoomType roomType);
RoomType selectByName(RoomType roomType);
RoomType selectByName(String roomType);
RoomType selectById(int typeId);

View File

@@ -0,0 +1,46 @@
package cn.mafangui.hotel.service.impl;
import cn.mafangui.hotel.entity.RoomType;
import cn.mafangui.hotel.mapper.RoomTypeMapper;
import cn.mafangui.hotel.service.RoomTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RoomTypeServiceImpl implements RoomTypeService {
@Autowired
private RoomTypeMapper roomTypeMapper;
@Override
public int insert(RoomType roomType) {
return roomTypeMapper.insertSelective(roomType);
}
@Override
public int delete(int typeId) {
return roomTypeMapper.deleteByPrimaryKey(typeId);
}
@Override
public int update(RoomType roomType) {
return roomTypeMapper.updateByPrimaryKeySelective(roomType);
}
@Override
public RoomType selectByName(String roomType) {
return roomTypeMapper.selectByRoomType(roomType);
}
@Override
public RoomType selectById(int typeId) {
return roomTypeMapper.selectByPrimaryKey(typeId);
}
@Override
public List<RoomType> findAllType() {
return roomTypeMapper.selectAll();
}
}