将应用自管表的 JdbcClient 数据访问迁移为实体、Mapper、构造器查询和必要的显式 SQL。 保留 AgentScope 自管表及原有业务语义,并补充事务、查询与数据库集成测试。
68 lines
2.9 KiB
Java
68 lines
2.9 KiB
Java
package tech.easyflow.manuagent.entity;
|
|
|
|
import com.mybatisflex.annotation.Column;
|
|
import com.mybatisflex.annotation.Id;
|
|
import com.mybatisflex.annotation.KeyType;
|
|
import com.mybatisflex.annotation.Table;
|
|
import com.mybatisflex.core.keygen.KeyGenerators;
|
|
import java.time.OffsetDateTime;
|
|
import java.util.UUID;
|
|
import org.apache.ibatis.type.JdbcType;
|
|
import tech.easyflow.manuagent.typehandler.JsonbStringTypeHandler;
|
|
import tech.easyflow.manuagent.typehandler.UuidTypeHandler;
|
|
|
|
/**
|
|
* 映射 {@code app.project_plan} 表的不可变规划版本实体。
|
|
*/
|
|
@Table(value = "project_plan", schema = "app")
|
|
public class ProjectPlanEntity {
|
|
|
|
/** 规划主键。 */
|
|
@Id(keyType = KeyType.Generator, value = KeyGenerators.uuid)
|
|
@Column(typeHandler = UuidTypeHandler.class)
|
|
private UUID id;
|
|
/** 所属项目。 */
|
|
@Column(typeHandler = UuidTypeHandler.class)
|
|
private UUID projectId;
|
|
/** 项目内递增版本号。 */
|
|
private Integer planVersion;
|
|
/** 草稿、已确认或已取代状态。 */
|
|
private String status;
|
|
/** 完整规划 JSON。 */
|
|
@Column(jdbcType = JdbcType.OTHER, typeHandler = JsonbStringTypeHandler.class)
|
|
private String planJson;
|
|
/** 创建用户。 */
|
|
@Column(typeHandler = UuidTypeHandler.class)
|
|
private UUID createdBy;
|
|
/** 确认用户。 */
|
|
@Column(typeHandler = UuidTypeHandler.class)
|
|
private UUID confirmedBy;
|
|
/** 确认时间。 */
|
|
private OffsetDateTime confirmedAt;
|
|
/** 创建时间。 */
|
|
private OffsetDateTime createdAt;
|
|
/** 更新时间。 */
|
|
private OffsetDateTime updatedAt;
|
|
|
|
public UUID getId() { return id; }
|
|
public void setId(UUID id) { this.id = id; }
|
|
public UUID getProjectId() { return projectId; }
|
|
public void setProjectId(UUID projectId) { this.projectId = projectId; }
|
|
public Integer getPlanVersion() { return planVersion; }
|
|
public void setPlanVersion(Integer planVersion) { this.planVersion = planVersion; }
|
|
public String getStatus() { return status; }
|
|
public void setStatus(String status) { this.status = status; }
|
|
public String getPlanJson() { return planJson; }
|
|
public void setPlanJson(String planJson) { this.planJson = planJson; }
|
|
public UUID getCreatedBy() { return createdBy; }
|
|
public void setCreatedBy(UUID createdBy) { this.createdBy = createdBy; }
|
|
public UUID getConfirmedBy() { return confirmedBy; }
|
|
public void setConfirmedBy(UUID confirmedBy) { this.confirmedBy = confirmedBy; }
|
|
public OffsetDateTime getConfirmedAt() { return confirmedAt; }
|
|
public void setConfirmedAt(OffsetDateTime confirmedAt) { this.confirmedAt = confirmedAt; }
|
|
public OffsetDateTime getCreatedAt() { return createdAt; }
|
|
public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = createdAt; }
|
|
public OffsetDateTime getUpdatedAt() { return updatedAt; }
|
|
public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; }
|
|
}
|