use of tk.ainiyue.danyuan.application.user.userbase.po.SysUserBaseInfo in project danyuan-application by 514840279.
the class SysUserBaseController method save.
@ApiOperation(value = "修改角色信息", notes = "")
@RequestMapping(path = "/save", method = RequestMethod.POST)
@ResponseBody
public String save(@RequestBody SysUserBaseInfo info) {
logger.info("save", SysUserBaseController.class);
try {
SysUserBaseInfo baseInfo = sysUserBaseService.findByName(info.getUserName());
if (baseInfo == null) {
info.setUuid(UUID.randomUUID().toString().replaceAll("-", ""));
encryptPassword(info);
sysUserBaseService.save(info);
} else {
return "用户名已存在";
}
return "1";
} catch (Exception e) {
return "0";
}
}
use of tk.ainiyue.danyuan.application.user.userbase.po.SysUserBaseInfo in project danyuan-application by 514840279.
the class SysUserBaseServiceImpl method findAllBySearchText.
/**
* 方法名 : findAllBySearchText
* 功 能 : TODO(这里用一句话描述这个方法的作用)
* 参 数 : @param pageNumber
* 参 数 : @param pageSize
* 参 数 : @param info
* 参 数 : @return
* 参 考 : @see
* tk.ainiyue.danyuan.application.user.userbase.service.SysUserBaseService#findAllBySearchText(int,
* int, tk.ainiyue.danyuan.application.user.userbase.po.SysUserBaseInfo)
* 作 者 : Administrator
*/
@Override
public Page<SysUserBaseInfo> findAllBySearchText(int pageNumber, int pageSize, SysUserBaseInfo info) {
// logger.info(tableUuid, SysColumnServiceImpl.class);
// Page<SysColumnInfo> list = sysColumnDao.findAllByTableUuid(tableUuid);
Example<SysUserBaseInfo> example = Example.of(info);
Sort sort = new Sort(new Order(Direction.ASC, "createTime"));
PageRequest request = new PageRequest(pageNumber - 1, pageSize, sort);
Page<SysUserBaseInfo> sourceCodes = sysUserBaseDao.findAll(example, request);
return sourceCodes;
}
use of tk.ainiyue.danyuan.application.user.userbase.po.SysUserBaseInfo in project danyuan-application by 514840279.
the class SysUserBaseServiceImpl method findByName.
/**
* 方法名 : findByName
* 功 能 : TODO(这里用一句话描述这个方法的作用)
* 参 数 : @param userName
* 参 数 : @return
* 参 考 : @see
* tk.ainiyue.danyuan.application.user.userbase.service.SysUserBaseService#findByName(java.lang.String)
* 作 者 : Administrator
*/
@Override
public SysUserBaseInfo findByName(String userName) {
SysUserBaseInfo info = new SysUserBaseInfo();
info.setUserName(userName);
Example<SysUserBaseInfo> example = Example.of(info);
SysUserBaseInfo sourceCodes = sysUserBaseDao.findOne(example);
return sourceCodes;
}
use of tk.ainiyue.danyuan.application.user.userbase.po.SysUserBaseInfo in project danyuan-application by 514840279.
the class CustomUserDetailsService method loadUserByUsername.
@Override
public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
SysUserBaseInfo user;
try {
user = sysUserBaseService.findByName(userName);
} catch (Exception e) {
throw new UsernameNotFoundException("user select fail");
}
if (user == null) {
throw new UsernameNotFoundException("no user found");
} else {
try {
List<SysMenuInfo> menu = sysUserBaseService.getRoleByUser(user.getUuid());
List<GrantedAuthority> gas = new ArrayList<>();
if (menu != null) {
for (SysMenuInfo sysMenuInfo : menu) {
gas.add(new SimpleGrantedAuthority(sysMenuInfo.getName()));
}
}
// gas.add(new SwitchUserGrantedAuthority("ROLE_USER", new Authentication()));
UserDetails users = new User(user.getUserName(), user.getPassword(), true, true, true, true, gas);
return users;
} catch (Exception e) {
throw new UsernameNotFoundException("user role select fail");
}
}
}
Aggregations