whycxzp
2025-03-31 6249ef6adf616e11aa7a9b601635c9f0e6ac0ba0
src/main/java/com/whyc/service/BattStationTempHisService.java
@@ -30,7 +30,53 @@
    private SubTablePageInfoUtil pageInfoUtil;
    public void createTableByMonth(Integer battGroupId,String yearMonth) {
        jdbcSqlExecuteService.execute("CREATE TABLE IF NOT EXISTS `db_power_history`.`db_batt_station_temp_history_"+yearMonth+"` LIKE `db_power_history`.`db_batt_station_temp_history`");
        yearMonth = battGroupId+"_"+yearMonth;
        //创建自增序列
        String createSeq = "CREATE SEQUENCE db_power_history.\"tb_batt_station_temp_history_"+yearMonth+"_id_seq\"\n" +
                "INCREMENT 1\n" +
                "MINVALUE 1\n" +
                "MAXVALUE 9223372036854775807\n" +
                "START 1\n" +
                "CACHE 1;\n" +
                "\n" +
                "ALTER SEQUENCE db_power_history.\"tb_batt_station_temp_history_"+yearMonth+"_id_seq\" OWNER TO sysdba;\n" +
                "\n" +
                "SELECT setval('db_power_history.\"tb_batt_station_temp_history_"+yearMonth+"_id_seq\"',1,false);";
        String sqlTable = "CREATE TABLE db_power_history.tb_batt_station_temp_history_"+yearMonth+"(\n" +
                "\tid bigint NOT NULL DEFAULT nextval('db_power_history.tb_batt_station_temp_history_"+yearMonth+"_id_seq'::regclass),\n" +
                "\tpixel_x integer NOT NULL,\n" +
                "\tpixel_y integer NOT NULL,\n" +
                "\tmax_temp double precision NOT NULL,\n" +
                "\tmin_temp double precision NOT NULL,\n" +
                "\tmin_temp_point character varying NOT NULL COLLATE pg_catalog.\"default\",\n" +
                "\tmax_temp_point character varying NOT NULL COLLATE pg_catalog.\"default\",\n" +
                "\tcamera_id integer NOT NULL,\n" +
                "\trecord_time timestamp without time zone NOT NULL,\n" +
                "\tstation_id integer,\n" +
                "\tbatt_group_id integer,\n" +
                "\t PRIMARY KEY (id)\n" +
                ")\n" +
                "\n" +
                ";\n" +
                "\n" +
                "ALTER    TABLE db_power_history.tb_batt_station_temp_history_"+yearMonth+"\n" +
                "\tOWNER TO sysdba;\n" +
                "\n" +
                "COMMENT ON COLUMN db_power_history.tb_batt_station_temp_history_"+yearMonth+".pixel_x IS '像素x轴';\n" +
                "\n" +
                "COMMENT ON COLUMN db_power_history.tb_batt_station_temp_history_"+yearMonth+".pixel_y IS '像素y轴';\n" +
                "\n" +
                "COMMENT ON COLUMN db_power_history.tb_batt_station_temp_history_"+yearMonth+".max_temp IS '最大温度';\n" +
                "\n" +
                "COMMENT ON COLUMN db_power_history.tb_batt_station_temp_history_"+yearMonth+".min_temp IS '最小温度';\n" +
                "\n" +
                "COMMENT ON COLUMN db_power_history.tb_batt_station_temp_history_"+yearMonth+".min_temp_point IS '最小温度坐标,格式为x*y,用逗号隔开';\n" +
                "\n" +
                "COMMENT ON COLUMN db_power_history.tb_batt_station_temp_history_"+yearMonth+".max_temp_point IS '最大温度坐标,格式为x*y,用逗号隔开';\n" +
                "\n" +
                "COMMENT ON COLUMN db_power_history.tb_batt_station_temp_history_"+yearMonth+".camera_id IS '摄像头id';";
        jdbcSqlExecuteService.execute(createSeq+sqlTable);
    }
    public boolean existTempHisTableByMonth(Integer battGroupId, String yearMonth) {