Files
chaozhanggui/pluss-dao-bundle/target/classes/mapper/AgentMapper.xml
2023-01-28 15:57:27 +08:00

73 lines
2.7 KiB
XML

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.pluss.platform.mapper.AgentMapper">
<select id="selectPage" resultType="cn.pluss.platform.vo.AgentInfo">
SELECT
ua.userId,
ui.loginName,
mr.rate,
ui.phone,
ui.STATUS,
ua.userName,
ui.createTime,
ui.updateTime
FROM
tb_pluss_user_app ua
LEFT JOIN tb_pluss_user_info ui ON ua.userId = ui.id
LEFT JOIN tb_pluss_merchant_rate mr ON ua.userId = mr.userId
WHERE
ua.userType = 'agent'
<include refid="commonWhere"/>
ORDER BY
ui.createTime
</select>
<select id="selectOne" resultType="cn.pluss.platform.vo.AgentInfo">
SELECT ua.userId, ui.loginName, mr.rate, ui.phone, ui.status, ua.userName, ui.createTime,
ui.updateTime,pc.cashAmt
FROM tb_pluss_user_app ua
LEFT JOIN tb_pluss_user_info ui
ON ua.userId = ui.id
LEFT JOIN tb_pluss_merchant_rate mr
ON ua.userId=mr.userId
LEFT JOIN tb_pluss_cash pc
ON ua.userId = pc.userId
WHERE ua.userType = 'agent'
<include refid="commonWhere"/>
LIMIT 1
</select>
<sql id="commonWhere">
<if test="agentInfo.userId != null and agentInfo.userId != ''">
AND ua.userId = #{agentInfo.userId}
</if>
<if test="agentInfo.loginName != null and agentInfo.loginName != ''">
AND ui.loginName LIKE CONCAT("%", #{agentInfo.loginName}, "%")
</if>
<if test="agentInfo.parentId != null">
AND ua.parentId = #{agentInfo.parentId}
</if>
<if test="agentInfo.phone != null and agentInfo.phone != ''">
AND ui.phone LIKE CONCAT("%", #{agentInfo.phone}, "%")
</if>
<if test="agentInfo.userName != null and agentInfo.userName != ''">
AND ua.userName LIKE #{agentInfo.userName}
</if>
<if test="agentInfo.createTimeStart != null">
AND ui.createTime &gt; #{agentInfo.createTimeStart}
</if>
<if test="agentInfo.createTimeEnd != null">
AND ui.createTime &lt;= #{agentInfo.createTimeEnd}
</if>
<if test="agentInfo.updateTimeStart != null">
AND ui.updateTime &gt; #{agentInfo.updateTimeStart}
</if>
<if test="agentInfo.updateTimeEnd != null">
AND ui.updateTime &lt;= #{agentInfo.updateTimeEnd}
</if>
<if test="agentInfo.rate != null and agentInfo.rate != ''">
AND mr.rate = #{agentInfo.rate}
</if>
</sql>
</mapper>