package com.judong.chuanyiserver.dao;

import com.judong.chuanyiserver.entity.Permission;
import com.judong.chuanyiserver.entity.Role;
import com.judong.chuanyiserver.entity.User;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserDao {

    User getUserByNamePass(String userName, String password);

    User getUserById(String userId);

    User getUserByName(String userName);

    Integer addUser(String userId, String userName, String password);

    Role getRoleByName(String roleName);

    Integer addRole(String roleName);

    Integer addUserRole(String userId, int roleId);

    List<Integer> getRoleIdListByUserId(String userId);

    List<Role> getShareRoleList(String userId, List<Role> roleList);

    List<Integer> getNoShareOldRoleList(String userId, List<Role> roleList);

    Integer deleteUserRole(String userId, List<Integer> roleIdList);

    Integer addRoleList(String userId, List<Role> roleList);

    List<Permission> getPermissionByRoleList(List<Integer> roleList);

    List<Role> getRoleListByUserId(String userId);

    Long getUserCount();

    List<User> getUserPage(Long startNum, Long limitNum);

    Integer deleteUserRoleByUserId(String userId);

    Integer updateUserState(String userId, Integer userState);

    Integer updateLoginState(String userId);

    Integer updateUser(User user);

    Integer updateRole(Role role);

    Long getRoleCount();

    List<Role> getRoleListByPage(Long startNum, Long limitNum);

    Role getRoleById(Integer id);

    Permission getPermissionByUrl(String permissionUrl);

    Integer addPermission(Permission permission);

    User getUserByNameNoId(String userId, String userName);

    Role getRoleByNoIdName(int id, String roleName);

    Permission getPermissionByNoIdUrl(int id, String permissionUrl);

    Integer updatePermission(Permission permission);

    Permission getPermissionById(Integer id);

    Long getPermissionCount();

    List<Permission> getPermissionListByPage(Long startNum, Long limitNum);

    Integer deletePermissionById(Integer id);

    Integer deleteRolePermissionById(Integer id);

    List<Permission> getSharePermissionList(int roleId, List<Permission> permissionList);

    Integer deleteRolePermissionByRoleId(int roleId);

    List<Integer> getNoShareOldPermissionList(int roleId, List<Permission> permissionList);

    Integer deleteRolePermission(int roleId, List<Integer> permissionIdList);

    Integer addPermissionList(int roleId, List<Permission> permissionList);
}
