欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

java——添加大量学生用户

程序员文章站 2022-03-09 23:19:27
...
@RequestMapping(value = "/add", method = RequestMethod.POST)
    @RequiresPermissions("user:add")
	public Result<?> add() {
	    try{

        }catch(Exception e){
	        e.printStackTrace();
        }
        List<StStudent> stStudents=stStudentService.list();
        for(StStudent ststudent:stStudents){
            SysUser user=new SysUser();
            user.setRealname(ststudent.getStName());
            user.setUsername(ststudent.getStudentId());
            user.setWorkNo(ststudent.getStudentId());
            user.setSex(new Integer(ststudent.getSex()));
            user.setCreateTime(new Date());//设置创建时间
            String salt = oConvertUtils.randomGen(8);
            user.setSalt(salt);
            String passwordEncode = PasswordUtil.encrypt(user.getUsername(), "123456", salt);
            user.setPassword(passwordEncode);
            user.setDelFlag("0");
            sysUserService.addUserWithRole(user, "1257603335870078978");
        }
        return Result.ok("添加成功!");
	}

java——添加大量学生用户

相关标签: 项目碎片