师傅登陆接口
This commit is contained in:
parent
76ecbc8ea9
commit
450ad684e6
|
|
@ -70,6 +70,23 @@ public class WorkerController extends BaseController {
|
|||
return prefix + "/worker";
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
@ResponseBody
|
||||
public AjaxResult login(@RequestBody Worker worker){
|
||||
try {
|
||||
List<Worker> workerList = workerService.getWorkList(worker);
|
||||
if(workerList.size() > 0){
|
||||
return AjaxResult.success(workerList.get(0));
|
||||
}else {
|
||||
return AjaxResult.error("用户名或密码错误!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
return AjaxResult.error("登陆失败!");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
@ResponseBody
|
||||
public AjaxResult register(@RequestBody Worker request){
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@
|
|||
<if test="name != null and name != ''">
|
||||
AND w.name LIKE '%${name}%'
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
AND w.phone = #{phone}
|
||||
</if>
|
||||
<if test="password != null and password != ''">
|
||||
AND w.password = #{password}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue