本模块为 alien-store-platform 服务提供商户证照历史记录的完整管理功能,包括证照的创建、更新、删除、查询等操作。
CREATE TABLE `store_license_history` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`store_id` int NULL COMMENT '商户ID',
`license_status` int NOT NULL COMMENT '证照类型: 1-合同管理,2-食品经营许可证',
`license_execute_status` int NOT NULL COMMENT '审核状态: 1-审核中, 2-审核拒绝, 3-审核通过',
`img_url` varchar(500) NOT NULL COMMENT '图片URL',
`delete_flag` int NOT NULL DEFAULT '0' COMMENT '删除标记, 0:未删除, 1:已删除',
`created_time` datetime NOT NULL COMMENT '创建时间',
`created_user_id` int DEFAULT NULL COMMENT '创建人ID',
`updated_time` datetime DEFAULT NULL COMMENT '修改时间',
`updated_user_id` int DEFAULT NULL COMMENT '修改人ID',
PRIMARY KEY (`id`) USING BTREE
);
alien-entity/src/main/java/shop/alien/entity/store/StoreLicenseHistory.javaalien-entity/src/main/java/shop/alien/mapper/StoreLicenseHistoryMapper.javaalien-entity/src/main/java/shop/alien/entity/store/dto/StoreLicenseHistoryDTO.javaalien-entity/src/main/java/shop/alien/entity/store/vo/StoreLicenseHistoryVO.javaalien-store-platform/src/main/java/shop/alien/storeplatform/service/StoreLicenseHistoryService.javaalien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StoreLicenseHistoryServiceImpl.javaalien-store-platform/src/main/java/shop/alien/storeplatform/controller/StoreLicenseHistoryController.javaPOST /storeLicenseHistory/create请求体:
{
"storeId": 1,
"licenseStatus": 1,
"licenseExecuteStatus": 1,
"imgUrl": "https://example.com/image.jpg"
}
响应:
{
"code": 200,
"msg": "创建成功",
"data": {
"id": 1,
"storeId": 1,
"licenseStatus": 1,
"licenseExecuteStatus": 1,
"imgUrl": "https://example.com/image.jpg",
"createdTime": "2025-11-24 10:00:00"
}
}
PUT /storeLicenseHistory/update请求体:
{
"id": 1,
"storeId": 1,
"licenseStatus": 1,
"licenseExecuteStatus": 2,
"imgUrl": "https://example.com/image.jpg"
}
DELETE /storeLicenseHistory/delete?id=1GET /storeLicenseHistory/getById?id=1响应:
{
"code": 200,
"data": {
"id": 1,
"storeId": 1,
"storeName": "测试商户",
"licenseStatus": 1,
"licenseStatusName": "合同管理",
"licenseExecuteStatus": 3,
"licenseExecuteStatusName": "审核通过",
"imgUrl": "https://example.com/image.jpg",
"createdTime": "2025-11-24 10:00:00"
}
}
GET /storeLicenseHistory/listByStoreId?storeId=1GET /storeLicenseHistory/listByStoreIdAndType?storeId=1&licenseStatus=1storeId: 商户IDlicenseStatus: 证照类型(1-合同管理,2-食品经营许可证)GET /storeLicenseHistory/page?current=1&size=10&storeId=1&licenseStatus=1&licenseExecuteStatus=3current: 当前页(必填,默认 1)size: 每页大小(必填,默认 10)storeId: 商户ID(可选)licenseStatus: 证照类型(可选)licenseExecuteStatus: 审核状态(可选)1: 合同管理2: 食品经营许可证1: 审核中2: 审核拒绝3: 审核通过@Validated 和 @NotNull 进行参数校验@TableLogic 实现软删除启动 alien-store-platform 服务后,访问:
http://localhost:{port}/swagger-ui.htmlhttp://localhost:{port}/doc.html在 "商家端-证照历史管理" 分组下可以看到所有接口。
数据库字段类型: 原表结构中 img_url 字段类型为 int,这应该是错误的。实际代码中已将其定义为 String 类型用于存储图片 URL。建议修改数据库字段类型为 varchar(500)。
依赖关系:
StoreInfo 表用于验证商户是否存在和获取商户名称StoreInfoMapper 已正确注入权限控制: 当前接口未添加权限验证,如需要请在 Controller 中添加相应注解
事务管理: 建议在 Service 实现类的方法上添加 @Transactional 注解