Преглед на файлове

删除ERP模块
新增minigame模块

Hixon преди 3 месеца
родител
ревизия
bac0fcc4c5

+ 3 - 3
pom.xml

@@ -364,15 +364,15 @@
             </dependency>-->
 
             <!--  工作流模块  -->
-            <dependency>
+            <!--<dependency>
                 <groupId>org.dromara</groupId>
                 <artifactId>ruoyi-workflow</artifactId>
                 <version>${revision}</version>
-            </dependency>
+            </dependency>-->
 
             <dependency>
                 <groupId>org.dromara</groupId>
-                <artifactId>ruoyi-erp</artifactId>
+                <artifactId>ruoyi-minigame</artifactId>
                 <version>${revision}</version>
             </dependency>
 

+ 6 - 0
ruoyi-admin/pom.xml

@@ -86,6 +86,12 @@
             <artifactId>ruoyi-workflow</artifactId>
         </dependency>-->
 
+        <!--  工作流模块  -->
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-minigame</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>de.codecentric</groupId>
             <artifactId>spring-boot-admin-starter-client</artifactId>

+ 2 - 2
ruoyi-admin/src/main/resources/application-dev.yml

@@ -91,13 +91,13 @@ spring:
 spring.data:
   redis:
     # 地址
-    host: localhost
+    host: bt.hixon.vip
     # 端口,默认为6379
     port: 6379
     # 数据库索引
     database: 0
     # redis 密码必须配置
-    password: ruoyi123
+    password: password
     # 连接超时时间
     timeout: 10s
     # 是否开启ssl

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -155,7 +155,7 @@ mybatis-plus:
       # 主键类型
       # AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
       # 如需改为自增 需要将数据库表全部设置为自增
-      idType: ASSIGN_ID
+      idType: AUTO
 
 # 数据加密
 mybatis-encryptor:

+ 1 - 0
ruoyi-modules/pom.xml

@@ -15,6 +15,7 @@
         <module>ruoyi-job</module>
         <module>ruoyi-system</module>
         <!--<module>ruoyi-workflow</module>-->
+        <module>ruoyi-minigame</module>
     </modules>
 
     <artifactId>ruoyi-modules</artifactId>

+ 6 - 1
ruoyi-modules/ruoyi-job/pom.xml

@@ -27,7 +27,12 @@
             <groupId>org.dromara</groupId>
             <artifactId>ruoyi-common-job</artifactId>
         </dependency>
-        
+
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-system</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 60 - 0
ruoyi-modules/ruoyi-minigame/pom.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.dromara</groupId>
+        <artifactId>ruoyi-modules</artifactId>
+        <version>${revision}</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+    <artifactId>ruoyi-minigame</artifactId>
+
+    <description>
+        小游戏模块
+    </description>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-common-mail</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-common-mybatis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-common-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-common-log</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-common-idempotent</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-common-excel</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-common-translation</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-common-tenant</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-common-security</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

+ 106 - 0
ruoyi-modules/ruoyi-minigame/src/main/java/org/dromara/minigame/controller/ProductController.java

@@ -0,0 +1,106 @@
+package org.dromara.minigame.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.excel.utils.ExcelUtil;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.minigame.domain.bo.ProductBo;
+import org.dromara.minigame.domain.vo.ProductVo;
+import org.dromara.minigame.service.IProductService;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 产品
+ *
+ * @author Hixon
+ * @date 2024-08-05
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/miniGame/product")
+public class ProductController extends BaseController {
+
+    private final IProductService productService;
+
+    /**
+     * 查询产品列表
+     */
+    @SaCheckPermission("miniGame:product:list")
+    @GetMapping("/list")
+    public TableDataInfo<ProductVo> list(ProductBo bo, PageQuery pageQuery) {
+        return productService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出产品列表
+     */
+    @SaCheckPermission("miniGame:product:export")
+    @Log(title = "产品", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(ProductBo bo, HttpServletResponse response) {
+        List<ProductVo> list = productService.queryList(bo);
+        ExcelUtil.exportExcel(list, "产品", ProductVo.class, response);
+    }
+
+    /**
+     * 获取产品详细信息
+     *
+     * @param id 主键
+     */
+    @SaCheckPermission("miniGame:product:query")
+    @GetMapping("/{id}")
+    public R<ProductVo> getInfo(@NotNull(message = "主键不能为空")
+                                     @PathVariable Long id) {
+        return R.ok(productService.queryById(id));
+    }
+
+    /**
+     * 新增产品
+     */
+    @SaCheckPermission("miniGame:product:add")
+    @Log(title = "产品", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody ProductBo bo) {
+        return toAjax(productService.insertByBo(bo));
+    }
+
+    /**
+     * 修改产品
+     */
+    @SaCheckPermission("miniGame:product:edit")
+    @Log(title = "产品", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody ProductBo bo) {
+        return toAjax(productService.updateByBo(bo));
+    }
+
+    /**
+     * 删除产品
+     *
+     * @param ids 主键串
+     */
+    @SaCheckPermission("miniGame:product:remove")
+    @Log(title = "产品", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable Long[] ids) {
+        return toAjax(productService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 49 - 0
ruoyi-modules/ruoyi-minigame/src/main/java/org/dromara/minigame/domain/Product.java

@@ -0,0 +1,49 @@
+package org.dromara.minigame.domain;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.dromara.common.tenant.core.TenantEntity;
+
+import java.io.Serial;
+
+/**
+ * 产品对象 product
+ *
+ * @author Hixon
+ * @date 2024-08-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("product")
+public class Product extends TenantEntity {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 产品ID
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 分类ID
+     */
+    private Long categoryId;
+
+    /**
+     * 产品名称
+     */
+    private String name;
+
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
+    @TableLogic
+    private String delFlag;
+
+
+}

+ 43 - 0
ruoyi-modules/ruoyi-minigame/src/main/java/org/dromara/minigame/domain/bo/ProductBo.java

@@ -0,0 +1,43 @@
+package org.dromara.minigame.domain.bo;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import org.dromara.minigame.domain.Product;
+
+/**
+ * 产品业务对象 product
+ *
+ * @author Hixon
+ * @date 2024-08-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = Product.class, reverseConvertGenerate = false)
+public class ProductBo extends BaseEntity {
+
+    /**
+     * 产品ID
+     */
+    @NotNull(message = "产品ID不能为空", groups = { EditGroup.class })
+    private Long id;
+
+    /**
+     * 分类ID
+     */
+    @NotNull(message = "分类ID不能为空", groups = { AddGroup.class, EditGroup.class })
+    private Long categoryId;
+
+    /**
+     * 产品名称
+     */
+    @NotBlank(message = "产品名称不能为空", groups = { AddGroup.class, EditGroup.class })
+    private String name;
+
+
+}

+ 50 - 0
ruoyi-modules/ruoyi-minigame/src/main/java/org/dromara/minigame/domain/vo/ProductVo.java

@@ -0,0 +1,50 @@
+package org.dromara.minigame.domain.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import org.dromara.common.excel.annotation.ExcelDictFormat;
+import org.dromara.common.excel.convert.ExcelDictConvert;
+import org.dromara.minigame.domain.Product;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+
+
+/**
+ * 产品视图对象 product
+ *
+ * @author Hixon
+ * @date 2024-08-05
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = Product.class)
+public class ProductVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 产品ID
+     */
+    @ExcelProperty(value = "产品ID")
+    private Long id;
+
+    /**
+     * 分类ID
+     */
+    @ExcelProperty(value = "分类ID", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(dictType = "sys_normal_disable")
+    private Long categoryId;
+
+    /**
+     * 产品名称
+     */
+    @ExcelProperty(value = "产品名称")
+    private String name;
+
+
+}

+ 15 - 0
ruoyi-modules/ruoyi-minigame/src/main/java/org/dromara/minigame/mapper/ProductMapper.java

@@ -0,0 +1,15 @@
+package org.dromara.minigame.mapper;
+
+import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
+import org.dromara.minigame.domain.Product;
+import org.dromara.minigame.domain.vo.ProductVo;
+
+/**
+ * 产品Mapper接口
+ *
+ * @author Hixon
+ * @date 2024-08-05
+ */
+public interface ProductMapper extends BaseMapperPlus<Product, ProductVo> {
+
+}

+ 68 - 0
ruoyi-modules/ruoyi-minigame/src/main/java/org/dromara/minigame/service/IProductService.java

@@ -0,0 +1,68 @@
+package org.dromara.minigame.service;
+
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.minigame.domain.bo.ProductBo;
+import org.dromara.minigame.domain.vo.ProductVo;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 产品Service接口
+ *
+ * @author Hixon
+ * @date 2024-08-05
+ */
+public interface IProductService {
+
+    /**
+     * 查询产品
+     *
+     * @param id 主键
+     * @return 产品
+     */
+    ProductVo queryById(Long id);
+
+    /**
+     * 分页查询产品列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 产品分页列表
+     */
+    TableDataInfo<ProductVo> queryPageList(ProductBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询符合条件的产品列表
+     *
+     * @param bo 查询条件
+     * @return 产品列表
+     */
+    List<ProductVo> queryList(ProductBo bo);
+
+    /**
+     * 新增产品
+     *
+     * @param bo 产品
+     * @return 是否新增成功
+     */
+    Boolean insertByBo(ProductBo bo);
+
+    /**
+     * 修改产品
+     *
+     * @param bo 产品
+     * @return 是否修改成功
+     */
+    Boolean updateByBo(ProductBo bo);
+
+    /**
+     * 校验并批量删除产品信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 130 - 0
ruoyi-modules/ruoyi-minigame/src/main/java/org/dromara/minigame/service/impl/ProductServiceImpl.java

@@ -0,0 +1,130 @@
+package org.dromara.minigame.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.minigame.domain.Product;
+import org.dromara.minigame.domain.bo.ProductBo;
+import org.dromara.minigame.domain.vo.ProductVo;
+import org.dromara.minigame.mapper.ProductMapper;
+import org.dromara.minigame.service.IProductService;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 产品Service业务层处理
+ *
+ * @author Hixon
+ * @date 2024-08-05
+ */
+@RequiredArgsConstructor
+@Service
+public class ProductServiceImpl implements IProductService {
+
+    private final ProductMapper baseMapper;
+
+    /**
+     * 查询产品
+     *
+     * @param id 主键
+     * @return 产品
+     */
+    @Override
+    public ProductVo queryById(Long id){
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 分页查询产品列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 产品分页列表
+     */
+    @Override
+    public TableDataInfo<ProductVo> queryPageList(ProductBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<Product> lqw = buildQueryWrapper(bo);
+        Page<ProductVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询符合条件的产品列表
+     *
+     * @param bo 查询条件
+     * @return 产品列表
+     */
+    @Override
+    public List<ProductVo> queryList(ProductBo bo) {
+        LambdaQueryWrapper<Product> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<Product> buildQueryWrapper(ProductBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<Product> lqw = Wrappers.lambdaQuery();
+        lqw.eq(bo.getCategoryId() != null, Product::getCategoryId, bo.getCategoryId());
+        lqw.like(StringUtils.isNotBlank(bo.getName()), Product::getName, bo.getName());
+        return lqw;
+    }
+
+    /**
+     * 新增产品
+     *
+     * @param bo 产品
+     * @return 是否新增成功
+     */
+    @Override
+    public Boolean insertByBo(ProductBo bo) {
+        Product add = MapstructUtils.convert(bo, Product.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改产品
+     *
+     * @param bo 产品
+     * @return 是否修改成功
+     */
+    @Override
+    public Boolean updateByBo(ProductBo bo) {
+        Product update = MapstructUtils.convert(bo, Product.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(Product entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 校验并批量删除产品信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteByIds(ids) > 0;
+    }
+}

+ 7 - 0
ruoyi-modules/ruoyi-minigame/src/main/resources/mapper/miniGame/ProductMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.dromara.minigame.mapper.ProductMapper">
+
+</mapper>