当前位置:网站首页>Set object value changes null value object
Set object value changes null value object
2022-07-01 19:54:00 【Ink stained with frost】
List<ShangpinInfoVODTO> footers= baseShangpinMapper.selectShangpinPageFooterList(term,wrapper);
fillFootersKcJeByKhJgsd( khdm,footers);
log("footers",footers,true);
protected void fillFootersKcJeByKhJgsd(String khdm,List<ShangpinInfoVODTO> footers) throws Exception{
String jgsd=baseKehuService.getJgsd2VOByKhdm(khdm).getJgsd();
fillFootersKcJeByJgsd( jgsd,footers);
}
protected void fillFootersKcJeByJgsd(String jgsd,List<ShangpinInfoVODTO> footers) throws Exception{
for(ShangpinInfoVODTO vo:footers){
log("vo1", vo, true);
if(null==vo) {
vo=new ShangpinInfoVODTO();
vo.setKcsl(0);
vo.setKcje(0.0);
}else{
switch(jgsd){
case "BZSJ":vo.setKcje(vo.getBzsje()); break;
case "SJ1": vo.setKcje(vo.getSj1e()); break;
case "SJ2": vo.setKcje(vo.getSj2e()); break;
case "SJ3": vo.setKcje(vo.getSj3e()); break;
case "SJ4": vo.setKcje(vo.getSj4e()); break;
case "4":vo.setKcje(vo.getBzsje()); break;
case "5": vo.setKcje(vo.getSj1e()); break;
case "6": vo.setKcje(vo.getSj2e()); break;
case "7": vo.setKcje(vo.getSj3e()); break;
case "8": vo.setKcje(vo.getSj4e()); break;
default:break;
}
}
if(null==vo.getKcsl()) vo.setKcsl(0);
if(null==vo.getKcje()) vo.setKcje(0.0);
log("vo2", vo, true);
}
log("footers1", footers, true);
}Print the results :
2022-06-30 10:08:39.419 INFO 1376 --- [io-18089-exec-2] com.hieasy.comm.util.BaseUtil : vo1:null
2022-06-30 10:08:39.419 INFO 1376 --- [io-18089-exec-2] com.hieasy.comm.util.BaseUtil : vo2:{"guige1List":[],"kcje":0.0,"kcsl":0,"limitKcys":0,"limitKcysType":0,"picList":[]}
2022-06-30 10:08:39.419 INFO 1376 --- [io-18089-exec-2] com.hieasy.comm.util.BaseUtil : footers1:[null]
2022-06-30 10:08:39.430 INFO 1376 --- [io-18089-exec-2] com.hieasy.comm.util.BaseUtil : footers:[null]
From the print results , Collection null value new The value of , Cannot change the object
It needs to be replaced with the following code :
protected void fillFootersKcJeByKhJgsd(String khdm,List<ShangpinInfoVODTO> footers) throws Exception{
String jgsd=baseKehuService.getJgsd2VOByKhdm(khdm).getJgsd();
fillFootersKcJeByJgsd( jgsd,footers);
}
protected void fillFootersKcJeByJgsd(String jgsd,List<ShangpinInfoVODTO> footers) throws Exception{
for (int i = 0; i < footers.size(); i++) {
ShangpinInfoVODTO sp= footers.get(i);
if(null==sp) {
sp=new ShangpinInfoVODTO();
sp.setKcsl(0);
sp.setKcje(0.0);
footers.set(i, sp);
}else{
switch(jgsd){
case "BZSJ":sp.setKcje(sp.getBzsje()); break;
case "SJ1": sp.setKcje(sp.getSj1e()); break;
case "SJ2": sp.setKcje(sp.getSj2e()); break;
case "SJ3": sp.setKcje(sp.getSj3e()); break;
case "SJ4": sp.setKcje(sp.getSj4e()); break;
case "4":sp.setKcje(sp.getBzsje()); break;
case "5": sp.setKcje(sp.getSj1e()); break;
case "6": sp.setKcje(sp.getSj2e()); break;
case "7": sp.setKcje(sp.getSj3e()); break;
case "8": sp.setKcje(sp.getSj4e()); break;
default:break;
}
}
}
log("footers1", footers, true);
}Print the results :
2022-06-30 10:19:36.651 INFO 8584 --- [io-18089-exec-2] com.hieasy.comm.util.BaseUtil : footers1:[{"guige1List":[],"kcje":0.0,"kcsl":0,"limitKcys":0,"limitKcysType":0,"picList":[]}]
边栏推荐
- [research materials] Huawei Technology ICT 2021: at the beginning of the "Yuan" year, the industry is "new" -- download attached
- Test self-study people must see: how to find test items in software testing?
- Unreal Engine packaging project
- Bind this of the current scope for callback functions in other cases such as timers and delayers
- Bao, what if the O & M 100+ server is a headache? Use Xingyun housekeeper!
- EasyCVR通过国标GB28181协议接入设备,出现设备自动拉流是什么原因?
- 2022/5/23-2022/5/30
- MySQL reports an error can't create table 'demo01 tb_ Student‘ (errno: 150)*
- JS proxy
- Example explanation: move graph explorer to jupyterlab
猜你喜欢

Test self-study people must see: how to find test items in software testing?

Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?

JS 之 常用内置类的使用

Oracle physical architecture
![[AI server setup] CUDA environment](/img/ca/2acfc42ea3ba24934a89472a8632f6.png)
[AI server setup] CUDA environment

GC garbage collection

Related concepts of cookies and sessions

强大、好用、适合程序员/软件开发者的专业编辑器/笔记软件综合评测和全面推荐

开发那些事儿:EasyCVR集群设备管理页面功能展示优化

windows环境 redis安装和启动(后台启动)
随机推荐
Source code series of authentic children -inheritablethreadlocal (line by line source code takes you to analyze the author's ideas)
通过js实现金字塔(星号金字塔,回文对称数字金字塔)
实例讲解将Graph Explorer搬上JupyterLab
PowerDesigner设计Name和Comment 替换
墨天轮沙龙 | 清华乔嘉林:Apache IoTDB,源于清华,建设开源生态之路
为定时器和延时器等其它情况的回调函数绑定当前作用域的this
Hls4ml entry method
Botu V16 obtains the system time and converts it into a string
Sum the amount
新窗口打开页面-window.open
自定义插入页面标签以及实现类似通讯录的首字母搜索
Interview question 1
STC 32位8051单片机开发实例教程 二 I/O工作模式及其配置
Difference between redo and undo
振弦采集模块测量振弦传感器的流程步骤
较真儿学源码系列-InheritableThreadLocal(逐行源码带你分析作者思路)
振弦采集模塊測量振弦傳感器的流程步驟
Wechat applet realizes keyword highlighting
Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?
开发那些事儿:EasyCVR平台添加播放地址鉴权功能