select d.*,rownum from(
SELECT
rt.outboundkey 出库单号,
(SELECT owner_name FROM bd_owner c WHERE c.owner_code = rt.owner_code AND c.project_code = rt.project_code AND c.whse_code = rt.whse_code AND c.company_code = rt.company_code) 货主,
rt.externorderkey1 客户订单号,
pl.pickkey 拣货单
FROM wh_pick pl left join wh_outbound rt On pl.outboundkey = rt.outboundkey
WHERE 1=1
AND pl.status In ( 'new','part_pick')
${if(len(key) == 0,"","AND pl.pickkey in (" + key + ")")}
and rt.project_code = '${pkey}'
and rt.whse_code = '${wkey}'
order by pl.outboundkey asc)d
谁能告诉我红色那段sql代表的含义,我怎样才能要他语法通过
${if(len(key) == 0,"","AND pl.pickkey in (" + key + ")")}
你sql语句模板还没替换完
什么叫模板没替换完?我问的是${if()}和红色里面的sql代表什么意思
if(len(key) != 0则加上AND pl.pickkey in (" + key + ")
也就是判断key的长度,如果长度不等于零就要加上这个条件
这是sql么?红色部分应该是sql模板,需要转换后才能用。
1.${if(len(key) == 0,"","AND pl.pickkey in (" + key + ")")}
if(len(key) == 0
空语句不执行
else
AND pl.pickkey in (" + key + ")
2.整体,三个或者四个 and 条件。
AND pl.status In ( 'new','part_pick')
AND pl.pickkey in (" + key + ")") 或没有
and rt.project_code = '${pkey}'
and rt.whse_code = '${wkey}'