select
tuspa.LIST_ID listId,
tuss.SUP_NAME supName,
#这块使用了concat函数 一般是需要拼接几个 就在中间写几个
concat(tup.PRODUCT_CODE,'-',tup.PRODUCT_NAME) productName,
tuspa.SUP_PRODUCT_CODE supProductCode,
tuspa.STATE state,
tuspa.REMARKS remarks,
tuss.SUP_TYPE supType
from t_uw_supplice_product_auth as tuspa
left join t_uw_service_supplier as tuss on tuspa.SUP_ID=tuss.SUP_ID
left join t_uw_product as tup on tuspa.PRODUCT_ID=tup.PRODUCT_ID
<where>
<if test="req.supId != null">
and tuspa.SUP_ID =#{req.supId}
</if>
<if test="req.productId != null">
and tuspa.PRODUCT_ID =#{req.productId}
</if>
<if test="req.state != null and req.state !=''">
and tuspa.STATE =#{req.state}
</if>
</where>
mybatis中合并俩个字段使用concat函数优美解决
于 2021-10-29 10:43:27 首次发布