package com.gci.boot.modules.system.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gci.boot.modules.system.entity.SysUser;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * 用户表 服务类
 * </p>
 *
 * @author chenzhiwei
 * @since 2023-08-17
 */
public interface ISysUserService extends IService<SysUser> {

    SysUser getByUsername(String username);

    @Transactional(rollbackFor = Exception.class)
    void addUserEncryptPassword(SysUser user, List<String> roleIds, List<String> departIds);

    @Transactional(rollbackFor = Exception.class)
    void editUserEncryptPassword(SysUser user, List<String> roleIds, List<String> departIds);

    @Transactional(rollbackFor = Exception.class)
    void addUser(SysUser user, List<String> roleIds, List<String> departIds);

    @Transactional(rollbackFor = Exception.class)
    void addInnerUser(SysUser user, List<String> roleIds, List<String> departIds, List<String> projectIds);

    @Transactional(rollbackFor = Exception.class)
    void editUser(SysUser user, List<String> roleIds, List<String> departIds);

    @Transactional(rollbackFor = Exception.class)
    void editInnerUser(SysUser user, List<String> roleIds, List<String> departIds, List<String> projectIds);

    String processPhone(SysUser user);

    void resetPassword(String username, String oldpassword, String newpassword, String confirmpassword);

    Set<String> getUserRolesSet(String username);

    Set<String> getUserRoleIdsSet(String username);

    Set<String> getUserPermissionsSet(String username);

    Map<String, String> getUserRoleIds(List<String> userIdList);

	List<SysUser> getByRoleCode(String roleCode);

    void deleteBatch(List<String> userIds);

    @Transactional(rollbackFor = Exception.class)
    void delete(String userId);

    /**
     * 分页查询内部用户列表
     * @param user
     * @return
     */
    IPage<SysUser> queryInnerUserList(Page<SysUser> page, SysUser user);

    IPage<SysUser> queryPageListV2(SysUser user, String roleName, String departName, String column, String order, Page<SysUser> page);
}
