From ae1471f378f399f76518539ec8992e64a3673436 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期三, 08 一月 2025 15:26:06 +0800
Subject: [PATCH] 1.订单提交:订单最小金额配置
---
src/main/java/com/mzl/flower/service/impl/ConfigParamGroupServiceImpl.java | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/mzl/flower/service/impl/ConfigParamGroupServiceImpl.java b/src/main/java/com/mzl/flower/service/impl/ConfigParamGroupServiceImpl.java
index 697e7d9..983b957 100644
--- a/src/main/java/com/mzl/flower/service/impl/ConfigParamGroupServiceImpl.java
+++ b/src/main/java/com/mzl/flower/service/impl/ConfigParamGroupServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.mzl.flower.config.exception.ValidationException;
import com.mzl.flower.config.security.SecurityUtils;
import com.mzl.flower.dto.request.configParam.ParamGroupDTO;
import com.mzl.flower.dto.request.configParam.QueryConfigParamDTO;
@@ -12,11 +13,13 @@
import com.mzl.flower.entity.configParam.ConfigParamGroupDO;
import com.mzl.flower.mapper.configParam.ConfigParamGroupMapper;
import com.mzl.flower.mapper.configParam.ConfigParamGroupMapperCustom;
+import com.mzl.flower.mapper.configParam.ConfigParamMapper;
import com.mzl.flower.service.ConfigParamGroupService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
import java.util.List;
@@ -37,6 +40,9 @@
@Autowired
private ConfigParamGroupMapper configParamGroupMapper;
+ @Autowired
+ ConfigParamMapper configParamMapper;
+
@Override
public List<ConfigParamGroupDO> getList(QueryConfigParamDTO dto) {
QueryWrapper<ConfigParamGroupDO> wrapper = new QueryWrapper<>();
@@ -47,6 +53,14 @@
@Override
public void saveConfigParamGroup(ParamGroupDTO dto) {
+ ConfigParamGroupDO c1 = configParamMapper.getByParamGroup(dto.getParamGroup());
+ if (!ObjectUtils.isEmpty(c1)) {
+ throw new ValidationException("变量分组重复");
+ }
+ ConfigParamGroupDO c2 = configParamMapper.getByParamGroupName(dto.getParamGroupName());
+ if (!ObjectUtils.isEmpty(c2)) {
+ throw new ValidationException("变量分组名重复");
+ }
ConfigParamGroupDO configParamGroupDO = new ConfigParamGroupDO();
BeanUtils.copyProperties(dto, configParamGroupDO);
configParamGroupDO.create(SecurityUtils.getUserId());
@@ -55,6 +69,19 @@
@Override
public void updateConfigParamGroup(ParamGroupDTO dto) {
+ ConfigParamGroupDO c1 = configParamMapper.getByParamGroup(dto.getParamGroup());
+ if (!ObjectUtils.isEmpty(c1)) {
+ if (c1.getId() != dto.getId()) {
+ throw new ValidationException("已存在变量分组,无法修改");
+ }
+ }
+
+ ConfigParamGroupDO c2 = configParamMapper.getByParamGroupName(dto.getParamGroupName());
+ if (!ObjectUtils.isEmpty(c2)) {
+ if (c2.getId() != dto.getId()) {
+ throw new ValidationException("已存在变量分组名,无法修改");
+ }
+ }
ConfigParamGroupDO configParamGroupDO = configParamGroupMapper.selectById(dto.getId());
BeanUtils.copyProperties(dto, configParamGroupDO);
configParamGroupDO.update(SecurityUtils.getUserId());
--
Gitblit v1.9.3