style(core): 调整表格头默认样式

- 修改表格头默认字体颜色为黑色 (#000000)
- 修改表格头默认背景颜色为灰色 (#cccccc)
- 更新相关服务类、工具类和注解的默认值
This commit is contained in:
liushuang 2025-08-26 19:05:29 +08:00
parent 8a49e5280b
commit 7fa5300273
5 changed files with 34 additions and 24 deletions

@ -22,14 +22,14 @@ feishu-table-helper 是一个简化飞书表格操作的 Java 库。通过使用
<dependency> <dependency>
<groupId>cn.isliu</groupId> <groupId>cn.isliu</groupId>
<artifactId>feishu-table-helper</artifactId> <artifactId>feishu-table-helper</artifactId>
<version>0.0.2</version> <version>0.0.3</version>
</dependency> </dependency>
``` ```
### Gradle ### Gradle
```gradle ```gradle
implementation 'cn.isliu:feishu-table-helper:0.0.2' implementation 'cn.isliu:feishu-table-helper:0.0.3'
``` ```
## 快速开始 ## 快速开始
@ -38,22 +38,29 @@ implementation 'cn.isliu:feishu-table-helper:0.0.2'
```java ```java
// 初始化配置 // 初始化配置
FsClient.getInstance().initializeClient("your_app_id", "your_app_secret"); try (FsClient fsClient = FsClient.getInstance()) {
fsClient.initializeClient("your_app_id","your_app_secret");
}
``` ```
### 2. 创建实体类 ### 2. 创建实体类
```java ```java
@TableConf(headLine = 3, titleRow = 2, enableDesc = true)
public class Employee extends BaseEntity { public class Employee extends BaseEntity {
@TableProperty(value = "姓名", order = 1)
@TableProperty(value = {"ID", "员工信息", "员工编号"}, order = 0, desc = "员工编号不超过20个字符")
private String employeeId;
@TableProperty(value = {"ID", "员工信息", "姓名"}, order = 1, desc = "员工姓名不超过20个字符")
private String name; private String name;
@TableProperty(value = "邮箱", order = 2) @TableProperty(value = "部门", order = 3, desc = "员工部门不超过20个字符")
private String email;
@TableProperty(value = "部门", order = 3)
private String department; private String department;
@TableProperty(value = {"员工信息", "邮箱"}, order = 2, desc = "员工邮箱不超过50个字符")
private String email;
// getters and setters... // getters and setters...
} }
``` ```
@ -65,6 +72,8 @@ public class Employee extends BaseEntity {
String sheetId = FsHelper.create("员工表", "your_spreadsheet_token", Employee.class); String sheetId = FsHelper.create("员工表", "your_spreadsheet_token", Employee.class);
``` ```
![员工表](img/b3d92bda-8d51-4aa7-b66e-496cb2430802.png)
### 4. 写入数据 ### 4. 写入数据
```java ```java
@ -98,16 +107,17 @@ employees.forEach(emp -> System.out.println(emp.name + " - " + emp.email));
- `fieldFormatClass()`: 字段格式化处理类 - `fieldFormatClass()`: 字段格式化处理类
- `optionsClass()`: 选项处理类 - `optionsClass()`: 选项处理类
## 配置选项 ### @TableConf
通过 [FsConfig](file://../src/main/java/cn/isliu/core/config/FsConfig.java#L5-L55) 类可以配置以下选项 用于配置表格样式
- `headLine`: 表头行号 - `headLine()`: 表头行数
- `titleLine`: 标题行号 - `titleLine()`: 标题行数
- `isCover`: 是否覆盖写入 - `enableCover()`: 是否开启覆盖写入
- `CELL_TEXT`: 是否设置单元格为文本格式 - `isText()`: 是否设置表格为纯文本
- `FORE_COLOR`: 前景色 - `headFontColor()`: 表头字体颜色
- `BACK_COLOR`: 背景色 - `headBackColor()`: 表头背景颜色
- `enableDesc()`: 是否开启字段描述
## 依赖 ## 依赖

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -49,12 +49,12 @@ public @interface TableConf {
* *
* @return 字体颜色 * @return 字体颜色
*/ */
String headFontColor() default "#ffffff"; String headFontColor() default "#000000";
/** /**
* 背景颜色 * 背景颜色
* *
* @return 背景颜色 * @return 背景颜色
*/ */
String headBackColor() default "#000000"; String headBackColor() default "#cccccc";
} }

@ -819,8 +819,8 @@ public class CustomCellService extends AbstractFeishuApiService {
private String formatter= ""; private String formatter= "";
private Integer hAlign = 1; private Integer hAlign = 1;
private Integer vAlign = 1; private Integer vAlign = 1;
private String foreColor = "#ffffff"; private String foreColor = "#000000";
private String backColor = "#000000"; private String backColor = "#cccccc";
private String borderType = "FULL_BORDER"; private String borderType = "FULL_BORDER";
private String borderColor = "#6d6d6d"; private String borderColor = "#6d6d6d";
private Boolean clean = false; private Boolean clean = false;

@ -408,12 +408,12 @@ public class PropertyUtil {
@Override @Override
public String headFontColor() { public String headFontColor() {
return "#ffffff"; return "#000000";
} }
@Override @Override
public String headBackColor() { public String headBackColor() {
return "#000000"; return "#cccccc";
} }
}; };
} }