From dee9f245cd463669dbf707e05a2872d4466cbf9b Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期四, 14 八月 2025 09:44:14 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 framework/src/main/java/cn/lili/modules/lmk/service/impl/ActivityRefPrizeServiceImpl.java |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 119 insertions(+), 0 deletions(-)

diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/ActivityRefPrizeServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/ActivityRefPrizeServiceImpl.java
new file mode 100644
index 0000000..27abbd0
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/ActivityRefPrizeServiceImpl.java
@@ -0,0 +1,119 @@
+package cn.lili.modules.lmk.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import cn.lili.modules.lmk.domain.entity.ActivityRefPrize;
+import cn.lili.modules.lmk.mapper.ActivityRefPrizeMapper;
+import cn.lili.modules.lmk.service.ActivityRefPrizeService;
+import cn.lili.base.Result;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import cn.lili.modules.lmk.domain.form.ActivityRefPrizeForm;
+import cn.lili.modules.lmk.domain.vo.ActivityRefPrizeVO;
+import cn.lili.modules.lmk.domain.query.ActivityRefPrizeQuery;
+import org.springframework.stereotype.Service;
+import lombok.RequiredArgsConstructor;
+import cn.lili.utils.PageUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.util.Assert;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 娲诲姩濂栧搧鍏宠仈琛� 鏈嶅姟瀹炵幇绫�
+ *
+ * @author peng
+ * @since 2025-08-14
+ */
+@Service
+@RequiredArgsConstructor
+public class ActivityRefPrizeServiceImpl extends ServiceImpl<ActivityRefPrizeMapper, ActivityRefPrize> implements ActivityRefPrizeService {
+
+    private final ActivityRefPrizeMapper activityRefPrizeMapper;
+
+    /**
+     * 娣诲姞
+     * @param form
+     * @return
+     */
+    @Override
+    public Result add(ActivityRefPrizeForm form) {
+        ActivityRefPrize entity = ActivityRefPrizeForm.getEntityByForm(form, null);
+        baseMapper.insert(entity);
+        return Result.ok("娣诲姞鎴愬姛");
+    }
+
+    /**
+     * 淇敼
+     * @param form
+     * @return
+     */
+    @Override
+    public Result update(ActivityRefPrizeForm form) {
+        ActivityRefPrize entity = baseMapper.selectById(form.getId());
+
+        // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
+        Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
+        BeanUtils.copyProperties(form, entity);
+        baseMapper.updateById(entity);
+        return Result.ok("淇敼鎴愬姛");
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎
+     * @param ids
+     * @return
+     */
+    @Override
+    public Result remove(List<String> ids) {
+        baseMapper.deleteBatchIds(ids);
+        return Result.ok("鍒犻櫎鎴愬姛");
+    }
+
+    /**
+     * id鍒犻櫎
+     * @param id
+     * @return
+     */
+    @Override
+    public Result removeById(String id) {
+        baseMapper.deleteById(id);
+        return Result.ok("鍒犻櫎鎴愬姛");
+    }
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     * @param query
+     * @return
+     */
+    @Override
+    public Result page(ActivityRefPrizeQuery query) {
+        IPage<ActivityRefPrizeVO> page = PageUtil.getPage(query, ActivityRefPrizeVO.class);
+        baseMapper.getPage(page, query);
+        return Result.ok().data(page.getRecords()).total(page.getTotal());
+    }
+
+    /**
+     * 鏍规嵁id鏌ユ壘
+     * @param id
+     * @return
+     */
+    @Override
+    public Result detail(String id) {
+        ActivityRefPrizeVO vo = baseMapper.getById(id);
+        Assert.notNull(vo, "璁板綍涓嶅瓨鍦�");
+        return Result.ok().data(vo);
+    }
+
+    /**
+     * 鍒楄〃
+     * @return
+     */
+    @Override
+    public Result all() {
+        List<ActivityRefPrize> entities = baseMapper.selectList(null);
+        List<ActivityRefPrizeVO> vos = entities.stream()
+                .map(entity -> ActivityRefPrizeVO.getVoByEntity(entity, null))
+                .collect(Collectors.toList());
+        return Result.ok().data(vos);
+    }
+}

--
Gitblit v1.8.0