Pārlūkot izejas kodu

feat:样式管理接口、添加租户初始化菜单

xuezizhuo 1 gadu atpakaļ
vecāks
revīzija
7e0826cb82

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDragTableStyleController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.web.controller.system;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.SysDragTableStyle;
+import com.ruoyi.system.service.ISysDragTableStyleService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 动态格样式模板Controller
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+@RestController
+@RequestMapping("/system/style")
+public class SysDragTableStyleController extends BaseController
+{
+    @Autowired
+    private ISysDragTableStyleService sysDragTableStyleService;
+
+    /**
+     * 查询动态格样式模板列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:style:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(SysDragTableStyle sysDragTableStyle)
+    {
+        startPage();
+        List<SysDragTableStyle> list = sysDragTableStyleService.selectSysDragTableStyleList(sysDragTableStyle);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出动态格样式模板列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:style:export')")
+    @Log(title = "动态格样式模板", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, SysDragTableStyle sysDragTableStyle)
+    {
+        List<SysDragTableStyle> list = sysDragTableStyleService.selectSysDragTableStyleList(sysDragTableStyle);
+        ExcelUtil<SysDragTableStyle> util = new ExcelUtil<SysDragTableStyle>(SysDragTableStyle.class);
+        util.exportExcel(response, list, "动态格样式模板数据");
+    }
+
+    /**
+     * 获取动态格样式模板详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:style:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(sysDragTableStyleService.selectSysDragTableStyleById(id));
+    }
+
+    /**
+     * 新增动态格样式模板
+     */
+    @PreAuthorize("@ss.hasPermi('system:style:add')")
+    @Log(title = "动态格样式模板", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysDragTableStyle sysDragTableStyle)
+    {
+        return toAjax(sysDragTableStyleService.insertSysDragTableStyle(sysDragTableStyle));
+    }
+
+    /**
+     * 修改动态格样式模板
+     */
+    @PreAuthorize("@ss.hasPermi('system:style:edit')")
+    @Log(title = "动态格样式模板", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysDragTableStyle sysDragTableStyle)
+    {
+        return toAjax(sysDragTableStyleService.updateSysDragTableStyle(sysDragTableStyle));
+    }
+
+    /**
+     * 删除动态格样式模板
+     */
+    @PreAuthorize("@ss.hasPermi('system:style:remove')")
+    @Log(title = "动态格样式模板", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(sysDragTableStyleService.deleteSysDragTableStyleByIds(ids));
+    }
+}

+ 166 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDragTableStyle.java

@@ -0,0 +1,166 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 动态格样式模板对象 sys_drag_table_style
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+public class SysDragTableStyle extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 编号 */
+    private Long id;
+
+    /** 样式key(唯一) */
+    @Excel(name = "样式key", readConverterExp = "唯=一")
+    private String styleKey;
+
+    /** 样式名称 */
+    @Excel(name = "样式名称")
+    private String styleName;
+
+    /** 样式类型 */
+    @Excel(name = "样式类型")
+    private Long styleType;
+
+    /** 样式代码 */
+    @Excel(name = "样式代码")
+    private String styleCode;
+
+    /** 样式描述 */
+    @Excel(name = "样式描述")
+    private String styleDescription;
+
+    /** 样式状态(0正常 1停用) */
+    @Excel(name = "样式状态", readConverterExp = "0=正常,1=停用")
+    private String styleStatus;
+
+    /** 删除标志(0:否;1:是) */
+    private String delFlag;
+
+    /** 创建者ID */
+    @Excel(name = "创建者ID")
+    private Long createById;
+
+    /** 更新者ID */
+    @Excel(name = "更新者ID")
+    private Long updateById;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setStyleKey(String styleKey) 
+    {
+        this.styleKey = styleKey;
+    }
+
+    public String getStyleKey() 
+    {
+        return styleKey;
+    }
+    public void setStyleName(String styleName) 
+    {
+        this.styleName = styleName;
+    }
+
+    public String getStyleName() 
+    {
+        return styleName;
+    }
+    public void setStyleType(Long styleType) 
+    {
+        this.styleType = styleType;
+    }
+
+    public Long getStyleType() 
+    {
+        return styleType;
+    }
+    public void setStyleCode(String styleCode) 
+    {
+        this.styleCode = styleCode;
+    }
+
+    public String getStyleCode() 
+    {
+        return styleCode;
+    }
+    public void setStyleDescription(String styleDescription) 
+    {
+        this.styleDescription = styleDescription;
+    }
+
+    public String getStyleDescription() 
+    {
+        return styleDescription;
+    }
+    public void setStyleStatus(String styleStatus) 
+    {
+        this.styleStatus = styleStatus;
+    }
+
+    public String getStyleStatus() 
+    {
+        return styleStatus;
+    }
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+    public void setCreateById(Long createById) 
+    {
+        this.createById = createById;
+    }
+
+    public Long getCreateById() 
+    {
+        return createById;
+    }
+    public void setUpdateById(Long updateById) 
+    {
+        this.updateById = updateById;
+    }
+
+    public Long getUpdateById() 
+    {
+        return updateById;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("styleKey", getStyleKey())
+            .append("styleName", getStyleName())
+            .append("styleType", getStyleType())
+            .append("styleCode", getStyleCode())
+            .append("styleDescription", getStyleDescription())
+            .append("styleStatus", getStyleStatus())
+            .append("delFlag", getDelFlag())
+            .append("createBy", getCreateBy())
+            .append("createById", getCreateById())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateById", getUpdateById())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDragTableStyleMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysDragTableStyle;
+
+/**
+ * 动态格样式模板Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+public interface SysDragTableStyleMapper 
+{
+    /**
+     * 查询动态格样式模板
+     * 
+     * @param id 动态格样式模板主键
+     * @return 动态格样式模板
+     */
+    SysDragTableStyle selectSysDragTableStyleById(Long id);
+
+    /**
+     * 查询动态格样式模板列表
+     * 
+     * @param sysDragTableStyle 动态格样式模板
+     * @return 动态格样式模板集合
+     */
+    List<SysDragTableStyle> selectSysDragTableStyleList(SysDragTableStyle sysDragTableStyle);
+
+    /**
+     * 新增动态格样式模板
+     * 
+     * @param sysDragTableStyle 动态格样式模板
+     * @return 结果
+     */
+    int insertSysDragTableStyle(SysDragTableStyle sysDragTableStyle);
+
+    /**
+     * 修改动态格样式模板
+     * 
+     * @param sysDragTableStyle 动态格样式模板
+     * @return 结果
+     */
+    int updateSysDragTableStyle(SysDragTableStyle sysDragTableStyle);
+
+    /**
+     * 删除动态格样式模板
+     * 
+     * @param id 动态格样式模板主键
+     * @return 结果
+     */
+    int deleteSysDragTableStyleById(Long id);
+
+    /**
+     * 批量删除动态格样式模板
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteSysDragTableStyleByIds(Long[] ids);
+}

+ 62 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDragTableStyleService.java

@@ -0,0 +1,62 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.system.domain.SysDragTableStyle;
+
+import java.util.List;
+
+/**
+ * 动态格样式模板Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+public interface ISysDragTableStyleService 
+{
+    /**
+     * 查询动态格样式模板
+     * 
+     * @param id 动态格样式模板主键
+     * @return 动态格样式模板
+     */
+    SysDragTableStyle selectSysDragTableStyleById(Long id);
+
+    /**
+     * 查询动态格样式模板列表
+     * 
+     * @param sysDragTableStyle 动态格样式模板
+     * @return 动态格样式模板集合
+     */
+    List<SysDragTableStyle> selectSysDragTableStyleList(SysDragTableStyle sysDragTableStyle);
+
+    /**
+     * 新增动态格样式模板
+     * 
+     * @param sysDragTableStyle 动态格样式模板
+     * @return 结果
+     */
+    int insertSysDragTableStyle(SysDragTableStyle sysDragTableStyle);
+
+    /**
+     * 修改动态格样式模板
+     * 
+     * @param sysDragTableStyle 动态格样式模板
+     * @return 结果
+     */
+    int updateSysDragTableStyle(SysDragTableStyle sysDragTableStyle);
+
+    /**
+     * 批量删除动态格样式模板
+     * 
+     * @param ids 需要删除的动态格样式模板主键集合
+     * @return 结果
+     */
+    int deleteSysDragTableStyleByIds(Long[] ids);
+
+    /**
+     * 删除动态格样式模板信息
+     * 
+     * @param id 动态格样式模板主键
+     * @return 结果
+     */
+    int deleteSysDragTableStyleById(Long id);
+}

+ 101 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDragTableStyleServiceImpl.java

@@ -0,0 +1,101 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.SysDragTableStyleMapper;
+import com.ruoyi.system.domain.SysDragTableStyle;
+import com.ruoyi.system.service.ISysDragTableStyleService;
+
+/**
+ * 动态格样式模板Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+@Service
+public class SysDragTableStyleServiceImpl implements ISysDragTableStyleService 
+{
+    @Autowired
+    private SysDragTableStyleMapper sysDragTableStyleMapper;
+
+    /**
+     * 查询动态格样式模板
+     * 
+     * @param id 动态格样式模板主键
+     * @return 动态格样式模板
+     */
+    @Override
+    public SysDragTableStyle selectSysDragTableStyleById(Long id)
+    {
+        return sysDragTableStyleMapper.selectSysDragTableStyleById(id);
+    }
+
+    /**
+     * 查询动态格样式模板列表
+     * 
+     * @param sysDragTableStyle 动态格样式模板
+     * @return 动态格样式模板
+     */
+    @Override
+    public List<SysDragTableStyle> selectSysDragTableStyleList(SysDragTableStyle sysDragTableStyle)
+    {
+        return sysDragTableStyleMapper.selectSysDragTableStyleList(sysDragTableStyle);
+    }
+
+    /**
+     * 新增动态格样式模板
+     * 
+     * @param sysDragTableStyle 动态格样式模板
+     * @return 结果
+     */
+    @Override
+    public int insertSysDragTableStyle(SysDragTableStyle sysDragTableStyle)
+    {
+        sysDragTableStyle.setCreateTime(DateUtils.getNowDate());
+        sysDragTableStyle.setCreateById(SecurityUtils.getUserId());
+        sysDragTableStyle.setCreateBy(SecurityUtils.getUsername());
+        return sysDragTableStyleMapper.insertSysDragTableStyle(sysDragTableStyle);
+    }
+
+    /**
+     * 修改动态格样式模板
+     * 
+     * @param sysDragTableStyle 动态格样式模板
+     * @return 结果
+     */
+    @Override
+    public int updateSysDragTableStyle(SysDragTableStyle sysDragTableStyle)
+    {
+        sysDragTableStyle.setUpdateTime(DateUtils.getNowDate());
+        sysDragTableStyle.setUpdateById(SecurityUtils.getUserId());
+        sysDragTableStyle.setUpdateBy(SecurityUtils.getUsername());
+        return sysDragTableStyleMapper.updateSysDragTableStyle(sysDragTableStyle);
+    }
+
+    /**
+     * 批量删除动态格样式模板
+     * 
+     * @param ids 需要删除的动态格样式模板主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysDragTableStyleByIds(Long[] ids)
+    {
+        return sysDragTableStyleMapper.deleteSysDragTableStyleByIds(ids);
+    }
+
+    /**
+     * 删除动态格样式模板信息
+     * 
+     * @param id 动态格样式模板主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysDragTableStyleById(Long id)
+    {
+        return sysDragTableStyleMapper.deleteSysDragTableStyleById(id);
+    }
+}

+ 101 - 0
ruoyi-system/src/main/resources/mapper/system/SysDragTableStyleMapper.xml

@@ -0,0 +1,101 @@
+<?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="com.ruoyi.system.mapper.SysDragTableStyleMapper">
+    
+    <resultMap type="SysDragTableStyle" id="SysDragTableStyleResult">
+        <result property="id"    column="id"    />
+        <result property="styleKey"    column="style_key"    />
+        <result property="styleName"    column="style_name"    />
+        <result property="styleType"    column="style_type"    />
+        <result property="styleCode"    column="style_code"    />
+        <result property="styleDescription"    column="style_description"    />
+        <result property="styleStatus"    column="style_status"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createById"    column="create_by_id"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateById"    column="update_by_id"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectSysDragTableStyleVo">
+        select id, style_key, style_name, style_type, style_code, style_description, style_status, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time from sys_drag_table_style
+    </sql>
+
+    <select id="selectSysDragTableStyleList" parameterType="SysDragTableStyle" resultMap="SysDragTableStyleResult">
+        <include refid="selectSysDragTableStyleVo"/>
+        where del_flag = '0'
+            <if test="styleKey != null  and styleKey != ''"> and style_key = #{styleKey}</if>
+            <if test="styleName != null  and styleName != ''"> and style_name like concat('%', #{styleName}, '%')</if>
+            <if test="styleType != null "> and style_type = #{styleType}</if>
+            <if test="styleCode != null  and styleCode != ''"> and style_code = #{styleCode}</if>
+            <if test="styleDescription != null  and styleDescription != ''"> and style_description = #{styleDescription}</if>
+            <if test="styleStatus != null  and styleStatus != ''"> and style_status = #{styleStatus}</if>
+            <if test="createById != null "> and create_by_id = #{createById}</if>
+            <if test="updateById != null "> and update_by_id = #{updateById}</if>
+             order by create_time desc
+    </select>
+    
+    <select id="selectSysDragTableStyleById" parameterType="Long" resultMap="SysDragTableStyleResult">
+        <include refid="selectSysDragTableStyleVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertSysDragTableStyle" parameterType="SysDragTableStyle">
+        insert into sys_drag_table_style
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="styleKey != null">style_key,</if>
+            <if test="styleName != null">style_name,</if>
+            <if test="styleType != null">style_type,</if>
+            <if test="styleCode != null">style_code,</if>
+            <if test="styleDescription != null">style_description,</if>
+            <if test="styleStatus != null">style_status,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createById != null">create_by_id,</if>
+            <if test="createTime != null">create_time,</if>
+            del_flag
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="styleKey != null">#{styleKey},</if>
+            <if test="styleName != null">#{styleName},</if>
+            <if test="styleType != null">#{styleType},</if>
+            <if test="styleCode != null">#{styleCode},</if>
+            <if test="styleDescription != null">#{styleDescription},</if>
+            <if test="styleStatus != null">#{styleStatus},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createById != null">#{createById},</if>
+            <if test="createTime != null">#{createTime},</if>
+            '0'
+         </trim>
+    </insert>
+
+    <update id="updateSysDragTableStyle" parameterType="SysDragTableStyle">
+        update sys_drag_table_style
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="styleKey != null">style_key = #{styleKey},</if>
+            <if test="styleName != null">style_name = #{styleName},</if>
+            <if test="styleType != null">style_type = #{styleType},</if>
+            <if test="styleCode != null">style_code = #{styleCode},</if>
+            <if test="styleDescription != null">style_description = #{styleDescription},</if>
+            <if test="styleStatus != null">style_status = #{styleStatus},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateById != null">update_by_id = #{updateById},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteSysDragTableStyleById" parameterType="Long">
+        update sys_drag_table_style set del_flag = '2' where id = #{id}
+    </update>
+
+    <update id="deleteSysDragTableStyleByIds" parameterType="String">
+        update sys_drag_table_style set del_flag = '2' where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+</mapper>

+ 51 - 1
ruoyi-system/src/main/resources/sql/initialize_sys_tenant_menu.json

@@ -906,7 +906,7 @@
         "updateTime": null,
         "remark": null,
         "menuId": 1109,
-        "menuName": "租户字典管理",
+        "menuName": "字典管理",
         "parentName": null,
         "parentId": 1,
         "orderNum": 10,
@@ -973,5 +973,55 @@
         "children": [],
         "tenantName": null,
         "tenantId": null
+    },
+    {
+        "createBy": null,
+        "createTime": "2023-10-11 09:28:10",
+        "updateBy": null,
+        "updateTime": null,
+        "remark": null,
+        "menuId": 3811,
+        "menuName": "联动表格",
+        "parentName": null,
+        "parentId": 1103,
+        "orderNum": 5,
+        "path": "relateTable",
+        "component": "relateTable/index",
+        "query": null,
+        "isFrame": "1",
+        "isCache": "0",
+        "menuType": "C",
+        "visible": "0",
+        "status": "0",
+        "perms": "",
+        "icon": "bpmn-icon-call-activity",
+        "children": [],
+        "tenantName": null,
+        "tenantId": null
+    },
+    {
+        "createBy": null,
+        "createTime": "2023-10-11 09:28:10",
+        "updateBy": null,
+        "updateTime": null,
+        "remark": null,
+        "menuId": 3806,
+        "menuName": "动态表格",
+        "parentName": null,
+        "parentId": 1103,
+        "orderNum": 6,
+        "path": "relateTableEdit",
+        "component": "relateTable/relateTableEdit",
+        "query": null,
+        "isFrame": "1",
+        "isCache": "0",
+        "menuType": "C",
+        "visible": "1",
+        "status": "0",
+        "perms": "",
+        "icon": "#",
+        "children": [],
+        "tenantName": null,
+        "tenantId": null
     }
 ]