Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hanni-external-api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨向龙
hanni-external-api
Commits
10970e47
Commit
10970e47
authored
Mar 23, 2026
by
yangxianglong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自采联营门店系统开发
parent
7d16e08c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
72 deletions
+5
-72
README.md
README.md
+3
-2
ItemSyncCache.java
src/main/java/cn/nhsoft/hanni/item/model/ItemSyncCache.java
+0
-43
ItemSyncCacheRepository.java
...nhsoft/hanni/item/repository/ItemSyncCacheRepository.java
+0
-14
mysql-item-sync.sql
src/main/resources/db/mysql-item-sync.sql
+2
-13
No files found.
README.md
View file @
10970e47
...
@@ -88,8 +88,9 @@ mvn spring-boot:run
...
@@ -88,8 +88,9 @@ mvn spring-boot:run
## 数据库
## 数据库
-
**脚本位置**
:
`src/main/resources/db/mysql-item-sync.sql`
-
**脚本位置**
:
`src/main/resources/db/mysql-item-sync.sql`
;已有旧库增量对齐见
`mysql-item-sync-upgrade.sql`
-
**主要表**
:
`item_sync_log`
(任务汇总)、
`item_sync_snapshot`
(条码快照/变更跳过)、
`item_sync_detail`
(单次明细)、
`item_sync_cache`
(旧版 MD5 缓存,可不用)、
`lemeng_oauth_token`
(Token 持久化)
-
**主要表**
:
`item_sync_log`
(任务汇总)、
`item_sync_snapshot`
(条码快照/变更跳过)、
`item_sync_detail`
(单次明细)、
`lemeng_oauth_token`
(Token 持久化)
-
**已废弃**
:旧表
`item_sync_cache`
(MD5 缓存)已不再使用;若库中仍存在可执行
`mysql-drop-item-sync-cache.sql`
删除
-
本地 H2 可使用
`ddl-auto=update`
自动建表;MySQL 建议执行上述脚本或由 Hibernate 按策略创建(以运维规范为准)。
-
本地 H2 可使用
`ddl-auto=update`
自动建表;MySQL 建议执行上述脚本或由 Hibernate 按策略创建(以运维规范为准)。
---
---
...
...
src/main/java/cn/nhsoft/hanni/item/model/ItemSyncCache.java
deleted
100644 → 0
View file @
7d16e08c
package
cn
.
nhsoft
.
hanni
.
item
.
model
;
import
javax.persistence.*
;
import
java.util.Date
;
/**
* 商品同步缓存,用于变更检测
*/
@Entity
@Table
(
name
=
"item_sync_cache"
,
indexes
=
{
@Index
(
columnList
=
"barcode"
)})
public
class
ItemSyncCache
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"barcode"
,
length
=
64
,
unique
=
true
)
private
String
barcode
;
@Column
(
name
=
"content_hash"
,
length
=
64
)
private
String
contentHash
;
@Column
(
name
=
"update_time"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Date
updateTime
;
@PrePersist
@PreUpdate
public
void
prePersist
()
{
if
(
updateTime
==
null
)
{
updateTime
=
new
Date
();
}
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getBarcode
()
{
return
barcode
;
}
public
void
setBarcode
(
String
barcode
)
{
this
.
barcode
=
barcode
;
}
public
String
getContentHash
()
{
return
contentHash
;
}
public
void
setContentHash
(
String
contentHash
)
{
this
.
contentHash
=
contentHash
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
src/main/java/cn/nhsoft/hanni/item/repository/ItemSyncCacheRepository.java
deleted
100644 → 0
View file @
7d16e08c
package
cn
.
nhsoft
.
hanni
.
item
.
repository
;
import
cn.nhsoft.hanni.item.model.ItemSyncCache
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
import
java.util.Optional
;
public
interface
ItemSyncCacheRepository
extends
JpaRepository
<
ItemSyncCache
,
Long
>
{
Optional
<
ItemSyncCache
>
findByBarcode
(
String
barcode
);
List
<
ItemSyncCache
>
findByBarcodeIn
(
List
<
String
>
barcodes
);
}
src/main/resources/db/mysql-item-sync.sql
View file @
10970e47
-- 汉尼外部 API 相关表(MySQL 8+, utf8mb4)
-- 汉尼外部 API 相关表(MySQL 8+, utf8mb4)
-- 含:商品同步、乐檬 OAuth Token 持久化
-- 含:商品同步、乐檬 OAuth Token 持久化
-- 执行前请替换库名: USE your_database;
-- 执行前请替换库名: USE your_database;
--
-- 若库中已有旧表、仅需增量对齐字段/索引,请使用: mysql-item-sync-upgrade.sql
SET
NAMES
utf8mb4
;
SET
NAMES
utf8mb4
;
...
@@ -69,19 +71,6 @@ CREATE TABLE IF NOT EXISTS `item_sync_detail` (
...
@@ -69,19 +71,6 @@ CREATE TABLE IF NOT EXISTS `item_sync_detail` (
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'同步任务商品明细'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'同步任务商品明细'
;
-- ----------------------------
-- ----------------------------
-- 旧版 MD5 变更缓存(当前逻辑已改用 snapshot,可不再使用;历史数据可保留)
-- ----------------------------
CREATE
TABLE
IF
NOT
EXISTS
`item_sync_cache`
(
`id`
BIGINT
NOT
NULL
AUTO_INCREMENT
,
`barcode`
VARCHAR
(
64
)
NOT
NULL
,
`content_hash`
VARCHAR
(
64
)
DEFAULT
NULL
,
`update_time`
DATETIME
(
3
)
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`uk_item_sync_cache_barcode`
(
`barcode`
),
KEY
`idx_item_sync_cache_barcode`
(
`barcode`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'商品同步缓存(旧)'
;
-- ----------------------------
-- 乐檬 OAuth Token 持久化(与 JPA 实体 LemengOAuthToken 对应;服务重启从库加载)
-- 乐檬 OAuth Token 持久化(与 JPA 实体 LemengOAuthToken 对应;服务重启从库加载)
-- ----------------------------
-- ----------------------------
CREATE
TABLE
IF
NOT
EXISTS
`lemeng_oauth_token`
(
CREATE
TABLE
IF
NOT
EXISTS
`lemeng_oauth_token`
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment