Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-04-01 18:34:40 +08:00
commit a3e5a088c8
14 files changed
+247 -31

No files matched your search

+1
View File
@@ -212,6 +212,7 @@ CREATE TABLE wallet_rule_transaction
after_balance int DEFAULT 0 NOT NULL COMMENT '转换后的金额',
balance_multiple int DEFAULT 0 NOT NULL COMMENT '钱包转换百分比',
is_refund VARCHAR(64) default '0' not null comment '是否退回',
refund_time datetime default NULL comment '退回时间',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
@@ -16,6 +16,7 @@ public enum WalletBizEnum {
PAYMENT("4", "支付"),
REFUND("5", "退款"),
TRANSFER_ACCOUNTS("6", "转账"),
TRANSFER_ACCOUNTS_REFUND("7", "转账退款"),
;
private final String code;
@@ -4,6 +4,8 @@ import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@Data
@@ -12,9 +14,14 @@ public class WalletRuleTransactionDto extends WalletRuleTransactionEntity implem
/**
* 树状结构搜索
*/
private List<Long> deptIds;
private Boolean isInclude = false;
private Long userId;
private LocalDate[] createTimeList;
private LocalDate[] refundTimeList;
}
@@ -0,0 +1,25 @@
package com.bsd.pjcloud.wallet.api.dto.rule;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Data
public class WalletRuleTransferAccountsDto {
@Schema(description = "用户id")
@NotNull(message = "用户id不能为空")
private Long userId;
@Schema(description = "源钱包id")
@NotNull(message = "源钱包类型id不能为空")
private Long sourceWalletTypeId;
@Schema(description = "目标钱包id")
@NotNull(message = "目标钱包类型id不能为空")
private Long targetWalletTypeId;
@Schema(description = "转换金额")
@NotNull(message = "转换金额不能为空")
private Integer balance;
}
@@ -75,6 +75,12 @@ public class WalletRuleTransactionEntity extends Model<WalletRuleTransactionEnti
@Schema(description = "是否退回")
private String isRefund;
/**
* 退回时间
*/
@Schema(description = "退回时间")
private LocalDateTime refundTime;
/**
* 创建人
*/
@@ -27,6 +27,8 @@ public class WalletRuleJoinUserConfigVo {
private String sourceWalletTypeName;
private String sourceWalletUniqueCode;
/**
* 目标钱包相关
*/
@@ -38,6 +40,8 @@ public class WalletRuleJoinUserConfigVo {
private String targetWalletTypeName;
private String targetWalletUniqueCode;
/**
* 可以转账的余额
*/
@@ -48,9 +52,19 @@ public class WalletRuleJoinUserConfigVo {
*/
private Long totalTopUpBalance = 0L;
/**
* 总的可以转账的金额
*/
private Long maxTransferBalance = 0L;
/**
* 总的转账余额
*/
private Long totalTransferBalance = 0L;
/**
* 钱包转换百分比
*/
private Integer balanceMultiple;
}
@@ -1,17 +1,26 @@
package com.bsd.pjcloud.wallet.api.vo.rule;
import com.bsd.pjcloud.admin.api.vo.base.BaseUserDeptInterface;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import lombok.Data;
@Data
public class WalletRuleTransactionVo extends WalletRuleTransactionEntity {
public class WalletRuleTransactionVo extends WalletRuleTransactionEntity implements BaseUserDeptInterface {
/**
* 用户相关
*/
private Long userId;
private Long deptId;
private String username;
private String userMobile;
private String userAvatar;
private Long userDeptId;
private String userDeptName;
/**
* 源钱包相关
@@ -10,8 +10,10 @@ import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransactionDto;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransferAccountsDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import com.bsd.pjcloud.wallet.service.WalletRuleTransactionService;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -37,18 +39,34 @@ public class WalletRuleTransactionController {
private final WalletRuleTransactionService walletRuleTransactionService;
@Operation(summary = "转账", description = "转账")
@PostMapping("/transfer-accounts")
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_transfer_accounts')")
public R transferAccounts(@Valid @RequestBody WalletRuleTransferAccountsDto body) {
walletRuleTransactionService.transferAccounts(body);
return R.ok();
}
@Operation(summary = "退回", description = "退回")
@GetMapping("/refund")
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_refund')")
public R refund(@RequestParam Long id) {
walletRuleTransactionService.refund(id);
return R.ok();
}
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_view')")
public R getWalletRuleTransactionPage(@ParameterObject Page page, @ParameterObject WalletRuleTransactionEntity walletRuleTransaction) {
public R getWalletRuleTransactionPage(@ParameterObject Page page, @ParameterObject WalletRuleTransactionEntity dto) {
LambdaQueryWrapper<WalletRuleTransactionEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(walletRuleTransactionService.page(page, wrapper));
}
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
@GetMapping("/page-join")
@PostMapping("/page-join")
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_view')")
public R pageJoin(@ParameterObject Page page, @ParameterObject WalletRuleTransactionDto dto) {
public R pageJoin(@ParameterObject Page page, @RequestBody WalletRuleTransactionDto dto) {
DataScope dataScope = DataScope.of().func(DataScopeFuncEnum.ALL);
return R.ok(walletRuleTransactionService.scopePageList(page, dto, dataScope));
}
@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransactionDto;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransferAccountsDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleTransactionVo;
import jakarta.validation.Valid;
public interface WalletRuleTransactionService extends IService<WalletRuleTransactionEntity> {
@@ -14,4 +16,13 @@ public interface WalletRuleTransactionService extends IService<WalletRuleTransac
*/
Page<WalletRuleTransactionVo> scopePageList(Page page, WalletRuleTransactionDto dto, DataScope dataScope);
/**
* 转账
*/
void transferAccounts(@Valid WalletRuleTransferAccountsDto body);
/**
* 退回
*/
void refund(Long id);
}
@@ -120,11 +120,11 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
}
switch (bizType) {
case UPDATE:
case RECHARGE, BATCH: {
case RECHARGE, BATCH, TRANSFER_ACCOUNTS: {
walletManageMapper.updateWhenRecharge(wallet.getId(), price);
break;
}
case REFUND: {
case REFUND, TRANSFER_ACCOUNTS_REFUND: {
walletManageMapper.updateWhenConsumptionRefund(wallet.getId(), price);
break;
}
@@ -9,13 +9,13 @@ import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
import com.bsd.pjcloud.wallet.api.dto.WalletTransactionSumAndCountDto;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
@@ -32,6 +32,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -76,7 +78,7 @@ public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper,
if (ObjectUtil.isEmpty(v)) continue;
WalletRuleJoinEntity item = BeanUtils.toBean(dto, WalletRuleJoinEntity.class);
item.setTargetDeptId(v);
if (existWalletRuleJoin(dto)) {
if (existWalletRuleJoin(item)) {
// 查询部门
SysDept sysDept = remoteDeptService.getDeptByDeptId(v).getData();
throw new RuntimeException(sysDept.getName() + "部门绑定类型不能重复");
@@ -131,9 +133,11 @@ public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper,
throw new RuntimeException("源钱包不存在");
}
configVo.setSourceWalletId(sourceWallet.getId());
configVo.setTargetWalletBalance(sourceWallet.getBalance());
configVo.setSourceWalletBalance(sourceWallet.getBalance());
configVo.setSourceWalletTypeId(sourceWallet.getWalletTypeId());
configVo.setSourceWalletTypeName(sourceWallet.getWalletTypeName());
configVo.setSourceWalletUniqueCode(sourceWallet.getWalletTypeUniqueCode());
configVo.setTotalTopUpBalance(sourceWallet.getTotalRecharge().longValue());
// 目标钱包信息
WalletManageVo targetWallet = walletManageService.join(userId, targetWalletTypeId);
if (ObjectUtil.isEmpty(targetWallet)) {
@@ -143,25 +147,17 @@ public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper,
configVo.setTargetWalletBalance(targetWallet.getBalance());
configVo.setTargetWalletTypeId(targetWallet.getWalletTypeId());
configVo.setTargetWalletTypeName(targetWallet.getWalletTypeName());
// 查询用户充值的总充值余额
WalletTransactionSumAndCountDto totalTopupDto = new WalletTransactionSumAndCountDto();
totalTopupDto.setBizTypes(WalletBizEnum.getTopUpCodes());
totalTopupDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
totalTopupDto.setWalletTypeId(sourceWalletTypeId);
WalletTransactionSumAndCountVo totalTopupVo = walletTransactionMapper.sumAndCountUser(totalTopupDto);
if (ObjectUtil.isNotEmpty(totalTopupVo) && ObjectUtil.isNotEmpty(totalTopupVo.getSum())) {
configVo.setTotalTopUpBalance(totalTopupVo.getSum());
}
configVo.setTargetWalletUniqueCode(targetWallet.getWalletTypeUniqueCode());
// 查询总的转账余额
WalletTransactionSumAndCountDto transferBalanceDto = new WalletTransactionSumAndCountDto();
totalTopupDto.setBizTypes(List.of(WalletBizEnum.TRANSFER_ACCOUNTS.getCode()));
totalTopupDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
totalTopupDto.setWalletTypeId(targetWalletTypeId);
transferBalanceDto.setBizTypes(List.of(WalletBizEnum.TRANSFER_ACCOUNTS.getCode()));
transferBalanceDto.setType(WalletTransactionSumAndCountDto.TYPE_INCOME);
transferBalanceDto.setWalletTypeId(targetWalletTypeId);
transferBalanceDto.setWalletId(targetWallet.getId());
WalletTransactionSumAndCountVo transferBalanceVo = walletTransactionMapper.sumAndCountUser(transferBalanceDto);
if (ObjectUtil.isNotEmpty(transferBalanceVo)) {
configVo.setTotalTransferBalance(transferBalanceVo.getSum());
}
// 转账百分比配置
// 查询用户
UserInfo userInfo = remoteUserService.getByUserId(sourceWallet.getUserId()).getData();
if (ObjectUtil.isEmpty(userInfo)) {
@@ -171,6 +167,7 @@ public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper,
configVo.setUserDpetId(userInfo.getSysUser().getDeptId());
configVo.setUsername(userInfo.getSysUser().getName());
configVo.setUserMobile(userInfo.getSysUser().getPhone());
// 转账百分比配置
WalletRuleJoinEntity walletRuleJoin = baseMapper.selectOne(new LambdaQueryWrapper<WalletRuleJoinEntity>()
.eq(WalletRuleJoinEntity::getSourceWalletTypeId, sourceWallet.getWalletTypeId())
.eq(WalletRuleJoinEntity::getTargetWalletTypeId, targetWallet.getWalletTypeId())
@@ -181,6 +178,15 @@ public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper,
SysDept sysDept = remoteDeptService.getDeptByDeptId(userInfo.getSysUser().getDeptId()).getData();
throw new RuntimeException("该用户所属的部门<" + sysDept.getName() + ">未配置钱包规则");
}
if (ObjectUtil.equals(walletRuleJoin.getStatus(), YesNoEnum.NO.getCode())) {
// 查询部门
SysDept sysDept = remoteDeptService.getDeptByDeptId(userInfo.getSysUser().getDeptId()).getData();
throw new RuntimeException("该用户所属的部门<" + sysDept.getName() + ">未配置未打开");
}
configVo.setBalanceMultiple(walletRuleJoin.getBalanceMultiple());
// 计算最大可以转过去的金额
Long maxTransferBalance = BigDecimal.valueOf(sourceWallet.getTotalRecharge()).multiply(BigDecimal.valueOf(walletRuleJoin.getBalanceMultiple())).divide(BigDecimal.valueOf(100)).setScale(0, RoundingMode.HALF_UP).longValue();
configVo.setMaxTransferBalance(maxTransferBalance);
return configVo;
}
@@ -1,18 +1,37 @@
package com.bsd.pjcloud.wallet.service.impl.rule;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.admin.api.vo.UserVO;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransactionDto;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransferAccountsDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinUserConfigVo;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleTransactionVo;
import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleTransactionMapper;
import com.bsd.pjcloud.wallet.service.WalletManageService;
import com.bsd.pjcloud.wallet.service.WalletRuleJoinService;
import com.bsd.pjcloud.wallet.service.WalletRuleTransactionService;
import com.bsd.pjcloud.wallet.service.WalletTransactionService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* 钱包转账记录
*/
@@ -22,11 +41,95 @@ import org.springframework.validation.annotation.Validated;
@Service
public class WalletRuleTransactionServiceImpl extends ServiceImpl<WalletRuleTransactionMapper, WalletRuleTransactionEntity> implements WalletRuleTransactionService {
private final WalletRuleJoinService walletRuleJoinService;
private final WalletManageService walletManageService;
private final WalletTransactionService walletTransactionService;
private final RemoteUserService userService;
/**
* 分页复杂查询
*/
@Override
public Page<WalletRuleTransactionVo> scopePageList(Page page, WalletRuleTransactionDto dto, DataScope dataScope) {
return baseMapper.scopePageList(page, dto, dataScope);
Page<WalletRuleTransactionVo> pageList = baseMapper.scopePageList(page, dto, dataScope);
disposeList(pageList.getRecords(), dto);
return pageList;
}
/**
* 转账
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void transferAccounts(WalletRuleTransferAccountsDto body) {
// 查询配置
WalletRuleJoinUserConfigVo userConfig = walletRuleJoinService.userConfig(body.getUserId(), body.getSourceWalletTypeId(), body.getTargetWalletTypeId());
if (ObjectUtil.isEmpty(userConfig)) return;
WalletRuleTransactionEntity entity = new WalletRuleTransactionEntity();
int price = userConfig.getSourceWalletBalance() - body.getBalance();
if (price < 0) {
throw new RuntimeException("源钱包" + userConfig.getSourceWalletTypeName() + "余额不足");
}
// 查询源饭卡
if (ObjectUtil.equals(userConfig.getSourceWalletUniqueCode(), WalletTypeEnum.EAT.getCode())) {
if (price < 4000) {
throw new RuntimeException(WalletTypeEnum.EAT.getDesc() + "余额必须留40元用于公午餐");
}
}
entity.setSourceWalletId(userConfig.getSourceWalletId());
entity.setTargetWalletId(userConfig.getTargetWalletId());
entity.setSourceWalletBalance(userConfig.getSourceWalletBalance());
entity.setTargetWalletBalance(userConfig.getTargetWalletBalance());
entity.setBalance(body.getBalance());
entity.setAfterBalance(userConfig.getTargetWalletBalance() + body.getBalance());
entity.setBalanceMultiple(userConfig.getBalanceMultiple());
entity.setIsRefund(YesNoEnum.NO.getCode());
baseMapper.insert(entity);
// 源头钱包扣减
walletTransactionService.reduceWalletBalance(userConfig.getSourceWalletId(), body.getBalance(), String.valueOf(entity.getId()), WalletBizEnum.TRANSFER_ACCOUNTS);
// 目标钱包增加
walletTransactionService.addWalletBalance(userConfig.getTargetWalletId(), body.getBalance(), String.valueOf(entity.getId()), WalletBizEnum.TRANSFER_ACCOUNTS);
}
/**
* 退回
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void refund(Long id) {
// 判断是否已退回
WalletRuleTransactionEntity detail = baseMapper.selectById(id);
if (ObjectUtil.isEmpty(detail)) throw new RuntimeException("查询不到转账记录");
if (ObjectUtil.equals(detail.getIsRefund(), YesNoEnum.YES.getCode())) {
throw new RuntimeException("已退回请勿重复操作");
}
// 判断源钱包余额是否够
WalletManageVo tragetWallet = walletManageService.join(detail.getTargetWalletId());
int price = tragetWallet.getBalance() - detail.getBalance();
if (price < 0) {
throw new RuntimeException("源钱包" + tragetWallet.getWalletTypeName() + "余额不足,无法退回");
}
// 源头钱包增加
walletTransactionService.addWalletBalance(detail.getSourceWalletId(), detail.getBalance(), String.valueOf(detail.getId()), WalletBizEnum.TRANSFER_ACCOUNTS_REFUND);
// 目标钱包扣减
walletTransactionService.reduceWalletBalance(detail.getTargetWalletId(), detail.getBalance(), String.valueOf(detail.getId()), WalletBizEnum.TRANSFER_ACCOUNTS_REFUND);
// 改状态
WalletRuleTransactionEntity updateObj = new WalletRuleTransactionEntity();
updateObj.setId(id);
updateObj.setRefundTime(LocalDateTime.now());
updateObj.setIsRefund(YesNoEnum.YES.getCode());
baseMapper.updateById(updateObj);
}
private void disposeList(List<WalletRuleTransactionVo> list, WalletRuleTransactionDto dto) {
// 用户
List<Long> userIds = list.stream().map(WalletRuleTransactionVo::getUserId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(userIds)) {
List<UserVO> userList = userService.getUserDeptByIds(new ArrayList<>(userIds)).getData();
if (ObjectUtil.isNotEmpty(userList)) {
DataUtil.convertUserDeptList(list, CollectionUtils.convertMap(userList, UserVO::getUserId));
}
}
}
}
@@ -99,10 +99,10 @@
<where>
a.del_flag = 0 and a.dept_id is not null
<if test="dto.walletId != null">
and a.wallet_id = ${dto.walletId}
and a.wallet_id = #{dto.walletId}
</if>
<if test="dto.walletTypeId != null">
and m.wallet_type_id = ${dto.walletTypeId}
and m.wallet_type_id = #{dto.walletTypeId}
</if>
<if test="dto.type != null">
<if test="dto.type == 1">
@@ -12,6 +12,7 @@
<result property="afterBalance" column="after_balance"/>
<result property="balanceMultiple" column="balance_multiple"/>
<result property="isRefund" column="is_refund"/>
<result property="refundTime" column="refund_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
@@ -30,6 +31,7 @@
a.after_balance,
a.balance_multiple,
a.is_refund,
a.refund_time,
a.create_by,
a.create_time,
a.update_by,
@@ -46,12 +48,21 @@
<if test="dto.targetWalletId != null">
and a.target_wallet_id = #{dto.targetWalletId}
</if>
<if test="dto.isRefund != null">
and a.is_refund = #{dto.isRefund}
</if>
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
</if>
<if test="dto.refundTimeList != null and dto.refundTimeList.length == 2">
and a.refund_time between #{dto.refundTimeList[0]} and #{dto.refundTimeList[1]}
</if>
</sql>
<select id="scopePageList" resultType="com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleTransactionVo">
<include refid="selectA"/>
t.user_id,
t.dept_id,
t.dept_id as userDeptId,
sourceWalletType.name as sourceWalletTypeName,
sourceWalletType.unique_code as sourceWalletTypeCode,
targetWalletType.name as targetWalletTypeName,
@@ -64,16 +75,19 @@
left join wallet_type targetWalletType on targetWalletType.id = targetWallet.wallet_type_id
<where>
<include refid="whereA"/>
<if test="dto.userId != null">
and t.user_id = #{dto.userId}
</if>
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
and a.dept_id IN
and t.dept_id IN
</when>
<when test="dto.isInclude != null and dto.isInclude == false">
and a.dept_id NOT IN
and t.dept_id NOT IN
</when>
<otherwise>
and a.dept_id IN
and t.dept_id IN
</otherwise>
</choose>
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
@@ -81,5 +95,6 @@
</foreach>
</if>
</where>
group by a.id
</select>
</mapper>