package com.lovenav.controller;

import com.alibaba.fastjson2.JSONObject;
import com.lovenav.dao.AuthDao;
import com.lovenav.entity.Auth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("/Auth")
public class AuthController {

    @Autowired
    AuthDao authDao;

    @RequestMapping("/retAllAuth")
    public String retAllAuth(){
        List<Auth> auths = authDao.selectAllAuth();
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", 200);
        result.put("msg", "查询结果");
        result.put("data",auths);
        String jsonString = JSONObject.toJSONString(result);
        return jsonString;
    }
}
