hongchuangyanfa vor 2 Jahren
Ursprung
Commit
65d18c1759
20 geänderte Dateien mit 1010 neuen und 8 gelöschten Zeilen
  1. 34 0
      blade-service-api/blade-control-api/src/main/java/org/springblade/control/dto/DictInfoDTO.java
  2. 66 0
      blade-service-api/blade-control-api/src/main/java/org/springblade/control/entity/DictInfo.java
  3. 0 4
      blade-service-api/blade-control-api/src/main/java/org/springblade/control/feign/test.java
  4. 70 0
      blade-service-api/blade-control-api/src/main/java/org/springblade/control/vo/DictInfoVO.java
  5. 120 0
      blade-service/blade-control/src/main/java/org/springblade/control/controller/DictInfoController.java
  6. 52 0
      blade-service/blade-control/src/main/java/org/springblade/control/mapper/DictInfoMapper.java
  7. 24 0
      blade-service/blade-control/src/main/java/org/springblade/control/mapper/DictInfoMapper.xml
  8. 74 0
      blade-service/blade-control/src/main/java/org/springblade/control/service/IDictInfoService.java
  9. 73 0
      blade-service/blade-control/src/main/java/org/springblade/control/service/impl/DictInfoServiceImpl.java
  10. 62 0
      blade-service/blade-control/src/main/java/org/springblade/control/wrapper/DictInfoWrapper.java
  11. 0 4
      blade-service/blade-control/src/main/java/org/springblade/control/wrapper/test.java
  12. 127 0
      src/main/java/org/springblade/control/controller/DictInfoController.java
  13. 34 0
      src/main/java/org/springblade/control/dto/DictInfoDTO.java
  14. 64 0
      src/main/java/org/springblade/control/entity/DictInfo.java
  15. 42 0
      src/main/java/org/springblade/control/mapper/DictInfoMapper.java
  16. 32 0
      src/main/java/org/springblade/control/mapper/DictInfoMapper.xml
  17. 41 0
      src/main/java/org/springblade/control/service/IDictInfoService.java
  18. 41 0
      src/main/java/org/springblade/control/service/impl/DictInfoServiceImpl.java
  19. 34 0
      src/main/java/org/springblade/control/vo/DictInfoVO.java
  20. 20 0
      src/main/java/sql/dictinfo.menu.sql

+ 34 - 0
blade-service-api/blade-control-api/src/main/java/org/springblade/control/dto/DictInfoDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.dto;
+
+import org.springblade.control.entity.DictInfo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 参数信息表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DictInfoDTO extends DictInfo {
+    private static final long serialVersionUID = 1L;
+
+}

+ 66 - 0
blade-service-api/blade-control-api/src/main/java/org/springblade/control/entity/DictInfo.java

@@ -0,0 +1,66 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 参数信息表实体类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@Data
+@TableName("c_dict_info")
+@EqualsAndHashCode(callSuper = true)
+public class DictInfo extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 父主键
+     */
+    private Long parentId;
+    /**
+     * 字典名称
+     */
+    private String dictName;
+    /**
+     * 字典值
+     */
+    private String dictValue;
+    /**
+     * 排序
+     */
+    private Integer sort;
+    /**
+     * 参数类型
+     */
+    private Integer type;
+    /**
+     * 自定义码
+     */
+    private String code;
+
+
+}

+ 0 - 4
blade-service-api/blade-control-api/src/main/java/org/springblade/control/feign/test.java

@@ -1,4 +0,0 @@
-package org.springblade.control.feign;
-
-public class test {
-}

+ 70 - 0
blade-service-api/blade-control-api/src/main/java/org/springblade/control/vo/DictInfoVO.java

@@ -0,0 +1,70 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import org.springblade.control.entity.DictInfo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.tool.node.INode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 参数信息表视图实体类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DictInfoVO extends DictInfo implements INode<DictInfoVO> {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 主键ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long id;
+
+    /**
+     * 父节点ID
+     */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long parentId;
+
+    /**
+     * 子孙节点
+     */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private List<DictInfoVO> children;
+
+    @Override
+    public List<DictInfoVO> getChildren() {
+        if (this.children == null) {
+            this.children = new ArrayList<>();
+        }
+        return this.children;
+    }
+
+    /**
+     * 上级字典
+     */
+    private String parentName;
+}

+ 120 - 0
blade-service/blade-control/src/main/java/org/springblade/control/controller/DictInfoController.java

@@ -0,0 +1,120 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.controller;
+
+import io.swagger.annotations.*;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.system.entity.DictBiz;
+import org.springblade.system.vo.DictBizVO;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.control.entity.DictInfo;
+import org.springblade.control.vo.DictInfoVO;
+import org.springblade.control.service.IDictInfoService;
+import org.springblade.core.boot.ctrl.BladeController;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 参数信息表 控制器
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/dictinfo")
+@Api(value = "参数信息表", tags = "参数信息表接口")
+public class DictInfoController extends BladeController {
+
+    private final IDictInfoService dictInfoService;
+
+    /**
+     * 新增或修改 参数信息表
+     */
+    @PostMapping("/submit")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "新增或修改", notes = "传入dictInfo")
+    public R submit(@Valid @RequestBody DictInfo dictInfo) {
+        return R.status(dictInfoService.saveOrUpdate(dictInfo));
+    }
+
+
+    /**
+     * 删除 参数信息表
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入ids")
+    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+        return R.status(dictInfoService.deleteLogic(Func.toLongList(ids)));
+    }
+
+
+    /**
+     * 获取字典
+     */
+    @GetMapping("/dictionary")
+    @ApiOperationSupport(order = 8)
+    @ApiOperation(value = "获取字典", notes = "获取字典")
+    public R<List<DictBiz>> dictionary(String code) {
+        List<DictBiz> tree = dictInfoService.getList(code, "notRoot");
+        return R.data(tree);
+    }
+
+    /**
+     * 顶级列表
+     */
+    @GetMapping("/parent-list")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "code", value = "字典编号", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "dictValue", value = "字典名称", paramType = "query", dataType = "string")
+    })
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "列表", notes = "传入dict")
+    public R<IPage<DictInfoVO>> parentList(@ApiIgnore @RequestParam Map<String, Object> dict, Query query) {
+        return R.data(dictInfoService.parentList(dict, query));
+    }
+
+    /**
+     * 子列表
+     */
+    @GetMapping("/child-list")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "code", value = "字典编号", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "dictValue", value = "字典名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "parentId", value = "字典名称", paramType = "query", dataType = "string")
+    })
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "列表", notes = "传入dict")
+    public R<List<DictInfoVO>> childList(@ApiIgnore @RequestParam Map<String, Object> dict, @RequestParam(required = false, defaultValue = "-1") Long parentId) {
+        return R.data(dictInfoService.childList(dict, parentId));
+    }
+
+
+}

+ 52 - 0
blade-service/blade-control/src/main/java/org/springblade/control/mapper/DictInfoMapper.java

@@ -0,0 +1,52 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.control.entity.DictInfo;
+import org.springblade.control.vo.DictInfoVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.system.entity.DictBiz;
+
+import java.util.List;
+
+/**
+ * 参数信息表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+public interface DictInfoMapper extends BaseMapper<DictInfo> {
+
+    /**
+     * 自定义分页
+     *
+     * @param page
+     * @param dictInfo
+     * @return
+     */
+    List<DictInfoVO> selectDictInfoPage(IPage page, DictInfoVO dictInfo);
+
+    /**
+     * 获取字典表
+     *
+     * @param code 字典编号
+     * @return
+     */
+    List<DictBiz> getList(@Param("code") String code, @Param("notRoot") String notRoot);
+}

+ 24 - 0
blade-service/blade-control/src/main/java/org/springblade/control/mapper/DictInfoMapper.xml

@@ -0,0 +1,24 @@
+<?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.springblade.control.mapper.DictInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="dictInfoResultMap" type="org.springblade.control.entity.DictInfo">
+        <result column="id" property="id"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="dict_name" property="dictName"/>
+        <result column="dict_value" property="dictValue"/>
+        <result column="sort" property="sort"/>
+        <result column="type" property="type"/>
+        <result column="code" property="code"/>
+    </resultMap>
+
+
+    <select id="selectDictInfoPage" resultMap="dictInfoResultMap">
+        select *
+        from c_dict_info
+        where is_deleted = 0
+    </select>
+
+</mapper>

+ 74 - 0
blade-service/blade-control/src/main/java/org/springblade/control/service/IDictInfoService.java

@@ -0,0 +1,74 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.service;
+
+import org.springblade.control.entity.DictInfo;
+import org.springblade.control.vo.DictInfoVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.support.Query;
+import org.springblade.system.entity.DictBiz;
+import org.springblade.system.vo.DictBizVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 参数信息表 服务类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+public interface IDictInfoService extends BaseService<DictInfo> {
+
+    /**
+     * 自定义分页
+     *
+     * @param page
+     * @param dictInfo
+     * @return
+     */
+    IPage<DictInfoVO> selectDictInfoPage(IPage<DictInfoVO> page, DictInfoVO dictInfo);
+
+
+    /**
+     * 获取字典表
+     *
+     * @param code 字典编号
+     * @return
+     */
+    List<DictBiz> getList(String code, String notRoot);
+
+
+    /**
+     * 顶级列表
+     *
+     * @param dict
+     * @param query
+     * @return
+     */
+    IPage<DictInfoVO> parentList(Map<String, Object> dict, Query query);
+
+    /**
+     * 子列表
+     *
+     * @param dict
+     * @param parentId
+     * @return
+     */
+    List<DictInfoVO> childList(Map<String, Object> dict, Long parentId);
+}

+ 73 - 0
blade-service/blade-control/src/main/java/org/springblade/control/service/impl/DictInfoServiceImpl.java

@@ -0,0 +1,73 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.service.impl;
+
+import org.springblade.common.constant.CommonConstant;
+import org.springblade.control.entity.DictInfo;
+import org.springblade.control.vo.DictInfoVO;
+import org.springblade.control.mapper.DictInfoMapper;
+import org.springblade.control.service.IDictInfoService;
+import org.springblade.control.wrapper.DictInfoWrapper;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.system.cache.DictBizCache;
+import org.springblade.system.entity.DictBiz;
+import org.springblade.system.vo.DictBizVO;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 参数信息表 服务实现类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@Service
+public class DictInfoServiceImpl extends BaseServiceImpl<DictInfoMapper, DictInfo> implements IDictInfoService {
+
+    @Override
+    public IPage<DictInfoVO> selectDictInfoPage(IPage<DictInfoVO> page, DictInfoVO dictInfo) {
+        return page.setRecords(baseMapper.selectDictInfoPage(page, dictInfo));
+    }
+
+    @Override
+    public List<DictBiz> getList(String code, String notRoot) {
+        return baseMapper.getList(code, notRoot);
+    }
+
+    @Override
+    public IPage<DictInfoVO> parentList(Map<String, Object> dict, Query query) {
+        IPage<DictInfo> page = this.page(Condition.getPage(query), Condition.getQueryWrapper(dict, DictInfo.class).lambda().eq(DictInfo::getParentId, CommonConstant.TOP_PARENT_ID).orderByAsc(DictInfo::getSort));
+        return DictInfoWrapper.build().pageVO(page);
+    }
+
+    @Override
+    public List<DictInfoVO> childList(Map<String, Object> dict, Long parentId) {
+        if (parentId < 0) {
+            return new ArrayList<>();
+        }
+        dict.remove("parentId");
+        DictBiz parentDict = DictBizCache.getById(parentId);
+        List<DictInfo> list = this.list(Condition.getQueryWrapper(dict, DictInfo.class).lambda().ne(DictInfo::getId, parentId).eq(DictInfo::getCode, parentDict.getCode()).orderByAsc(DictInfo::getSort));
+        return DictInfoWrapper.build().listNodeVO(list);
+    }
+}

+ 62 - 0
blade-service/blade-control/src/main/java/org/springblade/control/wrapper/DictInfoWrapper.java

@@ -0,0 +1,62 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.wrapper;
+
+import org.springblade.control.entity.DictInfo;
+import org.springblade.control.vo.DictInfoVO;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.constant.BladeConstant;
+import org.springblade.core.tool.node.ForestNodeMerger;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.system.cache.DictCache;
+import org.springblade.system.entity.Dict;
+import org.springblade.system.vo.DictVO;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author Chill
+ */
+public class DictInfoWrapper extends BaseEntityWrapper<DictInfo, DictInfoVO> {
+
+    public static DictInfoWrapper build() {
+        return new DictInfoWrapper();
+    }
+
+    @Override
+    public DictInfoVO entityVO(DictInfo dictinfo) {
+        DictInfoVO dictInfoVO = Objects.requireNonNull(BeanUtil.copy(dictinfo, DictInfoVO.class));
+        if (Func.equals(dictinfo.getParentId(), BladeConstant.TOP_PARENT_ID)) {
+            dictInfoVO.setParentName(BladeConstant.TOP_PARENT_NAME);
+        } else {
+            Dict parent = DictCache.getById(dictinfo.getParentId());
+            dictInfoVO.setParentName(parent.getDictValue());
+        }
+        return dictInfoVO;
+    }
+
+    public List<DictInfoVO> listNodeVO(List<DictInfo> list) {
+        List<DictInfoVO> collect = list.stream().map(dict -> BeanUtil.copy(dict, DictInfoVO.class)).collect(Collectors.toList());
+        return ForestNodeMerger.merge(collect);
+    }
+
+}

+ 0 - 4
blade-service/blade-control/src/main/java/org/springblade/control/wrapper/test.java

@@ -1,4 +0,0 @@
-package org.springblade.control.wrapper;
-
-public class test {
-}

+ 127 - 0
src/main/java/org/springblade/control/controller/DictInfoController.java

@@ -0,0 +1,127 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.control.entity.DictInfo;
+import org.springblade.control.vo.DictInfoVO;
+import org.springblade.control.service.IDictInfoService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 参数信息表 控制器
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/dictinfo")
+@Api(value = "参数信息表", tags = "参数信息表接口")
+public class DictInfoController extends BladeController {
+
+	private final IDictInfoService dictInfoService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入dictInfo")
+	public R<DictInfo> detail(DictInfo dictInfo) {
+		DictInfo detail = dictInfoService.getOne(Condition.getQueryWrapper(dictInfo));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 参数信息表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入dictInfo")
+	public R<IPage<DictInfo>> list(DictInfo dictInfo, Query query) {
+		IPage<DictInfo> pages = dictInfoService.page(Condition.getPage(query), Condition.getQueryWrapper(dictInfo));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 参数信息表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入dictInfo")
+	public R<IPage<DictInfoVO>> page(DictInfoVO dictInfo, Query query) {
+		IPage<DictInfoVO> pages = dictInfoService.selectDictInfoPage(Condition.getPage(query), dictInfo);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 参数信息表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入dictInfo")
+	public R save(@Valid @RequestBody DictInfo dictInfo) {
+		return R.status(dictInfoService.save(dictInfo));
+	}
+
+	/**
+	 * 修改 参数信息表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入dictInfo")
+	public R update(@Valid @RequestBody DictInfo dictInfo) {
+		return R.status(dictInfoService.updateById(dictInfo));
+	}
+
+	/**
+	 * 新增或修改 参数信息表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入dictInfo")
+	public R submit(@Valid @RequestBody DictInfo dictInfo) {
+		return R.status(dictInfoService.saveOrUpdate(dictInfo));
+	}
+
+	
+	/**
+	 * 删除 参数信息表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(dictInfoService.deleteLogic(Func.toLongList(ids)));
+	}
+
+	
+}

+ 34 - 0
src/main/java/org/springblade/control/dto/DictInfoDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.dto;
+
+import org.springblade.control.entity.DictInfo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 参数信息表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DictInfoDTO extends DictInfo {
+	private static final long serialVersionUID = 1L;
+
+}

+ 64 - 0
src/main/java/org/springblade/control/entity/DictInfo.java

@@ -0,0 +1,64 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 参数信息表实体类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@Data
+@TableName("c_dict_info")
+@EqualsAndHashCode(callSuper = true)
+public class DictInfo extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 父主键
+	*/
+		private Long parentId;
+	/**
+	* 字典名称
+	*/
+		private String dictName;
+	/**
+	* 字典值
+	*/
+		private String dictValue;
+	/**
+	* 排序
+	*/
+		private Integer sort;
+	/**
+	* 参数类型
+	*/
+		private Integer type;
+	/**
+	* 自定义码
+	*/
+		private String code;
+
+
+}

+ 42 - 0
src/main/java/org/springblade/control/mapper/DictInfoMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.mapper;
+
+import org.springblade.control.entity.DictInfo;
+import org.springblade.control.vo.DictInfoVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 参数信息表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+public interface DictInfoMapper extends BaseMapper<DictInfo> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param dictInfo
+	 * @return
+	 */
+	List<DictInfoVO> selectDictInfoPage(IPage page, DictInfoVO dictInfo);
+
+}

+ 32 - 0
src/main/java/org/springblade/control/mapper/DictInfoMapper.xml

@@ -0,0 +1,32 @@
+<?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.springblade.control.mapper.DictInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="dictInfoResultMap" type="org.springblade.control.entity.DictInfo">
+        <result column="id" property="id"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="dict_name" property="dictName"/>
+        <result column="dict_value" property="dictValue"/>
+        <result column="sort" property="sort"/>
+        <result column="type" property="type"/>
+        <result column="code" property="code"/>
+    </resultMap>
+
+
+    <select id="selectDictInfoPage" resultMap="dictInfoResultMap">
+        select *
+        from c_dict_info
+        where is_deleted = 0
+    </select>
+
+    <select id="getList" resultMap="dictInfoResultMap">
+        select * from c_dict_info where code = #{code}
+        <if test="notRoot != null and notRoot != ''">
+            and parent_id > 0
+        </if>
+        and is_deleted = 0
+        order by sort
+    </select>
+</mapper>

+ 41 - 0
src/main/java/org/springblade/control/service/IDictInfoService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.service;
+
+import org.springblade.control.entity.DictInfo;
+import org.springblade.control.vo.DictInfoVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 参数信息表 服务类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+public interface IDictInfoService extends BaseService<DictInfo> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param dictInfo
+	 * @return
+	 */
+	IPage<DictInfoVO> selectDictInfoPage(IPage<DictInfoVO> page, DictInfoVO dictInfo);
+
+}

+ 41 - 0
src/main/java/org/springblade/control/service/impl/DictInfoServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.service.impl;
+
+import org.springblade.control.entity.DictInfo;
+import org.springblade.control.vo.DictInfoVO;
+import org.springblade.control.mapper.DictInfoMapper;
+import org.springblade.control.service.IDictInfoService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 参数信息表 服务实现类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@Service
+public class DictInfoServiceImpl extends BaseServiceImpl<DictInfoMapper, DictInfo> implements IDictInfoService {
+
+	@Override
+	public IPage<DictInfoVO> selectDictInfoPage(IPage<DictInfoVO> page, DictInfoVO dictInfo) {
+		return page.setRecords(baseMapper.selectDictInfoPage(page, dictInfo));
+	}
+
+}

+ 34 - 0
src/main/java/org/springblade/control/vo/DictInfoVO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.control.vo;
+
+import org.springblade.control.entity.DictInfo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 参数信息表视图实体类
+ *
+ * @author BladeX
+ * @since 2023-06-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DictInfoVO extends DictInfo {
+	private static final long serialVersionUID = 1L;
+
+}

+ 20 - 0
src/main/java/sql/dictinfo.menu.sql

@@ -0,0 +1,20 @@
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`,
+                         `is_open`, `remark`, `is_deleted`)
+VALUES ('1665658060720152578', 1123598815738675201, 'dictinfo', '参数信息表', 'menu', '/control/dictinfo', NULL, 1, 1, 0, 1,
+        NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`,
+                         `is_open`, `remark`, `is_deleted`)
+VALUES ('1665658060720152579', '1665658060720152578', 'dictinfo_add', '新增', 'add', '/control/dictinfo/add', 'plus', 1,
+        2, 1, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`,
+                         `is_open`, `remark`, `is_deleted`)
+VALUES ('1665658060720152580', '1665658060720152578', 'dictinfo_edit', '修改', 'edit', '/control/dictinfo/edit', 'form',
+        2, 2, 2, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`,
+                         `is_open`, `remark`, `is_deleted`)
+VALUES ('1665658060720152581', '1665658060720152578', 'dictinfo_delete', '删除', 'delete',
+        '/api/blade-control/dictinfo/remove', 'delete', 3, 2, 3, 1, NULL, 0);
+INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`,
+                         `is_open`, `remark`, `is_deleted`)
+VALUES ('1665658060720152582', '1665658060720152578', 'dictinfo_view', '查看', 'view', '/control/dictinfo/view',
+        'file-text', 4, 2, 2, 1, NULL, 0);