From 10cc0db30a1be5377e4c09bce349014a667849b6 Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期三, 12 一月 2022 13:21:08 +0800
Subject: [PATCH] Merge branch 'phs' into test

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsConfigServiceImpl.java |   68 ++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 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
new file mode 100644
index 0000000..6ed72b0
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsConfigServiceImpl.java
@@ -0,0 +1,68 @@
+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;
+
+/**
+ * (McsConfig)表服务实现类
+ *
+ * @author makejava
+ * @since 2021-12-28 14:37:07
+ */
+@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