feat:转账记录代码生成
This commit is contained in:
1 parent
00e53e3f4d
commit
c5c400c807
16 files changed
+527
-18
No files matched your search
@@ -209,7 +209,7 @@ CREATE TABLE wallet_rule_transaction
|
||||
balance int DEFAULT 0 NOT NULL COMMENT '转换金额',
|
||||
after_balance int DEFAULT 0 NOT NULL COMMENT '转换后的金额',
|
||||
balance_multiple int DEFAULT 0 NOT NULL COMMENT '钱包转换百分比',
|
||||
status VARCHAR(64) default '0' not null comment '是否启用',
|
||||
is_refund VARCHAR(64) default '0' not 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 '修改人',
|
||||
|
||||
+3
-3
@@ -7,8 +7,8 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
//@Builder
|
||||
//@AllArgsConstructor
|
||||
//@NoArgsConstructor
|
||||
public class WalletRuleJoinDto extends WalletRuleJoinEntity {
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package com.bsd.pjcloud.wallet.api.dto.rule;
|
||||
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
|
||||
|
||||
public class WalletRuleTransactionDto extends WalletRuleTransactionEntity {
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package com.bsd.pjcloud.wallet.api.entity.rule;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 钱包转账记录
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("wallet_rule_transaction")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "钱包转账记录")
|
||||
public class WalletRuleTransactionEntity extends Model<WalletRuleTransactionEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 源钱包id
|
||||
*/
|
||||
@Schema(description="源钱包id")
|
||||
private Long sourceWalletId;
|
||||
|
||||
/**
|
||||
* 目标钱包id
|
||||
*/
|
||||
@Schema(description="目标钱包id")
|
||||
private Long targetWalletId;
|
||||
|
||||
/**
|
||||
* 源钱包余额
|
||||
*/
|
||||
@Schema(description="源钱包余额")
|
||||
private Integer sourceWalletBalance;
|
||||
|
||||
/**
|
||||
* 目标钱包余额
|
||||
*/
|
||||
@Schema(description="目标钱包余额")
|
||||
private Integer targetWalletBalance;
|
||||
|
||||
/**
|
||||
* 转换金额
|
||||
*/
|
||||
@Schema(description="转换金额")
|
||||
private Integer balance;
|
||||
|
||||
/**
|
||||
* 转换后的金额
|
||||
*/
|
||||
@Schema(description="转换后的金额")
|
||||
private Integer afterBalance;
|
||||
|
||||
/**
|
||||
* 钱包转换百分比
|
||||
*/
|
||||
@Schema(description="钱包转换百分比")
|
||||
private Integer balanceMultiple;
|
||||
|
||||
/**
|
||||
* 是否退回
|
||||
*/
|
||||
@Schema(description="是否退回")
|
||||
private String isRefund;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="删除标记")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description="租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+18
@@ -12,4 +12,22 @@ import lombok.NoArgsConstructor;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class WalletRuleJoinVo extends WalletRuleJoinEntity {
|
||||
|
||||
/**
|
||||
* 源钱包类型
|
||||
*/
|
||||
private String sourceName;
|
||||
|
||||
private String sourceUniqueCode;
|
||||
|
||||
private String sourceIcon;
|
||||
|
||||
/**
|
||||
* 目标钱包类型
|
||||
*/
|
||||
private String targetName;
|
||||
|
||||
private String targetUniqueCode;
|
||||
|
||||
private String targetIcon;
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo.rule;
|
||||
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
|
||||
|
||||
public class WalletRuleTransactionVo extends WalletRuleTransactionEntity {
|
||||
}
|
||||
+28
-11
@@ -6,10 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRuleJoinService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
@@ -17,10 +18,10 @@ import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 钱包规则配置
|
||||
@@ -36,46 +37,62 @@ public class WalletRuleJoinController {
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_view')")
|
||||
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_view')")
|
||||
public R getWalletRuleJoinPage(@ParameterObject Page page, @ParameterObject WalletRuleJoinEntity walletRuleJoin) {
|
||||
LambdaQueryWrapper<WalletRuleJoinEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(walletRuleJoinService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject WalletRuleJoinDto dto) {
|
||||
DataScope dataScope = null;
|
||||
return R.ok(walletRuleJoinService.scopeJoinPage(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_view')")
|
||||
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(walletRuleJoinService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("join-detail/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
|
||||
public R joinDetail(@PathVariable("id") Long id) {
|
||||
return R.ok(walletRuleJoinService.joinDetail(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增钱包规则配置", description = "新增钱包规则配置")
|
||||
@SysLog("新增钱包规则配置")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_add')")
|
||||
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_add')")
|
||||
public R save(@RequestBody WalletRuleJoinEntity walletRuleJoin) {
|
||||
return R.ok(walletRuleJoinService.save(walletRuleJoin));
|
||||
return R.ok(walletRuleJoinService.create(walletRuleJoin));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改钱包规则配置", description = "修改钱包规则配置")
|
||||
@SysLog("修改钱包规则配置")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_edit')")
|
||||
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_edit')")
|
||||
public R updateById(@RequestBody WalletRuleJoinEntity walletRuleJoin) {
|
||||
return R.ok(walletRuleJoinService.updateById(walletRuleJoin));
|
||||
return R.ok(walletRuleJoinService.edit(walletRuleJoin));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除钱包规则配置", description = "通过id删除钱包规则配置")
|
||||
@SysLog("通过id删除钱包规则配置")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_del')")
|
||||
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(walletRuleJoinService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
walletRuleJoinService.delByIds(CollUtil.toList(ids));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_export')")
|
||||
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_export')")
|
||||
public List<WalletRuleJoinEntity> export(WalletRuleJoinEntity walletRuleJoin, Long[] ids) {
|
||||
return walletRuleJoinService.list(Wrappers.lambdaQuery(walletRuleJoin).in(ArrayUtil.isNotEmpty(ids), WalletRuleJoinEntity::getId, ids));
|
||||
}
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.bsd.pjcloud.wallet.controller.rule;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRuleTransactionService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 钱包转账记录
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/wallet-rule-transaction")
|
||||
@Tag(description = "wallet-rule-transaction", name = "钱包转账记录管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class WalletRuleTransactionController {
|
||||
|
||||
private final WalletRuleTransactionService walletRuleTransactionService;
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_view')")
|
||||
public R getWalletRuleTransactionPage(@ParameterObject Page page, @ParameterObject WalletRuleTransactionEntity walletRuleTransaction) {
|
||||
LambdaQueryWrapper<WalletRuleTransactionEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(walletRuleTransactionService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(walletRuleTransactionService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增钱包转账记录", description = "新增钱包转账记录")
|
||||
@SysLog("新增钱包转账记录")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_add')")
|
||||
public R save(@RequestBody WalletRuleTransactionEntity walletRuleTransaction) {
|
||||
return R.ok(walletRuleTransactionService.save(walletRuleTransaction));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改钱包转账记录", description = "修改钱包转账记录")
|
||||
@SysLog("修改钱包转账记录")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_edit')")
|
||||
public R updateById(@RequestBody WalletRuleTransactionEntity walletRuleTransaction) {
|
||||
return R.ok(walletRuleTransactionService.updateById(walletRuleTransaction));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除钱包转账记录", description = "通过id删除钱包转账记录")
|
||||
@SysLog("通过id删除钱包转账记录")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(walletRuleTransactionService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_export')")
|
||||
public List<WalletRuleTransactionEntity> export(WalletRuleTransactionEntity walletRuleTransaction, Long[] ids) {
|
||||
return walletRuleTransactionService.list(Wrappers.lambdaQuery(walletRuleTransaction).in(ArrayUtil.isNotEmpty(ids), WalletRuleTransactionEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+7
@@ -1,11 +1,18 @@
|
||||
package com.bsd.pjcloud.wallet.mapper.rule;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface WalletRuleJoinMapper extends PjcloudBaseMapper<WalletRuleJoinEntity> {
|
||||
|
||||
Page<WalletRuleJoinVo> scopeJoinPage(Page page, @Param("dto") WalletRuleJoinDto dto, DataScope dataScope);
|
||||
|
||||
WalletRuleJoinVo joinDetail(@Param("id") Long id);
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.bsd.pjcloud.wallet.mapper.rule;
|
||||
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface WalletRuleTransactionMapper extends PjcloudBaseMapper<WalletRuleTransactionEntity> {
|
||||
|
||||
|
||||
}
|
||||
+32
@@ -1,8 +1,40 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
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.WalletRuleJoinDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface WalletRuleJoinService extends IService<WalletRuleJoinEntity> {
|
||||
|
||||
/**
|
||||
* 权限分页查询
|
||||
*/
|
||||
Page<WalletRuleJoinVo> scopeJoinPage(Page page, WalletRuleJoinDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Long create(WalletRuleJoinEntity dto);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
Long edit(WalletRuleJoinEntity dto);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
void delByIds(ArrayList<Long> list);
|
||||
|
||||
/**
|
||||
* 复杂详情
|
||||
*/
|
||||
WalletRuleJoinVo joinDetail(Long id);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
|
||||
|
||||
public interface WalletRuleTransactionService extends IService<WalletRuleTransactionEntity> {
|
||||
|
||||
}
|
||||
+107
@@ -1,13 +1,120 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl.rule;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleJoinMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRuleJoinService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 钱包规则配置
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper, WalletRuleJoinEntity> implements WalletRuleJoinService {
|
||||
|
||||
private final WalletTypeService walletTypeService;
|
||||
|
||||
/**
|
||||
* 权限分页查询
|
||||
*/
|
||||
@Override
|
||||
public Page<WalletRuleJoinVo> scopeJoinPage(Page page, WalletRuleJoinDto dto, DataScope dataScope) {
|
||||
return baseMapper.scopeJoinPage(page, dto, dataScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Override
|
||||
public Long create(WalletRuleJoinEntity dto) {
|
||||
if (existWalletRuleJoin(dto)) {
|
||||
throw new RuntimeException("绑定类型不能重复");
|
||||
}
|
||||
if (areWalletIdsDistinct(dto)) {
|
||||
throw new RuntimeException("源钱包类型与目标钱包类型不能重复");
|
||||
}
|
||||
WalletTypeEntity targetMch = walletTypeService.getById(dto.getTargetWalletTypeId());
|
||||
if (ObjectUtil.isEmpty(targetMch)) {
|
||||
throw new RuntimeException("目标钱包类型不存在");
|
||||
}
|
||||
baseMapper.insert(dto);
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@Override
|
||||
public Long edit(WalletRuleJoinEntity dto) {
|
||||
if (existWalletRuleJoin(dto)) {
|
||||
throw new RuntimeException("绑定类型不能重复");
|
||||
}
|
||||
if (areWalletIdsDistinct(dto)) {
|
||||
throw new RuntimeException("源钱包类型与目标钱包类型不能重复");
|
||||
}
|
||||
WalletTypeEntity targetMch = walletTypeService.getById(dto.getTargetWalletTypeId());
|
||||
if (ObjectUtil.isEmpty(targetMch)) {
|
||||
throw new RuntimeException("目标钱包类型不存在");
|
||||
}
|
||||
baseMapper.updateById(dto);
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Override
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
baseMapper.deleteByIds(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复杂详情
|
||||
*/
|
||||
@Override
|
||||
public WalletRuleJoinVo joinDetail(Long id) {
|
||||
return baseMapper.joinDetail(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否重复
|
||||
*/
|
||||
private boolean existWalletRuleJoin(WalletRuleJoinEntity dto) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletRuleJoinEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getSourceWalletTypeId()), WalletRuleJoinEntity::getSourceWalletTypeId, dto.getSourceWalletTypeId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getTargetWalletTypeId()), WalletRuleJoinEntity::getTargetWalletTypeId, dto.getTargetWalletTypeId())
|
||||
.ne(ObjectUtil.isNotEmpty(dto.getId()), WalletRuleJoinEntity::getId, dto.getId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(dto.getId())) {
|
||||
return count >= 1;
|
||||
}
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* sourceWalletTypeId和targetWalletTypeId是否重复
|
||||
*/
|
||||
private boolean areWalletIdsDistinct(WalletRuleJoinEntity dto) {
|
||||
if (!ObjectUtil.isAllNotEmpty(dto.getSourceWalletTypeId(), dto.getTargetWalletTypeId())) {
|
||||
return false;
|
||||
}
|
||||
return ObjectUtil.equals(dto.getSourceWalletTypeId(), dto.getTargetWalletTypeId());
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl.rule;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleTransactionMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRuleTransactionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 钱包转账记录
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WalletRuleTransactionServiceImpl extends ServiceImpl<WalletRuleTransactionMapper, WalletRuleTransactionEntity> implements WalletRuleTransactionService {
|
||||
}
|
||||
+58
-3
@@ -2,8 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.wallet.mapper.rule.WalletRuleJoinMapper">
|
||||
|
||||
<resultMap id="walletRuleJoinMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity">
|
||||
<resultMap id="walletRuleJoinMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="sourceWalletTypeId" column="source_wallet_type_id"/>
|
||||
<result property="targetWalletTypeId" column="target_wallet_type_id"/>
|
||||
@@ -15,5 +14,61 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</resultMap>
|
||||
|
||||
<sql id="sleectA">
|
||||
select a.id,
|
||||
a.source_wallet_type_id,
|
||||
a.target_wallet_type_id,
|
||||
a.balance_multiple,
|
||||
a.status,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = 0
|
||||
<if test="dto.sourceWalletTypeId != null">
|
||||
and a.source_wallet_type_id = #{dto.sourceWalletTypeId}
|
||||
</if>
|
||||
<if test="dto.targetWalletTypeId != null">
|
||||
and a.target_wallet_type_id = #{dto.targetWalletTypeId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopeJoinPage" resultType="com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo">
|
||||
<include refid="sleectA"/>
|
||||
source.name as sourceName,
|
||||
source.unique_code as sourceUniqueCode,
|
||||
source.icon as sourceIcon,
|
||||
target.name as targetName,
|
||||
target.unique_code as targetUniqueCode,
|
||||
target.icon as targetIcon
|
||||
from wallet_rule_join a
|
||||
left join wallet_type source on source.id = a.source_wallet_type_id
|
||||
left join wallet_type target on target.id = a.target_wallet_type_id
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="joinDetail" resultType="com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo">
|
||||
<include refid="sleectA"/>
|
||||
source.name as sourceName,
|
||||
source.unique_code as sourceUniqueCode,
|
||||
source.icon as sourceIcon,
|
||||
target.name as targetName,
|
||||
target.unique_code as targetUniqueCode,
|
||||
target.icon as targetIcon
|
||||
from wallet_rule_join a
|
||||
left join wallet_type source on source.id = a.source_wallet_type_id
|
||||
left join wallet_type target on target.id = a.target_wallet_type_id
|
||||
<where>
|
||||
a.id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?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.bsd.pjcloud.wallet.mapper.rule.WalletRuleTransactionMapper">
|
||||
<resultMap id="walletRuleTransactionMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="sourceWalletId" column="source_wallet_id"/>
|
||||
<result property="targetWalletId" column="target_wallet_id"/>
|
||||
<result property="sourceWalletBalance" column="source_wallet_balance"/>
|
||||
<result property="targetWalletBalance" column="target_wallet_balance"/>
|
||||
<result property="balance" column="balance"/>
|
||||
<result property="afterBalance" column="after_balance"/>
|
||||
<result property="balanceMultiple" column="balance_multiple"/>
|
||||
<result property="isRefund" column="is_refund"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user