最近使用的finereport  ,使用了神奇的传参功能。。。。。。

代码如下

select t.title,t.code,
Decode(t.status,0,'草稿',1,'已提交',2,'已批准',3,'已发布',4,'已提交',5,'已注销') as status
,u.username,   --执行人
r.keycode as category, --类别
d.keycode as assettype,   --资产类型
Decode(t.apply_type,'1','安全作业','2','符合性检查','3','事件管理') as apply_type,
t.version,t.standard,t.description
from smp_policy t,tb_user u,
(select * from tb_dictionary where type = 'assettype' ) d ,
(select * from tb_dictionary where type ='policy.type') r where t.op_id = u.id and d.value(+) = t.assettype and r.value = t.category
${if(len(code) == 0,"","and t.code like '%"+code+"%'")}
${if(len(title) == 0,"","and t.title like '%"+title+"%'")}

 

 

其中(+) 是一个表关联外面一个表的时候 如果该字段为空导致查询缺少数据的问题,

上面的查询中的assettype 就有可能为空,导致查询缺少数据

 

如图所示

Logo

永洪科技,致力于打造全球领先的数据技术厂商,具备从数据应用方案咨询、BI、AIGC智能分析、数字孪生、数据资产、数据治理、数据实施的端到端大数据价值服务能力。

更多推荐