package cn.cslg.pas.controller;

import cn.cslg.pas.common.core.base.Constants;
import cn.cslg.pas.common.model.vo.UserVO;
import cn.cslg.pas.common.utils.Response;
import cn.cslg.pas.domain.User;
import cn.cslg.pas.service.UserService;
import cn.cslg.pas.service.upLoadPatent.UploadTaskService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * <p>
 * 系统用户 前端控制器
 * </p>
 *
 * @author 王岩
 * @since 2021-12-24
 */
@Tag(name = "系统用户")
@RestController
@RequestMapping(Constants.API_VERSION_V2 + "/user")
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class UserController {

    private final UserService userService;
    private final UploadTaskService uploadTaskService;
    @GetMapping("list")
    @Operation(summary = "租户列表")
    public String getPageList(UserVO params) throws IOException {
        return userService.getPageList(params);
    }
    @GetMapping("personnelList")
    @Operation(summary = "人员列表")
    public String getPersonnelList(UserVO params) throws IOException {
        return userService.getPersonnelList(params);
    }

    @PostMapping("add")
    @Operation(summary = "新增用户")
    public String add(@RequestBody User user) {
        return userService.add(user);
    }

    @PostMapping("edit")
    @Operation(summary = "编辑用户")
    public String edit(@RequestBody User user) {
        return userService.edit(user);
    }

    @PostMapping("delete")
    @Operation(summary = "删除用户")
    public String delete(Integer id) {
        return userService.delete(id);
    }

    @PostMapping("addTask")
    @Operation(summary = "删除用户")
    public String test(Integer id) {
        return "test";
    }



}
