Skip to content

Commit d3f5dc2

Browse files
committed
#AI commit# CC: REQ-01文件数据集导入功能-数据模型:新增FileParseResult/FileColumnDefine解析结果DTO、FileSourceParseException异常、JobFileResource实体+JobFileResourceDao及mapper xml(仿JobTransformProcessorDao模式)、FileSourceUploadResult响应VO / REQ-01 file dataset import data model: add FileParseResult/FileColumnDefine parse DTOs, FileSourceParseException, JobFileResource entity + JobFileResourceDao & mapper xml (mirrors JobTransformProcessorDao), FileSourceUploadResult response VO
1 parent fe7559f commit d3f5dc2

7 files changed

Lines changed: 685 additions & 0 deletions

File tree

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
package com.webank.wedatasphere.exchangis.job.server.domain;
2+
3+
import java.util.Date;
4+
5+
/**
6+
* File source BML resource metadata entity (mirrors {@code exchangis_job_file_resources} table).
7+
*
8+
* <p>Stores the BML reference of a file uploaded as a job source, for metadata/reuse/audit.
9+
* Architecture ② / M5: file source does NOT go through datasource management, so this table is
10+
* the only place holding the file BML reference (no {@code exchangis_datasource} row).
11+
*
12+
* <p>文件 source 上传至 BML 的文件元数据实体(对应 {@code exchangis_job_file_resources} 表)。
13+
* 架构②/M5:文件 source 不走数据源管理流程,本表是文件 BML 引用的唯一存储(不写数据源表)。
14+
*/
15+
public class JobFileResource {
16+
17+
/**
18+
* Id
19+
*/
20+
private Long id;
21+
22+
/**
23+
* Associated job id, null if uploaded before job save
24+
* 关联作业ID,上传时未保存作业则为空
25+
*/
26+
private Long jobId;
27+
28+
/**
29+
* Original file name / 原始文件名
30+
*/
31+
private String fileName;
32+
33+
/**
34+
* File size in bytes / 文件字节数
35+
*/
36+
private long fileSize;
37+
38+
/**
39+
* File type: CSV/TEXT / 文件类型
40+
*/
41+
private String fileType;
42+
43+
/**
44+
* Detected encoding / 检测编码
45+
*/
46+
private String encoding;
47+
48+
/**
49+
* Detected separator / 检测分隔符
50+
*/
51+
private String separator;
52+
53+
/**
54+
* Has header row / 是否有表头
55+
*/
56+
private boolean hasHeader;
57+
58+
/**
59+
* BML resource id / BML 资源ID
60+
*/
61+
private String bmlResourceId;
62+
63+
/**
64+
* BML version / BML 版本
65+
*/
66+
private String bmlVersion;
67+
68+
/**
69+
* BML owner/creator / BML 所有者/创建者
70+
*/
71+
private String owner;
72+
73+
/**
74+
* FileParseResult JSON snapshot / 解析结果 JSON 快照
75+
*/
76+
private String parseResult;
77+
78+
/**
79+
* Create time / 创建时间
80+
*/
81+
private Date createTime;
82+
83+
/**
84+
* Update time / 更新时间
85+
*/
86+
private Date updateTime;
87+
88+
public Long getId() {
89+
return id;
90+
}
91+
92+
public void setId(Long id) {
93+
this.id = id;
94+
}
95+
96+
public Long getJobId() {
97+
return jobId;
98+
}
99+
100+
public void setJobId(Long jobId) {
101+
this.jobId = jobId;
102+
}
103+
104+
public String getFileName() {
105+
return fileName;
106+
}
107+
108+
public void setFileName(String fileName) {
109+
this.fileName = fileName;
110+
}
111+
112+
public long getFileSize() {
113+
return fileSize;
114+
}
115+
116+
public void setFileSize(long fileSize) {
117+
this.fileSize = fileSize;
118+
}
119+
120+
public String getFileType() {
121+
return fileType;
122+
}
123+
124+
public void setFileType(String fileType) {
125+
this.fileType = fileType;
126+
}
127+
128+
public String getEncoding() {
129+
return encoding;
130+
}
131+
132+
public void setEncoding(String encoding) {
133+
this.encoding = encoding;
134+
}
135+
136+
public String getSeparator() {
137+
return separator;
138+
}
139+
140+
public void setSeparator(String separator) {
141+
this.separator = separator;
142+
}
143+
144+
public boolean isHasHeader() {
145+
return hasHeader;
146+
}
147+
148+
public void setHasHeader(boolean hasHeader) {
149+
this.hasHeader = hasHeader;
150+
}
151+
152+
public String getBmlResourceId() {
153+
return bmlResourceId;
154+
}
155+
156+
public void setBmlResourceId(String bmlResourceId) {
157+
this.bmlResourceId = bmlResourceId;
158+
}
159+
160+
public String getBmlVersion() {
161+
return bmlVersion;
162+
}
163+
164+
public void setBmlVersion(String bmlVersion) {
165+
this.bmlVersion = bmlVersion;
166+
}
167+
168+
public String getOwner() {
169+
return owner;
170+
}
171+
172+
public void setOwner(String owner) {
173+
this.owner = owner;
174+
}
175+
176+
public String getParseResult() {
177+
return parseResult;
178+
}
179+
180+
public void setParseResult(String parseResult) {
181+
this.parseResult = parseResult;
182+
}
183+
184+
public Date getCreateTime() {
185+
return createTime;
186+
}
187+
188+
public void setCreateTime(Date createTime) {
189+
this.createTime = createTime;
190+
}
191+
192+
public Date getUpdateTime() {
193+
return updateTime;
194+
}
195+
196+
public void setUpdateTime(Date updateTime) {
197+
this.updateTime = updateTime;
198+
}
199+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.webank.wedatasphere.exchangis.job.server.mapper;
2+
3+
import com.webank.wedatasphere.exchangis.job.server.domain.JobFileResource;
4+
5+
/**
6+
* File source BML resource dao (mirrors {@code JobTransformProcessorDao} pattern).
7+
*
8+
* <p>MyBatis auto-scans {@code mapper/impl/*.xml} and the {@code job.server.mapper} base package
9+
* (see {@code dss-exchangis-server.properties}), so no manual registration is needed.
10+
*
11+
* <p>文件 source BML 资源元数据 DAO(仿 {@code JobTransformProcessorDao} 模式)。
12+
*/
13+
public interface JobFileResourceDao {
14+
15+
/**
16+
* Insert one entity (落库一条)
17+
*
18+
* @param entity entity
19+
* @return auto-generated id
20+
*/
21+
Long insert(JobFileResource entity);
22+
23+
/**
24+
* Get by job id (按作业ID查)
25+
*
26+
* @param jobId job id
27+
* @return entity
28+
*/
29+
JobFileResource getByJobId(Long jobId);
30+
31+
/**
32+
* Get by BML resource id (按 BML resourceId 查)
33+
*
34+
* @param bmlResourceId bml resource id
35+
* @return entity
36+
*/
37+
JobFileResource getByResourceId(String bmlResourceId);
38+
39+
/**
40+
* Update BML version (重新上传时更新 BML version)
41+
*
42+
* @param entity entity
43+
*/
44+
void updateVersion(JobFileResource entity);
45+
46+
/**
47+
* Delete by job id (作业删除联动)
48+
*
49+
* @param jobId job id
50+
*/
51+
void deleteByJobId(Long jobId);
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3+
<mapper namespace="com.webank.wedatasphere.exchangis.job.server.mapper.JobFileResourceDao">
4+
5+
<resultMap id="JobFileResourceMap" type="com.webank.wedatasphere.exchangis.job.server.domain.JobFileResource">
6+
<id column="id" property="id"/>
7+
<result column="job_id" property="jobId"/>
8+
<result column="file_name" property="fileName"/>
9+
<result column="file_size" property="fileSize"/>
10+
<result column="file_type" property="fileType"/>
11+
<result column="encoding" property="encoding"/>
12+
<result column="separator" property="separator"/>
13+
<result column="has_header" property="hasHeader"/>
14+
<result column="bml_resource_id" property="bmlResourceId"/>
15+
<result column="bml_version" property="bmlVersion"/>
16+
<result column="owner" property="owner"/>
17+
<result column="parse_result" property="parseResult"/>
18+
<result column="create_time" property="createTime"/>
19+
<result column="update_time" property="updateTime"/>
20+
</resultMap>
21+
22+
<sql id="TableName">
23+
exchangis_job_file_resources
24+
</sql>
25+
26+
<sql id="BaseColumnList">
27+
id, job_id, file_name, file_size, file_type, encoding, separator, has_header,
28+
bml_resource_id, bml_version, owner, parse_result, create_time, update_time
29+
</sql>
30+
31+
<insert id="insert" useGeneratedKeys="true" keyProperty="id"
32+
parameterType="com.webank.wedatasphere.exchangis.job.server.domain.JobFileResource">
33+
INSERT INTO
34+
<include refid="TableName"/>
35+
(job_id, file_name, file_size, file_type, encoding, separator, has_header,
36+
bml_resource_id, bml_version, owner, parse_result)
37+
VALUES (
38+
#{jobId},
39+
#{fileName},
40+
#{fileSize},
41+
#{fileType},
42+
#{encoding},
43+
#{separator},
44+
#{hasHeader},
45+
#{bmlResourceId},
46+
#{bmlVersion},
47+
#{owner},
48+
#{parseResult}
49+
)
50+
</insert>
51+
52+
<select id="getByJobId" parameterType="java.lang.Long" resultMap="JobFileResourceMap">
53+
SELECT
54+
<include refid="BaseColumnList"/>
55+
FROM
56+
<include refid="TableName"/>
57+
WHERE job_id = #{jobId}
58+
LIMIT 1
59+
</select>
60+
61+
<select id="getByResourceId" parameterType="java.lang.String" resultMap="JobFileResourceMap">
62+
SELECT
63+
<include refid="BaseColumnList"/>
64+
FROM
65+
<include refid="TableName"/>
66+
WHERE bml_resource_id = #{bmlResourceId}
67+
ORDER BY id DESC
68+
LIMIT 1
69+
</select>
70+
71+
<update id="updateVersion" parameterType="com.webank.wedatasphere.exchangis.job.server.domain.JobFileResource">
72+
UPDATE
73+
<include refid="TableName"/>
74+
SET
75+
bml_version = #{bmlVersion},
76+
file_size = #{fileSize},
77+
encoding = #{encoding},
78+
separator = #{separator},
79+
has_header = #{hasHeader},
80+
parse_result = #{parseResult},
81+
update_time = CURRENT_TIMESTAMP
82+
WHERE bml_resource_id = #{bmlResourceId}
83+
</update>
84+
85+
<delete id="deleteByJobId" parameterType="java.lang.Long">
86+
DELETE FROM
87+
<include refid="TableName"/>
88+
WHERE job_id = #{jobId}
89+
</delete>
90+
91+
</mapper>

0 commit comments

Comments
 (0)