霸王餐配置
This commit is contained in:
parent
069c5d5968
commit
a4559e550c
|
|
@ -18,8 +18,8 @@ public class CodeGen {
|
||||||
private final static String DATABASE = "czg_cashier_test";
|
private final static String DATABASE = "czg_cashier_test";
|
||||||
private final static String OLD_DATABASE = "fycashier";
|
private final static String OLD_DATABASE = "fycashier";
|
||||||
|
|
||||||
// private final static boolean IS_OLD_VERSION = false;
|
private final static boolean IS_OLD_VERSION = false;
|
||||||
private final static boolean IS_OLD_VERSION = true;
|
// private final static boolean IS_OLD_VERSION = true;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
//配置数据源
|
//配置数据源
|
||||||
|
|
@ -81,7 +81,7 @@ public class CodeGen {
|
||||||
//设置表前缀和只生成哪些表,setGenerateTable 未配置时,生成所有表
|
//设置表前缀和只生成哪些表,setGenerateTable 未配置时,生成所有表
|
||||||
globalConfig.getStrategyConfig()
|
globalConfig.getStrategyConfig()
|
||||||
.setTablePrefix("tb_")
|
.setTablePrefix("tb_")
|
||||||
.setGenerateTable("tb_version");
|
.setGenerateTable("tb_free_dine_config");
|
||||||
|
|
||||||
EntityConfig entityConfig = globalConfig.getEntityConfig();
|
EntityConfig entityConfig = globalConfig.getEntityConfig();
|
||||||
if (IS_OLD_VERSION) {
|
if (IS_OLD_VERSION) {
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,14 @@ public class ShopInfoController {
|
||||||
@Resource
|
@Resource
|
||||||
private CurVersionService curVersionService;
|
private CurVersionService curVersionService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CurFreeDineConfigService curFreeDineConfigService;
|
||||||
|
|
||||||
|
@RequestMapping("/freeDineConfig")
|
||||||
|
public CzgResult<String> freeDineConfig() {
|
||||||
|
return curFreeDineConfigService.mergeData();
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping("/version")
|
@RequestMapping("/version")
|
||||||
public CzgResult<String> version() {
|
public CzgResult<String> version() {
|
||||||
return curVersionService.mergeVersion();
|
return curVersionService.mergeVersion();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
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.math.BigDecimal;
|
||||||
|
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-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_free_dine_config")
|
||||||
|
public class CurFreeDineConfig implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private Boolean enable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值多少倍免单
|
||||||
|
*/
|
||||||
|
private Integer rechargeTimes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单满多少元可以使用
|
||||||
|
*/
|
||||||
|
private BigDecimal rechargeThreshold;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否与优惠券共享
|
||||||
|
*/
|
||||||
|
private Boolean withCoupon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否与积分同享
|
||||||
|
*/
|
||||||
|
private Boolean withPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值说明
|
||||||
|
*/
|
||||||
|
private String rechargeDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用类型 dine-in店内 takeout 自取 post快递,takeaway外卖
|
||||||
|
*/
|
||||||
|
private String useType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可用的子门店id
|
||||||
|
*/
|
||||||
|
private String childShopIdList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.czg.mergedata.cur.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.mergedata.cur.entity.CurFreeDineConfig;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 霸王餐配置信息表 映射层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-03-17
|
||||||
|
*/
|
||||||
|
public interface CurFreeDineConfigMapper extends BaseMapper<CurFreeDineConfig> {
|
||||||
|
|
||||||
|
@Select("truncate tb_free_dine_config")
|
||||||
|
void truncateTable();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
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.CurFreeDineConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 霸王餐配置信息表 服务层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-03-17
|
||||||
|
*/
|
||||||
|
public interface CurFreeDineConfigService extends IService<CurFreeDineConfig> {
|
||||||
|
|
||||||
|
CzgResult<String> mergeData();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
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.OldFreeDineConfigService;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.mergedata.cur.entity.CurFreeDineConfig;
|
||||||
|
import com.czg.mergedata.cur.mapper.CurFreeDineConfigMapper;
|
||||||
|
import com.czg.mergedata.cur.service.CurFreeDineConfigService;
|
||||||
|
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-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CurFreeDineConfigServiceImpl extends ServiceImpl<CurFreeDineConfigMapper, CurFreeDineConfig> implements CurFreeDineConfigService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OldFreeDineConfigService oldFreeDineConfigService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public CzgResult<String> mergeData() {
|
||||||
|
getMapper().truncateTable();
|
||||||
|
|
||||||
|
List<CurFreeDineConfig> curFreeDineConfigs = new ArrayList<>();
|
||||||
|
|
||||||
|
oldFreeDineConfigService.list().forEach(oldFreeDineConfig -> {
|
||||||
|
CurFreeDineConfig curFreeDineConfig = BeanUtil.toBean(oldFreeDineConfig, CurFreeDineConfig.class);
|
||||||
|
curFreeDineConfigs.add(curFreeDineConfig);
|
||||||
|
});
|
||||||
|
|
||||||
|
saveBatch(curFreeDineConfigs);
|
||||||
|
|
||||||
|
return CzgResult.success("数据合并成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.czg.mergedata.old.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
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-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_free_dine_config")
|
||||||
|
public class OldFreeDineConfig implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private Boolean enable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值多少倍免单
|
||||||
|
*/
|
||||||
|
private Integer rechargeTimes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单满多少元可以使用
|
||||||
|
*/
|
||||||
|
private BigDecimal rechargeThreshold;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否与优惠券共享
|
||||||
|
*/
|
||||||
|
private Boolean withCoupon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否与积分同享
|
||||||
|
*/
|
||||||
|
private Boolean withPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值说明
|
||||||
|
*/
|
||||||
|
private String rechargeDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用类型 dine-in店内 takeout 自取 post快递,takeaway外卖
|
||||||
|
*/
|
||||||
|
private String useType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店id
|
||||||
|
*/
|
||||||
|
private Integer shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可用的子门店id
|
||||||
|
*/
|
||||||
|
private String childShopIdList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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.OldFreeDineConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 霸王餐配置信息表 映射层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-03-17
|
||||||
|
*/
|
||||||
|
@UseDataSource("ds2")
|
||||||
|
public interface OldFreeDineConfigMapper extends BaseMapper<OldFreeDineConfig> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.czg.mergedata.old.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.mergedata.old.entity.OldFreeDineConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 霸王餐配置信息表 服务层。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-03-17
|
||||||
|
*/
|
||||||
|
public interface OldFreeDineConfigService extends IService<OldFreeDineConfig> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.czg.mergedata.old.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.mergedata.old.entity.OldFreeDineConfig;
|
||||||
|
import com.czg.mergedata.old.mapper.OldFreeDineConfigMapper;
|
||||||
|
import com.czg.mergedata.old.service.OldFreeDineConfigService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 霸王餐配置信息表 服务层实现。
|
||||||
|
*
|
||||||
|
* @author mac
|
||||||
|
* @since 2025-03-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OldFreeDineConfigServiceImpl extends ServiceImpl<OldFreeDineConfigMapper, OldFreeDineConfig> implements OldFreeDineConfigService{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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.CurFreeDineConfigMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -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.OldFreeDineConfigMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -198,4 +198,10 @@
|
||||||
- tb_version 表
|
- tb_version 表
|
||||||
|
|
||||||
|
|
||||||
|
### 29. 霸王餐配置
|
||||||
|
> /merge/shopInfo/freeDineConfig
|
||||||
|
#### 执行表
|
||||||
|
- tb_free_dine_config 表
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue