From 12c595079a76967023895b701bd918b85adca5e5 Mon Sep 17 00:00:00 2001 From: puhanshu <a9236326> Date: 星期四, 30 十二月 2021 18:06:36 +0800 Subject: [PATCH] 微商业街-12/30代码提交 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsConfigServiceImpl.java | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 51 insertions(+), 1 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsConfigServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsConfigServiceImpl.java index d6718bd..6ed72b0 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsConfigServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsConfigServiceImpl.java @@ -1,10 +1,20 @@ package com.panzhihua.service_community.service.impl; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; import com.panzhihua.service_community.dao.McsConfigDAO; import com.panzhihua.service_community.entity.McsConfig; import com.panzhihua.service_community.service.McsConfigService; -import org.springframework.stereotype.Service; /** * (McsConfig)表服务实现类 @@ -15,4 +25,44 @@ @Service("mcsConfigService") public class McsConfigServiceImpl extends ServiceImpl<McsConfigDAO, McsConfig> implements McsConfigService { + /** + * 获取所有数字商业街配置 + * @return + */ + @Override + public R getAllMcsConfig() { + List<McsConfig> mcsConfigs = this.baseMapper.selectList(null); + List<McsConfigVO> configList = new ArrayList<>(); + if (!mcsConfigs.isEmpty()) { + mcsConfigs.forEach(e -> { + McsConfigVO configVO = new McsConfigVO(); + BeanUtils.copyProperties(e, configVO); + configList.add(configVO); + }); + } + return R.ok(configList); + } + + /** + * 修改数字商业街配置 + * @param configs + * @return + */ + @Override + public R putMcsConfig(List<McsConfigVO> configs) { + if (nonNull(configs) && !configs.isEmpty()) { + List<McsConfig> mcsConfigs = new ArrayList<>(); + configs.forEach(e -> { + McsConfig mcsConfig = this.baseMapper.selectOne(new QueryWrapper<McsConfig>().lambda().eq(McsConfig::getKey, e.getKey())); + if (nonNull(mcsConfig)) { + mcsConfig.setValue(e.getValue()); + mcsConfigs.add(mcsConfig); + } + }); + if (!mcsConfigs.isEmpty()) { + this.updateBatchById(mcsConfigs); + } + } + return R.ok(); + } } -- Gitblit v1.7.1