From 0426a879b859aa898d93085d43e0f749a7a4b4ba Mon Sep 17 00:00:00 2001 From: dzq Date: Fri, 25 Apr 2025 09:58:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=94=AF=E4=BB=98=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=BF=97):=20=E6=96=B0=E5=A2=9E=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增支付操作日志模块,包括实体类、Mapper、Service、DTO、查询条件、命令类、控制器等。支持支付操作日志的增删改查功能,并提供了根据订单ID查询最新日志的功能。 --- .../shop/PaymentOperationLogController.java | 68 +++++++++++++++++++ ...PaymentOperationLogApplicationService.java | 57 ++++++++++++++++ .../AddPaymentOperationLogCommand.java | 11 +++ .../UpdatePaymentOperationLogCommand.java | 16 +++++ .../db/PaymentOperationLogEntity.java | 52 ++++++++++++++ .../db/PaymentOperationLogMapper.java | 40 +++++++++++ .../db/PaymentOperationLogService.java | 26 +++++++ .../db/PaymentOperationLogServiceImpl.java | 40 +++++++++++ .../dto/PaymentOperationLogDTO.java | 37 ++++++++++ .../model/PaymentOperationLogModel.java | 39 +++++++++++ .../PaymentOperationLogModelFactory.java | 27 ++++++++ .../query/SearchPaymentOperationLogQuery.java | 34 ++++++++++ .../mapper/shop/PaymentOperationLogMapper.xml | 5 ++ .../mybatisplus/CodeGenerator.java | 2 +- sql/20250425_payment_log.sql | 15 ++++ 15 files changed, 468 insertions(+), 1 deletion(-) create mode 100644 agileboot-admin/src/main/java/com/agileboot/admin/controller/shop/PaymentOperationLogController.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/PaymentOperationLogApplicationService.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/command/AddPaymentOperationLogCommand.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/command/UpdatePaymentOperationLogCommand.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogEntity.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogMapper.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogService.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogServiceImpl.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/dto/PaymentOperationLogDTO.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/model/PaymentOperationLogModel.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/model/PaymentOperationLogModelFactory.java create mode 100644 agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/query/SearchPaymentOperationLogQuery.java create mode 100644 agileboot-domain/src/main/resources/mapper/shop/PaymentOperationLogMapper.xml create mode 100644 sql/20250425_payment_log.sql diff --git a/agileboot-admin/src/main/java/com/agileboot/admin/controller/shop/PaymentOperationLogController.java b/agileboot-admin/src/main/java/com/agileboot/admin/controller/shop/PaymentOperationLogController.java new file mode 100644 index 0000000..d4391b5 --- /dev/null +++ b/agileboot-admin/src/main/java/com/agileboot/admin/controller/shop/PaymentOperationLogController.java @@ -0,0 +1,68 @@ +package com.agileboot.admin.controller.shop; + +import com.agileboot.admin.customize.aop.accessLog.AccessLog; +import com.agileboot.common.core.base.BaseController; +import com.agileboot.common.core.dto.ResponseDTO; +import com.agileboot.common.core.page.PageDTO; +import com.agileboot.common.enums.common.BusinessTypeEnum; +import com.agileboot.domain.common.command.BulkOperationCommand; +import com.agileboot.domain.shop.paymentOperationLog.PaymentOperationLogApplicationService; +import com.agileboot.domain.shop.paymentOperationLog.command.AddPaymentOperationLogCommand; +import com.agileboot.domain.shop.paymentOperationLog.command.UpdatePaymentOperationLogCommand; +import com.agileboot.domain.shop.paymentOperationLog.db.PaymentOperationLogEntity; +import com.agileboot.domain.shop.paymentOperationLog.dto.PaymentOperationLogDTO; +import com.agileboot.domain.shop.paymentOperationLog.query.SearchPaymentOperationLogQuery; +import io.swagger.v3.oas.annotations.Operation; +import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/shop/paymentOperationLogs") +@RequiredArgsConstructor +@Validated +public class PaymentOperationLogController extends BaseController { + + private final PaymentOperationLogApplicationService paymentOperationLogApplicationService; + + @Operation(summary = "支付操作日志列表") + @GetMapping + public ResponseDTO> list(SearchPaymentOperationLogQuery query) { + PageDTO page = paymentOperationLogApplicationService.getPaymentOperationLogList(query); + return ResponseDTO.ok(page); + } + + @Operation(summary = "新增支付操作日志") + @AccessLog(title = "支付操作日志管理", businessType = BusinessTypeEnum.ADD) + @PostMapping + public ResponseDTO add(@Validated @RequestBody AddPaymentOperationLogCommand command) { + paymentOperationLogApplicationService.addPaymentOperationLog(command); + return ResponseDTO.ok(); + } + + @Operation(summary = "修改支付操作日志") + @AccessLog(title = "支付操作日志管理", businessType = BusinessTypeEnum.MODIFY) + @PutMapping("/{logId}") + public ResponseDTO edit(@PathVariable Long logId, @Validated @RequestBody UpdatePaymentOperationLogCommand command) { + command.setLogId(logId); + paymentOperationLogApplicationService.updatePaymentOperationLog(command); + return ResponseDTO.ok(); + } + + @Operation(summary = "删除支付操作日志") + @AccessLog(title = "支付操作日志管理", businessType = BusinessTypeEnum.DELETE) + @DeleteMapping("/{ids}") + public ResponseDTO remove(@PathVariable @NotNull List ids) { + paymentOperationLogApplicationService.deletePaymentOperationLog(new BulkOperationCommand<>(ids)); + return ResponseDTO.ok(); + } +} \ No newline at end of file diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/PaymentOperationLogApplicationService.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/PaymentOperationLogApplicationService.java new file mode 100644 index 0000000..1ce3c6c --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/PaymentOperationLogApplicationService.java @@ -0,0 +1,57 @@ +package com.agileboot.domain.shop.paymentOperationLog; + +import com.agileboot.common.core.page.PageDTO; +import com.agileboot.domain.common.command.BulkOperationCommand; +import com.agileboot.domain.shop.paymentOperationLog.command.AddPaymentOperationLogCommand; +import com.agileboot.domain.shop.paymentOperationLog.command.UpdatePaymentOperationLogCommand; +import com.agileboot.domain.shop.paymentOperationLog.db.PaymentOperationLogEntity; +import com.agileboot.domain.shop.paymentOperationLog.db.PaymentOperationLogService; +import com.agileboot.domain.shop.paymentOperationLog.dto.PaymentOperationLogDTO; +import com.agileboot.domain.shop.paymentOperationLog.model.PaymentOperationLogModel; +import com.agileboot.domain.shop.paymentOperationLog.model.PaymentOperationLogModelFactory; +import com.agileboot.domain.shop.paymentOperationLog.query.SearchPaymentOperationLogQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import java.util.List; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +@RequiredArgsConstructor +public class PaymentOperationLogApplicationService { + private final PaymentOperationLogService paymentOperationLogService; + private final PaymentOperationLogModelFactory paymentOperationLogModelFactory; + + public PageDTO getPaymentOperationLogList(SearchPaymentOperationLogQuery query) { + Page page = paymentOperationLogService.getPaymentLogList(query); + List dtoList = page.getRecords().stream() + .map(PaymentOperationLogDTO::new) + .collect(Collectors.toList()); + return new PageDTO<>(dtoList, page.getTotal()); + } + + public void addPaymentOperationLog(AddPaymentOperationLogCommand command) { + PaymentOperationLogModel model = paymentOperationLogModelFactory.create(); + model.loadAddCommand(command); + model.insert(); + } + + public void updatePaymentOperationLog(UpdatePaymentOperationLogCommand command) { + PaymentOperationLogModel model = paymentOperationLogModelFactory.loadById(command.getLogId()); + model.loadUpdateCommand(command); + model.updateById(); + } + + public void deletePaymentOperationLog(BulkOperationCommand command) { + for (Long logId : command.getIds()) { + PaymentOperationLogModel model = paymentOperationLogModelFactory.loadById(logId); + model.deleteById(); + } + } + + public PaymentOperationLogEntity selectLatestByOrderId(Long orderId) { + return paymentOperationLogService.selectLatestByOrderId(orderId); + } +} \ No newline at end of file diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/command/AddPaymentOperationLogCommand.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/command/AddPaymentOperationLogCommand.java new file mode 100644 index 0000000..0b7513d --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/command/AddPaymentOperationLogCommand.java @@ -0,0 +1,11 @@ +package com.agileboot.domain.shop.paymentOperationLog.command; + +import com.agileboot.domain.shop.paymentOperationLog.db.PaymentOperationLogEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class AddPaymentOperationLogCommand extends PaymentOperationLogEntity { + +} \ No newline at end of file diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/command/UpdatePaymentOperationLogCommand.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/command/UpdatePaymentOperationLogCommand.java new file mode 100644 index 0000000..7c8e04a --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/command/UpdatePaymentOperationLogCommand.java @@ -0,0 +1,16 @@ +package com.agileboot.domain.shop.paymentOperationLog.command; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.PositiveOrZero; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class UpdatePaymentOperationLogCommand extends AddPaymentOperationLogCommand { + + @NotNull + @PositiveOrZero + private Long logId; + +} \ No newline at end of file diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogEntity.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogEntity.java new file mode 100644 index 0000000..f698e25 --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogEntity.java @@ -0,0 +1,52 @@ +package com.agileboot.domain.shop.paymentOperationLog.db; + +import com.agileboot.common.core.base.BaseEntity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * 支付操作日志表 + *

+ * + * @author valarchie + * @since 2025-04-25 + */ +@Getter +@Setter +@TableName("payment_operation_log") +@ApiModel(value = "PaymentOperationLogEntity对象", description = "支付操作日志表") +public class PaymentOperationLogEntity extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("日志ID") + @TableId(value = "log_id", type = IdType.AUTO) + private Long logId; + + @ApiModelProperty("订单ID(关联shop_order.order_id)") + @TableField("order_id") + private Long orderId; + + @ApiModelProperty("操作状态(1成功 2失败)") + @TableField("`status`") + private Integer status; + + @ApiModelProperty("操作备注") + @TableField("remark") + private String remark; + + + @Override + public Serializable pkVal() { + return this.logId; + } + +} diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogMapper.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogMapper.java new file mode 100644 index 0000000..06a0848 --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogMapper.java @@ -0,0 +1,40 @@ +package com.agileboot.domain.shop.paymentOperationLog.db; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import java.util.List; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +/** + *

+ * 支付操作日志表 Mapper 接口 + *

+ * + * @author valarchie + * @since 2025-04-25 + */ +public interface PaymentOperationLogMapper extends BaseMapper { + + @Select("SELECT * " + + "FROM payment_operation_log " + + "${ew.customSqlSegment}") + Page getPaymentLogList( + Page page, + @Param(Constants.WRAPPER) Wrapper queryWrapper + ); + + @Select("SELECT * FROM payment_operation_log WHERE order_id = #{orderId} ORDER BY create_time DESC LIMIT 1") + PaymentOperationLogEntity selectLatestByOrderId(Long orderId); + + @Select("SELECT * FROM payment_operation_log WHERE status = #{status} ORDER BY create_time DESC") + List selectByStatus(Integer status); + + @Select("SELECT * FROM payment_operation_log WHERE order_id = #{orderId} AND status = #{status}") + PaymentOperationLogEntity selectByOrderAndStatus( + @Param("orderId") Long orderId, + @Param("status") Integer status + ); +} diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogService.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogService.java new file mode 100644 index 0000000..63ca82d --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogService.java @@ -0,0 +1,26 @@ +package com.agileboot.domain.shop.paymentOperationLog.db; + +import com.agileboot.common.core.page.AbstractPageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 支付操作日志表 服务类 + *

+ * + * @author valarchie + * @since 2025-04-25 + */ +public interface PaymentOperationLogService extends IService { + + Page getPaymentLogList(AbstractPageQuery query); + + List selectAll(); + + PaymentOperationLogEntity selectLatestByOrderId(Long orderId); + + PaymentOperationLogEntity selectByOrderAndStatus(Long orderId, Integer status); +} diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogServiceImpl.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogServiceImpl.java new file mode 100644 index 0000000..8e7d949 --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/db/PaymentOperationLogServiceImpl.java @@ -0,0 +1,40 @@ +package com.agileboot.domain.shop.paymentOperationLog.db; + +import com.agileboot.common.core.page.AbstractPageQuery; +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 org.springframework.stereotype.Service; +import java.util.List; + +/** + *

+ * 支付操作日志表 服务实现类 + *

+ * + * @author valarchie + * @since 2025-04-25 + */ +@Service +public class PaymentOperationLogServiceImpl extends ServiceImpl implements PaymentOperationLogService { + + @Override + public Page getPaymentLogList(AbstractPageQuery query) { + return this.page(query.toPage(), query.toQueryWrapper()); + } + + @Override + public List selectAll() { + return this.list(); + } + + @Override + public PaymentOperationLogEntity selectLatestByOrderId(Long orderId) { + return baseMapper.selectLatestByOrderId(orderId); + } + + @Override + public PaymentOperationLogEntity selectByOrderAndStatus(Long orderId, Integer status) { + return baseMapper.selectByOrderAndStatus(orderId, status); + } +} diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/dto/PaymentOperationLogDTO.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/dto/PaymentOperationLogDTO.java new file mode 100644 index 0000000..276603f --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/dto/PaymentOperationLogDTO.java @@ -0,0 +1,37 @@ +package com.agileboot.domain.shop.paymentOperationLog.dto; + +import cn.hutool.core.bean.BeanUtil; +import com.agileboot.common.annotation.ExcelColumn; +import com.agileboot.common.annotation.ExcelSheet; +import com.agileboot.domain.common.cache.CacheCenter; +import com.agileboot.domain.shop.paymentOperationLog.db.PaymentOperationLogEntity; +import com.agileboot.domain.system.user.db.SysUserEntity; +import lombok.Data; + +@ExcelSheet(name = "支付操作日志列表") +@Data +public class PaymentOperationLogDTO { + + public PaymentOperationLogDTO(PaymentOperationLogEntity entity) { + if (entity != null) { + BeanUtil.copyProperties(entity, this); + + this.statusStr = entity.getStatus() == 1 ? "成功" : "失败"; + } + } + + @ExcelColumn(name = "日志ID") + private Long logId; + + @ExcelColumn(name = "订单ID") + private Long orderId; + + @ExcelColumn(name = "操作状态") + private String statusStr; + + @ExcelColumn(name = "操作备注") + private String remark; + + @ExcelColumn(name = "操作人") + private String operatorName; +} \ No newline at end of file diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/model/PaymentOperationLogModel.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/model/PaymentOperationLogModel.java new file mode 100644 index 0000000..98247f5 --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/model/PaymentOperationLogModel.java @@ -0,0 +1,39 @@ +package com.agileboot.domain.shop.paymentOperationLog.model; + +import cn.hutool.core.bean.BeanUtil; +import com.agileboot.domain.shop.paymentOperationLog.command.AddPaymentOperationLogCommand; +import com.agileboot.domain.shop.paymentOperationLog.command.UpdatePaymentOperationLogCommand; +import com.agileboot.domain.shop.paymentOperationLog.db.PaymentOperationLogEntity; +import com.agileboot.domain.shop.paymentOperationLog.db.PaymentOperationLogService; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class PaymentOperationLogModel extends PaymentOperationLogEntity { + + private PaymentOperationLogService paymentOperationLogService; + + public PaymentOperationLogModel(PaymentOperationLogEntity entity, PaymentOperationLogService paymentOperationLogService) { + this(paymentOperationLogService); + if (entity != null) { + BeanUtil.copyProperties(entity, this); + } + } + + public PaymentOperationLogModel(PaymentOperationLogService paymentOperationLogService) { + this.paymentOperationLogService = paymentOperationLogService; + } + + public void loadAddCommand(AddPaymentOperationLogCommand command) { + if (command != null) { + BeanUtil.copyProperties(command, this, "logId"); + } + } + + public void loadUpdateCommand(UpdatePaymentOperationLogCommand command) { + if (command != null) { + loadAddCommand(command); + } + } +} \ No newline at end of file diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/model/PaymentOperationLogModelFactory.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/model/PaymentOperationLogModelFactory.java new file mode 100644 index 0000000..d1bc78b --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/model/PaymentOperationLogModelFactory.java @@ -0,0 +1,27 @@ +package com.agileboot.domain.shop.paymentOperationLog.model; + +import com.agileboot.common.exception.ApiException; +import com.agileboot.common.exception.error.ErrorCode; +import com.agileboot.domain.shop.paymentOperationLog.db.PaymentOperationLogEntity; +import com.agileboot.domain.shop.paymentOperationLog.db.PaymentOperationLogService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class PaymentOperationLogModelFactory { + + private final PaymentOperationLogService paymentOperationLogService; + + public PaymentOperationLogModel loadById(Long logId) { + PaymentOperationLogEntity entity = paymentOperationLogService.getById(logId); + if (entity == null) { + throw new ApiException(ErrorCode.Business.COMMON_OBJECT_NOT_FOUND, logId, "支付操作日志"); + } + return new PaymentOperationLogModel(entity, paymentOperationLogService); + } + + public PaymentOperationLogModel create() { + return new PaymentOperationLogModel(paymentOperationLogService); + } +} \ No newline at end of file diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/query/SearchPaymentOperationLogQuery.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/query/SearchPaymentOperationLogQuery.java new file mode 100644 index 0000000..a940668 --- /dev/null +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/paymentOperationLog/query/SearchPaymentOperationLogQuery.java @@ -0,0 +1,34 @@ +package com.agileboot.domain.shop.paymentOperationLog.query; + +import cn.hutool.core.util.StrUtil; +import com.agileboot.common.core.page.AbstractPageQuery; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import java.util.Date; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class SearchPaymentOperationLogQuery extends AbstractPageQuery { + + private Long orderId; + private Integer status; + private String remark; + private Date startTime; + private Date endTime; + + @Override + public QueryWrapper addQueryCondition() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + + queryWrapper + .eq(orderId != null, "order_id", orderId) + .eq(status != null, "`status`", status) + .like(StrUtil.isNotEmpty(remark), "remark", remark) + .between(startTime != null && endTime != null, "create_time", startTime, endTime); + + this.timeRangeColumn = "create_time"; + + return queryWrapper; + } +} \ No newline at end of file diff --git a/agileboot-domain/src/main/resources/mapper/shop/PaymentOperationLogMapper.xml b/agileboot-domain/src/main/resources/mapper/shop/PaymentOperationLogMapper.xml new file mode 100644 index 0000000..3a556b0 --- /dev/null +++ b/agileboot-domain/src/main/resources/mapper/shop/PaymentOperationLogMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/agileboot-infrastructure/src/main/java/com/agileboot/infrastructure/mybatisplus/CodeGenerator.java b/agileboot-infrastructure/src/main/java/com/agileboot/infrastructure/mybatisplus/CodeGenerator.java index 653ac3a..16b5f1b 100644 --- a/agileboot-infrastructure/src/main/java/com/agileboot/infrastructure/mybatisplus/CodeGenerator.java +++ b/agileboot-infrastructure/src/main/java/com/agileboot/infrastructure/mybatisplus/CodeGenerator.java @@ -61,7 +61,7 @@ public class CodeGenerator { //生成的类 放在orm子模块下的/target/generated-code目录底下 .module("/agileboot-orm/target/generated-code") .parentPackage("com.agileboot") - .tableName("cabinet_cell_operation") + .tableName("payment_operation_log") // 决定是否继承基类 .isExtendsFromBaseEntity(true) .build(); diff --git a/sql/20250425_payment_log.sql b/sql/20250425_payment_log.sql new file mode 100644 index 0000000..a879487 --- /dev/null +++ b/sql/20250425_payment_log.sql @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS `payment_operation_log`; + +CREATE TABLE `payment_operation_log` ( + `log_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '日志ID', + `order_id` BIGINT NULL COMMENT '订单ID(关联shop_order.order_id)', + `status` TINYINT NOT NULL DEFAULT 1 COMMENT '操作状态(1成功 2失败)', + `creator_id` BIGINT NOT NULL DEFAULT 0 COMMENT '创建者ID', + `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater_id` BIGINT NOT NULL DEFAULT 0 COMMENT '更新者ID', + `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `remark` TEXT DEFAULT NULL COMMENT '操作备注', + `deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '删除标志(0存在 1删除)', + PRIMARY KEY (`log_id`), + KEY `idx_create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='支付操作日志表'; \ No newline at end of file