Browse Source

feat(business): 添加盲注结构管理功能

- 新增 BlindStructures 实体类
- 新增 BlindStructuresBo 业务对象类
- 新增 BlindStructuresController 控制器
- 新增 BlindStructuresMapper Mapper 接口- 新增 BlindStructuresMapper.xml Mapper 配置文件
- 新增 BlindStructuresServiceImpl 服务实现类
- 新增 BlindStructuresVo 视图对象类
- 新增 IBlindStructuresService 服务接口
fugui001 6 months ago
parent
commit
99f1bf3e4a

+ 105 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/controller/BlindStructuresController.java

@@ -0,0 +1,105 @@
+package org.dromara.business.controller;
+
+import java.util.List;
+
+import lombok.RequiredArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.*;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.common.mybatis.core.page.PageQuery;
+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.log.enums.BusinessType;
+import org.dromara.common.excel.utils.ExcelUtil;
+import org.dromara.business.domain.vo.BlindStructuresVo;
+import org.dromara.business.domain.bo.BlindStructuresBo;
+import org.dromara.business.service.IBlindStructuresService;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+
+/**
+ * 【盲注结构管理】
+ *
+ * @author Lion Li
+ * @date 2025-06-10
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/business/structures")
+public class BlindStructuresController extends BaseController {
+
+    private final IBlindStructuresService blindStructuresService;
+
+    /**
+     * 查询【盲注结构】列表
+     */
+    @SaCheckPermission("business:structures:list")
+    @GetMapping("/list")
+    public TableDataInfo<BlindStructuresVo> list(BlindStructuresBo bo, PageQuery pageQuery) {
+        return blindStructuresService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出【盲注结构】列表
+     */
+    @SaCheckPermission("business:structures:export")
+    @Log(title = "【盲注结构】", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(BlindStructuresBo bo, HttpServletResponse response) {
+        List<BlindStructuresVo> list = blindStructuresService.queryList(bo);
+        ExcelUtil.exportExcel(list, "【请填写功能名称】", BlindStructuresVo.class, response);
+    }
+
+    /**
+     * 获取【盲注结构】详细信息
+     *
+     * @param id 主键
+     */
+    @SaCheckPermission("business:structures:query")
+    @GetMapping("/{id}")
+    public R<BlindStructuresVo> getInfo(@NotNull(message = "主键不能为空")
+                                     @PathVariable Long id) {
+        return R.ok(blindStructuresService.queryById(id));
+    }
+
+    /**
+     * 新增【盲注结构】
+     */
+    @SaCheckPermission("business:structures:add")
+    @Log(title = "【盲注结构】", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody BlindStructuresBo bo) {
+        return toAjax(blindStructuresService.insertByBo(bo));
+    }
+
+    /**
+     * 修改【盲注结构】
+     */
+    @SaCheckPermission("business:structures:edit")
+    @Log(title = "【盲注结构】", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody BlindStructuresBo bo) {
+        return toAjax(blindStructuresService.updateByBo(bo));
+    }
+
+    /**
+     * 删除【盲注结构】
+     *
+     * @param ids 主键串
+     */
+    @SaCheckPermission("business:structures:remove")
+    @Log(title = "【盲注结构】", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable Long[] ids) {
+        return toAjax(blindStructuresService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 51 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/BlindStructures.java

@@ -0,0 +1,51 @@
+package org.dromara.business.domain;
+
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.Date;
+
+import java.io.Serial;
+
+/**
+ * 【请填写功能名称】对象 blind_structures
+ *
+ * @author Lion Li
+ * @date 2025-06-10
+ */
+@Data
+@TableName("blind_structures")
+public class BlindStructures{
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     *
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 盲注结构名称,如:Standard, Turbo
+     */
+    private String name;
+
+    /**
+     * 描述信息
+     */
+    private String description;
+
+    /**
+     *
+     */
+    private Date createdAt;
+
+    /**
+     *
+     */
+    private Date updatedAt;
+
+
+}

+ 53 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/bo/BlindStructuresBo.java

@@ -0,0 +1,53 @@
+package org.dromara.business.domain.bo;
+
+import org.dromara.business.domain.BlindStructures;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import jakarta.validation.constraints.*;
+import java.util.Date;
+
+
+/**
+ * 【请填写功能名称】业务对象 blind_structures
+ *
+ * @author Lion Li
+ * @date 2025-06-10
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = BlindStructures.class, reverseConvertGenerate = false)
+public class BlindStructuresBo extends BaseEntity {
+
+    /**
+     *
+     */
+    @NotNull(message = "不能为空", groups = { EditGroup.class })
+    private Long id;
+
+    /**
+     * 盲注结构名称,如:Standard, Turbo
+     */
+    @NotBlank(message = "盲注结构名称,如:Standard, Turbo不能为空", groups = { AddGroup.class, EditGroup.class })
+    private String name;
+
+    /**
+     * 描述信息
+     */
+    private String description;
+
+    /**
+     *
+     */
+    private Date createdAt;
+
+    /**
+     *
+     */
+    private Date updatedAt;
+
+
+}

+ 57 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/vo/BlindStructuresVo.java

@@ -0,0 +1,57 @@
+package org.dromara.business.domain.vo;
+
+import java.util.Date;
+import org.dromara.business.domain.BlindStructures;
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * 【请填写功能名称】视图对象 blind_structures
+ *
+ * @author Lion Li
+ * @date 2025-06-10
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = BlindStructures.class)
+public class BlindStructuresVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     *id
+     */
+    @ExcelProperty(value = "编码")
+    private Long id;
+
+    /**
+     * 盲注结构名称,如:Standard, Turbo
+     */
+    @ExcelProperty(value = "盲注结构名称,如:Standard, Turbo")
+    private String name;
+
+    /**
+     * 描述信息
+     */
+    @ExcelProperty(value = "描述信息")
+    private String description;
+
+    /**
+     *创建时间
+     */
+    @ExcelProperty(value = "创建时间")
+    private Date createdAt;
+
+    /**
+     *更新时间
+     */
+    @ExcelProperty(value = "更新时间")
+    private Date updatedAt;
+
+
+}

+ 44 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/BlindStructuresMapper.java

@@ -0,0 +1,44 @@
+package org.dromara.business.mapper;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+import org.dromara.business.domain.BlindStructures;
+import org.dromara.business.domain.vo.BlindStructuresVo;
+import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ *
+ * @author Lion Li
+ * @date 2025-06-10
+ */
+@DS("mysql2")
+public interface BlindStructuresMapper extends BaseMapperPlus<BlindStructures, BlindStructuresVo> {
+
+
+    @InterceptorIgnore(tenantLine = "true")
+    Page<BlindStructuresVo> selectVoPage(@Param("page") Page<BlindStructures> page, @Param("ew") Wrapper<BlindStructures> wrapper);
+
+    @InterceptorIgnore(tenantLine = "true")
+    BlindStructuresVo selectVoByIdInfo(Long id);
+
+    @InterceptorIgnore(tenantLine = "true")
+    int updateBlindStructuresById(BlindStructures update);
+
+    @InterceptorIgnore(tenantLine = "true")
+    int insertBlindStructures(BlindStructures insert);
+
+    @InterceptorIgnore(tenantLine = "true")
+    int deleteBlindStructuresByIds(@Param("ids") Collection<Long> ids);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<BlindStructuresVo> selectBlindStructuresVoList(@Param("ew") Wrapper<BlindStructures> wrapper);
+
+
+}

+ 68 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/IBlindStructuresService.java

@@ -0,0 +1,68 @@
+package org.dromara.business.service;
+
+import org.dromara.business.domain.vo.BlindStructuresVo;
+import org.dromara.business.domain.bo.BlindStructuresBo;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Service接口
+ *
+ * @author Lion Li
+ * @date 2025-06-10
+ */
+public interface IBlindStructuresService {
+
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 主键
+     * @return 【请填写功能名称】
+     */
+    BlindStructuresVo queryById(Long id);
+
+    /**
+     * 分页查询【请填写功能名称】列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 【请填写功能名称】分页列表
+     */
+    TableDataInfo<BlindStructuresVo> queryPageList(BlindStructuresBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询符合条件的【请填写功能名称】列表
+     *
+     * @param bo 查询条件
+     * @return 【请填写功能名称】列表
+     */
+    List<BlindStructuresVo> queryList(BlindStructuresBo bo);
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param bo 【请填写功能名称】
+     * @return 是否新增成功
+     */
+    Boolean insertByBo(BlindStructuresBo bo);
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param bo 【请填写功能名称】
+     * @return 是否修改成功
+     */
+    Boolean updateByBo(BlindStructuresBo bo);
+
+    /**
+     * 校验并批量删除【请填写功能名称】信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 134 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/BlindStructuresServiceImpl.java

@@ -0,0 +1,134 @@
+package org.dromara.business.service.impl;
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.dromara.business.domain.bo.BlindStructuresBo;
+import org.dromara.business.domain.vo.BlindStructuresVo;
+import org.dromara.business.domain.BlindStructures;
+import org.dromara.business.mapper.BlindStructuresMapper;
+import org.dromara.business.service.IBlindStructuresService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ *
+ * @author Lion Li
+ * @date 2025-06-10
+ */
+@Slf4j
+@RequiredArgsConstructor
+@Service
+public class BlindStructuresServiceImpl implements IBlindStructuresService {
+
+    private final BlindStructuresMapper baseMapper;
+
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 主键
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public BlindStructuresVo queryById(Long id){
+        return baseMapper.selectVoByIdInfo(id);
+    }
+
+    /**
+     * 分页查询【请填写功能名称】列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 【请填写功能名称】分页列表
+     */
+    @Override
+    public TableDataInfo<BlindStructuresVo> queryPageList(BlindStructuresBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<BlindStructures> lqw = buildQueryWrapper(bo);
+        Page<BlindStructuresVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询符合条件的【请填写功能名称】列表
+     *
+     * @param bo 查询条件
+     * @return 【请填写功能名称】列表
+     */
+    @Override
+    public List<BlindStructuresVo> queryList(BlindStructuresBo bo) {
+        LambdaQueryWrapper<BlindStructures> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectBlindStructuresVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<BlindStructures> buildQueryWrapper(BlindStructuresBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<BlindStructures> lqw = Wrappers.lambdaQuery();
+        lqw.orderByAsc(BlindStructures::getId);
+        lqw.like(StringUtils.isNotBlank(bo.getName()), BlindStructures::getName, bo.getName());
+        lqw.eq(StringUtils.isNotBlank(bo.getDescription()), BlindStructures::getDescription, bo.getDescription());
+        lqw.eq(bo.getCreatedAt() != null, BlindStructures::getCreatedAt, bo.getCreatedAt());
+        lqw.eq(bo.getUpdatedAt() != null, BlindStructures::getUpdatedAt, bo.getUpdatedAt());
+        return lqw;
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param bo 【请填写功能名称】
+     * @return 是否新增成功
+     */
+    @Override
+    public Boolean insertByBo(BlindStructuresBo bo) {
+        BlindStructures add = MapstructUtils.convert(bo, BlindStructures.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insertBlindStructures(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param bo 【请填写功能名称】
+     * @return 是否修改成功
+     */
+    @Override
+    public Boolean updateByBo(BlindStructuresBo bo) {
+        BlindStructures update = MapstructUtils.convert(bo, BlindStructures.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateBlindStructuresById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(BlindStructures entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 校验并批量删除【请填写功能名称】信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteBlindStructuresByIds(ids) > 0;
+    }
+}

+ 63 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/BlindStructuresMapper.xml

@@ -0,0 +1,63 @@
+<?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.business.mapper.BlindStructuresMapper">
+
+    <select id="selectVoPage" resultType="org.dromara.business.domain.vo.BlindStructuresVo">
+        SELECT id, name, description, created_at, updated_at
+        FROM blind_structures ${ew.customSqlSegment}
+    </select>
+
+
+    <select id="selectBlindStructuresVoList" resultType="org.dromara.business.domain.vo.BlindStructuresVo">
+        SELECT  id, name, description, created_at, updated_at FROM blind_structures  ${ew.customSqlSegment}
+    </select>
+
+    <select id="selectVoByIdInfo" resultType="org.dromara.business.domain.vo.BlindStructuresVo">
+       SELECT  id, name, description, created_at, updated_at FROM blind_structures WHERE id =  #{id}
+    </select>
+
+
+
+    <update id="updateBlindStructuresById">
+        UPDATE blind_structures
+        <set>
+            <if test="name != null and name != ''">
+                name = #{name},
+            </if>
+            <if test="description != null and description != ''">
+                description = #{description},
+            </if>
+            updated_at = NOW()
+        </set>
+        WHERE id = #{id}
+    </update>
+
+
+    <insert id="insertBlindStructures" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO blind_structures
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null and name != ''">name,</if>
+            <if test="description != null and description != ''">description,</if>
+        </trim>
+        <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
+            <if test="name != null and name != ''">#{name},</if>
+            <if test="description != null and description != ''">#{description},</if>
+        </trim>
+    </insert>
+
+
+    <delete id="deleteBlindStructuresByIds">
+        DELETE FROM blind_structures
+        <where>
+            id IN
+            <foreach item="id" collection="ids" open="(" separator="," close=")">
+                <if test="id > 0">
+                    #{id}
+                </if>
+            </foreach>
+        </where>
+    </delete>
+
+</mapper>