推广部分小修改

This commit is contained in:
liuyingfang
2023-07-25 14:41:25 +08:00
parent ae628adba4
commit 817223d79f
9 changed files with 141 additions and 23 deletions

View File

@@ -248,17 +248,14 @@
<select id="queryMerchantProfitPage" parameterType="java.util.Map"
resultType="cn.pluss.platform.entity.MerchantProfit">
SELECT
u.loginName as childLoginName,
u.trueName as childtrueName,
p.type_code ,
t.loginName as userLoginName,
t.trueName as usertrueName,
profit.*
profit.*,
ua.userType,
bi.alias
FROM
tb_pluss_merchant_profit profit
LEFT JOIN tb_pluss_user_promotion p ON profit.userId = p.parent_user_id
LEFT JOIN tb_pluss_user_info u ON p.user_id = u.id
left join tb_pluss_user_info t on profit.userId=t.id
LEFT JOIN tb_pluss_merchant_order merchantOrder ON profit.orderNumber = merchantOrder.orderNumber
LEFT JOIN tb_pluss_user_app ua ON ua.userId = profit.userId
LEFT JOIN tb_pluss_merchant_base_info bi ON merchantOrder.merchantCode = bi.merchantCode
<where>
profit.userId=#{userId}
<if test="id!= null">
@@ -283,7 +280,7 @@
and profit.merchantCode = #{merchantCode}
</if>
<if test="merchantName!= null">
and profit.merchantName like CONCAT('%',#{merchantName},'%')
and bi.alias like CONCAT('%',#{merchantName},'%')
</if>
<if test="consumeFee!= null">
and profit.consumeFee = #{consumeFee}
@@ -888,7 +885,7 @@
</select>
<select id="getConsumeFeeTeamToday" resultType="java.math.BigDecimal">
SELECT
SUM(v.consumeFee)
IFNULL(SUM(v.consumeFee),0)
FROM
(
SELECT
@@ -904,6 +901,7 @@
LEFT JOIN tb_pluss_merchant_order v ON v.merchantCode = b.merchantCode
WHERE
FIND_IN_SET( p.user_id, ID._ids )
AND b.userId != #{userId}
AND v.status = 1
AND date_format( `v`.`transDt`, '%Y-%m-%d' ) = date_format(( curdate() - INTERVAL 0 DAY ), '%Y-%m-%d' )
</select>
@@ -923,7 +921,10 @@
WHERE
up.parent_user_id = #{userId}
AND up.type_code = #{typeCode}
order by ua.userId ASC limit #{page}, #{size}
<if test="userName != null and userName != ''">
AND ua.userName = #{userName}
</if>
order by ua.userId DESC
</select>
<select id="getChannelStatus" resultType="cn.pluss.platform.entity.MerchantChannelStatus">
SELECT
@@ -933,4 +934,52 @@
WHERE merchantCode = #{merchantCode}
</select>
<select id="directlyOrder" resultType="cn.pluss.platform.vo.ProfitOrderVO">
SELECT
v.merchantName,
v.consumeFee,
v.transDt,
v.orderNumber
FROM
view_base_order v
WHERE v.userId in (select p.user_id from tb_pluss_user_promotion p where p.parent_user_id= #{userId})
order by v.id desc
limit #{pageSize} offset #{offset}
</select>
<select id="teamOrder" resultType="cn.pluss.platform.vo.ProfitOrderVO">
SELECT
v.merchantName,
v.consumeFee,
v.transDt,
v.orderNumber
FROM
view_base_order v
WHERE
v.userId IN (
SELECT
p.user_id
FROM
(
SELECT
@ids AS _ids,
( SELECT @ids := GROUP_CONCAT( user_id ) FROM tb_pluss_user_promotion WHERE FIND_IN_SET( parent_user_id, @ids ) ) AS cids,
@l := @l + 1 AS LEVEL
FROM
tb_pluss_user_promotion,
( SELECT @ids := #{userId}, @l := 0 ) b
WHERE
@ids IS NOT NULL
) ID,
tb_pluss_user_promotion p
WHERE
FIND_IN_SET( p.user_id, ID._ids )
ORDER BY
user_id
)
and v.userId!=#{userId}
ORDER BY
v.id desc
limit #{pageSize} offset #{offset}
</select>
</mapper>

View File

@@ -1666,4 +1666,15 @@
left join tb_pluss_user_info ui on ua.userId = ui.id
where ui.phone = #{phone} and userType not in ('agent_staff','staff') AND LENGTH(ui.phone) = 11
</select>
<select id="selectUserAppWithChannelStatusCountV2" resultType="java.lang.Integer">
SELECT
count(*)
FROM
tb_pluss_user_app ua
LEFT JOIN tb_pluss_user_promotion up ON ua.userId = up.parent_user_id
WHERE
up.parent_user_id = #{userId}
AND up.create_time <![CDATA[ >= ]]> #{startTime}
AND up.create_time <![CDATA[ <= ]]> #{endTime}
</select>
</mapper>