照片修改代码提交
parent
e00871e7b1
commit
cb190daee4
@ -0,0 +1,22 @@
|
||||
package com.shxy.xymanager_common.util;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ApplicationContextUtil implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext context;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.context = applicationContext;
|
||||
}
|
||||
|
||||
//根据bean名字获取工厂中指定bean 对象
|
||||
public static Object getBean(String beanName) {
|
||||
return context.getBean(beanName);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.shxy.xymanager_common.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SaltUtil {
|
||||
public static String getSalt(int n) {
|
||||
char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890!@#$%^&*()".toCharArray();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < n; i++) {
|
||||
char c = chars[new Random().nextInt(chars.length)];
|
||||
sb.append(c);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getSalt(4));
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package com.shxy.xymanager_service.impl;
|
||||
|
||||
import com.shxy.xymanager_common.dto.RoleAndPermsDto;
|
||||
import com.shxy.xymanager_common.dto.UserAndRoleDto;
|
||||
import com.shxy.xymanager_common.entity.Perms;
|
||||
import com.shxy.xymanager_dao.dao.UserDao;
|
||||
import com.shxy.xymanager_service.service.UserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户管理实现层
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Autowired
|
||||
UserDao userDao;
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户名查找用户角色
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public UserAndRoleDto findRoleByUsername(String username) {
|
||||
return userDao.findRolesByUserName(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleAndPermsDto findPermByRoleId(Integer id) {
|
||||
return userDao.findPermByRoleId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Perms> findPermsByRoleId2(String id) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package com.shxy.xymanager_service.service;
|
||||
|
||||
import com.shxy.xymanager_common.dto.RoleAndPermsDto;
|
||||
import com.shxy.xymanager_common.dto.UserAndRoleDto;
|
||||
import com.shxy.xymanager_common.entity.Perms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户管理接口
|
||||
*
|
||||
* @author 晶晶
|
||||
*/
|
||||
public interface UserService {
|
||||
|
||||
/**
|
||||
* 根据用户名查用户角色
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
UserAndRoleDto findRoleByUsername(String username);
|
||||
|
||||
//根据角色id查询权限集合
|
||||
RoleAndPermsDto findPermByRoleId(Integer id);
|
||||
|
||||
//根据角色id查询权限集合
|
||||
List<Perms> findPermsByRoleId2(String id);
|
||||
|
||||
}
|
Loading…
Reference in New Issue