From b394df082b875856884d6d02cce2a43c49ad6704 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Fri, 30 May 2025 16:44:46 +0800
Subject: [PATCH] Merge branch 'feature/pc-base' into xin

---
 oying-system/src/main/java/com/oying/modules/pc/category/service/impl/PlatformCategoryServiceImpl.java |   90 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/pc/category/service/impl/PlatformCategoryServiceImpl.java b/oying-system/src/main/java/com/oying/modules/pc/category/service/impl/PlatformCategoryServiceImpl.java
new file mode 100644
index 0000000..5b220a6
--- /dev/null
+++ b/oying-system/src/main/java/com/oying/modules/pc/category/service/impl/PlatformCategoryServiceImpl.java
@@ -0,0 +1,90 @@
+package com.oying.modules.pc.category.service.impl;
+
+import cn.hutool.core.util.ObjUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.oying.exception.EntityExistException;
+import com.oying.modules.pc.category.converter.PlatformCategoryDtoAssembler;
+import com.oying.modules.pc.category.domain.PlatformCategory;
+import com.oying.modules.pc.category.domain.dto.PlatformCategoryCreateRequest;
+import com.oying.modules.pc.category.domain.dto.PlatformCategoryQueryCriteria;
+import com.oying.modules.pc.category.domain.dto.PlatformCategoryUpdateDto;
+import com.oying.modules.pc.category.domain.dto.PlatformCategoryUpdateRequest;
+import com.oying.modules.pc.category.mapper.PlatformCategoryMapper;
+import com.oying.modules.pc.category.service.PlatformCategoryService;
+import com.oying.utils.PageResult;
+import com.oying.utils.PageUtil;
+import com.oying.utils.SecurityUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * 平台类目服务实现
+ *
+ * @author lzp
+ * @date 2025-04-30
+ **/
+@Service
+@RequiredArgsConstructor
+public class PlatformCategoryServiceImpl extends ServiceImpl<PlatformCategoryMapper, PlatformCategory> implements PlatformCategoryService {
+
+    private final PlatformCategoryMapper platformCategoryMapper;
+
+    @Override
+    public PageResult<PlatformCategory> queryAll(PlatformCategoryQueryCriteria criteria, Page<Object> page) {
+        return PageUtil.toPage(platformCategoryMapper.findAll(criteria, page));
+    }
+
+    @Override
+    public List<PlatformCategory> queryAll(PlatformCategoryQueryCriteria criteria) {
+        return platformCategoryMapper.findAll(criteria);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void create(PlatformCategoryCreateRequest request) {
+
+        PlatformCategory platformCategoryCreate = new PlatformCategory();
+        platformCategoryCreate.setName(request.getName());
+        platformCategoryCreate.setSortWeight(request.getSortWeight());
+        platformCategoryCreate.setIconId(request.getIconUploadFileId());
+        platformCategoryCreate.setActive(request.getActive());
+        platformCategoryCreate.setCreateBy(SecurityUtils.getCurrentUserId());
+
+        // 使用处理图标文件
+        platformCategoryMapper.insert(platformCategoryCreate);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void update(PlatformCategoryUpdateDto updateDto) {
+
+        Long categoryId = updateDto.getCategoryId();
+        PlatformCategory existingPlatformCategory = this.getById(categoryId);
+        if (ObjUtil.isEmpty(existingPlatformCategory)) {
+            throw new EntityExistException(PlatformCategory.class, "categoryId", Optional.ofNullable(categoryId).map(Object::toString).orElse("null"));
+        }
+
+        PlatformCategory platformCategoryUpdate = new PlatformCategory();
+        platformCategoryUpdate.setCategoryId(updateDto.getCategoryId());
+        platformCategoryUpdate.setName(updateDto.getName());
+        platformCategoryUpdate.setSortWeight(updateDto.getSortWeight());
+        platformCategoryUpdate.setIconId(updateDto.getIconUploadFileId());
+        platformCategoryUpdate.setActive(updateDto.getActive());
+        existingPlatformCategory.copy(platformCategoryUpdate);
+        existingPlatformCategory.setUpdateBy(SecurityUtils.getCurrentUserId());
+        platformCategoryMapper.updateById(existingPlatformCategory);
+
+        // 使用处理图标文件
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void deleteAll(List<Long> ids) {
+        platformCategoryMapper.deleteBatchIds(ids);
+    }
+}

--
Gitblit v1.9.3