panlinlin
2021-04-13 123ce171d2b8ca97d9f4011a33ce4e5e8d1cc339
src/main/java/com/genersoft/iot/vmp/web/AuthController.java
@@ -1,9 +1,9 @@
package com.genersoft.iot.vmp.web;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.service.IUserService;
import com.genersoft.iot.vmp.storager.dao.dto.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@@ -12,19 +12,16 @@
@RequestMapping(value = "/auth")
public class AuthController {
    @Value("${auth.username}")
    private String username;
    @Value("${auth.password}")
    private String password;
    @Autowired
    private IUserService userService;
    @RequestMapping("/login")
    public Object devices(String username, String password){
        if (!StringUtils.isEmpty(username) && username.equals(username)
                && !StringUtils.isEmpty(password) && password.equals(password)) {
    public String devices(String name, String passwd){
        User user = userService.getUser(name, passwd);
        if (user != null) {
            return "success";
        }else {
            return "fait";
            return "fail";
        }
    }
}