lucky 4 months ago
parent
commit
14139834a5

BIN
.git.zip


+ 34 - 0
zkqy-admin/src/main/java/com/zkqy/Test.java

@@ -0,0 +1,34 @@
+package com.zkqy;
+
+import java.lang.reflect.Field;
+
+public class Test {
+    public static void main(String[] args) {
+        int a = 10;
+        int b = 20;
+        method(a, b);
+        System.out.println(a + "--" + b); // 输出结果是 100--200
+    }
+
+    public static void method(int a, int b) {
+        try {
+            // 获取 Test 类的所有字段
+            Field[] fields = Test.class.getDeclaredFields();
+            // 遍历所有字段
+            for (Field field : fields) {
+                // 如果字段名为 a 或 b,则将其修改为 100 或 200
+                if (field.getName().equals("a")) {
+                    field.setInt(null, 100);
+                } else if (field.getName().equals("b")) {
+                    field.setInt(null, 200);
+                }
+            }
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        }
+    }
+
+    // 定义 a 和 b 字段,必须是静态的
+    private static int a;
+    private static int b;
+}

+ 111 - 0
zkqy-admin/src/main/java/com/zkqy/web/controller/dragForm/DragTreeController.java

@@ -0,0 +1,111 @@
+package com.zkqy.web.controller.dragForm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.zkqy.common.annotation.Anonymous;
+import com.zkqy.common.annotation.Log;
+import com.zkqy.common.core.controller.BaseController;
+import com.zkqy.common.core.domain.AjaxResult;
+import com.zkqy.common.core.page.TableDataInfo;
+import com.zkqy.common.enums.BusinessType;
+import com.zkqy.common.utils.poi.ExcelUtil;
+import com.zkqy.system.entity.DragTree;
+import com.zkqy.system.service.IDragTreeService;
+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;
+
+
+/**
+ * 拖拽树结构Controller
+ * 
+ * @author hmc
+ * @date 2025-03-05
+ */
+@RestController
+@RequestMapping("/dragTree/tree")
+public class DragTreeController extends BaseController
+{
+
+    @Autowired
+    private IDragTreeService dragTreeService;
+
+    /**
+     * 查询拖拽树结构列表
+     */
+//    @PreAuthorize("@ss.hasPermi('dragTree:tree:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(DragTree dragTree)
+    {
+        startPage();
+        List<DragTree> list = dragTreeService.selectDragTreeList(dragTree);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出拖拽树结构列表
+     */
+//    @PreAuthorize("@ss.hasPermi('dragTree:tree:export')")
+    @Log(title = "拖拽树结构", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, DragTree dragTree)
+    {
+        List<DragTree> list = dragTreeService.selectDragTreeList(dragTree);
+        ExcelUtil<DragTree> util = new ExcelUtil<DragTree>(DragTree.class);
+        util.exportExcel(response, list, "拖拽树结构数据");
+    }
+
+
+    /**
+     * 获取拖拽树结构详细信息
+     */
+//    @PreAuthorize("@ss.hasPermi('dragTree:tree:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(dragTreeService.selectDragTreeById(id));
+    }
+
+    /**
+     * 新增拖拽树结构
+     */
+//    @PreAuthorize("@ss.hasPermi('dragTree:tree:add')")
+    @Anonymous
+    @Log(title = "拖拽树结构", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody DragTree dragTree)
+    {
+        return toAjax(dragTreeService.insertDragTree(dragTree));
+    }
+
+    /**
+     * 修改拖拽树结构
+     */
+//    @PreAuthorize("@ss.hasPermi('dragTree:tree:edit')")
+    @Log(title = "拖拽树结构", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody DragTree dragTree)
+    {
+        return toAjax(dragTreeService.updateDragTree(dragTree));
+    }
+
+
+    /**
+     * 删除拖拽树结构
+     */
+//    @PreAuthorize("@ss.hasPermi('dragTree:tree:remove')")
+    @Log(title = "拖拽树结构", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(dragTreeService.deleteDragTreeByIds(ids));
+    }
+}

+ 240 - 0
zkqy-system/src/main/java/com/zkqy/system/entity/DragTree.java

@@ -0,0 +1,240 @@
+package com.zkqy.system.entity;
+
+import com.zkqy.common.annotation.Excel;
+import com.zkqy.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+
+/**
+ * 拖拽树结构对象 drag_tree
+ * 
+ * @author hmc
+ * @date 2025-03-05
+ */
+public class DragTree extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 唯一标识符,自增主键 */
+    private Long id;
+
+    private  String  treeTableKey;
+
+    public String getTreeTableKey() {
+        return treeTableKey;
+    }
+
+    public void setTreeTableKey(String treeTableKey) {
+        this.treeTableKey = treeTableKey;
+    }
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long menuId;
+
+    private String tableId;
+
+    private  String tableNameDes;
+
+    public String getTableNameDes() {
+        return tableNameDes;
+    }
+
+    public void setTableNameDes(String tableNameDes) {
+        this.tableNameDes = tableNameDes;
+    }
+
+    /** 菜单名称 */
+    @Excel(name = "菜单名称")
+    private String menuName;
+
+    /** 树形描述 */
+    @Excel(name = "树形描述")
+    private String treeDesc;
+
+    /** 树形组件绑定的表格 */
+    @Excel(name = "树形组件绑定的表格")
+    private String treeTableName;
+
+    /** 树形表格组件绑定表格的主键 */
+    @Excel(name = "树形表格组件绑定表格的主键")
+    private String treeTablePrimaryKey;
+
+    /** 递归列 */
+    @Excel(name = "递归列")
+    private String treeTableDgl;
+
+    /** 查询条件选的是 label 还是 value */
+    @Excel(name = "查询条件选的是 label 还是 value")
+    private String treeTableCondition;
+
+    /** 关联右侧查询表的表名称 */
+    @Excel(name = "关联右侧查询表的表名称")
+    private String treeTableJoinTable;
+
+    /** 整体的json */
+    @Excel(name = "整体的json")
+    private String allJson;
+
+    /** 删除标志(0:否 2:是) */
+    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 setMenuId(Long menuId) 
+    {
+        this.menuId = menuId;
+    }
+
+    public Long getMenuId() 
+    {
+        return menuId;
+    }
+    public void setMenuName(String menuName) 
+    {
+        this.menuName = menuName;
+    }
+
+    public String getMenuName() 
+    {
+        return menuName;
+    }
+    public void setTreeDesc(String treeDesc) 
+    {
+        this.treeDesc = treeDesc;
+    }
+
+    public String getTreeDesc() 
+    {
+        return treeDesc;
+    }
+    public void setTreeTableName(String treeTableName) 
+    {
+        this.treeTableName = treeTableName;
+    }
+
+    public String getTreeTableName() 
+    {
+        return treeTableName;
+    }
+    public void setTreeTablePrimaryKey(String treeTablePrimaryKey) 
+    {
+        this.treeTablePrimaryKey = treeTablePrimaryKey;
+    }
+
+    public String getTreeTablePrimaryKey() 
+    {
+        return treeTablePrimaryKey;
+    }
+    public void setTreeTableDgl(String treeTableDgl) 
+    {
+        this.treeTableDgl = treeTableDgl;
+    }
+
+    public String getTreeTableDgl() 
+    {
+        return treeTableDgl;
+    }
+    public void setTreeTableCondition(String treeTableCondition) 
+    {
+        this.treeTableCondition = treeTableCondition;
+    }
+
+    public String getTreeTableCondition() 
+    {
+        return treeTableCondition;
+    }
+    public void setTreeTableJoinTable(String treeTableJoinTable) 
+    {
+        this.treeTableJoinTable = treeTableJoinTable;
+    }
+
+    public String getTreeTableJoinTable() 
+    {
+        return treeTableJoinTable;
+    }
+    public void setAllJson(String allJson) 
+    {
+        this.allJson = allJson;
+    }
+
+    public String getAllJson() 
+    {
+        return allJson;
+    }
+    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;
+    }
+
+
+    public String getTableId() {
+        return tableId;
+    }
+
+    public void setTableId(String tableId) {
+        this.tableId = tableId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("menuId", getMenuId())
+            .append("menuName", getMenuName())
+            .append("treeDesc", getTreeDesc())
+            .append("treeTableName", getTreeTableName())
+            .append("treeTablePrimaryKey", getTreeTablePrimaryKey())
+            .append("treeTableDgl", getTreeTableDgl())
+            .append("treeTableCondition", getTreeTableCondition())
+            .append("treeTableJoinTable", getTreeTableJoinTable())
+            .append("allJson", getAllJson())
+            .append("delFlag", getDelFlag())
+            .append("createBy", getCreateBy())
+            .append("createById", getCreateById())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateById", getUpdateById())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 138 - 0
zkqy-system/src/main/resources/mapper/dragmapper/DragTreeMapper.xml

@@ -0,0 +1,138 @@
+<?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.zkqy.system.mapper.DragTreeMapper">
+
+    <resultMap type="com.zkqy.system.entity.DragTree" id="DragTreeResult">
+        <result property="id"    column="id"    />
+        <result property="menuId"    column="menu_id"    />
+        <result property="menuName"    column="menu_name"    />
+        <result property="treeDesc"    column="tree_desc"    />
+        <result property="treeTableName"    column="tree_table_name"    />
+        <result property="treeTablePrimaryKey"    column="tree_table_primary_key"    />
+        <result property="treeTableDgl"    column="tree_table_dgl"    />
+        <result property="treeTableCondition"    column="tree_table_condition"    />
+        <result property="treeTableJoinTable"    column="tree_table_join_table"    />
+        <result property="allJson"    column="all_json"    />
+        <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"    />
+        <result property="tableId" column="table_id"/>
+        <result property="tableNameDes" column="table_name_des"/>
+        <result property="treeTableKey" column="tree_table_key"/>
+    </resultMap>
+
+    <sql id="selectDragTreeVo">
+        select id, menu_id, menu_name, tree_desc, tree_table_name, tree_table_primary_key, tree_table_dgl, tree_table_condition, tree_table_join_table, table_name_des, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time,table_id,tree_table_key from {DBNAME}.drag_tree
+    </sql>
+
+    <select id="selectDragTreeList" parameterType="com.zkqy.system.entity.DragTree" resultMap="DragTreeResult">
+        <include refid="selectDragTreeVo"/>
+        <where>
+            <if test="menuId != null "> and menu_id = #{menuId}</if>
+            <if test="menuName != null  and menuName != ''"> and menu_name like concat('%', #{menuName}, '%')</if>
+            <if test="treeDesc != null  and treeDesc != ''"> and tree_desc = #{treeDesc}</if>
+            <if test="treeTableName != null  and treeTableName != ''"> and tree_table_name like concat('%', #{treeTableName}, '%')</if>
+            <if test="treeTablePrimaryKey != null  and treeTablePrimaryKey != ''"> and tree_table_primary_key = #{treeTablePrimaryKey}</if>
+            <if test="treeTableDgl != null  and treeTableDgl != ''"> and tree_table_dgl = #{treeTableDgl}</if>
+            <if test="treeTableCondition != null  and treeTableCondition != ''"> and tree_table_condition = #{treeTableCondition}</if>
+            <if test="treeTableJoinTable != null  and treeTableJoinTable != ''"> and tree_table_join_table = #{treeTableJoinTable}</if>
+            <if test="tableNameDes != null  and tableNameDes != ''"> and table_name_des = #{tableNameDes}</if>
+            <if test="createById != null "> and create_by_id = #{createById}</if>
+            <if test="updateById != null "> and update_by_id = #{updateById}</if>
+            <if test="tableId != null">and table_id=#{tableId},</if>
+            <if test="treeTableKey!=null">and tree_table_key=#{treeTableKey}</if>
+        </where>
+    </select>
+
+    <select id="selectDragTreeById" parameterType="Long" resultMap="DragTreeResult">
+        <include refid="selectDragTreeVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertDragTree" parameterType="com.zkqy.system.entity.DragTree" useGeneratedKeys="true" keyProperty="id">
+        insert into {DBNAME}.drag_tree
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="menuId != null">menu_id,</if>
+            <if test="menuName != null and menuName != ''">menu_name,</if>
+            <if test="treeDesc != null and treeDesc != ''">tree_desc,</if>
+            <if test="treeTableName != null and treeTableName != ''">tree_table_name,</if>
+            <if test="treeTablePrimaryKey != null">tree_table_primary_key,</if>
+            <if test="treeTableDgl != null">tree_table_dgl,</if>
+            <if test="treeTableCondition != null">tree_table_condition,</if>
+            <if test="treeTableJoinTable != null">tree_table_join_table,</if>
+            <if test="tableNameDes != null">`table_name_des`,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createById != null">create_by_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateById != null">update_by_id,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="tableId != null">table_id,</if>
+            <if test="treeTableKey!=null">tree_table_key,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="menuId != null">#{menuId},</if>
+            <if test="menuName != null and menuName != ''">#{menuName},</if>
+            <if test="treeDesc != null and treeDesc != ''">#{treeDesc},</if>
+            <if test="treeTableName != null and treeTableName != ''">#{treeTableName},</if>
+            <if test="treeTablePrimaryKey != null">#{treeTablePrimaryKey},</if>
+            <if test="treeTableDgl != null">#{treeTableDgl},</if>
+            <if test="treeTableCondition != null">#{treeTableCondition},</if>
+            <if test="treeTableJoinTable != null">#{treeTableJoinTable},</if>
+            <if test="tableNameDes != null">#{tableNameDes},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createById != null">#{createById},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateById != null">#{updateById},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="tableId != null">#{tableId},</if>
+            <if test="treeTableKey!=null">#{treeTableKey}</if>
+        </trim>
+    </insert>
+
+    <update id="updateDragTree" parameterType="com.zkqy.system.entity.DragTree">
+        update {DBNAME}.drag_tree
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="menuId != null">menu_id = #{menuId},</if>
+            <if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
+            <if test="treeDesc != null and treeDesc != ''">tree_desc = #{treeDesc},</if>
+            <if test="treeTableName != null and treeTableName != ''">tree_table_name = #{treeTableName},</if>
+            <if test="treeTablePrimaryKey != null">tree_table_primary_key = #{treeTablePrimaryKey},</if>
+            <if test="treeTableDgl != null">tree_table_dgl = #{treeTableDgl},</if>
+            <if test="treeTableCondition != null">tree_table_condition = #{treeTableCondition},</if>
+            <if test="treeTableJoinTable != null">tree_table_join_table = #{treeTableJoinTable},</if>
+            <if test="tableNameDes != null">`table_name_des`= #{tableNameDes},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createById != null">create_by_id = #{createById},</if>
+            <if test="createTime != null">create_time = #{createTime},</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>
+            <if test="tableId != null">table_id=#{tableId},</if>
+            <if test="treeTableKey!=null">tree_table_key=#{treeTableKey}</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteDragTreeById" parameterType="Long">
+        delete from {DBNAME}.drag_tree where id = #{id}
+    </delete>
+
+    <delete id="deleteDragTreeByIds" parameterType="String">
+        delete from {DBNAME}.drag_tree where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>