师傅登陆接口

This commit is contained in:
kuang.yifei@iwhalecloud.com 2022-08-09 18:13:02 +08:00
parent 76ecbc8ea9
commit 450ad684e6
2 changed files with 23 additions and 0 deletions

View File

@ -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){

View File

@ -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>