This commit is contained in:
freeebird 2018-10-14 13:40:39 +08:00
parent 132506deef
commit ebbc2671b2
5 changed files with 72 additions and 4 deletions

View File

@ -1 +1,6 @@
# hotel
# 酒店管理系统
### 背景说明
【整体背景】
随着旅游业的发展,以及世界商贸活动的频繁举行,其周边行业如酒店、餐饮、娱乐等行业也日趋发达。其中酒店宾馆组织庞大、服务项目多、信息量庞大,传统的人工管理方式已经无法满足要求。此时需要借助于计算机来进行现代化信息管理,从而提高服务质量和管理水平,同时降低管理成本。

View File

@ -23,7 +23,7 @@ public class AdminController {
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/login")
public int Login(String userName, String password){
public int login(String userName, String password){
Admin admin = new Admin();
admin.setUserName(userName);
admin.setPassword(password);
@ -47,6 +47,12 @@ public class AdminController {
return adminService.register(admin);
}
/**
* 更新资料
* @param userName
* @param password
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/updateProfile")
public int updateProfile(String userName, String password){
Admin admin = new Admin();

View File

@ -15,7 +15,7 @@ public interface AdminMapper {
int updateByPrimaryKeySelective(Admin record);
int updateByPrimaryKey(Admin record);
Admin selectByUserName(String userName);
Admin selectByUserNameAndPassword(Admin admin);
Admin selectByUserNameAndPassword(Admin record);
int updateByUserNameSelective(Admin record);
List<Admin> findAll();
}

View File

@ -86,7 +86,7 @@
select * from admin
where user_name = #{userName,jdbcType=VARCHAR}
</select>
<select id="selectByUserNameAndPassword" parameterType="cn.mafangui.hotel.entity.Admin">
<select id="selectByUserNameAndPassword" parameterType="cn.mafangui.hotel.entity.Admin" resultMap="BaseResultMap">
select * from admin
where user_name = #{userName,jdbcType=VARCHAR} and password = #{password,jdbcType=VARCHAR}
</select>

View File

@ -0,0 +1,57 @@
package cn.mafangui.hotel.controller;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class AdminControllerTest {
@Autowired
private AdminController adminController;
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Test
public void login() {
String userName = "admin";
Assert.assertEquals(0, adminController.login(userName, userName));
}
@Test
public void register() {
String userName = "test";
Assert.assertEquals(1, adminController.register(userName, userName));
}
@Test
public void updateProfile() {
String userName = "test";
String password = "1234";
Assert.assertEquals(1, adminController.updateProfile(userName, password));
}
@Test
public void getAdmin() {
String userName = "test";
Assert.assertNotNull(adminController.getAdmin(userName));
}
@Test
public void getAllAdmin() {
Assert.assertNotNull(adminController.getAllAdmin());
}
}