feat(phase-1): 无侵权同步数据底座——V189 建表/V190 菜单(每公司V21形状)/实体与Mapper+XML,三本台账同轮记账
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
package com.nanri.aiimage.modules.appearancepatent.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.entity.CleanItemEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 外观专利无侵权数据(biz_appearance_patent_clean_item,V189)数据访问口。
|
||||
*
|
||||
* <p>出表成功点由 {@code AppearancePatentCleanSyncService}(Phase 2)按 result_id
|
||||
* 覆盖式落表({@link #deleteByResultId} + {@link #insertBatch});后管只读页
|
||||
* (Phase 3)走 {@link #countCleanItems}/{@link #selectCleanItemPage}。SQL 全部落
|
||||
* {@code mapper/appearancepatent/AppearancePatentCleanItemMapper.xml}(铁律 1)。</p>
|
||||
*/
|
||||
@Mapper
|
||||
public interface AppearancePatentCleanItemMapper extends BaseMapper<CleanItemEntity> {
|
||||
|
||||
/** 删除某次结果文件已同步的全部明细行(覆盖式重写第一步,AC-2)。 */
|
||||
int deleteByResultId(@Param("resultId") Long resultId);
|
||||
|
||||
/**
|
||||
* 多值批量插入明细行(调用方按 ≤500 行/批分批,蓝图 §3.3)。
|
||||
*
|
||||
* <p>刻意不写 synced_at:该列有 DB 默认值 CURRENT_TIMESTAMP,显式传 null 会覆盖掉
|
||||
* 默认值(同 ShopDataCrawlItemMapper#insertBatch 的口径)。</p>
|
||||
*/
|
||||
int insertBatch(@Param("rows") List<CleanItemEntity> rows);
|
||||
|
||||
/** 只读页总数(与 {@link #selectCleanItemPage} 同一过滤面)。 */
|
||||
long countCleanItems(@Param("companyId") Long companyId,
|
||||
@Param("taskId") Long taskId,
|
||||
@Param("asin") String asin,
|
||||
@Param("country") String country,
|
||||
@Param("startDate") LocalDate startDate,
|
||||
@Param("endDate") LocalDate endDate);
|
||||
|
||||
/**
|
||||
* 只读页分页查询(synced_at 倒序)。
|
||||
*
|
||||
* <p>{@code offset}/{@code limit} 必须是服务侧钳制后的值——page 钳制防
|
||||
* {@code (page-1)*page_size} 溢出(铁律 15),默认值出处 {@code PageDefaults};
|
||||
* 钳制出口在 Phase 3 控制器/服务,mapper 不做第二次换算,避免两处各算各的。</p>
|
||||
*/
|
||||
List<CleanItemEntity> selectCleanItemPage(@Param("companyId") Long companyId,
|
||||
@Param("taskId") Long taskId,
|
||||
@Param("asin") String asin,
|
||||
@Param("country") String country,
|
||||
@Param("startDate") LocalDate startDate,
|
||||
@Param("endDate") LocalDate endDate,
|
||||
@Param("offset") long offset,
|
||||
@Param("limit") int limit);
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.nanri.aiimage.modules.appearancepatent.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 外观专利无侵权数据明细行({@code biz_appearance_patent_clean_item},V189,v1.3 R1)。
|
||||
*
|
||||
* <p>出表成功点由同步服务按 {@code result_id} 覆盖式落表(Phase 2),后管只读页按
|
||||
* 分公司隔离分页查询(Phase 3)。归属两列物化:{@code userId}=任务 owner、
|
||||
* {@code companyId}=owner 用户的 {@code users.company_id},同步时显式落值、不回填默认
|
||||
* (铁律 30:读不出≠没有)。字段与 chunk payload 行的取值契约由 Phase 0 黄金测试
|
||||
* {@code AppearancePatentChunkRowContractTest} 钉住。</p>
|
||||
*/
|
||||
@Data
|
||||
@TableName("biz_appearance_patent_clean_item")
|
||||
public class CleanItemEntity {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/** 来源结果文件行 id(biz_file_result.id)。 */
|
||||
private Long resultId;
|
||||
/** 来源任务 id(biz_file_task.id)。 */
|
||||
private Long taskId;
|
||||
/** 任务 owner 用户 id。 */
|
||||
private Long userId;
|
||||
/** 物化归属分公司(任务 owner 的 users.company_id)。 */
|
||||
private Long companyId;
|
||||
/** 结果内行号(uk_result_row 覆盖式重写的幂等键一半)。 */
|
||||
private Integer rowNo;
|
||||
private String asin;
|
||||
private String country;
|
||||
private String sku;
|
||||
private String brand;
|
||||
private String price;
|
||||
private String title;
|
||||
/** 商品主图/检测图 URL(payload 行 url 键)。 */
|
||||
private String imageUrl;
|
||||
/** 商品详情页 URL(payload 23 键契约暂无该键,V189 头注释第 2 条的落值口径)。 */
|
||||
private String itemUrl;
|
||||
/** 检测结论原值(严格口径下全为无侵权,存原值不转写)。 */
|
||||
private String conclusion;
|
||||
private String titleReason;
|
||||
private String appearanceReason;
|
||||
private String patentReason;
|
||||
/** 来源文件名(多源文件任务区分用)。 */
|
||||
private String sourceFilename;
|
||||
/** 同步落库时刻(DB 默认 CURRENT_TIMESTAMP,insert 不显式写,覆盖式重写随新行刷新)。 */
|
||||
private LocalDateTime syncedAt;
|
||||
}
|
||||
Reference in New Issue
Block a user