ITSM

运维管理系统


功能说明

简要描述
  • 用来设置某一个列表的行高,列宽,列显示隐藏 ,作用于某个人
添加表,脚本和网关

CREATE TABLE "public"."BasicCustomColumn" (
  "uuid" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "list_id" varchar(100) COLLATE "pg_catalog"."default",
  "user_id" varchar(100) COLLATE "pg_catalog"."default",
  "custom_column_json" jsonb,
  "row_height" varchar(100) COLLATE "pg_catalog"."default",
  "update_time" varchar(100) COLLATE "pg_catalog"."default"
);
ALTER TABLE "public"."BasicCustomColumn" ADD CONSTRAINT "BasicCustomColumn_pkey" PRIMARY KEY ("uuid");

INSERT INTO "public"."bee_idx_comm"("id", "name", "status", "path", "val", "time") VALUES ('86fd6ac79fdf6483', 'CustomColumn', '0', 'root/script/CustomColumn', '{"param":"{}","name":"CustomColumn","publicClass":"com.kingsware.fun.CustomColumn","script":"package com.kingsware.fun;\r\n\r\nimport com.alibaba.fastjson.JSONArray;\r\nimport com.alibaba.fastjson.JSONObject;\r\nimport com.kingsware.env.pojo.CollectResult;\r\nimport com.kingsware.env.script.KBaseMain;\r\nimport com.kingsware.env.util.jdbc.JdbcUtil;\r\nimport com.kingsware.socket.client.KEnvClient;\r\nimport org.apache.commons.lang3.StringUtils;\r\n\r\n\r\nimport java.text.SimpleDateFormat;\r\nimport java.util.Date;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.UUID;\r\n\r\n/**\r\n * @Author: xiaosk\r\n * @Date: 2021/12/20 17:33\r\n */\r\npublic class CustomColumn extends KBaseMain {\r\n\r\n\r\n    private String URL;//pg连接url\r\n    private String USERNAME;//pg数据库连接用户\r\n    private String PASSWORD;//pg数据库连接密码\r\n    private String DRIVER;//pg数据库连接驱动\r\n\r\n    @Override\r\n    public CollectResult mainEx(Object param, KEnvClient kEnvClient) throws Exception {\r\n        //postgreSQL\r\n        URL = kEnvClient.getVariableVal(\"smim.datasource.jdbc-url\");//smim\r\n        USERNAME = kEnvClient.getVariableVal(\"smim.datasource.username\");\r\n        PASSWORD = kEnvClient.getVariableVal(\"smim.datasource.password\");\r\n        DRIVER = kEnvClient.getVariableVal(\"smim.datasource.driverClassName\");\r\n        System.out.println(\"----------------------------------------------\"+param.toString());\r\n\r\n        CollectResult collectResult = new CollectResult();\r\n        Map o =  JSONObject.parseObject(param.toString());\r\n        String user_id = (String) o.get(\"userId\") ;\r\n        String list_id = (String) o.get(\"list_id\") ;\r\n        String type = (String) o.get(\"type\") ;\r\n\r\n\r\n        SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\r\n        String createTimeStr = dateFormat.format(new Date());\r\n        String sql = \"select uuid,list_id,row_height,custom_column_json::text as custom_column_json ,user_id,update_time from \\\"BasicCustomColumn\\\" where list_id=''\"+list_id+\"'' and user_id=''\"+user_id+\"''\" ;\r\n\r\n\r\n        List<Map<String,Object>>  list =  JdbcUtil.queryMapList(DRIVER, URL, USERNAME,PASSWORD,sql) ;\r\n\r\n        if(\"setRowHeight\".equals(type)){\r\n            String row_height = (String) o.get(\"row_height\") ;\r\n            if(list != null && list.size()>0){//修改\r\n                sql = \"UPDATE \\\"public\\\".\\\"BasicCustomColumn\\\" SET  \\\"row_height\\\" = ''\"+row_height+\"'', \\\"update_time\\\" = ''\"+createTimeStr+\"'' WHERE \\\"uuid\\\" = ''\"+list.get(0).get(\"uuid\")+\"'';\\n\" ;\r\n            }else{//新增\r\n                sql = \"INSERT INTO \\\"public\\\".\\\"BasicCustomColumn\\\"(\\\"uuid\\\", \\\"list_id\\\", \\\"user_id\\\", \\\"custom_column_json\\\", \\\"row_height\\\", \\\"update_time\\\") \" +\r\n                        \"VALUES (''\"+UUID.randomUUID() +\"'', ''\"+ list_id +\"'', ''\"+ user_id +\"'', ''[]'', ''\"+ row_height +\"'', ''\"+createTimeStr+\"'');\\n\" ;\r\n            }\r\n            JdbcUtil.update(DRIVER, URL, USERNAME,PASSWORD,sql) ;\r\n            collectResult.setResult(\"保存成功\");\r\n        }else if(\"setCustomColumnJson\".equals(type)){\r\n            JSONArray custom_column_json = (JSONArray) o.get(\"custom_column_json\") ;\r\n            if(list != null && list.size()>0){//修改\r\n                sql = \"UPDATE \\\"public\\\".\\\"BasicCustomColumn\\\" SET  \\\"custom_column_json\\\" = ''\"+custom_column_json.toString()+\"'', \\\"update_time\\\" = ''\"+createTimeStr+\"'' WHERE \\\"uuid\\\" = ''\"+list.get(0).get(\"uuid\")+\"'';\\n\" ;\r\n            }else{//新增\r\n                sql = \"INSERT INTO \\\"public\\\".\\\"BasicCustomColumn\\\"(\\\"uuid\\\", \\\"list_id\\\", \\\"user_id\\\", \\\"custom_column_json\\\", \\\"row_height\\\", \\\"update_time\\\") \" +\r\n                        \"VALUES (''\"+UUID.randomUUID() +\"'', ''\"+ list_id +\"'', ''\"+ user_id +\"'', ''\"+custom_column_json.toString()+\"'', '''', ''\"+createTimeStr+\"'');\\n\" ;\r\n            }\r\n            JdbcUtil.update(DRIVER, URL, USERNAME,PASSWORD,sql) ;\r\n            collectResult.setResult(\"保存成功\");\r\n        }else if(\"query\".equals(type)){\r\n            Map<String,Object> cmap = list.get(0) ;\r\n            String custom_column_json = (String) cmap.get(\"custom_column_json\") ;\r\n            if(StringUtils.isNotEmpty(custom_column_json)){\r\n                cmap.put(\"custom_column_json\" ,JSONArray.parseArray(custom_column_json)) ;\r\n            }\r\n            collectResult.setResult(list.get(0));\r\n        }\r\n        return collectResult ;\r\n    }\r\n}\r\n\r\n"}', '2021-12-21 14:35:24.443');

INSERT INTO "public"."BasicGatewayRoute"("uuid", "name", "sourcepath", "module", "targeturl", "targetpath", "logtype", "logcontent", "param", "responsebody", "remark", "createTime", "state", "updateTime", "verify", "type", "moduleId") VALUES ('c099a180-dfb3-4c04-a78b-db1904e319b0', '自定义列', '/ops/script/CustomColumn', NULL, NULL, 'CustomColumn', '操作', NULL, NULL, NULL, NULL, NULL, 0, NULL, 't', 'script', 'c321b0458d914c5c818896d41d1ad3e1');

BasicCustomColumn 表结构说明

字段 类型 默认 注释
uuid varchar(100) 唯一键
list_id varchar(100) 列表id
user_id varchar(100) 用户id
custom_column_json jsonb 自定义列
row_height varchar(100) 行高
update_time varchar(100) 修改时间


- 备注:无

页面列表

ITEM_HTML