package com.starry.admin.modules.personnel.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelUserInfoQueryVo;
import com.starry.admin.modules.personnel.module.vo.PlayPersonnelUserInfoReturnVo;
import com.starry.admin.modules.system.module.entity.SysUserEntity;
import com.starry.admin.modules.system.service.SysUserService;
import com.starry.common.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 管理员管理Controller
 *
 * @author admin
 * @since 2024-06-14
 */
@Api(tags = "系统用户管理", description = "系统用户信息管理相关接口，包括查询等操作")
@RestController
@RequestMapping("/personnel/user")
public class PlayPersonnelUserInfoController {

    @Resource
    private SysUserService sysUserService;

    /**
     * 分页查询账户信息列表
     */
    @ApiOperation(value = "分页查询用户列表", notes = "分页查询系统用户信息列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功", response = PlayPersonnelUserInfoReturnVo.class, responseContainer = "Page")})
    @PostMapping("/listByPage")
    public R listByPage(
            @ApiParam(value = "查询条件", required = true) @Validated @RequestBody PlayPersonnelUserInfoQueryVo vo) {
        IPage<PlayPersonnelUserInfoReturnVo> list = sysUserService.selectByPage(vo);
        return R.ok(list);
    }

    /**
     * 查询所有账户信息列表
     */
    @ApiOperation(value = "查询所有用户", notes = "查询所有系统用户信息")
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功", response = SysUserEntity.class, responseContainer = "List")})
    @GetMapping("/listAll")
    public R listAll() {
        List<SysUserEntity> list = sysUserService.selectAll();
        return R.ok(list);
    }

}
