package com.pannk.demo.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pannk.demo.entity.SysUserEntity;
import com.pannk.demo.service.SysUserService;
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;

/**
 * Created by wolf on 20-11-10.
 */
@RestController
@RequestMapping("/sys/user")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    /**
     * 列表查询
     *
     * @return
     */
    @GetMapping("/list")
    public Result list() {
        return Result.success(sysUserService.list());
    }

    /**
     * 分页查询
     *
     * @return
     */
    @GetMapping("/page")
    public Result page(int currPage,int pageSize) {
        IPage<SysUserEntity> page = new Page<>(currPage,pageSize);
        page = sysUserService.page(page,null);
        return Result.success(page);
    }

}
