/*
 *
 *      Copyright (c) 2018-2025, hnqz All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the pig4cloud.com developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: hnqz
 *
 */

package com.qunzhixinxi.hnqz.admin.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qunzhixinxi.hnqz.admin.api.dto.UserDTO;
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
import com.qunzhixinxi.hnqz.admin.api.vo.UserVO;
import com.qunzhixinxi.hnqz.admin.entity.WmDaAgent;
import com.qunzhixinxi.hnqz.common.core.util.R;
import com.qunzhixinxi.hnqz.common.data.datascope.DataScope;
import com.qunzhixinxi.hnqz.common.data.datascope.DataScopeMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author hnqz
 * @since 2017-10-29
 */
@Mapper
public interface SysUserMapper extends DataScopeMapper<SysUser> {

	/**
	 * 通过用户名查询用户信息（含有角色信息）
	 * @param username 用户名
	 * @return userVo
	 */
	UserVO getUserVoByUsername(String username);

	/**
	 * 分页查询用户信息（含角色）
	 * @param page 分页
	 * @param userDTO 查询参数
	 * @param dataScope
	 * @return list
	 */
	IPage<UserVO> getUserVosPage(Page page, @Param("query") UserDTO userDTO, DataScope dataScope);

	IPage<UserVO> getUserVosPageNoLock(Page page, @Param("query") UserDTO userDTO, DataScope dataScope);

	IPage<UserVO> selectUserList(Page page, @Param("query") UserDTO userDTO, DataScope dataScope);


	IPage<UserVO> selectListByExtEntNoPage(Page page, @Param("query") UserDTO userDTO, DataScope dataScope);


	List<UserVO> getUserVoByPlatId(@Param("query") UserDTO userDTO);

	List<UserVO> selectByPhone(@Param("query") UserDTO userDTO);
	@SqlParser(filter=true)
	List<UserVO> selectByDeptId(@Param("query")UserDTO userDTO);

	UserVO selectByUserId(@Param("query")UserDTO userDTO);

	void updateByPrimaryKeySelective(SysUser sysUser);


	/**
	 * 通过ID查询用户信息
	 * @param id 用户ID
	 * @return userVo
	 */
	UserVO getUserVoById(Integer id);

	/**
	 * 忽略逻辑删除
	 * 查询数据库的用户信息（包含已逻辑删除的数据） del_flag = 0
	 * @param id
	 * @return
	 */
	SysUser getByIdIgnore(String id);

	SysUser selectUserByName(SysUser sysUser);

	List<SysUser> selectUserById(SysUser sysUser);
}
