会员余额明细获取

This commit is contained in:
张松 2025-03-25 00:18:15 +08:00
parent 1cac2de9ac
commit 6c7b92845f
6 changed files with 52 additions and 9 deletions

View File

@ -6,6 +6,7 @@ import com.czg.account.entity.ShopUser;
import com.czg.account.entity.ShopUserFlow;
import com.czg.account.service.ShopUserFlowService;
import com.czg.account.service.ShopUserService;
import com.czg.account.vo.ShopUserFlowVO;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.annotation.SaStaffCheckPermission;
import com.czg.enums.ShopUserFlowBizEnum;
@ -63,15 +64,8 @@ public class ShopUserController {
@SaAdminCheckPermission(value = "shopUser:flow", name = "店铺用户充值记录")
@GetMapping("/flow")
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
public CzgResult<Page<ShopUserFlow>> flow(@RequestParam Integer userId, String bizCode) {
QueryWrapper queryWrapper = new QueryWrapper().eq(ShopUserFlow::getShopId, StpKit.USER.getShopId())
.eq(ShopUserFlow::getUserId, userId);
if (StrUtil.isNotBlank(bizCode)) {
queryWrapper.eq(ShopUserFlow::getBizCode, bizCode);
}
queryWrapper.orderBy(ShopUserFlow::getCreateTime, false);
queryWrapper.orderBy(ShopUserFlow::getId, true);
return CzgResult.success(shopUserFlowService.page(PageUtil.buildPage(), queryWrapper));
public CzgResult<Page<ShopUserFlowVO>> flow(Integer userId, String bizCode) {
return CzgResult.success(shopUserFlowService.pageInfo(StpKit.USER.getShopId(), userId, bizCode));
}
/**

View File

@ -1,6 +1,8 @@
package com.czg.account.service;
import com.czg.account.entity.ShopUserFlow;
import com.czg.account.vo.ShopUserFlowVO;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import java.math.BigDecimal;
@ -14,4 +16,6 @@ import java.math.BigDecimal;
public interface ShopUserFlowService extends IService<ShopUserFlow> {
void updateRefund(Long id, BigDecimal refundAmount);
Page<ShopUserFlowVO> pageInfo(Long shopId, Integer userId, String bizCode);
}

View File

@ -0,0 +1,16 @@
package com.czg.account.vo;
import com.czg.account.entity.ShopUserFlow;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author Administrator
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ShopUserFlowVO extends ShopUserFlow {
private String shopName;
private String phone;
private String nickName;
}

View File

@ -1,7 +1,11 @@
package com.czg.service.account.mapper;
import com.czg.account.vo.ShopUserFlowVO;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.ShopUserFlow;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户余额流水 映射层
@ -11,4 +15,5 @@ import com.czg.account.entity.ShopUserFlow;
*/
public interface ShopUserFlowMapper extends BaseMapper<ShopUserFlow> {
List<ShopUserFlowVO> pageInfo(@Param("shopId") Long shopId, @Param("userId") Integer userId, @Param("bizCode") String bizCode);
}

View File

@ -2,7 +2,12 @@ package com.czg.service.account.service.impl;
import com.czg.account.entity.ShopUserFlow;
import com.czg.account.service.ShopUserFlowService;
import com.czg.account.vo.ShopUserFlowVO;
import com.czg.service.account.mapper.ShopUserFlowMapper;
import com.czg.utils.PageUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.update.UpdateChain;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
@ -25,4 +30,10 @@ public class ShopUserFlowServiceImpl extends ServiceImpl<ShopUserFlowMapper, Sho
.eq(ShopUserFlow::getId, id)
.update();
}
@Override
public Page<ShopUserFlowVO> pageInfo(Long shopId, Integer userId, String bizCode) {
PageHelper.startPage(PageUtil.buildPageHelp());
return PageUtil.convert(new PageInfo<>(mapper.pageInfo(shopId, userId, bizCode)));
}
}

View File

@ -4,4 +4,17 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.ShopUserFlowMapper">
<select id="pageInfo" resultType="com.czg.account.vo.ShopUserFlowVO">
select a.*, c.shop_name as shopName, b.phone, b.nick_name as nickName from tb_shop_user_flow as a
join tb_shop_user as b on a.user_id=b.user_id and a.shop_id=b.shop_id
join tb_shop_info as c on c.id=a.shop_id
where a.shop_id=#{shopId}
<if test="bizCode != null and bizCode != ''">
and a.biz_code=#{bizCode}
</if>
<if test="userId != null">
and a.user_id=#{userId}
</if>
order by a.create_time desc
</select>
</mapper>