店铺扩展参数

This commit is contained in:
GYJ 2025-03-15 10:52:06 +08:00
parent 467d7e64d3
commit 20a572a655
13 changed files with 306 additions and 3 deletions

View File

@ -18,8 +18,8 @@ public class CodeGen {
private final static String DATABASE = "czg_cashier_test";
private final static String OLD_DATABASE = "fycashier";
private final static boolean IS_OLD_VERSION = false;
// private final static boolean IS_OLD_VERSION = true;
// private final static boolean IS_OLD_VERSION = false;
private final static boolean IS_OLD_VERSION = true;
public static void main(String[] args) {
//配置数据源
@ -81,7 +81,7 @@ public class CodeGen {
//设置表前缀和只生成哪些表setGenerateTable 未配置时生成所有表
globalConfig.getStrategyConfig()
.setTablePrefix("tb_")
.setGenerateTable("tb_shop_vendor_transact_pay", "tb_shop_vendor_transact", "tb_shop_vendor");
.setGenerateTable("tb_shop_extend");
EntityConfig entityConfig = globalConfig.getEntityConfig();
if (IS_OLD_VERSION) {

View File

@ -2,6 +2,7 @@ package com.czg.mergedata.controller;
import com.czg.mergedata.common.resp.CzgResult;
import com.czg.mergedata.cur.service.CurShopAdService;
import com.czg.mergedata.cur.service.CurShopExtendService;
import com.czg.mergedata.cur.service.CurShopStorageService;
import com.czg.mergedata.cur.service.CurShopVendorService;
import jakarta.annotation.Resource;
@ -24,6 +25,14 @@ public class ShopInfoController {
@Resource
private CurShopVendorService curShopVendorService;
@Resource
private CurShopExtendService curShopExtendService;
@RequestMapping("/extend")
public CzgResult<String> mergeShopExtend() {
return curShopExtendService.mergeShopExtend();
}
@RequestMapping("/vendor")
public CzgResult<String> mergeShopVendor() {
return curShopVendorService.mergeVendor();

View File

@ -0,0 +1,75 @@
package com.czg.mergedata.cur.entity;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 店铺扩展信息 实体类
*
* @author mac
* @since 2025-03-15
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_extend")
public class CurShopExtend implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 自增id
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 商户Id
*/
private Long shopId;
/**
* img:图片text:文本
*/
private String type;
/**
* 描述
*/
private String name;
/**
* 自定义key
*/
private String autoKey;
/**
*
*/
private String value;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 创建时间
*/
private LocalDateTime createTime;
private String detail;
}

View File

@ -0,0 +1,16 @@
package com.czg.mergedata.cur.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.mergedata.cur.entity.CurShopExtend;
import org.apache.ibatis.annotations.Select;
/**
* 店铺扩展信息 映射层
*
* @author mac
* @since 2025-03-15
*/
public interface CurShopExtendMapper extends BaseMapper<CurShopExtend> {
@Select("truncate tb_shop_extend")
void truncateTable();
}

View File

@ -0,0 +1,16 @@
package com.czg.mergedata.cur.service;
import com.czg.mergedata.common.resp.CzgResult;
import com.mybatisflex.core.service.IService;
import com.czg.mergedata.cur.entity.CurShopExtend;
/**
* 店铺扩展信息 服务层
*
* @author mac
* @since 2025-03-15
*/
public interface CurShopExtendService extends IService<CurShopExtend> {
CzgResult<String> mergeShopExtend();
}

View File

@ -0,0 +1,44 @@
package com.czg.mergedata.cur.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.czg.mergedata.common.resp.CzgResult;
import com.czg.mergedata.old.service.OldShopExtendService;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.mergedata.cur.entity.CurShopExtend;
import com.czg.mergedata.cur.mapper.CurShopExtendMapper;
import com.czg.mergedata.cur.service.CurShopExtendService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* 店铺扩展信息 服务层实现
*
* @author mac
* @since 2025-03-15
*/
@Service
public class CurShopExtendServiceImpl extends ServiceImpl<CurShopExtendMapper, CurShopExtend> implements CurShopExtendService {
@Resource
private OldShopExtendService oldShopExtendService;
@Override
@Transactional
public CzgResult<String> mergeShopExtend() {
getMapper().truncateTable();
List<CurShopExtend> list = new ArrayList<>();
oldShopExtendService.list().forEach(shopExtend -> {
CurShopExtend bean = BeanUtil.toBean(shopExtend, CurShopExtend.class);
list.add(bean);
});
saveBatch(list);
return CzgResult.success();
}
}

View File

@ -0,0 +1,77 @@
package com.czg.mergedata.old.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 店铺扩展信息 实体类
*
* @author mac
* @since 2025-03-15
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_extend")
public class OldShopExtend implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 自增id
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 商户Id
*/
private Integer shopId;
/**
* img:图片text:文本
*/
private String type;
/**
* 描述
*/
private String name;
/**
* 自定义key
*/
@Column("autoKey")
private String autoKey;
/**
*
*/
private String value;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 创建时间
*/
private LocalDateTime createTime;
private String detail;
}

View File

@ -0,0 +1,16 @@
package com.czg.mergedata.old.mapper;
import com.mybatisflex.annotation.UseDataSource;
import com.mybatisflex.core.BaseMapper;
import com.czg.mergedata.old.entity.OldShopExtend;
/**
* 店铺扩展信息 映射层
*
* @author mac
* @since 2025-03-15
*/
@UseDataSource("ds2")
public interface OldShopExtendMapper extends BaseMapper<OldShopExtend> {
}

View File

@ -0,0 +1,14 @@
package com.czg.mergedata.old.service;
import com.mybatisflex.core.service.IService;
import com.czg.mergedata.old.entity.OldShopExtend;
/**
* 店铺扩展信息 服务层
*
* @author mac
* @since 2025-03-15
*/
public interface OldShopExtendService extends IService<OldShopExtend> {
}

View File

@ -0,0 +1,18 @@
package com.czg.mergedata.old.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.mergedata.old.entity.OldShopExtend;
import com.czg.mergedata.old.mapper.OldShopExtendMapper;
import com.czg.mergedata.old.service.OldShopExtendService;
import org.springframework.stereotype.Service;
/**
* 店铺扩展信息 服务层实现
*
* @author mac
* @since 2025-03-15
*/
@Service
public class OldShopExtendServiceImpl extends ServiceImpl<OldShopExtendMapper, OldShopExtend> implements OldShopExtendService{
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.mergedata.cur.mapper.CurShopExtendMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.mergedata.old.mapper.OldShopExtendMapper">
</mapper>

View File

@ -158,4 +158,8 @@
- tb_shop_vendor_transact 表
- tb_shop_vendor_transact_pay 表
### 23. 店铺扩展参数
> /merge/shopInfo/extend
#### 执行表
- tb_shop_extend 表