管理端店铺用户相关接口

This commit is contained in:
张松
2025-02-13 16:06:15 +08:00
parent 140f9344e0
commit aa6df702f3
16 changed files with 504 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.ShopUserFlowMapper">
</mapper>

View File

@@ -3,5 +3,39 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.ShopUserMapper">
<update id="incrAccount">
update tb_shop_user
set amount=amount + #{money},
update_time=#{time}
where id = #{id}
and shop_id = #{shopId}
</update>
<update id="decrAccount">
update tb_shop_user
set amount=amount - #{money},
update_time=#{time}
where id = #{id}
and shop_id = #{shopId}
and amount - #{money} >= 0
</update>
<select id="selectPageByKeyAndIsVip" resultType="com.czg.account.entity.ShopUser">
select a.* from tb_user_info as a
left join tb_shop_user as b on a.id=b.user_id
where b.shop_id=#{shopId}
<if test="key != null and key != ''">
and (a.nick_name like %#{key}% or a.phone like %#{key}%)
</if>
<if test="isVip != null">
and b.is_vip=#{isVip}
</if>
</select>
<select id="selectUserSummary" resultType="com.czg.account.dto.shopuser.ShopUserSummaryDTO">
select count(a.id) userTotal, sum(IFNULL(a.amount, 0)) balanceTotal,sum(IFNULL(b.amount,0)) chargeTotal from tb_shop_user as a
left join tb_shop_user_flow as b on a.id=b.user_id and b.type='+' and b.biz_code in ('cashIn', 'wechatIn', 'alipayIn')
where a.shop_id = #{shopId}
<if test="isVip !=null">
and a.is_vip=#{isVip}
</if>
</select>
</mapper>