20200521
This commit is contained in:
parent
6c02d62343
commit
1c5661e442
@ -33,11 +33,15 @@ public class trafficController {
|
||||
|
||||
|
||||
/**登录验证*/
|
||||
@RequestMapping(value = "/login", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
@RequestMapping(value = "/logon", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public Map<String,Object> login(@RequestBody Map<String,Object> param) {
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result = trafficService.getUser();
|
||||
try {
|
||||
result = trafficService.getUser(param);
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.springboot.traffic.dao.trafficMapper">
|
||||
<!--用户注册-->
|
||||
<insert id="userRegister" parameterType="map">
|
||||
insert into traffic_user(user_id,user_name,user_password,user_phone)
|
||||
values
|
||||
@ -11,8 +12,9 @@
|
||||
#{formName.phone}
|
||||
)
|
||||
</insert>
|
||||
<!--用户登录-->
|
||||
<select id="getUser" parameterType="map" resultType="map">
|
||||
select * from traffic_user
|
||||
select * from traffic_user where user_name = #{formName.name} and user_password = #{formName.pass}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -8,11 +8,19 @@ import java.util.Map;
|
||||
@Mapper
|
||||
public interface trafficMapper {
|
||||
|
||||
/**用户注册
|
||||
* @param param**/
|
||||
/**
|
||||
* 用户注册
|
||||
* @param 用户名、密码、手机号
|
||||
* @return 1:注册成功 0:注册失败
|
||||
*/
|
||||
int userRegister(Map<String, Object> param);
|
||||
|
||||
List<Map<String, Object>> getUser();
|
||||
/**
|
||||
* 用户登录
|
||||
* @param 用户名、密码
|
||||
* @return 用户是否注册
|
||||
*/
|
||||
List<Map<String, Object>> getUser(Map<String, Object> param);
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,11 @@ public class trafficServiceImpl implements trafficService {
|
||||
@Autowired
|
||||
trafficMapper trafficMapper;
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
* @param 用户名、密码、手机号
|
||||
* @return 成功与否、数据
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> register(Map<String, Object> param) {
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
@ -28,10 +33,20 @@ public class trafficServiceImpl implements trafficService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* @param 用户名、密码
|
||||
* @return 用户是否注册
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getUser() {
|
||||
public Map<String, Object> getUser(Map<String, Object> param) {
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
List<Map<String,Object>> res = trafficMapper.getUser();
|
||||
List<Map<String,Object>> res = null;
|
||||
try {
|
||||
res = trafficMapper.getUser(param);
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
result.put("success", true);
|
||||
result.put("data", res);
|
||||
return result;
|
||||
|
@ -4,14 +4,19 @@ import java.util.Map;
|
||||
|
||||
public interface trafficService {
|
||||
|
||||
/**用户注册**/
|
||||
/**
|
||||
* 用户注册
|
||||
* @param 用户名、密码、手机号
|
||||
* @return 成功与否、数据
|
||||
*/
|
||||
Map<String, Object> register(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* 用户登录
|
||||
* @param 用户名、密码
|
||||
* @return 用户是否注册
|
||||
*/
|
||||
Map<String, Object> getUser();
|
||||
Map<String, Object> getUser(Map<String, Object> param);
|
||||
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
<el-input type="password" v-model="logonForm.pass"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('logonForm')">登录</el-button>
|
||||
<el-button type="primary" @click="submitLogon(logonForm)">登录</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
@ -181,7 +181,14 @@ export default {
|
||||
this.$message.error('用户名已存在!');
|
||||
}
|
||||
},r=>{
|
||||
this.$message.error('注册失败!');
|
||||
})
|
||||
},
|
||||
|
||||
//用户登录
|
||||
submitLogon(formName){
|
||||
this.$ajax.post("/traffic/logon",{formName},r=>{
|
||||
debugger
|
||||
})
|
||||
},
|
||||
|
||||
@ -210,6 +217,6 @@ export default {
|
||||
|
||||
.menu{
|
||||
height:4rem;
|
||||
width:100%
|
||||
width: %
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user