mybatis左连接需要输出左表的指定内容与筛选

  SELECT
rpl.ID, rpl.DID, rpl.TRADE_TYPE, rpl.TRADE_TIME, rpl.CALL_TIME, rpl.TRADE_ADDR, rpl.RECEIVE_PHONE, rpl.CALL_TYPE, rpl.CREATE_DATE, rpl.CREATE_BY,
rpl.STATE, rpl.REMARK, umci.contact_name
FROM
R360_Phonedetaillist rpl
Left join User_Mobile_Contact_Info umci ON rpl.receive_phone = umci.contact_mobile_no
<if test="userId != '' and userId != null">
and umci.user_id = #{userId}
</if>
WHERE
rpl.did = #{did}
<if test="orderField != '' and orderField != null and orderDirection != '' and orderDirection != null">
ORDER by ${orderField} ${orderDirection}
</if>
上一篇:postgreSQL数据类型转换字符串和数值


下一篇:LeetCode算法题-Construct String from Binary Tree(Java实现)