{ "properties" : { }, "id" : "fd6e2a140ba247308dc261417d9e1241", "script" : null, "groupId" : "05b429d9d76e469eb86e3e7ab55eb0fd", "name" : "人员统计", "createTime" : null, "updateTime" : 1698024744361, "lock" : null, "createBy" : null, "updateBy" : null, "path" : "/countEmployee", "method" : "GET", "parameters" : [ { "name" : "isFirst", "value" : "0", "description" : null, "required" : false, "dataType" : "String", "type" : null, "defaultValue" : null, "validateType" : null, "error" : null, "expression" : null, "children" : null }, { "name" : "region", "value" : "娄底市公安局", "description" : null, "required" : false, "dataType" : "String", "type" : null, "defaultValue" : null, "validateType" : null, "error" : null, "expression" : null, "children" : null } ], "options" : [ ], "requestBody" : "", "headers" : [ ], "paths" : [ ], "responseBody" : "{\n \"code\": 1,\n \"message\": \"success\",\n \"data\": [\n {\n \"类型\": \"在岗人数\",\n \"数量\": 0\n },\n {\n \"类型\": \"离岗人数\",\n \"数量\": 0\n },\n {\n \"类型\": \"未激活数\",\n \"数量\": 0\n }\n ],\n \"timestamp\": 1698024738993,\n \"executeTime\": 164\n}", "description" : null, "requestBodyDefinition" : null, "responseBodyDefinition" : null } ================================ var sql = """ SELECT "在岗人数" as 类型, COUNT(1) AS 数量 FROM dispatch.rd_employee_summary where security_station_id!="#1" ?{isFirst!=null&&isFirst!='1', and supervise_depart_name like CONCAT('%',#{region},'%') } UNION SELECT "离岗人数" as 类型, COUNT(1) AS 数量 FROM dispatch.rd_employee_summary where security_station_id="#1" ?{isFirst!=null&&isFirst!='1', and supervise_depart_name like CONCAT('%',#{region},'%') } UNION SELECT "未激活数" as 类型, COUNT(1) AS 数量 FROM dispatch.rd_employee_summary e left JOIN (select content_follow_id from dispatch.tenant_content_follows where follow_type=0 and is_followed=1 GROUP BY content_follow_id ) f on e.id=f.content_follow_id where f.content_follow_id is null ?{isFirst!=null&&isFirst!='1', and supervise_depart_name like CONCAT('%',#{region},'%') } """ return db.cache('one-countEmployee-' + region, 1000 * 60 * 1).select(sql)