diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/TenantPointsController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/TenantPointsController.java index 68123e7..8aadcef 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/TenantPointsController.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/TenantPointsController.java @@ -8,7 +8,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Operation; -import javax.validation.constraints.*; import javax.validation.*; import javax.servlet.http.*; import java.util.*; @@ -83,9 +82,9 @@ public class TenantPointsController { @GetMapping("/page") @Operation(summary = "获得租户积分记录分页") @PreAuthorize("@ss.hasPermission('system:tenant-points:query')") - public CommonResult> getTenantPointsPage(@Valid TenantPointsPageReqVO pageReqVO) { - PageResult pageResult = tenantPointsService.getTenantPointsPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, TenantPointsRespVO.class)); + public CommonResult> getTenantPointsPage(@Valid TenantPointsPageReqVO pageReqVO) { + PageResult tenantPointsPage = tenantPointsService.getTenantPointsPage(pageReqVO); + return success(tenantPointsPage); } @GetMapping("/export-excel") @@ -95,10 +94,12 @@ public class TenantPointsController { public void exportTenantPointsExcel(@Valid TenantPointsPageReqVO pageReqVO, HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = tenantPointsService.getTenantPointsPage(pageReqVO).getList(); + + List list = tenantPointsService.getTenantPointsPage(pageReqVO).getList(); + // 导出 Excel - ExcelUtils.write(response, "租户积分记录.xls", "数据", TenantPointsRespVO.class, - BeanUtils.toBean(list, TenantPointsRespVO.class)); + ExcelUtils.write(response, "租户积分记录.xls", "数据", TenantPointsPageRespVO.class, + BeanUtils.toBean(list, TenantPointsPageRespVO.class)); } @GetMapping("/transaction-history/page") diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/vo/TenantPointsPageReqVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/vo/TenantPointsPageReqVO.java index d0cd4b1..094b9b5 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/vo/TenantPointsPageReqVO.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/vo/TenantPointsPageReqVO.java @@ -38,6 +38,10 @@ public class TenantPointsPageReqVO extends PageParam { private Long targetTenantId; @Schema(description = "创建时间") - private LocalDateTime createdAt; + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createdAt; + + @Schema(description = "备注") + private String remark; } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/vo/TenantPointsPageRespVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/vo/TenantPointsPageRespVO.java new file mode 100644 index 0000000..65c1e4c --- /dev/null +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantpoints/vo/TenantPointsPageRespVO.java @@ -0,0 +1,58 @@ +package cn.iocoder.yudao.module.system.controller.admin.tenantpoints.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 租户积分记录 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TenantPointsPageRespVO { + + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "16587") + @ExcelProperty("主键") + private Long id; + + @Schema(description = "本次变动点数,正加负减", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("本次变动点数,正加负减") + private Integer points; + + @Schema(description = "变动后余额快照(冗余)") + @ExcelProperty("变动后余额快照(冗余)") + private Integer balance; + + @Schema(description = "变动类型,", example = "转账") + @ExcelProperty("变动类型,") + private String type; + + @Schema(description = "变动描述", example = "转账金额 100") + @ExcelProperty("变动描述") + private String description; + + @Schema(description = "订单 Id/业务单号", example = "84") + @ExcelProperty("订单 Id/业务单号") + private Long orderId; + + @Schema(description = "业务流水号(转账、订单等唯一标识)") + @ExcelProperty("业务流水号(转账、订单等唯一标识)") + private String bizNo; + + @Schema(description = "操作人 Id", example = "8171") + @ExcelProperty("操作人 Id") + private Long operatorId; + + @Schema(description = "目标租户 Id(转账使用)", example = "18731") + @ExcelProperty("目标租户 Id(转账使用)") + private Long targetTenantId; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createdAt; + + @Schema(description = "租户名称", example = "租户 A") + @ExcelProperty("租户名称") + private String tenantName; +} \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenantpoints/TenantPointsMapper.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenantpoints/TenantPointsMapper.java index d503940..75c0ecf 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenantpoints/TenantPointsMapper.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenantpoints/TenantPointsMapper.java @@ -7,8 +7,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.module.system.dal.dataobject.tenantpoints.TenantPointsDO; +import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.system.controller.admin.tenantpoints.vo.*; +import org.apache.ibatis.annotations.Param; /** * 租户积分记录 Mapper @@ -53,4 +55,7 @@ public interface TenantPointsMapper extends BaseMapperX { .orderByDesc(TenantPointsDO::getId)); } + IPage selectPageWithXML(@Param("iPage") IPage iPage, @Param("pageReqVO") TenantPointsPageReqVO pageReqVO); + + IPage selectPageWithTenantIdXML(@Param("iPage")IPage iPage,@Param("pageReqVO") TenantPointsPageReqVO pageReqVO,@Param("tenantId") Long tenantId); } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantpoints/TenantPointsService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantpoints/TenantPointsService.java index b40b71c..a7c548e 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantpoints/TenantPointsService.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantpoints/TenantPointsService.java @@ -57,7 +57,7 @@ public interface TenantPointsService { * @param pageReqVO 分页查询 * @return 租户积分记录分页 */ - PageResult getTenantPointsPage(TenantPointsPageReqVO pageReqVO); + PageResult getTenantPointsPage(TenantPointsPageReqVO pageReqVO); PageResult getTenantTransactionHistoryPointsPage(PageParam pageReqVO, Long tenantId); } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantpoints/TenantPointsServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantpoints/TenantPointsServiceImpl.java index a7e0c30..a3623ae 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantpoints/TenantPointsServiceImpl.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantpoints/TenantPointsServiceImpl.java @@ -2,10 +2,11 @@ package cn.iocoder.yudao.module.system.service.tenantpoints; import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; import java.util.*; import cn.iocoder.yudao.module.system.controller.admin.tenantpoints.vo.*; @@ -18,7 +19,6 @@ import cn.iocoder.yudao.module.system.dal.mysql.tenantpoints.TenantPointsMapper; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; /** @@ -86,12 +86,18 @@ public class TenantPointsServiceImpl implements TenantPointsService { } @Override - public PageResult getTenantPointsPage(TenantPointsPageReqVO pageReqVO) { + public PageResult getTenantPointsPage(TenantPointsPageReqVO pageReqVO) { Long tenantId = TenantContextHolder.getTenantId(); + if (tenantId == 1) { - return tenantPointsMapper.selectPage(pageReqVO); + IPage iPage = new Page<>(pageReqVO.getPageNo(),pageReqVO.getPageSize()); + IPage tenantPointsPageRespVOIPage = tenantPointsMapper.selectPageWithXML(iPage, pageReqVO); + return new PageResult<>(tenantPointsPageRespVOIPage.getRecords(),tenantPointsPageRespVOIPage.getTotal()); } - return tenantPointsMapper.selectPageWithTenantId(pageReqVO,tenantId); + + IPage iPage = new Page<>(pageReqVO.getPageNo(),pageReqVO.getPageSize()); + IPage tenantPointsPageRespVOIPage = tenantPointsMapper.selectPageWithTenantIdXML(iPage,pageReqVO,tenantId); + return new PageResult<>(tenantPointsPageRespVOIPage.getRecords(),tenantPointsPageRespVOIPage.getTotal()); } diff --git a/yudao-module-system/src/main/resources/mapper/TenantPointsMapper.xml b/yudao-module-system/src/main/resources/mapper/TenantPointsMapper.xml index 94a3d7d..bd04d3c 100644 --- a/yudao-module-system/src/main/resources/mapper/TenantPointsMapper.xml +++ b/yudao-module-system/src/main/resources/mapper/TenantPointsMapper.xml @@ -9,4 +9,70 @@ 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ --> + + + + \ No newline at end of file