推广部分大改

This commit is contained in:
liuyingfang
2023-07-21 19:30:00 +08:00
parent bfba38e27b
commit d4fe97d570
25 changed files with 805 additions and 58 deletions

View File

@@ -2981,4 +2981,18 @@
#{item}
</foreach>
</select>
<select id="queryMerchantOrderMoneyByTime" resultType="java.math.BigDecimal">
SELECT sum(consumeFee) from tb_pluss_merchant_order
<where>
<if test="startTime != null">
and transDt &gt;= #{startTime}
</if>
<if test="endTime!= null">
and transDt &lt;= #{endTime}
</if>
AND merchantCode = #{merchantCode}
AND status = 1
</where>
</select>
</mapper>

View File

@@ -248,14 +248,19 @@
<select id="queryMerchantProfitPage" parameterType="java.util.Map"
resultType="cn.pluss.platform.entity.MerchantProfit">
SELECT
profit.*,
ua.userType
u.loginName as childLoginName,
u.trueName as childtrueName,
p.type_code ,
t.loginName as userLoginName,
t.trueName as usertrueName,
profit.*
FROM
tb_pluss_merchant_profit profit
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_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
<where>
and merchantOrder.status = 1
profit.userId=#{userId}
<if test="id!= null">
and profit.id = #{id}
</if>
@@ -346,7 +351,6 @@
<if test="merchantParentPhone!= null">
and profit.merchantParentPhone = #{merchantParentPhone}
</if>
</where>
order by id desc limit #{pageSize} offset #{offset}
</select>
@@ -555,7 +559,7 @@
<select id="queryMerchantProfitSumPrice" parameterType="java.util.Map" resultType="java.lang.Double">
SELECT sum(price) from tb_pluss_merchant_profit profit
<where>
WHERE profit.type = 5
<if test="id!= null">
and profit.id = #{id}
</if>
@@ -565,9 +569,6 @@
<if test="userId!= null">
and profit.userId = #{userId}
</if>
<if test="type!= null">
and profit.type = #{type}
</if>
<if test="price!= null">
and profit.price = #{price}
</if>
@@ -658,7 +659,7 @@
<if test="recordDateEnd != null">
and profit.recordDate &lt;= #{recordDateEnd}
</if>
</where>
</select>
@@ -865,4 +866,71 @@
</foreach>
GROUP BY userId
</select>
<select id="getConsumeFeeTeam" resultType="java.math.BigDecimal">
SELECT
SUM(v.consumeFee)
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
LEFT JOIN tb_pluss_merchant_base_info b ON b.userId = p.user_id
LEFT JOIN tb_pluss_merchant_order v ON v.merchantCode = b.merchantCode
WHERE
FIND_IN_SET( p.user_id, ID._ids )
AND v.status = 1
</select>
<select id="getConsumeFeeTeamToday" resultType="java.math.BigDecimal">
SELECT
SUM(v.consumeFee)
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
LEFT JOIN tb_pluss_merchant_base_info b ON b.userId = p.user_id
LEFT JOIN tb_pluss_merchant_order v ON v.merchantCode = b.merchantCode
WHERE
FIND_IN_SET( p.user_id, ID._ids )
AND v.status = 1
AND date_format( `v`.`transDt`, '%Y-%m-%d' ) = date_format(( curdate() - INTERVAL 0 DAY ), '%Y-%m-%d' )
</select>
<select id="getTeamList" resultType="cn.pluss.platform.vo.MerchantProfitVO">
SELECT
ua.userId,
ua.userName,
ui.phone,
up.current_fee,
up.type_code,
ua.merchantCode,
ua.createDt
FROM
tb_pluss_user_promotion up
LEFT JOIN tb_pluss_user_app ua ON ua.userId = up.user_id
LEFT JOIN tb_pluss_user_info ui ON ui.id = ua.userId
WHERE
up.parent_user_id = #{userId}
AND up.type_code = #{typeCode}
order by ua.userId ASC limit #{page}, #{size}
</select>
<select id="getChannelStatus" resultType="cn.pluss.platform.entity.MerchantChannelStatus">
SELECT
`status`, authorizationStatus,remark,virChannelFlag
FROM
tb_pluss_merchant_channel_status
WHERE merchantCode = #{merchantCode}
</select>
</mapper>

View File

@@ -239,6 +239,202 @@
</where>
</select>
<select id="queryUserPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_user_app ua
LEFT JOIN tb_pluss_user_info ui ON ua.userId = ui.id
<where>
<if test="phone != null">
and ui.phone = #{phone}
</if>
<if test="id!= null">
and ua.id = #{id}
</if>
<if test="userId!= null">
and ua.userId = #{userId}
</if>
<if test="logo!= null">
and ua.logo = #{logo}
</if>
<if test="level!= null">
and ua.level = #{level}
</if>
<if test="userType!= null">
and ua.userType = #{userType}
</if>
<if test="createDt!= null">
and ua.createDt = #{createDt}
</if>
<if test="stTime!= null">
and ua.createDt &gt;= #{stTime}
</if>
<if test="enTime!= null">
and ua.createDt &lt;= #{enTime}
</if>
<if test="status!= null">
and ua.status = #{status}
</if>
<if test="certnum!= null">
and ua.certnum = #{certnum}
</if>
<if test="certBacKPhoto!= null">
and ua.certBacKPhoto = #{certBacKPhoto}
</if>
<if test="handCertPhoto!= null">
and ua.handCertPhoto = #{handCertPhoto}
</if>
<if test="bankName!= null">
and ua.bankName = #{bankName}
</if>
<if test="bankAddress!= null">
and ua.bankAddress = #{bankAddress}
</if>
<if test="bankBranch!= null">
and ua.bankBranch = #{bankBranch}
</if>
<if test="bankNo!= null">
and ua.bankNo = #{bankNo}
</if>
<if test="bankPhoto!= null">
and ua.bankPhoto = #{bankPhoto}
</if>
<if test="merchantCode!= null">
and ua.merchantCode = #{merchantCode}
</if>
<if test="fansProfit!= null">
and ua.fansProfit = #{fansProfit}
</if>
<if test="extendProfit!= null">
and ua.extendProfit = #{extendProfit}
</if>
<if test="cashProfit!= null">
and ua.cashProfit = #{cashProfit}
</if>
<if test="userName!= null">
and ua.userName = #{userName}
</if>
<if test="staffType!= null">
and ua.staffType = #{staffType}
</if>
<if test="parentId!= null">
and ua.parentId = #{parentId}
</if>
<if test="inviteNum!= null">
and ua.inviteNum = #{inviteNum}
</if>
<if test="bankStatus!= null">
and ua.bankStatus = #{bankStatus}
</if>
<if test="merchantStatus!= null">
and ua.merchantStatus = #{merchantStatus}
</if>
<if test="certReason!= null">
and ua.certReason = #{certReason}
</if>
<if test="bankReason!= null">
and ua.bankReason = #{bankReason}
</if>
<if test="merchantReason!= null">
and ua.merchantReason = #{merchantReason}
</if>
<if test="certPeriod!= null">
and ua.certPeriod = #{certPeriod}
</if>
<if test="certStartTime!= null">
and ua.certStartTime = #{certStartTime}
</if>
<if test="bankAddressCode!= null">
and ua.bankAddressCode = #{bankAddressCode}
</if>
<if test="merchantName!= null">
and ua.merchantName = #{merchantName}
</if>
<if test="merchantAddress!= null">
and ua.merchantAddress = #{merchantAddress}
</if>
<if test="merchantDetailAddress!= null">
and ua.merchantDetailAddress = #{merchantDetailAddress}
</if>
<if test="contactName!= null">
and ua.contactName = #{contactName}
</if>
<if test="contactPhone!= null">
and ua.contactPhone = #{contactPhone}
</if>
<if test="productDesc!= null">
and ua.productDesc = #{productDesc}
</if>
<if test="bussAuthNum!= null">
and ua.bussAuthNum = #{bussAuthNum}
</if>
<if test="bussAuthPeriod!= null">
and ua.bussAuthPeriod = #{bussAuthPeriod}
</if>
<if test="storeId!= null">
and ua.storeId = #{storeId}
</if>
<if test="appAuthToken!= null">
and ua.appAuthToken = #{appAuthToken}
</if>
<if test="tradeMoney!= null">
and ua.tradeMoney = #{tradeMoney}
</if>
<if test="authCount!= null">
and ua.authCount = #{authCount}
</if>
<if test="subMchId!= null">
and ua.subMchId = #{subMchId}
</if>
<if test="aisleSwitch!= null">
and ua.aisleSwitch = #{aisleSwitch}
</if>
<if test="unionpay!= null">
and ua.unionpay = #{unionpay}
</if>
<if test="mccCode!= null">
and ua.mccCode = #{mccCode}
</if>
<if test="contactEmail!= null">
and ua.contactEmail = #{contactEmail}
</if>
<if test="mccName!= null">
and ua.mccName = #{mccName}
</if>
<if test="leshuaLicenseName!= null">
and ua.leshuaLicenseName = #{leshuaLicenseName}
</if>
<if test="aliAccount!= null">
and ua.aliAccount = #{aliAccount}
</if>
<if test="aliName!= null">
and ua.aliName = #{aliName}
</if>
<if test="aliSignUrl!= null">
and ua.aliSignUrl = #{aliSignUrl}
</if>
<if test="wechatSignUrl!= null">
and ua.wechatSignUrl = #{wechatSignUrl}
</if>
<if test="token!= null">
and ua.token = #{token}
</if>
<if test="endTime!= null">
and ua.createDt <![CDATA[>=]]> #{startTime}
</if>
<if test="endTime!= null">
and ua.createDt <![CDATA[<=]]> #{endTime}
</if>
<if test="isVoice!= null">
and ua.isVoice = #{isVoice}
</if>
<if test="parentIdList!= null">
and ua.parentId in
<foreach collection="parentIdList" item="item" open="(" close=")" index="index" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="queryUserInfoVOPage" parameterType="java.util.Map" resultMap="userInfoVO">
SELECT DISTINCT SQL_CALC_FOUND_ROWS
ua.id,

View File

@@ -3,21 +3,38 @@
<mapper namespace="cn.pluss.platform.mapper.UserPromotionMapper">
<!-- 通用查询映射结果 -->
<!-- <resultMap id="BaseResultMap" type="cn.pluss.platform.entity.UserVoice">-->
<!-- <id column="id" property="id" />-->
<!-- <result column="userId" property="userId" />-->
<!-- <result column="paySuccess" property="paySuccess" />-->
<!-- <result column="payCancel" property="payCancel" />-->
<!-- <result column="memberCharge" property="memberCharge" />-->
<!-- <result column="memberConsume" property="memberConsume" />-->
<!-- <result column="deliveryOrder" property="deliveryOrder" />-->
<!-- <result column="storeOrder" property="storeOrder" />-->
<!-- <result column="urge" property="urge" />-->
<!-- </resultMap>-->
<resultMap id="BaseResultMap" type="cn.pluss.platform.entity.UserPromotion">
<id column="id" property="userId" jdbcType="VARCHAR" />
<result column="user_id" property="userId" />
<result column="type_code" property="typeCode" />
<result column="current_fee" property="currentFee" />
<result column="parent_user_id" property="parentUserId" />
<result column="create_time" property="createTime" />
<result column="is_extend" property="isExtend" />
<result column="update_time" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
user_id, type_code, current_fee, parent_user_id, is_extend, create_time, update_time
</sql>
<update id="updateByPrimaryKey">
update tb_pluss_user_promotion
set type_code = #{typeCode,jdbcType=VARCHAR},
current_fee = #{currentFee,jdbcType=DECIMAL},
parent_user_id = #{parentUserId,jdbcType=VARCHAR},
is_extend = #{isExtend,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where user_id = #{userId,jdbcType=INTEGER}
</update>
<select id="selectListByUserId" resultType="cn.pluss.platform.entity.UserProfit">
SELECT * FROM tb_pluss_user_promotion WHERE `user_id` IN
<foreach open="(" separator="," close=")" collection="userIdList" item="item">
#{item}
</foreach>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap">
select *
from tb_pluss_user_promotion
where user_id = #{userId}
</select>
</mapper>