9 changed files with 116 additions and 9 deletions
@ -0,0 +1,40 @@ |
|||
package cn.iocoder.yudao.framework.common.pojo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
|
|||
@Schema(description = "分页结果") |
|||
@Data |
|||
@Builder |
|||
public class PagedResponse<T> { |
|||
|
|||
@Schema(description = "总条数") |
|||
private long total; |
|||
|
|||
@Schema(description = "当前页码,从 1 开始") |
|||
private int current; |
|||
|
|||
@Schema(description = "分页大小") |
|||
private int size; |
|||
|
|||
@Schema(description = "当前页数据") |
|||
private List<T> records; |
|||
|
|||
@Schema(description = "总页数") |
|||
private int pages; |
|||
|
|||
public static <T> PagedResponse<T> of(long total, int current, int size, List<T> records) { |
|||
int pages = size <= 0 ? 0 : (int) ((total + size - 1) / size); |
|||
return PagedResponse.<T>builder() |
|||
.total(total) |
|||
.current(current) |
|||
.size(size) |
|||
.pages(pages) |
|||
.records(records == null ? Collections.emptyList() : records) |
|||
.build(); |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
--- #################### 数据库相关配置(达梦) #################### |
|||
|
|||
spring: |
|||
datasource: |
|||
dynamic: |
|||
druid: |
|||
connection-init-sqls: ["SET SCHEMA ALERT"] |
|||
datasource: |
|||
master: |
|||
url: jdbc:dm://120.26.116.243:5236?schema=ALERT |
|||
username: SYSDBA |
|||
password: powerSIS123 |
|||
driver-class-name: dm.jdbc.driver.DmDriver |
|||
# 与 master 保持一致,避免 local profile 的 MySQL 从库配置残留 |
|||
slave: |
|||
url: jdbc:dm://120.26.116.243:5236?schema=ALERT |
|||
username: SYSDBA |
|||
password: powerSIS123 |
|||
driver-class-name: dm.jdbc.driver.DmDriver |
|||
Loading…
Reference in new issue