package com.xy.service;

import com.xy.annotate.RestMappingController;
import com.xy.dto.SysMenuDto;
import com.xy.dto.SysWorkUser.*;
import com.xy.utils.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;
import java.util.List;

/***
 * 业务用户服务类
 * @author 谭斌
 * @date 2022/12/13 19:06
 */

@RestMappingController("sysWorkUser")
public interface SysWorkUserService {


    @PostMapping("register")
    R<Long> register(@Valid @RequestBody AddDto addDto);


    @PostMapping("update")
    R<String> update(@Valid @RequestBody UpdateDto updateDto);

    @PostMapping("del")
    R del(@RequestBody @Validated DelDto delDto);

    @PostMapping("login")
    R<String> login(@RequestBody @Validated LoginDto loginDto);

    @PostMapping("logout")
    @ApiOperation("登出")
    R logout();

    @PostMapping("list")
    R<List<SysWorkVo>> list(@RequestBody ListDto listDto);

    /**
     * 根据角色编号获取权限用户ID
     *
     * @param listDto
     * @return {@link R}<{@link List}<{@link Long}>>
     */
    @PostMapping("getUserIdListByRole")
    R<List<Long>> getUserIdListByRole(@RequestBody @Validated ListByRoleDto listDto);

    /**
     * 获取登录用户菜单
     *
     * @param workMenu
     * @return
     */
    @PostMapping("getUserMenus")
    public R<List<SysMenuDto.MenuVo>> getUserMenus(@RequestBody @Validated SysMenuDto.WorkMenuList workMenu);
}
