/**
* 文件：UserService.java
* 版本：1.0.0
* 日期：
* Copyright &reg; 
* All right reserved.
*/

package com.mortals.xhx.base.system.user.service;

import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDService;
import com.mortals.framework.service.IUser;
import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.user.model.UserEntity;

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

/**
 * <p>Title: 用户信息</p>
 * <p>Description: UserService service接口 </p>
 * <p>Copyright: Copyright &reg;  </p>
 * <p>Company: </p>
 * @author 
 * @version 1.0.0
 */

public interface UserService extends ICRUDService<UserEntity,Long> {
    /**
     * 用户登录
     *
     * @param loginName 登录用户名
     * @param password  登录密码
     * @param loginIp   登录IP
     * @return
     * @throws AppException
     */
    public UserEntity doLogin(String loginName, String password, String loginIp) throws AppException;

    /**
     * 校验用户名与密码是否正确
     *
     * @param loginName
     * @param password
     * @return
     * @throws AppException
     */
    public UserEntity doCheckUser(String loginName, String password) throws AppException;

    /**
     * 检查用户是否存在
     *
     * @param loginName 登录用户名
     * @param userId    密码
     * @return
     */
    public boolean existUser(String loginName, Long userId) throws AppException;

    /**
     * 通过登录用户获取菜单功能权限
     *
     * @param user
     * @return
     */
    public List<MenuEntity> findOutlookBarList(IUser user);

    /**
     * 查询用户所有有权限的菜单ID
     *
     * @param userEntity
     * @return
     */
    public Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException;

    /**
     * 查询用户记录
     *
     * @param platformId
     * @param params
     * @param currPage
     * @param prePageResult
     * @return
     * @throws AppException
     */
    public Result<UserEntity> find(Long platformId, UserEntity params, int currPage, int prePageResult) throws AppException;

    /**
     * 为客户创建用户
     *
     * @param currUser     当前用户
     * @param customerId   客户ID
     * @param customerName 客户名称
     * @param loginName
     * @param password
     * @param userName
     * @param mobile
     * @return
     * @throws AppException
     */
    public UserEntity createUser(IUser currUser, Long customerId, String customerName, String loginName, String password,
                                 String userName, String mobile) throws AppException;

    /**
     * 用户修改密码
     *
     * @param loginName
     * @param oldPwd
     * @param newPwd
     * @return
     * @throws AppException
     */
    public boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException;
}