导粉记录

This commit is contained in:
xiezhijun
2021-05-20 18:59:03 +08:00
parent 574c8b424e
commit 17df1db9e2
14 changed files with 135 additions and 26 deletions

View File

@ -124,8 +124,8 @@
from sys_import_fan_wx_account fwc
left join sys_wx_sale_account wa on wa.id = fwc.import_wx_account_id and wa.del_flag = 0
left join sys_wx_distribution swd on swd.wechat_account = wa.id and swd.del_flag = 0
left join sys_user su on swd.user_id = su.id and su.del_flag = 0
where fwc.del_flag = 0
left join sys_user su on swd.user_id = su.user_id and su.del_flag = 0
where fwc.del_flag = 0 and fwc.import_fan_record_id = #{id}
</select>
</mapper>

View File

@ -87,4 +87,22 @@
and import_wx_account_id = #{importWxAccountId} order by id desc limit 1
</select>
<!-- 根据微信号ID查询导粉多少 -->
<select id="getTotalImportFanNum" parameterType="SysImportFanWxAccount" resultType="Map">
select w.import_wx_account_id as wxAccountId,sum(w.import_fan_num) as fanNum
from
(
select fwa.import_wx_account_id,fwa.import_fan_num from sys_import_fan_wx_account fwa
left join sys_import_fan_record ifr on fwa.import_fan_record_id = ifr.id and ifr.del_flag = 0
where fwa.del_flag = 0
<if test="importFanDate != null">
and ifr.import_fan_date = #{importFanDate}
</if>
<if test="importWxAccountId != null">
and fwa.import_wx_account_id = #{importWxAccountId}
</if>
) w
group by w.import_wx_account_id order by w.import_wx_account_id desc
</select>
</mapper>

View File

@ -139,14 +139,13 @@
</insert>
<!-- 查询可以接粉的微信号以及对应销售,用于导粉记录管理 -->
<select id="getWxAccountAndSale" parameterType="SysWxSaleAccount" resultMap="SysWxSaleAccountResult">
<select id="getWxAccountAndSale" resultMap="SysWxSaleAccountResult">
select wa.id, wa.wx_account, su.nick_name as sale_name
from sys_wx_sale_account wa
left join sys_wx_distribution swd on wa.id = swd.wechat_account and swd.del_flag = 0
LEFT JOIN sys_user su ON su.user_id = swd.user_id AND su.del_flag = 0
where wa.del_flag = 0 and wa.status = 0
<if test="wxAccount != null and wxAccount != ''">and wa.wx_account like concat('%', #{wxAccount}, '%')</if>
order by wa.id desc
order by su.user_id asc
</select>
</mapper>