CAST()函数
<select id="exportExtAll" resultType="com.hq.domain.entity.order.vo.StatementExtExportVO">
select o.order_id,o.order_no,o.money_used as orderUsed,o.create_time as moneyeceivedTime,
s.money_received,s.money_available,s.money_used,s.ext_order_no,s.ext_pay_time,s.ext_pay_type,s.ext_status,s.exception_status,s.use_status,
m.name as settlementName,
bos.deal_school_name as schoolName, bos.teacher_recruit_name as teacherName
from t_statement_order o
left join t_statement s on o.statement_id = s.id
left join t_settlement_method m on s.settlement_id = m.id
left join biz_order_saleman bos on cast(o.order_id as char) = bos.order_id
<where>
<if test="settlementId != null">
s.settlement_id = #{settlementId}
</if>
<if test="extOrderNo != null and extOrderNo !=''">
and s.ext_order_no like concat('%',#{extOrderNo},'%')
</if>
<if test="startTime != null and startTime !=''">
and s.ext_pay_time >= #{startTime}
</if>
<if test="endTime != null and endTime !=''">
and s.ext_pay_time <= #{endTime}
</if>
<if test="exceptionStatus != null">
and s.exception_status = #{exceptionStatus}
</if>
<if test="useStatus != null">
and s.use_status = #{useStatus}
</if>
and s.ext_order_no is not null
</where>
order by s.ext_pay_time desc
</select>
select a.*,b.* from a left join b on a.aid = b.aid and b.dr = 0
where a.status = 1;
-- left join on 后面带and条件时,and条件只对left join右面的表起作用,对left join左面的表不起作用