修复查询会员充值金额bug
This commit is contained in:
parent
01d7327be6
commit
b3194b83dc
|
|
@ -16,19 +16,23 @@ import java.util.Map;
|
|||
*/
|
||||
public interface TbMShopUserMapper extends BaseMapper<TbMShopUser> {
|
||||
@Select("<script>" +
|
||||
"SELECT " +
|
||||
"COUNT(*) userTotal, " +
|
||||
"ifnull(SUM( " +
|
||||
"IFNULL( b.charge_amount, 0 )), 0) chageTotal\n" +
|
||||
"FROM\n" +
|
||||
"tb_shop_user AS a\n" +
|
||||
"LEFT JOIN tb_user_info AS b ON a.user_id = b.id\n" +
|
||||
"WHERE\n" +
|
||||
" a.shop_id = #{shopId}\n" +
|
||||
"SELECT \n" +
|
||||
" COUNT(DISTINCT a.id) AS userTotal, \n" +
|
||||
" COALESCE(SUM(flow.total_amount), 0) AS chageTotal, \n" +
|
||||
" COALESCE(SUM(a.amount), 0) AS balanceTotal \n" +
|
||||
"FROM \n" +
|
||||
" tb_shop_user AS a\n" +
|
||||
" LEFT JOIN (\n" +
|
||||
" SELECT shop_user_id, SUM(amount) AS total_amount \n" +
|
||||
" FROM tb_shop_user_flow \n" +
|
||||
" WHERE biz_code IN ('cashMemberIn','scanMemberIn') \n" +
|
||||
" GROUP BY shop_user_id\n" +
|
||||
" ) AS flow ON flow.shop_user_id = a.id\n" +
|
||||
"WHERE \n" +
|
||||
" a.shop_id = #{shopId} \n" +
|
||||
"<if test=\"isVip !=null\">\n" +
|
||||
" and a.is_vip=#{isVip}\n" +
|
||||
"</if>" +
|
||||
|
||||
"</script>")
|
||||
Map<String, Object> selectUserSummary(@Param("shopId") String shopId, @Param("isVip") Integer isVip);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue