package com.weather.controller;



import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.weather.common.AjaxResult;
import com.weather.entity.SysUser;

import com.weather.mapper.SysUserMapper;
import com.weather.service.ISysUserService;
import com.weather.vo.ApiResult;

import com.weather.vo.SysUser1;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;


import java.util.List;

/**
 * <p>
 * 用户信息表 前端控制器
 * </p>
 *
 * @author feng
 * @since 2023-09-01
 */
@RestController
@RequestMapping("/sys-user")
public class SysUserController {




    @Autowired
    ISysUserService sysUserService;

    @Autowired
    SysUserMapper   sysUserMapper;

    @GetMapping("list")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "查询系统用户")
    public ApiResult list() {
       /* QueryWrapper<SysUser> wrapper=new QueryWrapper<>();
        wrapper.lambda().orderByAsc(SysUser::getUserId);*/
        List<SysUser> list = sysUserService.list();
        if (list==null||list.size()<=0){
            return ApiResult.noData();
        }

        return ApiResult.success(list);
    }


    /**
     * 获取用户信息
     *
     * @return 用户信息
     */
    @GetMapping("getInfo")

    @ApiOperation(value = " 根据ID查询系统用户")
    public AjaxResult getInfo()
    {
        SysUser user = sysUserService.selectUserById((long) 1);
        SysUser1 user1 = sysUserMapper.selectUserById1((long) 1);

        AjaxResult ajax = AjaxResult.success();
        ajax.put("user1", user1);
        ajax.put("user", user);

        return ajax;
    }




}

