1、第一种情况是条件只需要查询一张表中的数据,
主要的SQL语句:
<!-- 分页查询主播列表-->
<select id="findAnchor" resultMap="AppUserResultMap">
SELECT
ta.id,
ta.nickname,
tl.title,
tlv.type as anchorType,
tlv.cash_deposit as cashDeposit,
ta.phone
FROM
t_app_user ta
LEFT JOIN t_liveroom tl ON ta.id = tl.anchor_id
LEFT JOIN t_liveinfo tlv ON ta.id = tlv.user_id and tlv.status=1
WHERE
ta.is_anchor = 1
<if test="id != null and id != '' ">
AND ta.id = #{id,jdbcType=BIGINT}
</if>
<if test="phone != null and phone != ''">
AND ta.phone = #{phone,jdbcType=VARCHAR}
</if>
<if test="nickname != null and status != '' ">
AND ta.nickname = #{nickname,jdbcType=VARCHAR}
</if>
&l