Java-11-在Mybatis中,Mapper里写一个创建PostgreSQL数据表语句
开门见山:
动态创建一个表:参数分别是tableName、pkey
<!--创建新账户交易表-->
<update id="createAccountHistoryTable" parameterType="java.util.Map">
CREATE TABLE ies."${tableName}"
(
id serial NOT NULL,
userid numeric(10,0) NOT NULL DEFAULT '-1'::integer,
transactionid character varying(129) DEFAULT NULL::character varying,
date timestamp(6) without time zone NOT NULL DEFAULT '1970-02-01 00:00:00'::timestamp without time zone,
type numeric(1,0) NOT NULL DEFAULT 0,
money real NOT NULL DEFAULT 0.0,
account real NOT NULL DEFAULT 0.0,
accounttype numeric(1,0) NOT NULL DEFAULT 0,
state numeric(1,0) NOT NULL DEFAULT 0,
dealuser character varying(65) DEFAULT ''::character varying,
dealdate timestamp(6) without time zone DEFAULT NULL::timestamp without time zone,
accountcode character varying(129) DEFAULT NULL::character varying,
accountname character varying(129) DEFAULT NULL::character varying,
remark text DEFAULT ''::character varying,
CONSTRAINT "${pkey}" PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE ies."${tableName}"
OWNER TO ies;
</update>
转载自:https://blog.csdn.net/IOT_LI/article/details/79564329