充值兑换码相关接口
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
package com.czg.service.market.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
import com.czg.market.dto.MkEnableConfigDTO;
|
||||
import com.czg.market.vo.MkEnableConfigVO;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.market.entity.MkEnableConfig;
|
||||
@@ -18,7 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
public class MkEnableConfigServiceImpl extends ServiceImpl<MkEnableConfigMapper, MkEnableConfig> implements MkEnableConfigService{
|
||||
|
||||
@Override
|
||||
public Integer detail(Long mainShopId, Long shopId, TableValueConstant.EnableConfig.Type type) {
|
||||
public MkEnableConfigVO detail(Long mainShopId, Long shopId, TableValueConstant.EnableConfig.Type type) {
|
||||
MkEnableConfig one = getOne(new QueryWrapper().eq(MkEnableConfig::getMainShopId, mainShopId).eq(MkEnableConfig::getType, type.getCode()));
|
||||
if (one == null) {
|
||||
one = new MkEnableConfig();
|
||||
@@ -27,22 +33,29 @@ public class MkEnableConfigServiceImpl extends ServiceImpl<MkEnableConfigMapper,
|
||||
one.setShopId(shopId);
|
||||
save(one);
|
||||
}
|
||||
return one.getIsEnable();
|
||||
MkEnableConfigVO configVO = BeanUtil.copyProperties(one, MkEnableConfigVO.class);
|
||||
if (StrUtil.isNotBlank(one.getShopIdList())) {
|
||||
configVO.setShopIdList(JSONArray.parseArray(one.getShopIdList()).toList(Long.class));
|
||||
}
|
||||
return configVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean upEnable(Long mainShopId, Long shopId, Integer enable, TableValueConstant.EnableConfig.Type type) {
|
||||
public Boolean upEnable(Long mainShopId, Long shopId, MkEnableConfigDTO dto, TableValueConstant.EnableConfig.Type type) {
|
||||
MkEnableConfig one = getOne(new QueryWrapper().eq(MkEnableConfig::getMainShopId, mainShopId).eq(MkEnableConfig::getType, type.getCode()));
|
||||
if (one == null) {
|
||||
one = new MkEnableConfig();
|
||||
one.setMainShopId(mainShopId);
|
||||
one.setIsEnable(enable);
|
||||
one.setIsEnable(dto.getIsEnable());
|
||||
one.setShopId(shopId);
|
||||
save(one);
|
||||
}else {
|
||||
one.setIsEnable(enable);
|
||||
updateById(one);
|
||||
one.setIsEnable(dto.getIsEnable());
|
||||
}
|
||||
return true;
|
||||
|
||||
if ("part".equals(dto.getUseType()) && dto.getShopIdList() != null) {
|
||||
one.setShopIdList(JSONObject.toJSONString(dto.getShopIdList()));
|
||||
}
|
||||
return updateById(one);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user