java入参为对象的(非基本数据类型int/float等)修改属性会影响原始对象

	@ApiOperation("登录接口")@RequestMapping(value = "/login", method = RequestMethod.POST)public Result<JSONObject> login(@RequestBody SysLoginModel sysLoginModel){Result<JSONObject> result = new Result<JSONObject>();// by wangh 测试System.out.println("1.result = " + result);String username = sysLoginModel.getUsername();String password = sysLoginModel.getPassword();//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户if(isLoginFailOvertimes(username)){return result.error500("该用户登录失败次数过多,请于10分钟后再次登录!");}//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户//update-begin--Author:scott  Date:20190805 for:暂时注释掉密码加密逻辑,有点问题//前端密码加密,后端进行密码解密//password = AesEncryptUtil.desEncrypt(sysLoginModel.getPassword().replaceAll("%2B", "\\+")).trim();//密码解密//update-begin--Author:scott  Date:20190805 for:暂时注释掉密码加密逻辑,有点问题//update-begin-author:taoyan date:20190828 for:校验验证码String captcha = sysLoginModel.getCaptcha();if(captcha==null){result.error500("验证码无效");// by wangh 测试System.out.println("3.result = " + result);return result;}String lowerCaseCaptcha = captcha.toLowerCase();//update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906// 加入密钥作为混淆,避免简单的拼接,被外部利用,用户自定义该密钥即可String origin = lowerCaseCaptcha+sysLoginModel.getCheckKey()+jeecgBaseConfig.getSignatureSecret();String realKey = Md5Util.md5Encode(origin, "utf-8");//update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906Object checkCode = redisUtil.get(realKey);//当进入登录页时,有一定几率出现验证码错误 #1714if(checkCode==null || !checkCode.toString().equals(lowerCaseCaptcha)) {log.warn("验证码错误,key= {} , Ui checkCode= {}, Redis checkCode = {}", sysLoginModel.getCheckKey(), lowerCaseCaptcha, checkCode);result.error500("验证码错误");// 改成特殊的code 便于前端判断result.setCode(HttpStatus.PRECONDITION_FAILED.value());// by wangh 测试System.out.println("4.result = " + result);return result;}//update-end-author:taoyan date:20190828 for:校验验证码//1. 校验用户是否有效//update-begin-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为falseLambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();queryWrapper.eq(SysUser::getUsername,username);SysUser sysUser = sysUserService.getOne(queryWrapper);//update-end-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为falseresult = sysUserService.checkUserIsEffective(sysUser);if(!result.isSuccess()) {// by wangh 测试System.out.println("5.result = " + result);return result;}//2. 校验用户名或密码是否正确String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());String syspassword = sysUser.getPassword(); // sysUser取自数据库,密码是md5加密的if (!syspassword.equals(userpassword)) {//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户addLoginFailOvertimes(username);//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户result.error500("用户名或密码错误");// by wangh 测试System.out.println("6.result = " + result);return result;}// by wangh 测试System.out.println("7.调用userinfo前 result = " + result);//用户登录信息userInfo(sysUser, result);// by wangh 测试System.out.println("8.调用userinfo后result = " + result);//update-begin--Author:liusq  Date:20210126  for:登录成功,删除redis中的验证码redisUtil.del(realKey);//update-begin--Author:liusq  Date:20210126  for:登录成功,删除redis中的验证码redisUtil.del(CommonConstant.LOGIN_FAIL + username);LoginUser loginUser = new LoginUser();BeanUtils.copyProperties(sysUser, loginUser);baseCommonService.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null,loginUser);//update-end--Author:wangshuai  Date:20200714  for:登录日志没有记录人员// by wangh 测试System.out.println("9.result = " + result);return result;}

方法中的userInfo(sysUser, result);函数没有返回值,但是却修改了result的属性,使得最终返回的result中添加了用户信息

为了验证result是否被userInfo()修改,分别在userInfo()前后加入打印:

// by wangh 测试
System.out.println("7.调用userinfo前 result = " + result);//用户登录信息
userInfo(sysUser, result);// by wangh 测试
System.out.println("8.调用userinfo后result = " + result);

输出结果:

7.调用userinfo前 result = Result(success=true, message=, code=0, result=null, timestamp=1697524486057, onlTable=null)8.调用userinfo后 result = Result(success=true, message=登录成功, code=200, result={"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2OTc1Njc2ODYsInVzZXJuYW1lIjoiYWRtaW4ifQ.8_WcvyNnonDRkSWvwCbFCMhwHm2Ggkfo_snCdbKcrUc","userInfo":{"activitiSync":1,"avatar":"https://static.jeecg.com/temp/国炬软件logo_1606575029126.png","birthday":1543939200000,"createTime":1561110850000,"delFlag":0,"departIds":"c6d7cb4deeac411cb3384b1b31278596","email":"jeecg@163.com","id":"e9ca23d68d884d4ebb19d07889727dae","loginTenantId":0,"orgCode":"A01","password":"cb362cfeefbf3d8d","phone":"18611111111","post":"总经理","realname":"管理员","salt":"RCGTeGiH","sex":1,"status":1,"updateBy":"admin","updateTime":1646837420000,"userIdentity":2,"username":"admin","workNo":"00001"},"departs":[{"createBy":"admin","createTime":1549866111000,"delFlag":"0","departName":"xxx网络公司","departOrder":0,"id":"c6d7cb4deeac411cb3384b1b31278596","izLeaf":0,"orgCategory":"1","orgCode":"A01","orgType":"1","parentId":"","tenantId":1,"updateBy":"test","updateTime":1665902900000}],"multi_depart":1,"sysAllDictItems":{"ol_form_biz_type":[{"label":"官方示例","text":"官方示例","title":"官方示例","value":"demo"},{"label":"流程表单","text":"流程表单","title":"流程表单","value":"bpm"},{"label":"测试表单","text":"测试表单","title":"测试表单","value":"temp"},{"label":"导入表单","text":"导入表单","title":"导入表单","value":"bdfl_include"}],"account_type":[{"label":"分享收入","text":"分享收入","title":"分享收入","value":"1"},{"label":"提现支出","text":"提现支出","title":"提现支出","value":"2"}],"education":[],"position_rank":[{"label":"员级","text":"员级","title":"员级","value":"1"},{"label":"助级","text":"助级","title":"助级","value":"2"},{"label":"中级","text":"中级","title":"中级","value":"3"},{"label":"副高级","text":"副高级","title":"副高级","value":"4"},{"label":"正高级","text":"正高级","title":"正高级","value":"5"}],"rule_conditions":[{"label":"大于","text":"大于","title":"大于","value":">"},{"label":"小于","text":"小于","title":"小于","value":"<"},{"label":"不等于","text":"不等于","title":"不等于","value":"!="},{"label":"等于","text":"等于","title":"等于","value":"="},{"label":"大于等于","text":"大于等于","title":"大于等于","value":">="},{"label":"小于等于","text":"小于等于","title":"小于等于","value":"<="},{"label":"左模糊","text":"左模糊","title":"左模糊","value":"LEFT_LIKE"},{"label":"右模糊","text":"右模糊","title":"右模糊","value":"RIGHT_LIKE"},{"label":"模糊","text":"模糊","title":"模糊","value":"LIKE"},{"label":"包含","text":"包含","title":"包含","value":"IN"},{"label":"自定义SQL表达式","text":"自定义SQL表达式","title":"自定义SQL表达式","value":"USE_SQL_RULES"}],"company_nature":[],"integral_resource":[{"label":"打卡","text":"打卡","title":"打卡","value":"1"},{"label":"答题","text":"答题","title":"答题","value":"2"},{"label":"留言","text":"留言","title":"留言","value":"3"},{"label":"兑换商品","text":"兑换商品","title":"兑换商品","value":"4"}],"staff_size":[],"ceshi_online":[{"label":"000","text":"000","title":"000","value":"00"},{"label":"easyui","text":"easyui","title":"easyui","value":"3"},{"label":"booostrap","text":"booostrap","title":"booostrap","value":"1"}],"online_graph_data_type":[{"label":"SQL","text":"SQL","title":"SQL","value":"sql"},{"label":"JSON","text":"JSON","title":"JSON","value":"json"},{"label":"API","text":"API","title":"API","value":"api"}],"online_graph_display_template":[{"label":"Tab风格","text":"Tab风格","title":"Tab风格","value":"tab"},{"label":"单排布局","text":"单排布局","title":"单排布局","value":"single"},{"label":"双排布局","text":"双排布局","title":"双排布局","value":"double"},{"label":"组合布局","text":"组合布局","title":"组合布局","value":"combination"}],"user_type":[{"label":"333","text":"333","title":"333","value":"333"}],"messageType":[{"label":"系统消息","text":"系统消息","title":"系统消息","value":"system"},{"label":"邮件消息","text":"邮件消息","title":"邮件消息","value":"email"},{"label":"钉钉消息","text":"钉钉消息","title":"钉钉消息","value":"dingtalk"},{"label":"企业微信","text":"企业微信","title":"企业微信","value":"wechat_enterprise"}],"remindMode":[{"label":"邮件提醒","text":"邮件提醒","title":"邮件提醒","value":"1"},{"label":"短信提醒","text":"短信提醒","title":"短信提醒","value":"2"},{"label":"系统消息","text":"系统消息","title":"系统消息","value":"4"}],"yn":[{"label":"是","text":"是","title":"是","value":"1"},{"label":"否","text":"否","title":"否","value":"0"}],"verify_status":[{"label":"默认","text":"默认","title":"默认","value":"0"},{"label":"待审核","text":"待审核","title":"待审核","value":"1"},{"label":"审核失败","text":"审核失败","title":"审核失败","value":"2"},{"label":"审核通过","text":"审核通过","title":"审核通过","value":"3"}],"has_next":[{"label":"有","text":"有","title":"有","value":"1"},{"label":"无","text":"无","title":"无","value":"0"}],"tenant_status":[{"label":"正常","text":"正常","title":"正常","value":"1"},{"label":"冻结","text":"冻结","title":"冻结","value":"0"}],"position_type":[{"label":"普通职位","text":"普通职位","title":"普通职位","value":"1"},{"label":"灵活用工","text":"灵活用工","title":"灵活用工","value":"2"},{"label":"共享用工","text":"共享用工","title":"共享用工","value":"3"}],"browse_type":[{"label":"浏览职位","text":"浏览职位","title":"浏览职位","value":"1"},{"label":"浏览简历","text":"浏览简历","title":"浏览简历","value":"2"},{"label":"浏览任务","text":"浏览任务","title":"浏览任务","value":"3"},{"label":"浏览培训","text":"浏览培训","title":"浏览培训","value":"4"}],"area":[{"label":"章贡区","text":"章贡区","title":"章贡区","value":"1"},{"label":"南康区","text":"南康区","title":"南康区","value":"2"},{"label":"赣县","text":"赣县","title":"赣县","value":"3"}],"rangeDate":[{"label":"今天","text":"今天","title":"今天","value":"jt"},{"label":"昨天","text":"昨天","title":"昨天","value":"zt"},{"label":"前天","text":"前天","title":"前天","value":"qt"},{"label":"本周","text":"本周","title":"本周","value":"bz"},{"label":"上周","text":"上周","title":"上周","value":"sz"},{"label":"本月","text":"本月","title":"本月","value":"by"},{"label":"上月","text":"上月","title":"上月","value":"sy"},{"label":"自定义日期","text":"自定义日期","title":"自定义日期","value":"zdy"}],"del_flag":[{"label":"已删除","text":"已删除","title":"已删除","value":"1"},{"label":"正常","text":"正常","title":"正常","value":"0"}],"messageHref":[{"label":"/task/myHandleTaskInfo","text":"/task/myHandleTaskInfo","title":"/task/myHandleTaskInfo","value":"bpm"},{"label":"/task/myHandleTaskInfo","text":"/task/myHandleTaskInfo","title":"/task/myHandleTaskInfo","value":"bpm_task"},{"label":"/eoa/email","text":"/eoa/email","title":"/eoa/email","value":"email"}],"cgform_table_type":[{"label":"单表","text":"单表","title":"单表","value":"1"},{"label":"主表","text":"主表","title":"主表","value":"2"},{"label":"附表","text":"附表","title":"附表","value":"3"}],"is_open":[{"label":"是","text":"是","title":"是","value":"Y"},{"label":"否","text":"否","title":"否","value":"N"}],"withdraw_status":[{"label":"待审核","text":"待审核","title":"待审核","value":"0"},{"label":"审核通过","text":"审核通过","title":"审核通过","value":"1"},{"label":"审核失败","text":"审核失败","title":"审核失败","value":"2"}],"url_type":[{"label":"内部链接","text":"内部链接","title":"内部链接","value":"1"},{"label":"外部链接","text":"外部链接","title":"外部链接","value":"2"}],"msg_category":[{"label":"通知公告","text":"通知公告","title":"通知公告","value":"1"},{"label":"系统消息","text":"系统消息","title":"系统消息","value":"2"}],"if_recommend":[{"label":"是","text":"是","title":"是","value":"1"},{"label":"否","text":"否","title":"否","value":"2"}],"org_category":[{"label":"岗位","text":"岗位","title":"岗位","value":"3"},{"label":"公司","text":"公司","title":"公司","value":"1"},{"label":"部门","text":"部门","title":"部门","value":"2"}],"priority":[{"label":"高","text":"高","title":"高","value":"H"},{"label":"中","text":"中","title":"中","value":"M"},{"label":"低","text":"低","title":"低","value":"L"}],"set_top":[{"label":"是","text":"是","title":"是","value":"1"},{"label":"否","text":"否","title":"否","value":"0"}],"dict_item_status":[{"label":"启用","text":"启用","title":"启用","value":"1"},{"label":"不启用","text":"不启用","title":"不启用","value":"0"}],"show_first":[{"label":"是","text":"是","title":"是","value":"1"},{"label":"否","text":"否","title":"否","value":"0"}],"job_status":[],"activiti_sync":[{"label":"同步","text":"同步","title":"同步","value":"1"},{"label":"不同步","text":"不同步","title":"不同步","value":"0"}],"if_common":[{"label":"是","text":"是","title":"是","value":"1"},{"label":"否","text":"否","title":"否","value":"0"}],"exp_require":[],"msgSendStatus":[{"label":"未发送","text":"未发送","title":"未发送","value":"0"},{"label":"发送成功","text":"发送成功","title":"发送成功","value":"1"},{"label":"发送失败","text":"发送失败","title":"发送失败","value":"2"}],"msg_type":[{"label":"指定用户","text":"指定用户","title":"指定用户","value":"USER"},{"label":"全体用户","text":"全体用户","title":"全体用户","value":"ALL"}],"eoa_plan_type":[{"label":"日常记录","text":"日常记录","title":"日常记录","value":"1"},{"label":"本周工作","text":"本周工作","title":"本周工作","value":"2"},{"label":"下周计划","text":"下周计划","title":"下周计划","value":"3"}],"serial_no":[{"label":"A","text":"A","title":"A","value":"A"},{"label":"B","text":"B","title":"B","value":"B"},{"label":"C","text":"C","title":"C","value":"C"},{"label":"D","text":"D","title":"D","value":"D"}],"status":[{"label":"正常","text":"正常","title":"正常","value":"1"},{"label":"停用","text":"停用","title":"停用","value":"2"}],"job_type":[],"msgType":[{"label":"文本","text":"文本","title":"文本","value":"1"},{"label":"富文本","text":"富文本","title":"富文本","value":"2"}],"eoa_plan_status":[{"label":"未开始","text":"未开始","title":"未开始","value":"0"},{"label":"进行中","text":"进行中","title":"进行中","value":"1"},{"label":"已完成","text":"已完成","title":"已完成","value":"2"}],"expect_salary":[],"reboot_type":[],"add_sign":[{"label":"正","text":"正","title":"正","value":"1"},{"label":"负","text":"负","title":"负","value":"0"}],"database_type":[{"label":"MySQL5.5","text":"MySQL5.5","title":"MySQL5.5","value":"1"},{"label":"MYSQL5.7+","text":"MYSQL5.7+","title":"MYSQL5.7+","value":"4"},{"label":"Oracle","text":"Oracle","title":"Oracle","value":"2"},{"label":"SQLServer","text":"SQLServer","title":"SQLServer","value":"3"},{"label":"postgresql","text":"postgresql","title":"postgresql","value":"6"},{"label":"marialDB","text":"marialDB","title":"marialDB","value":"5"},{"label":"达梦","text":"达梦","title":"达梦","value":"7"},{"label":"人大金仓","text":"人大金仓","title":"人大金仓","value":"8"},{"label":"神通","text":"神通","title":"神通","value":"9"},{"label":"SQLite","text":"SQLite","title":"SQLite","value":"10"},{"label":"DB2","text":"DB2","title":"DB2","value":"11"},{"label":"Hsqldb","text":"Hsqldb","title":"Hsqldb","value":"12"},{"label":"Derby","text":"Derby","title":"Derby","value":"13"},{"label":"H2","text":"H2","title":"H2","value":"14"},{"label":"其他数据库","text":"其他数据库","title":"其他数据库","value":"15"}],"log_type":[{"label":"操作日志","text":"操作日志","title":"操作日志","value":"2"},{"label":"登录日志","text":"登录日志","title":"登录日志","value":"1"}],"sub_type":[{"label":"单选题","text":"单选题","title":"单选题","value":"1"}],"show_dot":[{"label":"显示","text":"显示","title":"显示","value":"1"},{"label":"不显示","text":"不显示","title":"不显示","value":"0"}],"send_status":[{"label":"未发布","text":"未发布","title":"未发布","value":"0"},{"label":"已发布","text":"已发布","title":"已发布","value":"1"},{"label":"已撤销","text":"已撤销","title":"已撤销","value":"2"}],"pay_type":[{"label":"支付宝","text":"支付宝","title":"支付宝","value":"0"},{"label":"微信","text":"微信","title":"微信","value":"1"},{"label":"银联","text":"银联","title":"银联","value":"2"}],"eoa_cms_menu_type":[{"label":"列表","text":"列表","title":"列表","value":"1"},{"label":"链接","text":"链接","title":"链接","value":"2"}],"if_hot":[{"label":"是","text":"是","title":"是","value":"1"},{"label":"否","text":"否","title":"否","value":"0"}],"bpm_process_type":[{"label":"测试流程","text":"测试流程","title":"测试流程","value":"test"},{"label":"OA办公","text":"OA办公","title":"OA办公","value":"oa"},{"label":"业务办理","text":"业务办理","title":"业务办理","value":"business"}],"form_perms_type":[{"label":"可见(未授权不可见)","text":"可见(未授权不可见)","title":"可见(未授权不可见)","value":"1"},{"label":"可编辑(未授权禁用)","text":"可编辑(未授权禁用)","title":"可编辑(未授权禁用)","value":"2"}],"valid_status":[{"label":"无效","text":"无效","title":"无效","value":"0"},{"label":"有效","text":"有效","title":"有效","value":"1"}],"urgent_level":[{"label":"一般","text":"一般","title":"一般","value":"1"},{"label":"重要","text":"重要","title":"重要","value":"2"},{"label":"紧急","text":"紧急","title":"紧急","value":"3"}],"user_status":[{"label":"正常","text":"正常","title":"正常","value":"1"},{"label":"冻结","text":"冻结","title":"冻结","value":"2"}],"operate_type":[{"label":"查询","text":"查询","title":"查询","value":"1"},{"label":"添加","text":"添加","title":"添加","value":"2"},{"label":"修改","text":"修改","title":"修改","value":"3"},{"label":"删除","text":"删除","title":"删除","value":"4"},{"label":"导入","text":"导入","title":"导入","value":"5"},{"label":"导出","text":"导出","title":"导出","value":"6"}],"quartz_status":[{"label":"正常","text":"正常","title":"正常","value":"0"},{"label":"停止","text":"停止","title":"停止","value":"-1"}],"menu_type":[{"label":"按钮权限","text":"按钮权限","title":"按钮权限","value":"2"},{"label":"子菜单","text":"子菜单","title":"子菜单","value":"1"},{"label":"一级菜单","text":"一级菜单","title":"一级菜单","value":"0"}],"app_sort":[{"label":"默认排序","text":"默认排序","title":"默认排序","value":"0"},{"label":"打卡数量降序","text":"打卡数量降序","title":"打卡数量降序","value":"1"},{"label":"打卡数量升序","text":"打卡数量升序","title":"打卡数量升序","value":"2"},{"label":"浏览数量降序","text":"浏览数量降序","title":"浏览数量降序","value":"3"},{"label":"浏览数量升序","text":"浏览数量升序","title":"浏览数量升序","value":"4"}],"sex":[{"label":"男","text":"男","title":"男","value":"1"},{"label":"女","text":"女","title":"女","value":"2"}],"perms_type":[{"label":"显示","text":"显示","title":"显示","value":"1"},{"label":"禁用","text":"禁用","title":"禁用","value":"2"}],"global_perms_type":[{"label":"可见/可访问(授权后可见/可访问)","text":"可见/可访问(授权后可见/可访问)","title":"可见/可访问(授权后可见/可访问)","value":"1"},{"label":"可编辑(未授权时禁用)","text":"可编辑(未授权时禁用)","title":"可编辑(未授权时禁用)","value":"2"}],"cover_type":[{"label":"县市名称","text":"县市名称","title":"县市名称","value":"1"},{"label":"基地信息","text":"基地信息","title":"基地信息","value":"2"}],"online_graph_type":[{"label":"柱状图","text":"柱状图","title":"柱状图","value":"bar"},{"label":"曲线图","text":"曲线图","title":"曲线图","value":"line"},{"label":"饼图","text":"饼图","title":"饼图","value":"pie"},{"label":"数据列表","text":"数据列表","title":"数据列表","value":"table"}],"run_mode":[{"label":"正式","text":"正式","title":"正式","value":"1"},{"label":"测试","text":"测试","title":"测试","value":"0"}],"if_parttime":[{"label":"兼职","text":"兼职","title":"兼职","value":"1"},{"label":"全职","text":"全职","title":"全职","value":"0"}],"gz_district":[{"label":"不限","text":"不限","title":"不限","value":"0"},{"label":"章贡区","text":"章贡区","title":"章贡区","value":"章贡区"},{"label":"南康区","text":"南康区","title":"南康区","value":"南康区"},{"label":"赣县区","text":"赣县区","title":"赣县区","value":"赣县区"},{"label":"信丰县","text":"信丰县","title":"信丰县","value":"信丰县"},{"label":"大余县","text":"大余县","title":"大余县","value":"大余县"},{"label":"上犹县","text":"上犹县","title":"上犹县","value":"上犹县"},{"label":"崇义县","text":"崇义县","title":"崇义县","value":"崇义县"},{"label":"安远县","text":"安远县","title":"安远县","value":"安远县"},{"label":"龙南市","text":"龙南市","title":"龙南市","value":"龙南市"},{"label":"定南县","text":"定南县","title":"定南县","value":"定南县"},{"label":"全南县","text":"全南县","title":"全南县","value":"全南县"},{"label":"宁都县","text":"宁都县","title":"宁都县","value":"宁都县"},{"label":"于都县","text":"于都县","title":"于都县","value":"于都县"},{"label":"兴国县","text":"兴国县","title":"兴国县","value":"兴国县"},{"label":"会昌县","text":"会昌县","title":"会昌县","value":"会昌县"},{"label":"寻乌县","text":"寻乌县","title":"寻乌县","value":"寻乌县"},{"label":"石城县","text":"石城县","title":"石城县","value":"石城县"},{"label":"瑞金市","text":"瑞金市","title":"瑞金市","value":"瑞金市"}],"bpm_status":[{"label":"待提交","text":"待提交","title":"待提交","value":"1"},{"label":"处理中","text":"处理中","title":"处理中","value":"2"},{"label":"已完成","text":"已完成","title":"已完成","value":"3"},{"label":"已作废","text":"已作废","title":"已作废","value":"4"}],"work_overtime":[],"depart_status":[{"label":"不启用","text":"不启用","title":"不启用","value":"0"},{"label":"启用","text":"启用","title":"启用","value":"1"}],"task_type":[]}}, timestamp=1697524486057, onlTable=null)

这也解决了我之前看代码时的疑惑,为什么下面的代码会放在userInfo(sysUser, result)内,他们能影响最终的返回值吗?

obj.put("token", token);
obj.put("userInfo", sysUser);
result.setResult(obj);

	private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result) {String username = sysUser.getUsername();String syspassword = sysUser.getPassword();// 获取用户部门信息JSONObject obj = new JSONObject(new LinkedHashMap<>());//1.生成tokenString token = JwtUtil.sign(username, syspassword);// 设置token缓存有效时间redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);obj.put("token", token);//2.设置登录租户Result<JSONObject> loginTenantError = sysUserService.setLoginTenant(sysUser, obj, username,result);if (loginTenantError != null) {return loginTenantError;}//3.设置登录用户信息obj.put("userInfo", sysUser);//4.设置登录部门 分別處理單用戶0部門單部門和多部門情況List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());obj.put("departs", departs);if (departs == null || departs.size() == 0) {obj.put("multi_depart", 0);} else if (departs.size() == 1) {sysUserService.updateUserDepart(username, departs.get(0).getOrgCode(),null);obj.put("multi_depart", 1);} else {//查询当前是否有登录部门// update-begin--Author:wangshuai Date:20200805 for:如果用戶为选择部门,数据库为存在上一次登录部门,则取一条存进去SysUser sysUserById = sysUserService.getById(sysUser.getId());if(oConvertUtils.isEmpty(sysUserById.getOrgCode())){sysUserService.updateUserDepart(username, departs.get(0).getOrgCode(),null);}// update-end--Author:wangshuai Date:20200805 for:如果用戶为选择部门,数据库为存在上一次登录部门,则取一条存进去obj.put("multi_depart", 2);}obj.put("sysAllDictItems", sysDictService.queryAllDictItems());result.setResult(obj);result.success("登录成功");return result;}

 得出结论,即使不使用返回值,也可以通过修改传入参数对象的属性来影响主程序中的对象属性。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/108915.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

禁用和开启笔记本电脑的键盘功能,最快的方式

笔记本键盘通常较小&#xff0c;按键很不方便&#xff0c;当我们外接了键盘时就不需要再使用自带的键盘了&#xff0c;而且午睡的时候&#xff0c;总是担心碰到笔记本的键盘&#xff0c;可能会删掉我们的代码什么的&#xff0c;所以就想着怎么禁用掉&#xff0c;下面是操作步骤…

面向切面:AOP

文章目录 简介相关术语①横切关注点②通知&#xff08;增强&#xff09;③切面④目标⑤代理⑥连接点⑦切入点 场景模拟代理模式静态代理动态代理 基于注解的AOP&#xff08;重点&#xff09;准备工作各种通知切入点表达式语法重用切入点表达式获取通知的相关信息 环绕通知 切面…

分类算法-逻辑回归与二分类

1、逻辑回归的应用场景 广告点击率是否为垃圾邮件是否患病金融诈骗虚假账号 看到上面的例子&#xff0c;我们可以发现其中的特点&#xff0c;那就是都属于两个类别之间的判断。逻辑回归就是解决二分类问题的利器。 2、 逻辑回归的原理 2.1 输入 逻辑回归的输入就是一个线性…

HarmonyOS/OpenHarmony原生应用开发-华为Serverless服务支持情况(四)

文档中的TS作者认为就是ArkTS之意。 一、云存储 AppGallery Connect&#xff08;简称AGC&#xff09;云存储是一种可伸缩、免维护的云端存储服务&#xff0c;可用于存储图片、音频、视频或其他由用户生成的内容。借助云存储服务&#xff0c;您可以无需关心存储服务器的开发、…

Python自动化运维实战——Telnetlib和Netmiko自动化管理网络设备

❤️博客主页&#xff1a; iknow181&#x1f525;系列专栏&#xff1a; Python、JavaSE、JavaWeb、CCNP&#x1f389;欢迎大家点赞&#x1f44d;收藏⭐评论✍ 目录 一、前言 二、准备工作 三、Telnetlib Telnetlib介绍 Telnetlib模块及操作方法介绍 Telnetlib配置设备 T…

uniapp:使用subNVue原生子窗体在map上层添加自定义组件

我们想要在地图上层添加自定义组件&#xff0c;比如一个数据提示框&#xff0c;点一下会展开&#xff0c;再点一下收起&#xff0c;在h5段显示正常&#xff0c;但是到app端真机测试发现组件显示不出来&#xff0c;这是因为map是内置原生组件&#xff0c;层级最高&#xff0c;自…

从0开始编写BP,自适应学习率的BP神经网络,不使用MATLAB工具箱,纯手写matlab代码,以BP分类为例...

与上篇文章不同&#xff0c;仔细读了上篇文章的小伙伴应该知道&#xff0c;BP神经网络是有一个学习率的&#xff0c;而这个学习率很大程度上决定着神经网络的效果。这里采用自适应学习率&#xff0c;实现纯手写BP神经网络。 编程时&#xff0c;激活函数选择Sigmoid函数&#xf…

MFC-列表控件

目录 1、更改列表控件的属性&#xff1a; 2、代码设置表头&#xff1a; 3、设置正文内容&#xff1a; 4、设置属性&#xff0c;显示成表格形式 &#xff1a; 5、代码实现&#xff1a; 1、更改列表控件的属性&#xff1a; VIEW设置为Report模式会出现表格形状 2、代码设置…

二维码智慧门牌管理系统:高效标准化处理地址数据

文章目录 前言一、标准化数据的重要性二、标准检查与自动化处理三、人工修复与高效性四、数据应用与效益 前言 随着科技的快速发展&#xff0c;数据管理在现代社会中扮演着越来越重要的角色。为了提升数据质量&#xff0c;标准化检查成为必不可少的环节。今天&#xff0c;我们…

软考系统架构设计师考试冲刺攻略

系统架构冲刺攻略 上篇为综合知识&#xff0c;介绍了系统架构设计师应熟练掌握的基本知识&#xff0c;主要包括绪论、计算机系统、信息系统、信息安全技术、软件工程、数据库设计、系统架构设计、系统质量属性与架构评估、软件可靠性、软件架构的演化和维护、未来信息综合技术等…

【面试经典150 | 区间】插入区间

文章目录 Tag题目解读题目来源解题思路方法一&#xff1a;合并区间方法二&#xff1a;模拟 其他语言python3 写在最后 Tag 【模拟】【数组】 题目解读 给定一个含有多个无重叠区间的数组&#xff0c;并且数组已经按照区间开始值升序排序。在列表中插入一个新的区间&#xff0…

小程序原生代码转uniapp

写了一份小程序原生代码&#xff0c;想转为uniapp 再转为其他平台发布 1、在命令行里&#xff0c;运行【 npm install miniprogram-to-uniapp -g 】进行安装&#xff0c;因为这个包是工具&#xff0c;要求全局都能使用&#x…

JS加密/解密之webpack打包代码逆向

Webpack 是一个强大的打包工具&#xff0c;能够将多个文件打包成一个或多个最终的文件。然而&#xff0c;将已经经过打包的代码还原回原始源代码并不是一件直接的事情&#xff0c;因为 webpack 打包的过程通常会对代码进行压缩、混淆和优化&#xff0c;丢失了部分变量名和代码结…

【C++11新特性】右值引用和移动语义(移动构造,移动赋值)

文章目录 前言一、列表初始化&#xff08;不同于初始化列表&#xff09;二、initializer_list三、decltype关键字四、nullptr五、右值引用移动拷贝和移动赋值被编译器识别成将亡值的原因 左值引用和右值引用的场景和价值右值引用的场景move函数 六、关于右值引用的功能和属性问…

pinctrl子系统 - 架构和结构体关系(四)

一&#xff0c;pinctrl的引入 由于SoC系统越来越复杂、集成度越来越高&#xff0c;SoC中pin的数量也越来越多、功能也越来越复杂&#xff0c;这就对如何管理、使用这些pins提出了挑战。因此&#xff0c;用于管理这些pins的硬件模块&#xff08;pin controller&#xff09;就出…

c# xml 参数配置表的使用

使用简介 实际使用界面 配置表管理界面 进入 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;…

用GDB调试程序的栈帧

2023年10月17日&#xff0c;周二晚上 目录 练习GDB栈帧调试功能的程序 GDB栈帧方面的指令 调试效果 练习GDB栈帧调试功能的程序 斐波那契数列 #include <iostream>int factorial(int n) {if (n < 1) {return 1;} else {return n * factorial(n - 1);} }int main(…

Redis数据结构之listpack

前言 当数据量较小时&#xff0c;Redis 会优先考虑用 ziplist 来存储 hash、list、zset&#xff0c;这么做可以有效的节省内存空间&#xff0c;因为 ziplist 是一块连续的内存空间&#xff0c;它采用一种紧凑的方式来存储元素。但是它也有缺点&#xff0c;比如查找的时间复杂度…

nginx基础概念

1.正向代理&#xff1a;代理的是客户端&#xff0c;一般有明确的访问对象 比如&#xff1a;我现在通过v-p-n去访问YouTube&#xff0c;那么就是正向代理。 2.反向代理&#xff1a;代理的是服务器 最常见的就是web中&#xff0c;nginx去代理一群后端的服务器。 3.负载均衡&…