缓存失效问题

店铺开关枚举
This commit is contained in:
2025-12-19 09:24:51 +08:00
parent 47f28d7bbb
commit babf3609c9
6 changed files with 24 additions and 38 deletions

View File

@@ -1,8 +1,10 @@
package com.czg.account.service;
import com.czg.account.entity.ShopConfig;
import com.czg.account.entity.ShopInfo;
import com.mybatisflex.core.service.IService;
import java.io.Serializable;
import java.util.List;
/**
@@ -13,6 +15,8 @@ import java.util.List;
*/
public interface ShopConfigService extends IService<ShopConfig> {
ShopInfo getShopInfoAndConfig(Serializable id);
void editStatusByShopIdList(Long mainShopId, Integer isEnable, boolean onyUpValid, String name, String useShopType, List<Long> shopIdList);
boolean editConfig(Long shopId, ShopConfig shopConfig);

View File

@@ -24,7 +24,7 @@ public interface ShopInfoService extends IService<ShopInfo> {
/**
* 检测开关
* @param shopId 店铺id
* @param switchType ShopInfo的某列 开关
* @param switchType ShopInfo的某列 开关 目前只支持Integer类型字段
* @return true:开启 false:关闭
*/
boolean checkSwitch(Long shopId, ShopSwitchTypeEnum switchType) throws ValidateException;

View File

@@ -8,24 +8,18 @@ import com.czg.account.entity.ShopInfo;
* @author ww
*/
public enum ShopSwitchTypeEnum {
GROUP_BUY("groupBuy", "拼团开关", ShopInfo::getIsGroupBuy),
GROUP_BUY("拼团开关", ShopInfo::getIsGroupBuy),
;
private final String code;
private final String description;
private final SerializableFunction<ShopInfo, Integer> getter;
ShopSwitchTypeEnum(String code, String description,
ShopSwitchTypeEnum(String description,
SerializableFunction<ShopInfo, Integer> getter) {
this.code = code;
this.description = description;
this.getter = getter;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
@@ -44,14 +38,4 @@ public enum ShopSwitchTypeEnum {
public SerializableFunction<ShopInfo, Integer> getGetter() {
return getter;
}
// 根据code获取枚举
public static ShopSwitchTypeEnum getByCode(String code) {
for (ShopSwitchTypeEnum type : values()) {
if (type.code.equals(code)) {
return type;
}
}
throw new IllegalArgumentException("未知的开关类型: " + code);
}
}